diff --git a/src/main/java/biomesoplenty/api/block/BOPBlock.java b/src/main/java/biomesoplenty/api/block/BOPBlock.java index 50ccd0e37..0a8ecdf51 100644 --- a/src/main/java/biomesoplenty/api/block/BOPBlock.java +++ b/src/main/java/biomesoplenty/api/block/BOPBlock.java @@ -13,6 +13,7 @@ import java.util.Set; import com.google.common.collect.ImmutableSet; +import biomesoplenty.common.item.ItemBlockWithVariants; import biomesoplenty.common.util.block.BlockStateUtils; import biomesoplenty.common.util.inventory.CreativeTabBOP; import net.minecraft.block.Block; @@ -22,6 +23,7 @@ import net.minecraft.block.properties.PropertyEnum; import net.minecraft.block.state.IBlockState; import net.minecraft.creativetab.CreativeTabs; import net.minecraft.item.Item; +import net.minecraft.item.ItemBlock; import net.minecraft.item.ItemStack; import net.minecraftforge.fml.relauncher.Side; import net.minecraftforge.fml.relauncher.SideOnly; @@ -36,6 +38,11 @@ public abstract class BOPBlock extends Block this.setCreativeTab(CreativeTabBOP.instance); } + + // get the item class to use when registering this block + public Class getItemClass() { + return ItemBlockWithVariants.class; + } @Override @SideOnly(Side.CLIENT) diff --git a/src/main/java/biomesoplenty/api/block/BOPBlocks.java b/src/main/java/biomesoplenty/api/block/BOPBlocks.java index eb87edbc2..bb2efd089 100644 --- a/src/main/java/biomesoplenty/api/block/BOPBlocks.java +++ b/src/main/java/biomesoplenty/api/block/BOPBlocks.java @@ -32,4 +32,6 @@ public class BOPBlocks public static Block turnip_block; public static Block flesh; public static Block grass; + public static Block waterlily; + public static Block dirt; } diff --git a/src/main/java/biomesoplenty/common/block/BlockBOPDirt.java b/src/main/java/biomesoplenty/common/block/BlockBOPDirt.java new file mode 100644 index 000000000..e24a0a813 --- /dev/null +++ b/src/main/java/biomesoplenty/common/block/BlockBOPDirt.java @@ -0,0 +1,119 @@ +/******************************************************************************* + * Copyright 2014, the Biomes O' Plenty Team + * + * This work is licensed under a Creative Commons Attribution-NonCommercial-NoDerivatives 4.0 International Public License. + * + * To view a copy of this license, visit http://creativecommons.org/licenses/by-nc-nd/4.0/. + ******************************************************************************/ + +package biomesoplenty.common.block; + +import java.util.List; + +import net.minecraft.block.Block; +import net.minecraft.block.BlockDirt; +import net.minecraft.block.material.Material; +import net.minecraft.block.properties.IProperty; +import net.minecraft.block.properties.PropertyBool; +import net.minecraft.block.properties.PropertyEnum; +import net.minecraft.block.state.BlockState; +import net.minecraft.block.state.IBlockState; +import net.minecraft.creativetab.CreativeTabs; +import net.minecraft.init.Blocks; +import net.minecraft.item.Item; +import net.minecraft.item.ItemStack; +import net.minecraft.util.IStringSerializable; +import biomesoplenty.api.block.BOPBlock; +import biomesoplenty.api.block.BOPBlocks; + +public class BlockBOPDirt extends BOPBlock +{ + + public static final PropertyBool COARSE = PropertyBool.create("coarse"); + public static final PropertyEnum VARIANT_PROP = PropertyEnum.create("variant", BOPDirtType.class); + + public BlockBOPDirt() { + super(Material.ground); + this.setDefaultState(this.blockState.getBaseState().withProperty(COARSE, Boolean.valueOf(false)).withProperty(VARIANT_PROP, BOPDirtType.LOAMY)); + this.setHardness(0.5F); + this.setHarvestLevel("shovel", 0); + this.setStepSound(Block.soundTypeGravel); + } + + @Override + public IBlockState getStateFromMeta(int meta) + { + // both variant and coarseness saved in meta, first bit coarseness, other bits variant + return this.getDefaultState().withProperty(COARSE, Boolean.valueOf((meta & 8) > 0)).withProperty(VARIANT_PROP, BOPDirtType.values()[Math.min(2, meta & 7)]); + } + + @Override + public int getMetaFromState(IBlockState state) + { + // both variant and coarseness saved in meta, first bit coarseness, other bits variant + return (Boolean.TRUE.equals(state.getValue(COARSE)) ? 8 : 0) | ((BOPDirtType) state.getValue(VARIANT_PROP)).ordinal(); + } + + @Override + protected BlockState createBlockState() + { + return new BlockState(this, new IProperty[] { COARSE, VARIANT_PROP }); + } + + @Override + public IProperty[] getPresetProperties() + { + return new IProperty[] { COARSE, VARIANT_PROP }; + } + + @Override + public String getStateName(IBlockState state, boolean fullName) + { + return (Boolean.TRUE.equals(state.getValue(COARSE)) ? "coarse_" : "") + ((BOPDirtType) state.getValue(VARIANT_PROP)).getName() + "_dirt"; + } + + // enum representing the variants of dirt + public static enum BOPDirtType implements IStringSerializable + { + LOAMY, SANDY, SILTY; + + @Override + public String getName() + { + return this.name().toLowerCase(); + } + + @Override + public String toString() + { + return getName(); + } + + // get the blockstate which corresponds to the type of grass which grows on this dirt + public IBlockState getGrassBlockState() + { + switch(this) + { + case LOAMY: + return BOPBlocks.grass.getDefaultState().withProperty(BlockBOPGrass.VARIANT_PROP, BlockBOPGrass.BOPGrassType.LOAMY); + case SANDY: + return BOPBlocks.grass.getDefaultState().withProperty(BlockBOPGrass.VARIANT_PROP, BlockBOPGrass.BOPGrassType.SANDY); + case SILTY: + return BOPBlocks.grass.getDefaultState().withProperty(BlockBOPGrass.VARIANT_PROP, BlockBOPGrass.BOPGrassType.SILTY); + default: + return Blocks.grass.getStateFromMeta(BlockDirt.DirtType.DIRT.getMetadata()); + } + } + + public Block getGrassBlock() + { + return this.getGrassBlockState().getBlock(); + } + + public int getGrassBlockMeta() + { + return this.getGrassBlock().getMetaFromState(this.getGrassBlockState()); + } + } + +} diff --git a/src/main/java/biomesoplenty/common/block/BlockBOPGrass.java b/src/main/java/biomesoplenty/common/block/BlockBOPGrass.java index c46a5017c..93e4b5105 100644 --- a/src/main/java/biomesoplenty/common/block/BlockBOPGrass.java +++ b/src/main/java/biomesoplenty/common/block/BlockBOPGrass.java @@ -11,10 +11,14 @@ package biomesoplenty.common.block; import java.util.Random; import biomesoplenty.api.block.BOPBlock; +import biomesoplenty.api.block.BOPBlocks; import net.minecraft.block.Block; import net.minecraft.block.BlockDirt; +import net.minecraft.block.BlockTallGrass; +import net.minecraft.block.IGrowable; import net.minecraft.block.material.Material; import net.minecraft.block.properties.IProperty; +import net.minecraft.block.properties.PropertyBool; import net.minecraft.block.properties.PropertyEnum; import net.minecraft.block.state.BlockState; import net.minecraft.block.state.IBlockState; @@ -26,43 +30,56 @@ import net.minecraft.util.AxisAlignedBB; import net.minecraft.util.BlockPos; import net.minecraft.util.EnumFacing; import net.minecraft.util.EnumParticleTypes; +import net.minecraft.util.EnumWorldBlockLayer; import net.minecraft.util.IStringSerializable; +import net.minecraft.world.ColorizerGrass; +import net.minecraft.world.IBlockAccess; import net.minecraft.world.World; +import net.minecraft.world.biome.BiomeColorHelper; import net.minecraftforge.fml.relauncher.Side; import net.minecraftforge.fml.relauncher.SideOnly; -public class BlockBOPGrass extends BOPBlock +// TODO: add snowiness? +public class BlockBOPGrass extends BOPBlock implements IGrowable { public static final PropertyEnum VARIANT_PROP = PropertyEnum.create("variant", BOPGrassType.class); + public static final PropertyBool SNOWY = PropertyBool.create("snowy"); public BlockBOPGrass() { super(Material.grass); - this.setDefaultState(this.blockState.getBaseState().withProperty(VARIANT_PROP, BOPGrassType.SPECTRALMOSS)); + this.setDefaultState(this.blockState.getBaseState().withProperty(SNOWY, Boolean.valueOf(false)).withProperty(VARIANT_PROP, BOPGrassType.SPECTRALMOSS)); this.setHardness(0.6F); - this.setHarvestLevel("shovel", 0); // TODO: this means that ONLY a shovel can harvest this block... correct? + this.setHarvestLevel("shovel", 0); // TODO: I think this just determines which tool speeds up digging - need to investigate more this.setStepSound(Block.soundTypeGrass); this.setTickRandomly(true); } + @Override + public IBlockState getActualState(IBlockState state, IBlockAccess worldIn, BlockPos pos) + { + Block block = worldIn.getBlockState(pos.up()).getBlock(); + return state.withProperty(SNOWY, Boolean.valueOf(block == Blocks.snow || block == Blocks.snow_layer)); + } + @Override public IBlockState getStateFromMeta(int meta) { - // only one property to worry about, the variant, so just map [0 => SPECTRALMOSS, 1 => SMOLDERINGGRASS] + // only one property in meta to worry about, the variant, so just map according to integer index in BOPGrassType return this.getDefaultState().withProperty(VARIANT_PROP, BOPGrassType.values()[meta]); } @Override public int getMetaFromState(IBlockState state) { - // only one property to worry about, the variant, so just map [0 => SPECTRALMOSS, 1 => SMOLDERINGGRASS] + // only one property in meta to worry about, the variant, so just map according to integer index in BOPGrassType return ((BOPGrassType) state.getValue(VARIANT_PROP)).ordinal(); } @Override protected BlockState createBlockState() { - return new BlockState(this, new IProperty[] { VARIANT_PROP }); + return new BlockState(this, new IProperty[] { VARIANT_PROP, SNOWY }); } @Override @@ -77,21 +94,88 @@ public class BlockBOPGrass extends BOPBlock return ((BOPGrassType) state.getValue(VARIANT_PROP)).getName(); } + @Override + @SideOnly(Side.CLIENT) + public int getBlockColor() + { + return ColorizerGrass.getGrassColor(0.5D, 1.0D); + } + + @Override + @SideOnly(Side.CLIENT) + public int getRenderColor(IBlockState state) + { + return this.getBlockColor(); + } + + @Override + @SideOnly(Side.CLIENT) + public int colorMultiplier(IBlockAccess worldIn, BlockPos pos, int renderPass) + { + return BiomeColorHelper.getGrassColorAtPos(worldIn, pos); + } + + @Override + @SideOnly(Side.CLIENT) + public EnumWorldBlockLayer getBlockLayer() + { + return EnumWorldBlockLayer.CUTOUT_MIPPED; + } + + @Override + public boolean canSustainPlant(IBlockAccess world, BlockPos pos, EnumFacing direction, net.minecraftforge.common.IPlantable plantable) + { + + IBlockState state = world.getBlockState(pos); + net.minecraftforge.common.EnumPlantType plantType = plantable.getPlantType(world, pos.offset(direction)); + + switch ((BOPGrassType) state.getValue(VARIANT_PROP)) + { + // smoldering grass supports no plants + case SMOLDERING: + return false; + + default: + switch (plantType) + { + // support desert and plains plants + case Desert: case Plains: return true; + // support cave plants + case Cave: return isSideSolid(world, pos, EnumFacing.UP); + // support beach plants if there's water alongside + case Beach: + return ( + world.getBlockState(pos.east()).getBlock().getMaterial() == Material.water || + world.getBlockState(pos.west()).getBlock().getMaterial() == Material.water || + world.getBlockState(pos.north()).getBlock().getMaterial() == Material.water || + world.getBlockState(pos.south()).getBlock().getMaterial() == Material.water + ); + // don't support nether plants, water plants, or crops (require farmland), or anything else by default + default: + return false; + } + } + } + + @Override public boolean isFireSource(World world, BlockPos pos, EnumFacing side) { IBlockState state = world.getBlockState(pos); switch ((BOPGrassType) state.getValue(VARIANT_PROP)) { - // spectralmoss burns from below in the end + // spectral moss burns from below in the end // TODO: 1.7 code had dimension=-1 here - check -1 corresponds to end case SPECTRALMOSS: if ((world.provider instanceof net.minecraft.world.WorldProviderEnd) && side == EnumFacing.UP) {return true;} break; - // smolderinggrass always burns - case SMOLDERINGGRASS: + // smoldering grass always burns + case SMOLDERING: return false; + + default: + break; } return super.isFireSource(world, pos, side); } @@ -102,7 +186,7 @@ public class BlockBOPGrass extends BOPBlock IBlockState state = this.getStateFromMeta(meta); switch ((BOPGrassType) state.getValue(VARIANT_PROP)) { - // spectralmoss makes a hideous noise and throws a big fuss of particles around when placed in the nether + // spectral moss makes a hideous noise and throws a big fuss of particles around when placed in the nether case SPECTRALMOSS: if (world.provider instanceof net.minecraft.world.WorldProviderHell) { @@ -115,7 +199,7 @@ public class BlockBOPGrass extends BOPBlock } break; - case SMOLDERINGGRASS: + default: break; } return state; @@ -126,11 +210,9 @@ public class BlockBOPGrass extends BOPBlock public void randomDisplayTick(World worldIn, BlockPos pos, IBlockState state, Random rand) { switch ((BOPGrassType) state.getValue(VARIANT_PROP)) { - case SPECTRALMOSS: - break; - - // smolderinggrass throws up random flame and smoke particles - case SMOLDERINGGRASS: + + // smoldering grass throws up random flame and smoke particles + case SMOLDERING: if (rand.nextInt(4)==0) { worldIn.spawnParticle(EnumParticleTypes.SMOKE_NORMAL, (double)((float)pos.getX() + rand.nextFloat()), (double)((float)pos.getY() + 1.1F), (double)((float)pos.getZ() + rand.nextFloat()), 0.0D, 0.0D, 0.0D); @@ -140,6 +222,10 @@ public class BlockBOPGrass extends BOPBlock worldIn.spawnParticle(EnumParticleTypes.FLAME, (double)((float)pos.getX() + rand.nextFloat()), (double)((float)pos.getY() + 1.1F), (double)((float)pos.getZ() + rand.nextFloat()), 0.0D, 0.0D, 0.0D); } break; + + default: + break; + } super.randomDisplayTick(worldIn, pos, state, rand); } @@ -151,44 +237,144 @@ public class BlockBOPGrass extends BOPBlock { case SPECTRALMOSS: // spectral moss in the nether catches on fire and turns to smoldering grass - // elsewhere it should behave like grass spreading to nearby end_stone blocks if (world.provider instanceof net.minecraft.world.WorldProviderHell) { world.setBlockState(pos.up(), Blocks.fire.getDefaultState()); // might need to set fire AGE value... not sure - world.setBlockState(pos, this.getDefaultState().withProperty(VARIANT_PROP, BOPGrassType.SMOLDERINGGRASS)); + world.setBlockState(pos, this.getDefaultState().withProperty(VARIANT_PROP, BOPGrassType.SMOLDERING)); + } + break; + + default: + break; + } + switch ((BOPGrassType) state.getValue(VARIANT_PROP)) + { + case SMOLDERING: + // smoldering grass doesn't spread to nearby dirt + break; + + default: + // the other BOP grass types all do + this.spreadGrass(world, pos, state, rand, 4, 1, 3, 1); + break; + } + + } + + // spread grass to suitable nearby blocks + // tries - number of times to try and spread to a random nearby block + // xzSpread - how far can the grass spread in the x and z directions + // downSpread - how far can the grass spread downwards + // upSpread - how far can the grass spread upwards + // TODO: find a way to get vanilla grass to spread to BOP dirt types + @SideOnly(Side.CLIENT) + public void spreadGrass(World world, BlockPos pos, IBlockState state, Random rand, int tries, int xzSpread, int downSpread, int upSpread) + { + + // the type of grass which is spreading + BOPGrassType grassType = (BOPGrassType)state.getValue(VARIANT_PROP); + // the type of dirt this grass grows on + IBlockState dirtBlockState = grassType.getDirtBlockState(); + + // if this block is covered, then turn it back to dirt (IE kill the grass) + if (world.getLightFromNeighbors(pos.up()) < 4 && world.getBlockState(pos.up()).getBlock().getLightOpacity(world, pos.up()) > 2) + { + world.setBlockState(pos, dirtBlockState); + } + else + { + // if there's enough light from above, spread the grass randomly to nearby blocks of the correct dirt type + if (world.getLightFromNeighbors(pos.up()) >= 9) + { + for (int i = 0; i < tries; ++i) + { + // pick a random nearby position, and get the block, block state, and block above + BlockPos pos1 = pos.add(rand.nextInt(xzSpread * 2 + 1) - xzSpread, rand.nextInt(downSpread + upSpread + 1) - downSpread, rand.nextInt(xzSpread * 2 + 1) - xzSpread); + IBlockState target = world.getBlockState(pos1); + Block blockAboveTarget = world.getBlockState(pos1.up()).getBlock(); + + // see if this type of grass can spread to the target block + IBlockState targetGrass = grassType.spreadsToGrass(target); + if (targetGrass == null) {break;} + + // if there's enough light, turn the block to the relevant grass block + if (world.getLightFromNeighbors(pos1.up()) >= 4 && blockAboveTarget.getLightOpacity(world, pos1.up()) <= 2) + { + world.setBlockState(pos1, targetGrass); + } + } + } + } + } + + + @Override + public boolean canGrow(World worldIn, BlockPos pos, IBlockState state, boolean isClient) { + switch ((BOPGrassType) state.getValue(VARIANT_PROP)) + { + case SPECTRALMOSS: case SMOLDERING: + return false; + default: + return true; + } + } + + @Override + public boolean canUseBonemeal(World worldIn, Random rand, BlockPos pos, IBlockState state) { + switch ((BOPGrassType) state.getValue(VARIANT_PROP)) + { + case SPECTRALMOSS: case SMOLDERING: + return false; + default: + return true; + } + } + + // This is called when bonemeal is applied on the block + // The algorithm is functionally exactly the same as in the vanilla BlockGrass grow function, but has been rewritten to make its behavior clearer + @Override + public void grow(World worldIn, Random rand, BlockPos pos, IBlockState state) { + + BlockPos startPos = pos.up(); + BlockPos currPos; + + // 128 looks like a lot of tries, but many locations will be duplicated and many tries will be abandoned because the random walk hits a snag + for (int i = 0; i < 128; i++) { + + // go on a random walk away from the start position - abandon if we hit a block which can't spread the growth + // note walkLength increases gradually with i - so we attempt walks of different lengths + int walkLength = i / 16; + currPos = startPos; + boolean walkOk = true; + for (int j = 0; j < walkLength; j++) + { + // shift a random distance + currPos = currPos.add(rand.nextInt(3) - 1, (rand.nextInt(3) - 1) * rand.nextInt(3) / 2, rand.nextInt(3) - 1); + if (worldIn.getBlockState(currPos.down()).getBlock() != BOPBlocks.grass || worldIn.getBlockState(currPos).getBlock().isNormalCube()) + { + // this block can't spread the growth + walkOk = false; + break; + } + } + + // try and grow something at currPos + if (walkOk && worldIn.isAirBlock(currPos)) { + if (rand.nextInt(8)==0) { + // with 1/8 probability, plant a flower + worldIn.getBiomeGenForCoords(currPos).plantFlower(worldIn, rand, currPos); } else { - // if this block is covered, then turn it back to end_stone (IE kill the moss) - if (world.getLightFromNeighbors(pos.up()) < 4 && world.getBlockState(pos.up()).getBlock().getLightOpacity(world, pos.up()) > 2) + // otherwise plant tall grass + IBlockState tallgrassState = Blocks.tallgrass.getDefaultState().withProperty(BlockTallGrass.TYPE, BlockTallGrass.EnumType.GRASS); + if (Blocks.tallgrass.canBlockStay(worldIn, currPos, tallgrassState)) { - world.setBlockState(pos, Blocks.end_stone.getDefaultState()); - } - else - { - // if there's enough light from above, spread the moss randomly to nearby end_stone blocks - if (world.getLightFromNeighbors(pos.up()) >= 9) - { - for (int i = 0; i < 4; ++i) // try 4 times - { - // pick a random nearby position - BlockPos pos1 = pos.add(rand.nextInt(3) - 1, rand.nextInt(5) - 3, rand.nextInt(3) - 1); - Block blockAbove = world.getBlockState(pos1.up()).getBlock(); - IBlockState iblockstate1 = world.getBlockState(pos1); - // if there's enough light and it isn't covered, turn it to moss - if (iblockstate1.getBlock() == Blocks.end_stone && world.getLightFromNeighbors(pos1.up()) >= 4 && blockAbove.getLightOpacity(world, pos1.up()) <= 2) - { - world.setBlockState(pos1, this.getDefaultState().withProperty(VARIANT_PROP, BOPGrassType.SPECTRALMOSS) ); - } - } - } + worldIn.setBlockState(currPos, tallgrassState); } } - break; - - case SMOLDERINGGRASS: - break; - } + } + } } @Override @@ -197,12 +383,12 @@ public class BlockBOPGrass extends BOPBlock float heightOffset = 0.0F; switch ((BOPGrassType) state.getValue(VARIANT_PROP)) { - case SPECTRALMOSS: + // smoldering grass is a tiny bit lower than usual + case SMOLDERING: + heightOffset = 0.02F; break; - // smoldering grass is a tiny bit lower than usual - case SMOLDERINGGRASS: - heightOffset = 0.02F; + default: break; } return new AxisAlignedBB((double) pos.getX(), (double) pos.getY(), (double) pos.getZ(), (double) (pos.getX() + 1), (double) ((float) (pos.getY() + 1) - heightOffset), (double) (pos.getZ() + 1)); @@ -212,14 +398,15 @@ public class BlockBOPGrass extends BOPBlock public void onEntityCollidedWithBlock(World world, BlockPos pos, IBlockState state, Entity entity) { switch ((BOPGrassType) state.getValue(VARIANT_PROP)) - { - case SPECTRALMOSS: - break; - + { // smoldering grass sets you on fire for 2 seconds - case SMOLDERINGGRASS: + case SMOLDERING: entity.setFire(2); break; + + default: + break; + } } @@ -227,39 +414,21 @@ public class BlockBOPGrass extends BOPBlock @Override public Item getItemDropped(IBlockState state, Random rand, int fortune) { - switch ((BOPGrassType) state.getValue(VARIANT_PROP)) - { - case SPECTRALMOSS: - return Item.getItemFromBlock(Blocks.end_stone); - - case SMOLDERINGGRASS: - return Item.getItemFromBlock(Blocks.dirt); - } - return super.getItemDropped(state, rand, fortune); + return Item.getItemFromBlock( ((BOPGrassType) state.getValue(VARIANT_PROP)).getDirtBlock() ); } // goes hand in hand with getItemDropped() above to determine precisely what is dropped @Override public int damageDropped(IBlockState state) { - switch ((BOPGrassType) state.getValue(VARIANT_PROP)) - { - // end stone doesn't have any variants - case SPECTRALMOSS: - return 0; - - // make sure dirt item dropped is plain dirt (not any other variant) - case SMOLDERINGGRASS: - return BlockDirt.DirtType.DIRT.getMetadata(); - } - return super.damageDropped(state); + return ((BOPGrassType) state.getValue(VARIANT_PROP)).getDirtBlockMeta(); } - // enum representing the 2 variants of grass + // enum representing the variants of grass public static enum BOPGrassType implements IStringSerializable { - SPECTRALMOSS, SMOLDERINGGRASS; + SPECTRALMOSS, SMOLDERING, LOAMY, SANDY, SILTY; @Override public String getName() @@ -267,11 +436,10 @@ public class BlockBOPGrass extends BOPBlock switch(this) { case SPECTRALMOSS: - return "spectral_moss"; - case SMOLDERINGGRASS: - return "smoldering_grass_block"; + return "spectral_moss"; + default: + return this.name().toLowerCase() + "_grass_block"; } - return this.name().toLowerCase(); } @Override @@ -279,6 +447,84 @@ public class BlockBOPGrass extends BOPBlock { return getName(); } + + // get the blockstate which corresponds to the type of dirt which this grass variant grows on + // this is used to determine what drops when you break the grass block, and the type of dirt it reverts to when covered + public IBlockState getDirtBlockState() + { + switch(this) + { + case SPECTRALMOSS: + return Blocks.end_stone.getDefaultState(); + case LOAMY: + return BOPBlocks.dirt.getDefaultState().withProperty(BlockBOPDirt.VARIANT_PROP, BlockBOPDirt.BOPDirtType.LOAMY); + case SANDY: + return BOPBlocks.dirt.getDefaultState().withProperty(BlockBOPDirt.VARIANT_PROP, BlockBOPDirt.BOPDirtType.SANDY); + case SILTY: + return BOPBlocks.dirt.getDefaultState().withProperty(BlockBOPDirt.VARIANT_PROP, BlockBOPDirt.BOPDirtType.SILTY); + case SMOLDERING: default: + return Blocks.dirt.getStateFromMeta(BlockDirt.DirtType.DIRT.getMetadata()); + } + } + + public Block getDirtBlock() + { + return this.getDirtBlockState().getBlock(); + } + + public int getDirtBlockMeta() + { + return this.getDirtBlock().getMetaFromState(this.getDirtBlockState()); + } + + // if this type of grass can spread to the target block, return the grass which it will transform into + // otherwise return null + // this affects the grass spreading algorithm above, BlockBOPGrass.spreadGrass() + public IBlockState spreadsToGrass(IBlockState target) { + + switch(this) + { + // spectral moss only spreads to end stone + case SPECTRALMOSS: + if (target.getBlock()==Blocks.end_stone) + { + return BOPBlocks.grass.getDefaultState().withProperty(BlockBOPGrass.VARIANT_PROP, BlockBOPGrass.BOPGrassType.SPECTRALMOSS); + } + else + { + return null; + } + + // loamy/sandy/silty grasses spread to any kind of dirt + case LOAMY: case SANDY: case SILTY: + // vanilla dirt gets vanilla grass spread to it + if (target.getBlock() == Blocks.dirt && target.getValue(BlockDirt.VARIANT) == BlockDirt.DirtType.DIRT) + { + return Blocks.grass.getDefaultState(); + } + // BOP dirt get's the corresponding BOP grass spread to it (unless it's coarse - grass doesn't grow on coarse dirt) + else if (target.getBlock() == BOPBlocks.dirt && Boolean.FALSE.equals(target.getValue(BlockBOPDirt.COARSE)) ) + { + BlockBOPDirt.BOPDirtType targetDirtType = (BlockBOPDirt.BOPDirtType)target.getValue(BlockBOPDirt.VARIANT_PROP); + switch (targetDirtType) + { + case LOAMY: case SANDY: case SILTY: + return targetDirtType.getGrassBlockState(); + default: + return null; + } + } + else + { + return null; + } + + // smoldering grass doesn't spread at all + case SMOLDERING: default: + return null; + } + } + } } \ No newline at end of file diff --git a/src/main/java/biomesoplenty/common/block/BlockBOPLilypad.java b/src/main/java/biomesoplenty/common/block/BlockBOPLilypad.java new file mode 100644 index 000000000..b718e03ed --- /dev/null +++ b/src/main/java/biomesoplenty/common/block/BlockBOPLilypad.java @@ -0,0 +1,194 @@ +/******************************************************************************* + * Copyright 2014, the Biomes O' Plenty Team + * + * This work is licensed under a Creative Commons Attribution-NonCommercial-NoDerivatives 4.0 International Public License. + * + * To view a copy of this license, visit http://creativecommons.org/licenses/by-nc-nd/4.0/. + ******************************************************************************/ + +package biomesoplenty.common.block; + +import java.util.List; + +import biomesoplenty.api.block.BOPPlant; +import biomesoplenty.common.item.ItemBOPLilypad; +import net.minecraft.block.Block; +import net.minecraft.block.BlockLiquid; +import net.minecraft.block.material.Material; +import net.minecraft.block.properties.IProperty; +import net.minecraft.block.properties.PropertyEnum; +import net.minecraft.block.state.BlockState; +import net.minecraft.block.state.IBlockState; +import net.minecraft.entity.Entity; +import net.minecraft.entity.item.EntityBoat; +import net.minecraft.item.ItemBlock; +import net.minecraft.util.AxisAlignedBB; +import net.minecraft.util.BlockPos; +import net.minecraft.util.IStringSerializable; +import net.minecraft.world.IBlockAccess; +import net.minecraft.world.World; +import net.minecraftforge.common.EnumPlantType; +import net.minecraftforge.common.IPlantable; +import net.minecraftforge.fml.relauncher.Side; +import net.minecraftforge.fml.relauncher.SideOnly; + +public class BlockBOPLilypad extends BOPPlant implements IPlantable +{ + + public static final PropertyEnum VARIANT_PROP = PropertyEnum.create("variant", LilypadType.class); + + public BlockBOPLilypad() + { + this.setDefaultState(this.blockState.getBaseState().withProperty(VARIANT_PROP, LilypadType.MEDIUM)); + float f = 0.5F; + float f1 = 0.015625F; + this.setBlockBounds(0.5F - f, 0.0F, 0.5F - f, 0.5F + f, f1, 0.5F + f); + } + + // need to use a custom item class because of the unique way lilies are placed + @Override + public Class getItemClass() { + return ItemBOPLilypad.class; + } + + // lilies should always be in the centre of the water block + @Override + public Block.EnumOffsetType getOffsetType() + { + return Block.EnumOffsetType.NONE; + } + + @Override + public IBlockState getStateFromMeta(int meta) + { + // only one property to worry about, the variant, so just map [0 => MEDIUM, 1 => SMALL, 2 => TINY] + return this.getDefaultState().withProperty(VARIANT_PROP, LilypadType.values()[meta]); + } + + @Override + public int getMetaFromState(IBlockState state) + { + // only one property to worry about, the variant, so just map [0 => MEDIUM, 1 => SMALL, 2 => TINY] + return ((LilypadType) state.getValue(VARIANT_PROP)).ordinal(); + } + + @Override + protected BlockState createBlockState() + { + return new BlockState(this, new IProperty[] { VARIANT_PROP }); + } + + @Override + public IProperty[] getPresetProperties() + { + return new IProperty[] { VARIANT_PROP }; + } + + @Override + public String getStateName(IBlockState state, boolean fullName) + { + return ((LilypadType) state.getValue(VARIANT_PROP)).getName(); + } + + // copied from vanilla BlockLilyPad + // boats can go through lily pads + @Override + public void addCollisionBoxesToList(World worldIn, BlockPos pos, IBlockState state, AxisAlignedBB mask, List list, Entity collidingEntity) + { + if (collidingEntity == null || !(collidingEntity instanceof EntityBoat)) + { + super.addCollisionBoxesToList(worldIn, pos, state, mask, list, collidingEntity); + } + } + + // copied from vanilla BlockLilyPad + @Override + public AxisAlignedBB getCollisionBoundingBox(World worldIn, BlockPos pos, IBlockState state) + { + return new AxisAlignedBB((double)pos.getX() + this.minX, (double)pos.getY() + this.minY, (double)pos.getZ() + this.minZ, (double)pos.getX() + this.maxX, (double)pos.getY() + this.maxY, (double)pos.getZ() + this.maxZ); + } + + // copied from vanilla BlockLilyPad + @Override + @SideOnly(Side.CLIENT) + public int getBlockColor() + { + return 7455580; + } + + // copied from vanilla BlockLilyPad + @Override + @SideOnly(Side.CLIENT) + public int getRenderColor(IBlockState state) + { + return 7455580; + } + + // copied from vanilla BlockLilyPad + @Override + @SideOnly(Side.CLIENT) + public int colorMultiplier(IBlockAccess worldIn, BlockPos pos, int renderPass) + { + return 2129968; + } + + public boolean canPlaceBlockAt(World worldIn, BlockPos pos) + { + + Boolean y1 = super.canPlaceBlockAt(worldIn, pos); + Boolean y2 = worldIn.getBlockState(pos.down()).getBlock().canSustainPlant(worldIn, pos.down(), net.minecraft.util.EnumFacing.UP, this); + + return y1 && y2; + //return super.canPlaceBlockAt(worldIn, pos) && worldIn.getBlockState(pos.down()).getBlock().canSustainPlant(worldIn, pos.down(), net.minecraft.util.EnumFacing.UP, this); + } + + @Override + public boolean canBlockStay(World worldIn, BlockPos pos, IBlockState state) + { + if (pos.getY() >= 0 && pos.getY() < 256) + { + IBlockState iblockstate1 = worldIn.getBlockState(pos.down()); + return iblockstate1.getBlock().getMaterial() == Material.water && ((Integer)iblockstate1.getValue(BlockLiquid.LEVEL)).intValue() == 0; + } + else + { + return false; + } + } + + @Override + // This will stop it being placed on anything except water + public EnumPlantType getPlantType(IBlockAccess world, BlockPos pos) { + return EnumPlantType.Water; + } + + + // enum representing the 3 variants of lily + public static enum LilypadType implements IStringSerializable + { + MEDIUM, SMALL, TINY; + + @Override + public String getName() + { + return "lily_" + this.name().toLowerCase(); + } + + @Override + public String toString() + { + return getName(); + } + } + + + // TODO: copied from BlockBush - not sure exactly what this does... investigate further - possibly put into base class + @Override + public IBlockState getPlant(net.minecraft.world.IBlockAccess world, BlockPos pos) + { + IBlockState state = world.getBlockState(pos); + if (state.getBlock() != this) return getDefaultState(); + return state; + } + +} \ No newline at end of file diff --git a/src/main/java/biomesoplenty/common/init/ModBlocks.java b/src/main/java/biomesoplenty/common/init/ModBlocks.java index 6146d7ae6..40852e3da 100644 --- a/src/main/java/biomesoplenty/common/init/ModBlocks.java +++ b/src/main/java/biomesoplenty/common/init/ModBlocks.java @@ -9,19 +9,17 @@ package biomesoplenty.common.init; import static biomesoplenty.api.block.BOPBlocks.*; - -import java.util.Set; - import net.minecraft.block.Block; import net.minecraft.block.state.IBlockState; -import net.minecraft.client.resources.model.ModelBakery; import net.minecraft.item.Item; import net.minecraftforge.fml.common.registry.GameRegistry; import biomesoplenty.api.block.BOPBlock; import biomesoplenty.common.block.BlockAsh; +import biomesoplenty.common.block.BlockBOPDirt; import biomesoplenty.common.block.BlockBOPFlower; import biomesoplenty.common.block.BlockBOPFlower2; import biomesoplenty.common.block.BlockBOPGrass; +import biomesoplenty.common.block.BlockBOPLilypad; import biomesoplenty.common.block.BlockBOPLog; import biomesoplenty.common.block.BlockBOPLog2; import biomesoplenty.common.block.BlockBOPLog3; @@ -39,7 +37,6 @@ import biomesoplenty.common.block.BlockMud; import biomesoplenty.common.block.BlockTurnip; import biomesoplenty.common.block.BlockFlesh; import biomesoplenty.common.handler.GuiEventHandler; -import biomesoplenty.common.item.ItemBlockWithVariants; import biomesoplenty.common.util.block.BlockStateUtils; import biomesoplenty.core.BiomesOPlenty; @@ -67,8 +64,11 @@ public class ModBlocks turnip_block = registerBlock(new BlockTurnip(), "turnip_block"); flesh = registerBlock(new BlockFlesh(), "flesh"); grass = registerBlock(new BlockBOPGrass(), "grass"); + waterlily = registerBlock(new BlockBOPLilypad(), "waterlily"); + dirt = registerBlock(new BlockBOPDirt(), "dirt"); + } - + private static Block registerBlock(BOPBlock block, String name) { if (block.presetStates == null) @@ -78,14 +78,15 @@ public class ModBlocks if (block.hasPresetProperties()) { - GameRegistry.registerBlock(block, ItemBlockWithVariants.class, name); + GameRegistry.registerBlock(block, block.getItemClass(), name); for (IBlockState state : block.presetStates) { String stateName = block.getStateName(state, true); + int stateMeta = block.getMetaFromState(state); BiomesOPlenty.proxy.addVariantName(Item.getItemFromBlock(block), BiomesOPlenty.MOD_ID + ":" + stateName); - BiomesOPlenty.proxy.registerBlockForMeshing(block, block.getMetaFromState(state), stateName); + BiomesOPlenty.proxy.registerBlockForMeshing(block, stateMeta, stateName); GuiEventHandler.blockCount++; } diff --git a/src/main/java/biomesoplenty/common/item/ItemBOPLilypad.java b/src/main/java/biomesoplenty/common/item/ItemBOPLilypad.java new file mode 100644 index 000000000..b65b8da9e --- /dev/null +++ b/src/main/java/biomesoplenty/common/item/ItemBOPLilypad.java @@ -0,0 +1,87 @@ +/******************************************************************************* + * Copyright 2014, the Biomes O' Plenty Team + * + * This work is licensed under a Creative Commons Attribution-NonCommercial-NoDerivatives 4.0 International Public License. + * + * To view a copy of this license, visit http://creativecommons.org/licenses/by-nc-nd/4.0/. + ******************************************************************************/ + +package biomesoplenty.common.item; + +import biomesoplenty.api.block.BOPBlocks; +import net.minecraft.block.Block; +import net.minecraft.block.BlockLiquid; +import net.minecraft.block.material.Material; +import net.minecraft.block.state.IBlockState; +import net.minecraft.entity.player.EntityPlayer; +import net.minecraft.item.Item; +import net.minecraft.item.ItemStack; +import net.minecraft.stats.StatList; +import net.minecraft.util.BlockPos; +import net.minecraft.util.MovingObjectPosition; +import net.minecraft.world.World; + +public class ItemBOPLilypad extends ItemBlockWithVariants { + + public ItemBOPLilypad(Block block) { + super(block); + } + + // The code for right clicking needs to be overridden to handle the unique way lilies are placed - on top of the water + // (usually when you point the cursor at water the picked block is whatever is underneath the water - when placing lilies the water itself has to be picked) + // The below is copied from vanille BlockLilyPad + @Override + public ItemStack onItemRightClick(ItemStack itemStackIn, World worldIn, EntityPlayer playerIn) + { + MovingObjectPosition movingobjectposition = this.getMovingObjectPositionFromPlayer(worldIn, playerIn, true); + + if (movingobjectposition == null) + { + return itemStackIn; + } + else + { + if (movingobjectposition.typeOfHit == MovingObjectPosition.MovingObjectType.BLOCK) + { + BlockPos blockpos = movingobjectposition.getBlockPos(); + + if (!worldIn.isBlockModifiable(playerIn, blockpos)) + { + return itemStackIn; + } + + if (!playerIn.canPlayerEdit(blockpos.offset(movingobjectposition.sideHit), movingobjectposition.sideHit, itemStackIn)) + { + return itemStackIn; + } + + BlockPos blockpos1 = blockpos.up(); + IBlockState iblockstate = worldIn.getBlockState(blockpos); + + if (iblockstate.getBlock().getMaterial() == Material.water && ((Integer)iblockstate.getValue(BlockLiquid.LEVEL)).intValue() == 0 && worldIn.isAirBlock(blockpos1)) + { + // special case for handling block placement with water lilies + net.minecraftforge.common.util.BlockSnapshot blocksnapshot = net.minecraftforge.common.util.BlockSnapshot.getBlockSnapshot(worldIn, blockpos1); + + worldIn.setBlockState(blockpos1, BOPBlocks.waterlily.getStateFromMeta(itemStackIn.getMetadata())); + if (net.minecraftforge.event.ForgeEventFactory.onPlayerBlockPlace(playerIn, blocksnapshot, net.minecraft.util.EnumFacing.UP).isCanceled()) + { + blocksnapshot.restore(true, false); + return itemStackIn; + } + + if (!playerIn.capabilities.isCreativeMode) + { + --itemStackIn.stackSize; + } + + playerIn.triggerAchievement(StatList.objectUseStats[Item.getIdFromItem(this)]); + } + } + + return itemStackIn; + } + } + + +} \ No newline at end of file diff --git a/src/main/java/biomesoplenty/common/item/ItemBlockWithVariants.java b/src/main/java/biomesoplenty/common/item/ItemBlockWithVariants.java index 705f201e1..2e13a3805 100644 --- a/src/main/java/biomesoplenty/common/item/ItemBlockWithVariants.java +++ b/src/main/java/biomesoplenty/common/item/ItemBlockWithVariants.java @@ -9,9 +9,12 @@ package biomesoplenty.common.item; import biomesoplenty.api.block.BOPBlock; +import biomesoplenty.common.block.BlockBOPGrass; import net.minecraft.block.Block; import net.minecraft.item.ItemBlock; import net.minecraft.item.ItemStack; +import net.minecraftforge.fml.relauncher.Side; +import net.minecraftforge.fml.relauncher.SideOnly; public class ItemBlockWithVariants extends ItemBlock { @@ -22,6 +25,19 @@ public class ItemBlockWithVariants extends ItemBlock this.setMaxDamage(0); this.setHasSubtypes(true); } + + + @SideOnly(Side.CLIENT) + public int getColorFromItemStack(ItemStack stack, int renderPass) + { + // TODO: might be neater to use an interface rather than checking for specific blocks? + if (this.block instanceof BlockBOPGrass) + { + // grass item will render with grey grass unless we set the color here + return ((BlockBOPGrass)this.block).getRenderColor(this.block.getStateFromMeta(stack.getMetadata())); + } + return super.getColorFromItemStack(stack,renderPass); + } @Override public int getMetadata(int metadata) diff --git a/src/main/resources/assets/biomesoplenty/blockstates/dirt.json b/src/main/resources/assets/biomesoplenty/blockstates/dirt.json new file mode 100644 index 000000000..98f2543fa --- /dev/null +++ b/src/main/resources/assets/biomesoplenty/blockstates/dirt.json @@ -0,0 +1,10 @@ +{ + "variants": { + "coarse=false,variant=loamy": { "model": "biomesoplenty:loamy_dirt" }, + "coarse=false,variant=sandy": { "model": "biomesoplenty:sandy_dirt" }, + "coarse=false,variant=silty": { "model": "biomesoplenty:silty_dirt" }, + "coarse=true,variant=loamy": { "model": "biomesoplenty:coarse_loamy_dirt" }, + "coarse=true,variant=sandy": { "model": "biomesoplenty:coarse_sandy_dirt" }, + "coarse=true,variant=silty": { "model": "biomesoplenty:coarse_silty_dirt" } + } +} diff --git a/src/main/resources/assets/biomesoplenty/blockstates/grass.json b/src/main/resources/assets/biomesoplenty/blockstates/grass.json index 27e749c0f..cbda40f0c 100644 --- a/src/main/resources/assets/biomesoplenty/blockstates/grass.json +++ b/src/main/resources/assets/biomesoplenty/blockstates/grass.json @@ -1,6 +1,14 @@ { "variants": { - "variant=smoldering_grass_block": { "model": "biomesoplenty:smoldering_grass_block" }, - "variant=spectral_moss": { "model": "biomesoplenty:spectral_moss" } + "snowy=false,variant=smoldering_grass_block": { "model": "biomesoplenty:smoldering_grass_block" }, + "snowy=true,variant=smoldering_grass_block": { "model": "biomesoplenty:smoldering_grass_block" }, + "snowy=false,variant=spectral_moss": { "model": "biomesoplenty:spectral_moss" }, + "snowy=true,variant=spectral_moss": { "model": "biomesoplenty:spectral_moss" }, + "snowy=false,variant=loamy_grass_block": { "model": "biomesoplenty:loamy_grass_block" }, + "snowy=true,variant=loamy_grass_block": { "model": "biomesoplenty:loamy_grass_block_snowed" }, + "snowy=false,variant=sandy_grass_block": { "model": "biomesoplenty:sandy_grass_block" }, + "snowy=true,variant=sandy_grass_block": { "model": "biomesoplenty:sandy_grass_block_snowed" }, + "snowy=false,variant=silty_grass_block": { "model": "biomesoplenty:silty_grass_block" }, + "snowy=true,variant=silty_grass_block": { "model": "biomesoplenty:silty_grass_block_snowed" } } } diff --git a/src/main/resources/assets/biomesoplenty/blockstates/waterlily.json b/src/main/resources/assets/biomesoplenty/blockstates/waterlily.json new file mode 100644 index 000000000..26fa7c889 --- /dev/null +++ b/src/main/resources/assets/biomesoplenty/blockstates/waterlily.json @@ -0,0 +1,22 @@ +{ + "variants": { + "variant=lily_medium": [ + { "model": "biomesoplenty:lily_medium" }, + { "model": "biomesoplenty:lily_medium", "y": 90 }, + { "model": "biomesoplenty:lily_medium", "y": 180 }, + { "model": "biomesoplenty:lily_medium", "y": 270 } + ], + "variant=lily_small": [ + { "model": "biomesoplenty:lily_small" }, + { "model": "biomesoplenty:lily_small", "y": 90 }, + { "model": "biomesoplenty:lily_small", "y": 180 }, + { "model": "biomesoplenty:lily_small", "y": 270 } + ], + "variant=lily_tiny": [ + { "model": "biomesoplenty:lily_tiny" }, + { "model": "biomesoplenty:lily_tiny", "y": 90 }, + { "model": "biomesoplenty:lily_tiny", "y": 180 }, + { "model": "biomesoplenty:lily_tiny", "y": 270 } + ] + } +} \ No newline at end of file diff --git a/src/main/resources/assets/biomesoplenty/lang/en_US.lang b/src/main/resources/assets/biomesoplenty/lang/en_US.lang index beeb396ff..8b3a364ea 100644 --- a/src/main/resources/assets/biomesoplenty/lang/en_US.lang +++ b/src/main/resources/assets/biomesoplenty/lang/en_US.lang @@ -13,6 +13,9 @@ tile.bone_segment.large.name=Large Bone Segment tile.grass.spectral_moss.name=Spectral Moss tile.grass.smoldering_grass_block.name=Smoldering Grass Block +tile.grass.loamy_grass_block.name=Loamy Grass Block +tile.grass.sandy_grass_block.name=Sandy Grass Block +tile.grass.silty_grass_block.name=Silty Grass Block tile.coral.pink.name=Pink Coral tile.coral.orange.name=Orange Coral @@ -126,6 +129,17 @@ tile.stone.polished_shale.name=Polished Shale tile.turnip_block.name=Turnip +tile.waterlily.lily_medium.name=Medium Lily Pad +tile.waterlily.lily_small.name=Small Lily Pad +tile.waterlily.lily_tiny.name=Tiny Lily Pad + +tile.dirt.loamy_dirt.name=Loamy Dirt +tile.dirt.sandy_dirt.name=Sandy Dirt +tile.dirt.silty_dirt.name=Silty Dirt +tile.dirt.coarse_loamy_dirt.name=Coarse Loamy Dirt +tile.dirt.coarse_sandy_dirt.name=Coarse Sandy Dirt +tile.dirt.coarse_silty_dirt.name=Coarse Silty Dirt + item.fleshchunk.name=Chunk of Flesh item.mudball.name=Mud Ball item.turnip.name=Turnip diff --git a/src/main/resources/assets/biomesoplenty/models/block/coarse_loamy_dirt.json b/src/main/resources/assets/biomesoplenty/models/block/coarse_loamy_dirt.json new file mode 100644 index 000000000..8b8f67e42 --- /dev/null +++ b/src/main/resources/assets/biomesoplenty/models/block/coarse_loamy_dirt.json @@ -0,0 +1,6 @@ +{ + "parent": "block/cube_all", + "textures": { + "all": "biomesoplenty:blocks/coarse_dirt_loamy" + } +} diff --git a/src/main/resources/assets/biomesoplenty/models/block/coarse_sandy_dirt.json b/src/main/resources/assets/biomesoplenty/models/block/coarse_sandy_dirt.json new file mode 100644 index 000000000..735b1cbf3 --- /dev/null +++ b/src/main/resources/assets/biomesoplenty/models/block/coarse_sandy_dirt.json @@ -0,0 +1,6 @@ +{ + "parent": "block/cube_all", + "textures": { + "all": "biomesoplenty:blocks/coarse_dirt_sandy" + } +} diff --git a/src/main/resources/assets/biomesoplenty/models/block/coarse_silty_dirt.json b/src/main/resources/assets/biomesoplenty/models/block/coarse_silty_dirt.json new file mode 100644 index 000000000..6653b4688 --- /dev/null +++ b/src/main/resources/assets/biomesoplenty/models/block/coarse_silty_dirt.json @@ -0,0 +1,6 @@ +{ + "parent": "block/cube_all", + "textures": { + "all": "biomesoplenty:blocks/coarse_dirt_silty" + } +} diff --git a/src/main/resources/assets/biomesoplenty/models/block/lily_medium.json b/src/main/resources/assets/biomesoplenty/models/block/lily_medium.json new file mode 100644 index 000000000..31f733604 --- /dev/null +++ b/src/main/resources/assets/biomesoplenty/models/block/lily_medium.json @@ -0,0 +1,16 @@ +{ + "ambientocclusion": false, + "textures": { + "particle": "blocks/waterlily", + "texture": "biomesoplenty:blocks/lily_medium" + }, + "elements": [ + { "from": [ 0, 0.25, 0 ], + "to": [ 16, 0.25, 16 ], + "faces": { + "down": { "uv": [ 16, 16, 0, 0 ], "texture": "#texture", "tintindex": 0 }, + "up": { "uv": [ 16, 0, 0, 16 ], "texture": "#texture", "tintindex": 0 } + } + } + ] +} diff --git a/src/main/resources/assets/biomesoplenty/models/block/lily_small.json b/src/main/resources/assets/biomesoplenty/models/block/lily_small.json new file mode 100644 index 000000000..4a809e5c2 --- /dev/null +++ b/src/main/resources/assets/biomesoplenty/models/block/lily_small.json @@ -0,0 +1,16 @@ +{ + "ambientocclusion": false, + "textures": { + "particle": "blocks/waterlily", + "texture": "biomesoplenty:blocks/lily_small" + }, + "elements": [ + { "from": [ 0, 0.25, 0 ], + "to": [ 16, 0.25, 16 ], + "faces": { + "down": { "uv": [ 16, 16, 0, 0 ], "texture": "#texture", "tintindex": 0 }, + "up": { "uv": [ 16, 0, 0, 16 ], "texture": "#texture", "tintindex": 0 } + } + } + ] +} \ No newline at end of file diff --git a/src/main/resources/assets/biomesoplenty/models/block/lily_tiny.json b/src/main/resources/assets/biomesoplenty/models/block/lily_tiny.json new file mode 100644 index 000000000..d544d3efe --- /dev/null +++ b/src/main/resources/assets/biomesoplenty/models/block/lily_tiny.json @@ -0,0 +1,16 @@ +{ + "ambientocclusion": false, + "textures": { + "particle": "blocks/waterlily", + "texture": "biomesoplenty:blocks/lily_tiny" + }, + "elements": [ + { "from": [ 0, 0.25, 0 ], + "to": [ 16, 0.25, 16 ], + "faces": { + "down": { "uv": [ 16, 16, 0, 0 ], "texture": "#texture", "tintindex": 0 }, + "up": { "uv": [ 16, 0, 0, 16 ], "texture": "#texture", "tintindex": 0 } + } + } + ] +} \ No newline at end of file diff --git a/src/main/resources/assets/biomesoplenty/models/block/loamy_dirt.json b/src/main/resources/assets/biomesoplenty/models/block/loamy_dirt.json new file mode 100644 index 000000000..a8eb6eff1 --- /dev/null +++ b/src/main/resources/assets/biomesoplenty/models/block/loamy_dirt.json @@ -0,0 +1,6 @@ +{ + "parent": "block/cube_all", + "textures": { + "all": "biomesoplenty:blocks/dirt_loamy" + } +} diff --git a/src/main/resources/assets/biomesoplenty/models/block/loamy_grass_block.json b/src/main/resources/assets/biomesoplenty/models/block/loamy_grass_block.json new file mode 100644 index 000000000..5d5d5552c --- /dev/null +++ b/src/main/resources/assets/biomesoplenty/models/block/loamy_grass_block.json @@ -0,0 +1,10 @@ +{ + "parent": "block/grass", + "textures": { + "particle": "biomesoplenty:blocks/dirt_loamy", + "bottom": "biomesoplenty:blocks/dirt_loamy", + "top": "biomesoplenty:blocks/grass_top", + "side": "biomesoplenty:blocks/grass_loamy_side", + "overlay": "biomesoplenty:blocks/grass_side_overlay" + } +} \ No newline at end of file diff --git a/src/main/resources/assets/biomesoplenty/models/block/loamy_grass_block_snowed.json b/src/main/resources/assets/biomesoplenty/models/block/loamy_grass_block_snowed.json new file mode 100644 index 000000000..1ab261a20 --- /dev/null +++ b/src/main/resources/assets/biomesoplenty/models/block/loamy_grass_block_snowed.json @@ -0,0 +1,9 @@ +{ + "parent": "block/cube_bottom_top", + "textures": { + "particle": "biomesoplenty:blocks/dirt_loamy", + "bottom": "biomesoplenty:blocks/dirt_loamy", + "top": "biomesoplenty:blocks/grass_top", + "side": "biomesoplenty:blocks/grass_loamy_side_snowed" + } +} \ No newline at end of file diff --git a/src/main/resources/assets/biomesoplenty/models/block/sandy_dirt.json b/src/main/resources/assets/biomesoplenty/models/block/sandy_dirt.json new file mode 100644 index 000000000..1e27ebe02 --- /dev/null +++ b/src/main/resources/assets/biomesoplenty/models/block/sandy_dirt.json @@ -0,0 +1,6 @@ +{ + "parent": "block/cube_all", + "textures": { + "all": "biomesoplenty:blocks/dirt_sandy" + } +} diff --git a/src/main/resources/assets/biomesoplenty/models/block/sandy_grass_block.json b/src/main/resources/assets/biomesoplenty/models/block/sandy_grass_block.json new file mode 100644 index 000000000..93f8d1395 --- /dev/null +++ b/src/main/resources/assets/biomesoplenty/models/block/sandy_grass_block.json @@ -0,0 +1,10 @@ +{ + "parent": "block/grass", + "textures": { + "particle": "biomesoplenty:blocks/dirt_sandy", + "bottom": "biomesoplenty:blocks/dirt_sandy", + "top": "biomesoplenty:blocks/grass_top", + "side": "biomesoplenty:blocks/grass_sandy_side", + "overlay": "biomesoplenty:blocks/grass_side_overlay" + } +} \ No newline at end of file diff --git a/src/main/resources/assets/biomesoplenty/models/block/sandy_grass_block_snowed.json b/src/main/resources/assets/biomesoplenty/models/block/sandy_grass_block_snowed.json new file mode 100644 index 000000000..d45c607bc --- /dev/null +++ b/src/main/resources/assets/biomesoplenty/models/block/sandy_grass_block_snowed.json @@ -0,0 +1,9 @@ +{ + "parent": "block/cube_bottom_top", + "textures": { + "particle": "biomesoplenty:blocks/dirt_sandy", + "bottom": "biomesoplenty:blocks/dirt_sandy", + "top": "biomesoplenty:blocks/grass_top", + "side": "biomesoplenty:blocks/grass_sandy_side_snowed" + } +} \ No newline at end of file diff --git a/src/main/resources/assets/biomesoplenty/models/block/silty_dirt.json b/src/main/resources/assets/biomesoplenty/models/block/silty_dirt.json new file mode 100644 index 000000000..1813d7afe --- /dev/null +++ b/src/main/resources/assets/biomesoplenty/models/block/silty_dirt.json @@ -0,0 +1,6 @@ +{ + "parent": "block/cube_all", + "textures": { + "all": "biomesoplenty:blocks/dirt_silty" + } +} diff --git a/src/main/resources/assets/biomesoplenty/models/block/silty_grass_block.json b/src/main/resources/assets/biomesoplenty/models/block/silty_grass_block.json new file mode 100644 index 000000000..d917b3f7d --- /dev/null +++ b/src/main/resources/assets/biomesoplenty/models/block/silty_grass_block.json @@ -0,0 +1,10 @@ +{ + "parent": "block/grass", + "textures": { + "particle": "biomesoplenty:blocks/dirt_silty", + "bottom": "biomesoplenty:blocks/dirt_silty", + "top": "biomesoplenty:blocks/grass_top", + "side": "biomesoplenty:blocks/grass_silty_side", + "overlay": "biomesoplenty:blocks/grass_side_overlay" + } +} \ No newline at end of file diff --git a/src/main/resources/assets/biomesoplenty/models/block/silty_grass_block_snowed.json b/src/main/resources/assets/biomesoplenty/models/block/silty_grass_block_snowed.json new file mode 100644 index 000000000..42eabbdb2 --- /dev/null +++ b/src/main/resources/assets/biomesoplenty/models/block/silty_grass_block_snowed.json @@ -0,0 +1,9 @@ +{ + "parent": "block/cube_bottom_top", + "textures": { + "particle": "biomesoplenty:blocks/dirt_silty", + "bottom": "biomesoplenty:blocks/dirt_silty", + "top": "biomesoplenty:blocks/grass_top", + "side": "biomesoplenty:blocks/grass_silty_side_snowed" + } +} \ No newline at end of file diff --git a/src/main/resources/assets/biomesoplenty/models/item/coarse_loamy_dirt.json b/src/main/resources/assets/biomesoplenty/models/item/coarse_loamy_dirt.json new file mode 100644 index 000000000..9e9590809 --- /dev/null +++ b/src/main/resources/assets/biomesoplenty/models/item/coarse_loamy_dirt.json @@ -0,0 +1,10 @@ +{ + "parent": "biomesoplenty:block/coarse_loamy_dirt", + "display": { + "thirdperson": { + "rotation": [ 10, -45, 170 ], + "translation": [ 0, 1.5, -2.75 ], + "scale": [ 0.375, 0.375, 0.375 ] + } + } +} diff --git a/src/main/resources/assets/biomesoplenty/models/item/coarse_sandy_dirt.json b/src/main/resources/assets/biomesoplenty/models/item/coarse_sandy_dirt.json new file mode 100644 index 000000000..947655031 --- /dev/null +++ b/src/main/resources/assets/biomesoplenty/models/item/coarse_sandy_dirt.json @@ -0,0 +1,10 @@ +{ + "parent": "biomesoplenty:block/coarse_sandy_dirt", + "display": { + "thirdperson": { + "rotation": [ 10, -45, 170 ], + "translation": [ 0, 1.5, -2.75 ], + "scale": [ 0.375, 0.375, 0.375 ] + } + } +} diff --git a/src/main/resources/assets/biomesoplenty/models/item/coarse_silty_dirt.json b/src/main/resources/assets/biomesoplenty/models/item/coarse_silty_dirt.json new file mode 100644 index 000000000..d607d4768 --- /dev/null +++ b/src/main/resources/assets/biomesoplenty/models/item/coarse_silty_dirt.json @@ -0,0 +1,10 @@ +{ + "parent": "biomesoplenty:block/coarse_silty_dirt", + "display": { + "thirdperson": { + "rotation": [ 10, -45, 170 ], + "translation": [ 0, 1.5, -2.75 ], + "scale": [ 0.375, 0.375, 0.375 ] + } + } +} diff --git a/src/main/resources/assets/biomesoplenty/models/item/lily_medium.json b/src/main/resources/assets/biomesoplenty/models/item/lily_medium.json new file mode 100644 index 000000000..ebdc737d3 --- /dev/null +++ b/src/main/resources/assets/biomesoplenty/models/item/lily_medium.json @@ -0,0 +1,18 @@ +{ + "parent": "builtin/generated", + "textures": { + "layer0": "biomesoplenty:blocks/lily_medium" + }, + "display": { + "thirdperson": { + "rotation": [ -90, 0, 0 ], + "translation": [ 0, 1, -3 ], + "scale": [ 0.55, 0.55, 0.55 ] + }, + "firstperson": { + "rotation": [ 0, -135, 25 ], + "translation": [ 0, 4, 2 ], + "scale": [ 1.7, 1.7, 1.7 ] + } + } +} diff --git a/src/main/resources/assets/biomesoplenty/models/item/lily_small.json b/src/main/resources/assets/biomesoplenty/models/item/lily_small.json new file mode 100644 index 000000000..d80c348f1 --- /dev/null +++ b/src/main/resources/assets/biomesoplenty/models/item/lily_small.json @@ -0,0 +1,18 @@ +{ + "parent": "builtin/generated", + "textures": { + "layer0": "biomesoplenty:blocks/lily_small" + }, + "display": { + "thirdperson": { + "rotation": [ -90, 0, 0 ], + "translation": [ 0, 1, -3 ], + "scale": [ 0.55, 0.55, 0.55 ] + }, + "firstperson": { + "rotation": [ 0, -135, 25 ], + "translation": [ 0, 4, 2 ], + "scale": [ 1.7, 1.7, 1.7 ] + } + } +} diff --git a/src/main/resources/assets/biomesoplenty/models/item/lily_tiny.json b/src/main/resources/assets/biomesoplenty/models/item/lily_tiny.json new file mode 100644 index 000000000..d59b3aa41 --- /dev/null +++ b/src/main/resources/assets/biomesoplenty/models/item/lily_tiny.json @@ -0,0 +1,18 @@ +{ + "parent": "builtin/generated", + "textures": { + "layer0": "biomesoplenty:blocks/lily_tiny" + }, + "display": { + "thirdperson": { + "rotation": [ -90, 0, 0 ], + "translation": [ 0, 1, -3 ], + "scale": [ 0.55, 0.55, 0.55 ] + }, + "firstperson": { + "rotation": [ 0, -135, 25 ], + "translation": [ 0, 4, 2 ], + "scale": [ 1.7, 1.7, 1.7 ] + } + } +} diff --git a/src/main/resources/assets/biomesoplenty/models/item/loamy_dirt.json b/src/main/resources/assets/biomesoplenty/models/item/loamy_dirt.json new file mode 100644 index 000000000..03dafee35 --- /dev/null +++ b/src/main/resources/assets/biomesoplenty/models/item/loamy_dirt.json @@ -0,0 +1,10 @@ +{ + "parent": "biomesoplenty:block/loamy_dirt", + "display": { + "thirdperson": { + "rotation": [ 10, -45, 170 ], + "translation": [ 0, 1.5, -2.75 ], + "scale": [ 0.375, 0.375, 0.375 ] + } + } +} diff --git a/src/main/resources/assets/biomesoplenty/models/item/loamy_grass_block.json b/src/main/resources/assets/biomesoplenty/models/item/loamy_grass_block.json new file mode 100644 index 000000000..5e4f7a1ea --- /dev/null +++ b/src/main/resources/assets/biomesoplenty/models/item/loamy_grass_block.json @@ -0,0 +1,10 @@ +{ + "parent": "biomesoplenty:block/loamy_grass_block", + "display": { + "thirdperson": { + "rotation": [ 10, -45, 170 ], + "translation": [ 0, 1.5, -2.75 ], + "scale": [ 0.375, 0.375, 0.375 ] + } + } +} diff --git a/src/main/resources/assets/biomesoplenty/models/item/sandy_dirt.json b/src/main/resources/assets/biomesoplenty/models/item/sandy_dirt.json new file mode 100644 index 000000000..87753af57 --- /dev/null +++ b/src/main/resources/assets/biomesoplenty/models/item/sandy_dirt.json @@ -0,0 +1,10 @@ +{ + "parent": "biomesoplenty:block/sandy_dirt", + "display": { + "thirdperson": { + "rotation": [ 10, -45, 170 ], + "translation": [ 0, 1.5, -2.75 ], + "scale": [ 0.375, 0.375, 0.375 ] + } + } +} diff --git a/src/main/resources/assets/biomesoplenty/models/item/sandy_grass_block.json b/src/main/resources/assets/biomesoplenty/models/item/sandy_grass_block.json new file mode 100644 index 000000000..7c39a819e --- /dev/null +++ b/src/main/resources/assets/biomesoplenty/models/item/sandy_grass_block.json @@ -0,0 +1,10 @@ +{ + "parent": "biomesoplenty:block/sandy_grass_block", + "display": { + "thirdperson": { + "rotation": [ 10, -45, 170 ], + "translation": [ 0, 1.5, -2.75 ], + "scale": [ 0.375, 0.375, 0.375 ] + } + } +} diff --git a/src/main/resources/assets/biomesoplenty/models/item/silty_dirt.json b/src/main/resources/assets/biomesoplenty/models/item/silty_dirt.json new file mode 100644 index 000000000..34fb504a0 --- /dev/null +++ b/src/main/resources/assets/biomesoplenty/models/item/silty_dirt.json @@ -0,0 +1,10 @@ +{ + "parent": "biomesoplenty:block/silty_dirt", + "display": { + "thirdperson": { + "rotation": [ 10, -45, 170 ], + "translation": [ 0, 1.5, -2.75 ], + "scale": [ 0.375, 0.375, 0.375 ] + } + } +} diff --git a/src/main/resources/assets/biomesoplenty/models/item/silty_grass_block.json b/src/main/resources/assets/biomesoplenty/models/item/silty_grass_block.json new file mode 100644 index 000000000..19b1465b4 --- /dev/null +++ b/src/main/resources/assets/biomesoplenty/models/item/silty_grass_block.json @@ -0,0 +1,10 @@ +{ + "parent": "biomesoplenty:block/silty_grass_block", + "display": { + "thirdperson": { + "rotation": [ 10, -45, 170 ], + "translation": [ 0, 1.5, -2.75 ], + "scale": [ 0.375, 0.375, 0.375 ] + } + } +} diff --git a/src/main/resources/assets/biomesoplenty/textures/blocks/coarse_dirt_loamy.png b/src/main/resources/assets/biomesoplenty/textures/blocks/coarse_dirt_loamy.png new file mode 100644 index 000000000..60a76d44f Binary files /dev/null and b/src/main/resources/assets/biomesoplenty/textures/blocks/coarse_dirt_loamy.png differ diff --git a/src/main/resources/assets/biomesoplenty/textures/blocks/coarse_dirt_sandy.png b/src/main/resources/assets/biomesoplenty/textures/blocks/coarse_dirt_sandy.png new file mode 100644 index 000000000..674031e5a Binary files /dev/null and b/src/main/resources/assets/biomesoplenty/textures/blocks/coarse_dirt_sandy.png differ diff --git a/src/main/resources/assets/biomesoplenty/textures/blocks/coarse_dirt_silty.png b/src/main/resources/assets/biomesoplenty/textures/blocks/coarse_dirt_silty.png new file mode 100644 index 000000000..5d773a48d Binary files /dev/null and b/src/main/resources/assets/biomesoplenty/textures/blocks/coarse_dirt_silty.png differ diff --git a/src/main/resources/assets/biomesoplenty/textures/blocks/dirt_loamy.png b/src/main/resources/assets/biomesoplenty/textures/blocks/dirt_loamy.png new file mode 100644 index 000000000..afc8e2e80 Binary files /dev/null and b/src/main/resources/assets/biomesoplenty/textures/blocks/dirt_loamy.png differ diff --git a/src/main/resources/assets/biomesoplenty/textures/blocks/dirt_sandy.png b/src/main/resources/assets/biomesoplenty/textures/blocks/dirt_sandy.png new file mode 100644 index 000000000..924d2c94a Binary files /dev/null and b/src/main/resources/assets/biomesoplenty/textures/blocks/dirt_sandy.png differ diff --git a/src/main/resources/assets/biomesoplenty/textures/blocks/dirt_silty.png b/src/main/resources/assets/biomesoplenty/textures/blocks/dirt_silty.png new file mode 100644 index 000000000..4be6c4b82 Binary files /dev/null and b/src/main/resources/assets/biomesoplenty/textures/blocks/dirt_silty.png differ diff --git a/src/main/resources/assets/biomesoplenty/textures/blocks/grass_loamy_side.png b/src/main/resources/assets/biomesoplenty/textures/blocks/grass_loamy_side.png new file mode 100644 index 000000000..e91b3f8d6 Binary files /dev/null and b/src/main/resources/assets/biomesoplenty/textures/blocks/grass_loamy_side.png differ diff --git a/src/main/resources/assets/biomesoplenty/textures/blocks/grass_loamy_side_snowed.png b/src/main/resources/assets/biomesoplenty/textures/blocks/grass_loamy_side_snowed.png new file mode 100644 index 000000000..2ed9923b4 Binary files /dev/null and b/src/main/resources/assets/biomesoplenty/textures/blocks/grass_loamy_side_snowed.png differ diff --git a/src/main/resources/assets/biomesoplenty/textures/blocks/grass_sandy_side.png b/src/main/resources/assets/biomesoplenty/textures/blocks/grass_sandy_side.png new file mode 100644 index 000000000..6c17c8fb1 Binary files /dev/null and b/src/main/resources/assets/biomesoplenty/textures/blocks/grass_sandy_side.png differ diff --git a/src/main/resources/assets/biomesoplenty/textures/blocks/grass_sandy_side_snowed.png b/src/main/resources/assets/biomesoplenty/textures/blocks/grass_sandy_side_snowed.png new file mode 100644 index 000000000..b43de2585 Binary files /dev/null and b/src/main/resources/assets/biomesoplenty/textures/blocks/grass_sandy_side_snowed.png differ diff --git a/src/main/resources/assets/biomesoplenty/textures/blocks/grass_side_overlay.png b/src/main/resources/assets/biomesoplenty/textures/blocks/grass_side_overlay.png new file mode 100644 index 000000000..fc3fa9d72 Binary files /dev/null and b/src/main/resources/assets/biomesoplenty/textures/blocks/grass_side_overlay.png differ diff --git a/src/main/resources/assets/biomesoplenty/textures/blocks/grass_silty_side.png b/src/main/resources/assets/biomesoplenty/textures/blocks/grass_silty_side.png new file mode 100644 index 000000000..5114d319b Binary files /dev/null and b/src/main/resources/assets/biomesoplenty/textures/blocks/grass_silty_side.png differ diff --git a/src/main/resources/assets/biomesoplenty/textures/blocks/grass_silty_side_snowed.png b/src/main/resources/assets/biomesoplenty/textures/blocks/grass_silty_side_snowed.png new file mode 100644 index 000000000..12f4edd9d Binary files /dev/null and b/src/main/resources/assets/biomesoplenty/textures/blocks/grass_silty_side_snowed.png differ diff --git a/src/main/resources/assets/biomesoplenty/textures/blocks/grass_top.png b/src/main/resources/assets/biomesoplenty/textures/blocks/grass_top.png new file mode 100644 index 000000000..eaa7e458f Binary files /dev/null and b/src/main/resources/assets/biomesoplenty/textures/blocks/grass_top.png differ diff --git a/src/main/resources/assets/biomesoplenty/textures/blocks/lily_medium.png b/src/main/resources/assets/biomesoplenty/textures/blocks/lily_medium.png new file mode 100644 index 000000000..759cd831d Binary files /dev/null and b/src/main/resources/assets/biomesoplenty/textures/blocks/lily_medium.png differ diff --git a/src/main/resources/assets/biomesoplenty/textures/blocks/lily_small.png b/src/main/resources/assets/biomesoplenty/textures/blocks/lily_small.png new file mode 100644 index 000000000..0beac97bf Binary files /dev/null and b/src/main/resources/assets/biomesoplenty/textures/blocks/lily_small.png differ diff --git a/src/main/resources/assets/biomesoplenty/textures/blocks/lily_tiny.png b/src/main/resources/assets/biomesoplenty/textures/blocks/lily_tiny.png new file mode 100644 index 000000000..f8ad4320d Binary files /dev/null and b/src/main/resources/assets/biomesoplenty/textures/blocks/lily_tiny.png differ