diff --git a/src/main/java/com/progwml6/natura/nether/block/saplings/BlockNetherSapling.java b/src/main/java/com/progwml6/natura/nether/block/saplings/BlockNetherSapling.java index 18f93640..38f31a1f 100644 --- a/src/main/java/com/progwml6/natura/nether/block/saplings/BlockNetherSapling.java +++ b/src/main/java/com/progwml6/natura/nether/block/saplings/BlockNetherSapling.java @@ -2,20 +2,8 @@ import java.util.Locale; import java.util.Random; - import javax.annotation.Nonnull; -import com.progwml6.natura.Natura; -import com.progwml6.natura.library.NaturaRegistry; -import com.progwml6.natura.nether.NaturaNether; -import com.progwml6.natura.nether.block.leaves.BlockNetherLeaves; -import com.progwml6.natura.nether.block.leaves.BlockNetherLeaves2; -import com.progwml6.natura.nether.block.logs.BlockNetherLog; -import com.progwml6.natura.world.worldgen.trees.BaseTreeGenerator; -import com.progwml6.natura.world.worldgen.trees.nether.DarkwoodTreeGenerator; -import com.progwml6.natura.world.worldgen.trees.nether.FusewoodTreeGenerator; -import com.progwml6.natura.world.worldgen.trees.nether.GhostwoodTreeGenerator; - import net.minecraft.block.Block; import net.minecraft.block.BlockSapling; import net.minecraft.block.SoundType; @@ -35,11 +23,22 @@ import net.minecraft.world.IBlockAccess; import net.minecraft.world.World; import net.minecraftforge.common.EnumPlantType; + +import com.progwml6.natura.Natura; +import com.progwml6.natura.library.NaturaRegistry; +import com.progwml6.natura.nether.NaturaNether; +import com.progwml6.natura.nether.block.leaves.BlockNetherLeaves; +import com.progwml6.natura.nether.block.leaves.BlockNetherLeaves2; +import com.progwml6.natura.nether.block.logs.BlockNetherLog; +import com.progwml6.natura.world.worldgen.trees.BaseTreeGenerator; +import com.progwml6.natura.world.worldgen.trees.nether.DarkwoodTreeGenerator; +import com.progwml6.natura.world.worldgen.trees.nether.FusewoodTreeGenerator; +import com.progwml6.natura.world.worldgen.trees.nether.GhostwoodTreeGenerator; import slimeknights.mantle.block.EnumBlock; public class BlockNetherSapling extends BlockSapling { - public static PropertyEnum FOLIAGE = PropertyEnum.create("foliage", SaplingType.class); + public static final PropertyEnum FOLIAGE = PropertyEnum.create("foliage", SaplingType.class); public BlockNetherSapling() { @@ -50,118 +49,58 @@ public BlockNetherSapling() } @Override - public void getSubBlocks(CreativeTabs tab, NonNullList list) - { - for (SaplingType type : SaplingType.values()) - { - list.add(new ItemStack(this, 1, this.getMetaFromState(this.getDefaultState().withProperty(FOLIAGE, type)))); - } - } - - @Nonnull - @Override - protected BlockStateContainer createBlockState() - { - // TYPE has to be included because of the BlockSapling constructor.. but it's never used. - return new BlockStateContainer(this, FOLIAGE, STAGE, TYPE); - } - - /** - * Convert the given metadata into a BlockState for this Block - */ - @Nonnull - @Override - public IBlockState getStateFromMeta(int meta) - { - if (meta < 0 || meta >= SaplingType.values().length) - { - meta = 0; - } - - SaplingType sapling = SaplingType.values()[meta]; - - return this.getDefaultState().withProperty(FOLIAGE, sapling); - } - - /** - * Convert the BlockState into the correct metadata value - */ - @Override - public int getMetaFromState(IBlockState state) - { - return state.getValue(FOLIAGE).ordinal(); - } - - @Override - public int damageDropped(IBlockState state) - { - return this.getMetaFromState(state); - } - - @Override - public boolean canPlaceBlockAt(World worldIn, BlockPos pos) + public boolean canPlaceBlockAt(World worldIn, @Nonnull BlockPos pos) { Block block = worldIn.getBlockState(pos).getBlock(); - if (block == null || block.isReplaceable(worldIn, pos)) + if (block.isReplaceable(worldIn, pos)) { IBlockState soilBlockState = worldIn.getBlockState(pos.down()); Block netherSoil = soilBlockState.getBlock(); - if (netherSoil != null) - { - if (this.canGrowOnBlock(netherSoil) || netherSoil.canSustainPlant(soilBlockState, worldIn, pos.down(), EnumFacing.UP, this)) - { - return true; - } - } + return this.canGrowOnBlock(netherSoil) || netherSoil.canSustainPlant(soilBlockState, worldIn, pos.down(), EnumFacing.UP, this); } return false; } @Override - public boolean canBlockStay(World worldIn, BlockPos pos, IBlockState state) + public boolean canBlockStay(@Nonnull World worldIn, @Nonnull BlockPos pos, IBlockState state) { switch (state.getValue(FOLIAGE)) { - case DARKWOOD: - case FUSEWOOD: - case GHOSTWOOD: - IBlockState soilBlockState = worldIn.getBlockState(pos.down()); - Block netherSoil = soilBlockState.getBlock(); - - if (netherSoil == null) - { - return false; - } - - return this.canGrowOnBlock(netherSoil) || netherSoil.canSustainPlant(soilBlockState, worldIn, pos.down(), EnumFacing.UP, this); - default: - return true; + case DARKWOOD: + case FUSEWOOD: + case GHOSTWOOD: + IBlockState soilBlockState = worldIn.getBlockState(pos.down()); + Block netherSoil = soilBlockState.getBlock(); + + return this.canGrowOnBlock(netherSoil) || netherSoil.canSustainPlant(soilBlockState, worldIn, pos.down(), EnumFacing.UP, this); + default: + return true; } } - public boolean canGrowOnBlock(Block block) - { - return block == Blocks.SOUL_SAND || block == Blocks.NETHERRACK || block == NaturaNether.netherTaintedSoil; - } - @Nonnull @Override - public EnumPlantType getPlantType(IBlockAccess world, BlockPos pos) + public EnumPlantType getPlantType(@Nonnull IBlockAccess world, @Nonnull BlockPos pos) { return EnumPlantType.Nether; } + public boolean canGrowOnBlock(Block block) + { + return block == Blocks.SOUL_SAND || block == Blocks.NETHERRACK || block == NaturaNether.netherTaintedSoil; + } + @Override - public boolean isReplaceable(IBlockAccess worldIn, @Nonnull BlockPos pos) + public boolean isReplaceable(@Nonnull IBlockAccess worldIn, @Nonnull BlockPos pos) { return false; } @Nonnull @Override - public ItemStack getPickBlock(@Nonnull IBlockState state, RayTraceResult target, @Nonnull World world, @Nonnull BlockPos pos, EntityPlayer player) + public ItemStack getPickBlock(@Nonnull IBlockState state, @Nonnull RayTraceResult target, @Nonnull World world, @Nonnull BlockPos pos, @Nonnull EntityPlayer player) { IBlockState iblockstate = world.getBlockState(pos); int meta = iblockstate.getBlock().getMetaFromState(iblockstate); @@ -186,32 +125,32 @@ public void generateTree(@Nonnull World worldIn, @Nonnull BlockPos pos, @Nonnull switch (state.getValue(FOLIAGE)) { - case DARKWOOD: - log = NaturaNether.netherLog.getDefaultState().withProperty(BlockNetherLog.TYPE, BlockNetherLog.LogType.DARKWOOD); - flowering = NaturaNether.netherLeaves2.getDefaultState().withProperty(BlockNetherLeaves2.TYPE, BlockNetherLeaves2.LeavesType.DARKWOOD_FLOWERING); - fruiting = NaturaNether.netherLeaves2.getDefaultState().withProperty(BlockNetherLeaves2.TYPE, BlockNetherLeaves2.LeavesType.DARKWOOD_FRUIT); - leaves = NaturaNether.netherLeaves2.getDefaultState().withProperty(BlockNetherLeaves2.TYPE, BlockNetherLeaves2.LeavesType.DARKWOOD); + case DARKWOOD: + log = NaturaNether.netherLog.getDefaultState().withProperty(BlockNetherLog.TYPE, BlockNetherLog.LogType.DARKWOOD); + flowering = NaturaNether.netherLeaves2.getDefaultState().withProperty(BlockNetherLeaves2.TYPE, BlockNetherLeaves2.LeavesType.DARKWOOD_FLOWERING); + fruiting = NaturaNether.netherLeaves2.getDefaultState().withProperty(BlockNetherLeaves2.TYPE, BlockNetherLeaves2.LeavesType.DARKWOOD_FRUIT); + leaves = NaturaNether.netherLeaves2.getDefaultState().withProperty(BlockNetherLeaves2.TYPE, BlockNetherLeaves2.LeavesType.DARKWOOD); - gen = new DarkwoodTreeGenerator(3, log, leaves, flowering, fruiting); + gen = new DarkwoodTreeGenerator(3, log, leaves, flowering, fruiting); - break; - case FUSEWOOD: - log = NaturaNether.netherLog.getDefaultState().withProperty(BlockNetherLog.TYPE, BlockNetherLog.LogType.FUSEWOOD); - leaves = NaturaNether.netherLeaves.getDefaultState().withProperty(BlockNetherLeaves.TYPE, BlockNetherLeaves.LeavesType.FUSEWOOD); + break; + case FUSEWOOD: + log = NaturaNether.netherLog.getDefaultState().withProperty(BlockNetherLog.TYPE, BlockNetherLog.LogType.FUSEWOOD); + leaves = NaturaNether.netherLeaves.getDefaultState().withProperty(BlockNetherLeaves.TYPE, BlockNetherLeaves.LeavesType.FUSEWOOD); - gen = new FusewoodTreeGenerator(3, log, leaves, false); + gen = new FusewoodTreeGenerator(3, log, leaves, false); - break; - case GHOSTWOOD: - log = NaturaNether.netherLog.getDefaultState().withProperty(BlockNetherLog.TYPE, BlockNetherLog.LogType.GHOSTWOOD); - leaves = NaturaNether.netherLeaves.getDefaultState().withProperty(BlockNetherLeaves.TYPE, BlockNetherLeaves.LeavesType.GHOSTWOOD); + break; + case GHOSTWOOD: + log = NaturaNether.netherLog.getDefaultState().withProperty(BlockNetherLog.TYPE, BlockNetherLog.LogType.GHOSTWOOD); + leaves = NaturaNether.netherLeaves.getDefaultState().withProperty(BlockNetherLeaves.TYPE, BlockNetherLeaves.LeavesType.GHOSTWOOD); - gen = new GhostwoodTreeGenerator(log, leaves, false); + gen = new GhostwoodTreeGenerator(log, leaves, false); - break; - default: - Natura.log.warn("BlockNetherSapling Warning: Invalid sapling meta/foliage, " + state.getValue(FOLIAGE) + ". Please report!"); - break; + break; + default: + Natura.log.warn("BlockNetherSapling Warning: Invalid sapling meta/foliage, " + state.getValue(FOLIAGE) + ". Please report!"); + break; } @@ -229,6 +168,55 @@ public void generateTree(@Nonnull World worldIn, @Nonnull BlockPos pos, @Nonnull } } + @Override + public int damageDropped(@Nonnull IBlockState state) + { + return this.getMetaFromState(state); + } + + @Override + public void getSubBlocks(@Nonnull CreativeTabs tab, @Nonnull NonNullList list) + { + for (SaplingType type : SaplingType.values()) + { + list.add(new ItemStack(this, 1, this.getMetaFromState(this.getDefaultState().withProperty(FOLIAGE, type)))); + } + } + + /** + * Convert the given metadata into a BlockState for this Block + */ + @Nonnull + @Override + public IBlockState getStateFromMeta(int meta) + { + if (meta < 0 || meta >= SaplingType.values().length) + { + meta = 0; + } + + SaplingType sapling = SaplingType.values()[meta]; + + return this.getDefaultState().withProperty(FOLIAGE, sapling); + } + + /** + * Convert the BlockState into the correct metadata value + */ + @Override + public int getMetaFromState(IBlockState state) + { + return state.getValue(FOLIAGE).ordinal(); + } + + @Nonnull + @Override + protected BlockStateContainer createBlockState() + { + // TYPE has to be included because of the BlockSapling constructor, but it's never used. + return new BlockStateContainer(this, FOLIAGE, STAGE, TYPE); + } + public enum SaplingType implements IStringSerializable, EnumBlock.IEnumMeta { GHOSTWOOD, FUSEWOOD, DARKWOOD; @@ -240,6 +228,7 @@ public enum SaplingType implements IStringSerializable, EnumBlock.IEnumMeta this.meta = this.ordinal(); } + @Nonnull @Override public String getName() { diff --git a/src/main/java/com/progwml6/natura/nether/block/saplings/BlockNetherSapling2.java b/src/main/java/com/progwml6/natura/nether/block/saplings/BlockNetherSapling2.java index fe6e3283..c960e0bf 100644 --- a/src/main/java/com/progwml6/natura/nether/block/saplings/BlockNetherSapling2.java +++ b/src/main/java/com/progwml6/natura/nether/block/saplings/BlockNetherSapling2.java @@ -2,17 +2,8 @@ import java.util.Locale; import java.util.Random; - import javax.annotation.Nonnull; -import com.progwml6.natura.Natura; -import com.progwml6.natura.library.NaturaRegistry; -import com.progwml6.natura.nether.NaturaNether; -import com.progwml6.natura.nether.block.leaves.BlockNetherLeaves; -import com.progwml6.natura.nether.block.logs.BlockNetherLog2; -import com.progwml6.natura.world.worldgen.trees.BaseTreeGenerator; -import com.progwml6.natura.world.worldgen.trees.nether.BloodwoodTreeGenerator; - import net.minecraft.block.Block; import net.minecraft.block.BlockSapling; import net.minecraft.block.SoundType; @@ -32,11 +23,19 @@ import net.minecraft.world.IBlockAccess; import net.minecraft.world.World; import net.minecraftforge.common.EnumPlantType; + +import com.progwml6.natura.Natura; +import com.progwml6.natura.library.NaturaRegistry; +import com.progwml6.natura.nether.NaturaNether; +import com.progwml6.natura.nether.block.leaves.BlockNetherLeaves; +import com.progwml6.natura.nether.block.logs.BlockNetherLog2; +import com.progwml6.natura.world.worldgen.trees.BaseTreeGenerator; +import com.progwml6.natura.world.worldgen.trees.nether.BloodwoodTreeGenerator; import slimeknights.mantle.block.EnumBlock; public class BlockNetherSapling2 extends BlockSapling { - public static PropertyEnum FOLIAGE = PropertyEnum.create("foliage", SaplingType.class); + public static final PropertyEnum FOLIAGE = PropertyEnum.create("foliage", SaplingType.class); public BlockNetherSapling2() { @@ -47,116 +46,54 @@ public BlockNetherSapling2() } @Override - public void getSubBlocks(CreativeTabs tab, NonNullList list) - { - for (SaplingType type : SaplingType.values()) - { - list.add(new ItemStack(this, 1, this.getMetaFromState(this.getDefaultState().withProperty(FOLIAGE, type)))); - } - } - - @Nonnull - @Override - protected BlockStateContainer createBlockState() - { - // TYPE has to be included because of the BlockSapling constructor.. but it's never used. - return new BlockStateContainer(this, FOLIAGE, STAGE, TYPE); - } - - /** - * Convert the given metadata into a BlockState for this Block - */ - @Nonnull - @Override - public IBlockState getStateFromMeta(int meta) - { - if (meta < 0 || meta >= SaplingType.values().length) - { - meta = 0; - } - - SaplingType sapling = SaplingType.values()[meta]; - - return this.getDefaultState().withProperty(FOLIAGE, sapling); - } - - /** - * Convert the BlockState into the correct metadata value - */ - @Override - public int getMetaFromState(IBlockState state) - { - return state.getValue(FOLIAGE).ordinal(); - } - - @Override - public int damageDropped(IBlockState state) - { - return this.getMetaFromState(state); - } - - @Override - public boolean canPlaceBlockAt(World worldIn, BlockPos pos) + public boolean canPlaceBlockAt(World worldIn, @Nonnull BlockPos pos) { Block block = worldIn.getBlockState(pos).getBlock(); - if (block == null || block.isReplaceable(worldIn, pos)) + if (block.isReplaceable(worldIn, pos)) { IBlockState ceilingBlockState = worldIn.getBlockState(pos.up()); Block netherCeiling = ceilingBlockState.getBlock(); - if (netherCeiling != null) - { - if (this.canGrowOnBlock(netherCeiling) || netherCeiling.canSustainPlant(ceilingBlockState, worldIn, pos.up(), EnumFacing.DOWN, this)) - { - return true; - } - } + return this.canGrowOnBlock(netherCeiling) || netherCeiling.canSustainPlant(ceilingBlockState, worldIn, pos.up(), EnumFacing.DOWN, this); } return false; } @Override - public boolean canBlockStay(World worldIn, BlockPos pos, IBlockState state) + public boolean canBlockStay(@Nonnull World worldIn, @Nonnull BlockPos pos, IBlockState state) { - switch (state.getValue(FOLIAGE)) + if (state.getValue(FOLIAGE) == SaplingType.BLOODWOOD) { - case BLOODWOOD: IBlockState ceilingBlockState = worldIn.getBlockState(pos.up()); Block netherCeiling = ceilingBlockState.getBlock(); - if (netherCeiling == null) - { - return false; - } - return this.canGrowOnBlock(netherCeiling) || netherCeiling.canSustainPlant(ceilingBlockState, worldIn, pos.up(), EnumFacing.DOWN, this); - default: - return true; } - } - - public boolean canGrowOnBlock(Block block) - { - return block == Blocks.SOUL_SAND || block == Blocks.NETHERRACK || block == NaturaNether.netherTaintedSoil; + return true; } @Nonnull @Override - public EnumPlantType getPlantType(IBlockAccess world, BlockPos pos) + public EnumPlantType getPlantType(@Nonnull IBlockAccess world, @Nonnull BlockPos pos) { return EnumPlantType.Nether; } + public boolean canGrowOnBlock(Block block) + { + return block == Blocks.SOUL_SAND || block == Blocks.NETHERRACK || block == NaturaNether.netherTaintedSoil; + } + @Override - public boolean isReplaceable(IBlockAccess worldIn, @Nonnull BlockPos pos) + public boolean isReplaceable(@Nonnull IBlockAccess worldIn, @Nonnull BlockPos pos) { return false; } @Nonnull @Override - public ItemStack getPickBlock(@Nonnull IBlockState state, RayTraceResult target, @Nonnull World world, @Nonnull BlockPos pos, EntityPlayer player) + public ItemStack getPickBlock(@Nonnull IBlockState state, @Nonnull RayTraceResult target, @Nonnull World world, @Nonnull BlockPos pos, @Nonnull EntityPlayer player) { IBlockState iblockstate = world.getBlockState(pos); int meta = iblockstate.getBlock().getMetaFromState(iblockstate); @@ -179,9 +116,8 @@ public void generateTree(@Nonnull World worldIn, @Nonnull BlockPos pos, @Nonnull IBlockState log5; IBlockState leaves; - switch (state.getValue(FOLIAGE)) + if (state.getValue(FOLIAGE) == SaplingType.BLOODWOOD) { - case BLOODWOOD: log = NaturaNether.netherLog2.getDefaultState().withProperty(BlockNetherLog2.META, 15); log2 = NaturaNether.netherLog2.getDefaultState().withProperty(BlockNetherLog2.META, 0); log3 = NaturaNether.netherLog2.getDefaultState().withProperty(BlockNetherLog2.META, 1); @@ -190,12 +126,10 @@ public void generateTree(@Nonnull World worldIn, @Nonnull BlockPos pos, @Nonnull leaves = NaturaNether.netherLeaves.getDefaultState().withProperty(BlockNetherLeaves.TYPE, BlockNetherLeaves.LeavesType.BLOODWOOD); gen = new BloodwoodTreeGenerator(log, log2, log3, log4, log5, leaves); - - break; - default: + } + else + { Natura.log.warn("BlockNetherSapling Warning: Invalid sapling meta/foliage, " + state.getValue(FOLIAGE) + ". Please report!"); - break; - } // replace sapling with air @@ -212,6 +146,55 @@ public void generateTree(@Nonnull World worldIn, @Nonnull BlockPos pos, @Nonnull } } + @Override + public int damageDropped(@Nonnull IBlockState state) + { + return this.getMetaFromState(state); + } + + @Override + public void getSubBlocks(@Nonnull CreativeTabs tab, @Nonnull NonNullList list) + { + for (SaplingType type : SaplingType.values()) + { + list.add(new ItemStack(this, 1, this.getMetaFromState(this.getDefaultState().withProperty(FOLIAGE, type)))); + } + } + + /** + * Convert the given metadata into a BlockState for this Block + */ + @Nonnull + @Override + public IBlockState getStateFromMeta(int meta) + { + if (meta < 0 || meta >= SaplingType.values().length) + { + meta = 0; + } + + SaplingType sapling = SaplingType.values()[meta]; + + return this.getDefaultState().withProperty(FOLIAGE, sapling); + } + + /** + * Convert the BlockState into the correct metadata value + */ + @Override + public int getMetaFromState(IBlockState state) + { + return state.getValue(FOLIAGE).ordinal(); + } + + @Nonnull + @Override + protected BlockStateContainer createBlockState() + { + // TYPE has to be included because of the BlockSapling constructor, but it's never used. + return new BlockStateContainer(this, FOLIAGE, STAGE, TYPE); + } + public enum SaplingType implements IStringSerializable, EnumBlock.IEnumMeta { BLOODWOOD; @@ -223,6 +206,7 @@ public enum SaplingType implements IStringSerializable, EnumBlock.IEnumMeta this.meta = this.ordinal(); } + @Nonnull @Override public String getName() { diff --git a/src/main/java/com/progwml6/natura/overworld/block/saplings/BlockAppleSapling.java b/src/main/java/com/progwml6/natura/overworld/block/saplings/BlockAppleSapling.java index 49107bf0..fd5de51c 100644 --- a/src/main/java/com/progwml6/natura/overworld/block/saplings/BlockAppleSapling.java +++ b/src/main/java/com/progwml6/natura/overworld/block/saplings/BlockAppleSapling.java @@ -45,20 +45,20 @@ public BlockAppleSapling() @Nonnull @Override - public EnumPlantType getPlantType(IBlockAccess world, BlockPos pos) + public EnumPlantType getPlantType(@Nonnull IBlockAccess world, @Nonnull BlockPos pos) { return EnumPlantType.Plains; } @Override - public boolean isReplaceable(IBlockAccess worldIn, @Nonnull BlockPos pos) + public boolean isReplaceable(@Nonnull IBlockAccess worldIn, @Nonnull BlockPos pos) { return false; } @Nonnull @Override - public ItemStack getPickBlock(@Nonnull IBlockState state, RayTraceResult target, @Nonnull World world, @Nonnull BlockPos pos, EntityPlayer player) + public ItemStack getPickBlock(@Nonnull IBlockState state, @Nonnull RayTraceResult target, @Nonnull World world, @Nonnull BlockPos pos, @Nonnull EntityPlayer player) { IBlockState iblockstate = world.getBlockState(pos); int meta = iblockstate.getBlock().getMetaFromState(iblockstate); @@ -110,13 +110,13 @@ public void generateTree(@Nonnull World worldIn, @Nonnull BlockPos pos, @Nonnull } @Override - public int damageDropped(IBlockState state) + public int damageDropped(@Nonnull IBlockState state) { return this.getMetaFromState(state); } @Override - public void getSubBlocks(CreativeTabs tab, NonNullList list) + public void getSubBlocks(@Nonnull CreativeTabs tab, @Nonnull NonNullList list) { for (SaplingType type : SaplingType.values()) { diff --git a/src/main/java/com/progwml6/natura/overworld/block/saplings/BlockOverworldSapling.java b/src/main/java/com/progwml6/natura/overworld/block/saplings/BlockOverworldSapling.java index 4e3409c4..a45e0aa1 100644 --- a/src/main/java/com/progwml6/natura/overworld/block/saplings/BlockOverworldSapling.java +++ b/src/main/java/com/progwml6/natura/overworld/block/saplings/BlockOverworldSapling.java @@ -2,16 +2,8 @@ import java.util.Locale; import java.util.Random; - import javax.annotation.Nonnull; -import com.progwml6.natura.Natura; -import com.progwml6.natura.library.NaturaRegistry; -import com.progwml6.natura.overworld.NaturaOverworld; -import com.progwml6.natura.overworld.block.logs.BlockOverworldLog; -import com.progwml6.natura.world.worldgen.trees.BaseTreeGenerator; -import com.progwml6.natura.world.worldgen.trees.overworld.OverworldTreeGenerator; - import net.minecraft.block.BlockSapling; import net.minecraft.block.SoundType; import net.minecraft.block.properties.PropertyEnum; @@ -28,11 +20,19 @@ import net.minecraft.world.IBlockAccess; import net.minecraft.world.World; import net.minecraftforge.common.EnumPlantType; +import net.minecraftforge.event.terraingen.TerrainGen; + +import com.progwml6.natura.Natura; +import com.progwml6.natura.library.NaturaRegistry; +import com.progwml6.natura.overworld.NaturaOverworld; +import com.progwml6.natura.overworld.block.logs.BlockOverworldLog; +import com.progwml6.natura.world.worldgen.trees.BaseTreeGenerator; +import com.progwml6.natura.world.worldgen.trees.overworld.OverworldTreeGenerator; import slimeknights.mantle.block.EnumBlock; public class BlockOverworldSapling extends BlockSapling { - public static PropertyEnum FOLIAGE = PropertyEnum.create("foliage", SaplingType.class); + public static final PropertyEnum FOLIAGE = PropertyEnum.create("foliage", SaplingType.class); public BlockOverworldSapling() { @@ -43,80 +43,31 @@ public BlockOverworldSapling() } @Override - public void getSubBlocks(CreativeTabs tab, NonNullList list) - { - for (SaplingType type : SaplingType.values()) - { - list.add(new ItemStack(this, 1, this.getMetaFromState(this.getDefaultState().withProperty(FOLIAGE, type)))); - } - } - - @Nonnull - @Override - protected BlockStateContainer createBlockState() - { - // TYPE has to be included because of the BlockSapling constructor.. but it's never used. - return new BlockStateContainer(this, FOLIAGE, STAGE, TYPE); - } - - /** - * Convert the given metadata into a BlockState for this Block - */ - @Nonnull - @Override - public IBlockState getStateFromMeta(int meta) - { - if (meta < 0 || meta >= SaplingType.values().length) - { - meta = 0; - } - - SaplingType sapling = SaplingType.values()[meta]; - - return this.getDefaultState().withProperty(FOLIAGE, sapling); - } - - /** - * Convert the BlockState into the correct metadata value - */ - @Override - public int getMetaFromState(IBlockState state) - { - return state.getValue(FOLIAGE).ordinal(); - } - - @Override - public int damageDropped(IBlockState state) - { - return this.getMetaFromState(state); - } - - @Override - public boolean isReplaceable(IBlockAccess worldIn, @Nonnull BlockPos pos) + public boolean isReplaceable(@Nonnull IBlockAccess worldIn, @Nonnull BlockPos pos) { return false; } @Nonnull @Override - public EnumPlantType getPlantType(IBlockAccess world, BlockPos pos) + public ItemStack getPickBlock(@Nonnull IBlockState state, @Nonnull RayTraceResult target, @Nonnull World world, @Nonnull BlockPos pos, @Nonnull EntityPlayer player) { - return EnumPlantType.Plains; + IBlockState iblockstate = world.getBlockState(pos); + int meta = iblockstate.getBlock().getMetaFromState(iblockstate); + return new ItemStack(Item.getItemFromBlock(this), 1, meta); } @Nonnull @Override - public ItemStack getPickBlock(@Nonnull IBlockState state, RayTraceResult target, @Nonnull World world, @Nonnull BlockPos pos, EntityPlayer player) + public EnumPlantType getPlantType(@Nonnull IBlockAccess world, @Nonnull BlockPos pos) { - IBlockState iblockstate = world.getBlockState(pos); - int meta = iblockstate.getBlock().getMetaFromState(iblockstate); - return new ItemStack(Item.getItemFromBlock(this), 1, meta); + return EnumPlantType.Plains; } @Override public void generateTree(@Nonnull World worldIn, @Nonnull BlockPos pos, @Nonnull IBlockState state, @Nonnull Random rand) { - if (!net.minecraftforge.event.terraingen.TerrainGen.saplingGrowTree(worldIn, rand, pos)) + if (!TerrainGen.saplingGrowTree(worldIn, rand, pos)) { return; } @@ -126,37 +77,37 @@ public void generateTree(@Nonnull World worldIn, @Nonnull BlockPos pos, @Nonnull switch (state.getValue(FOLIAGE)) { - case MAPLE: - log = NaturaOverworld.overworldLog.getDefaultState().withProperty(BlockOverworldLog.TYPE, BlockOverworldLog.LogType.MAPLE); - leaves = NaturaOverworld.overworldLeaves.getDefaultState().withProperty(BlockOverworldLog.TYPE, BlockOverworldLog.LogType.MAPLE); + case MAPLE: + log = NaturaOverworld.overworldLog.getDefaultState().withProperty(BlockOverworldLog.TYPE, BlockOverworldLog.LogType.MAPLE); + leaves = NaturaOverworld.overworldLeaves.getDefaultState().withProperty(BlockOverworldLog.TYPE, BlockOverworldLog.LogType.MAPLE); - gen = new OverworldTreeGenerator(4, 2, log, leaves, true, true); + gen = new OverworldTreeGenerator(4, 2, log, leaves, true, true); - break; - case SILVERBELL: - log = NaturaOverworld.overworldLog.getDefaultState().withProperty(BlockOverworldLog.TYPE, BlockOverworldLog.LogType.SILVERBELL); - leaves = NaturaOverworld.overworldLeaves.getDefaultState().withProperty(BlockOverworldLog.TYPE, BlockOverworldLog.LogType.SILVERBELL); + break; + case SILVERBELL: + log = NaturaOverworld.overworldLog.getDefaultState().withProperty(BlockOverworldLog.TYPE, BlockOverworldLog.LogType.SILVERBELL); + leaves = NaturaOverworld.overworldLeaves.getDefaultState().withProperty(BlockOverworldLog.TYPE, BlockOverworldLog.LogType.SILVERBELL); - gen = new OverworldTreeGenerator(4, 2, log, leaves, true, true); + gen = new OverworldTreeGenerator(4, 2, log, leaves, true, true); - break; - case AMARANTH: - log = NaturaOverworld.overworldLog.getDefaultState().withProperty(BlockOverworldLog.TYPE, BlockOverworldLog.LogType.AMARANTH); - leaves = NaturaOverworld.overworldLeaves.getDefaultState().withProperty(BlockOverworldLog.TYPE, BlockOverworldLog.LogType.AMARANTH); + break; + case AMARANTH: + log = NaturaOverworld.overworldLog.getDefaultState().withProperty(BlockOverworldLog.TYPE, BlockOverworldLog.LogType.AMARANTH); + leaves = NaturaOverworld.overworldLeaves.getDefaultState().withProperty(BlockOverworldLog.TYPE, BlockOverworldLog.LogType.AMARANTH); - gen = new OverworldTreeGenerator(9, 8, log, leaves, true, true); + gen = new OverworldTreeGenerator(9, 8, log, leaves, true, true); - break; - case TIGER: - log = NaturaOverworld.overworldLog.getDefaultState().withProperty(BlockOverworldLog.TYPE, BlockOverworldLog.LogType.TIGER); - leaves = NaturaOverworld.overworldLeaves.getDefaultState().withProperty(BlockOverworldLog.TYPE, BlockOverworldLog.LogType.TIGER); + break; + case TIGER: + log = NaturaOverworld.overworldLog.getDefaultState().withProperty(BlockOverworldLog.TYPE, BlockOverworldLog.LogType.TIGER); + leaves = NaturaOverworld.overworldLeaves.getDefaultState().withProperty(BlockOverworldLog.TYPE, BlockOverworldLog.LogType.TIGER); - gen = new OverworldTreeGenerator(6, 4, log, leaves, true, true); + gen = new OverworldTreeGenerator(6, 4, log, leaves, true, true); - break; - default: - Natura.log.warn("BlockOverworldLog Warning: Invalid sapling meta/foliage, " + state.getValue(FOLIAGE) + ". Please report!"); - break; + break; + default: + Natura.log.warn("BlockOverworldLog Warning: Invalid sapling meta/foliage, " + state.getValue(FOLIAGE) + ". Please report!"); + break; } // replace sapling with air @@ -173,6 +124,55 @@ public void generateTree(@Nonnull World worldIn, @Nonnull BlockPos pos, @Nonnull } } + @Override + public int damageDropped(@Nonnull IBlockState state) + { + return this.getMetaFromState(state); + } + + @Override + public void getSubBlocks(@Nonnull CreativeTabs tab, @Nonnull NonNullList list) + { + for (SaplingType type : SaplingType.values()) + { + list.add(new ItemStack(this, 1, this.getMetaFromState(this.getDefaultState().withProperty(FOLIAGE, type)))); + } + } + + /** + * Convert the given metadata into a BlockState for this Block + */ + @Nonnull + @Override + public IBlockState getStateFromMeta(int meta) + { + if (meta < 0 || meta >= SaplingType.values().length) + { + meta = 0; + } + + SaplingType sapling = SaplingType.values()[meta]; + + return this.getDefaultState().withProperty(FOLIAGE, sapling); + } + + /** + * Convert the BlockState into the correct metadata value + */ + @Override + public int getMetaFromState(IBlockState state) + { + return state.getValue(FOLIAGE).ordinal(); + } + + @Nonnull + @Override + protected BlockStateContainer createBlockState() + { + // TYPE has to be included because of the BlockSapling constructor, but it's never used. + return new BlockStateContainer(this, FOLIAGE, STAGE, TYPE); + } + public enum SaplingType implements IStringSerializable, EnumBlock.IEnumMeta { MAPLE, SILVERBELL, AMARANTH, TIGER; @@ -184,6 +184,7 @@ public enum SaplingType implements IStringSerializable, EnumBlock.IEnumMeta this.meta = this.ordinal(); } + @Nonnull @Override public String getName() { diff --git a/src/main/java/com/progwml6/natura/overworld/block/saplings/BlockOverworldSapling2.java b/src/main/java/com/progwml6/natura/overworld/block/saplings/BlockOverworldSapling2.java index 5f1363f5..0b3432b6 100644 --- a/src/main/java/com/progwml6/natura/overworld/block/saplings/BlockOverworldSapling2.java +++ b/src/main/java/com/progwml6/natura/overworld/block/saplings/BlockOverworldSapling2.java @@ -2,19 +2,8 @@ import java.util.Locale; import java.util.Random; - import javax.annotation.Nonnull; -import com.progwml6.natura.Natura; -import com.progwml6.natura.library.NaturaRegistry; -import com.progwml6.natura.overworld.NaturaOverworld; -import com.progwml6.natura.overworld.block.logs.BlockOverworldLog2; -import com.progwml6.natura.world.worldgen.trees.BaseTreeGenerator; -import com.progwml6.natura.world.worldgen.trees.overworld.EucalyptusTreeGenerator; -import com.progwml6.natura.world.worldgen.trees.overworld.HopseedTreeGenerator; -import com.progwml6.natura.world.worldgen.trees.overworld.SakuraTreeGenerator; -import com.progwml6.natura.world.worldgen.trees.overworld.WillowTreeGenerator; - import net.minecraft.block.BlockSapling; import net.minecraft.block.SoundType; import net.minecraft.block.properties.PropertyEnum; @@ -31,11 +20,21 @@ import net.minecraft.world.IBlockAccess; import net.minecraft.world.World; import net.minecraftforge.common.EnumPlantType; + +import com.progwml6.natura.Natura; +import com.progwml6.natura.library.NaturaRegistry; +import com.progwml6.natura.overworld.NaturaOverworld; +import com.progwml6.natura.overworld.block.logs.BlockOverworldLog2; +import com.progwml6.natura.world.worldgen.trees.BaseTreeGenerator; +import com.progwml6.natura.world.worldgen.trees.overworld.EucalyptusTreeGenerator; +import com.progwml6.natura.world.worldgen.trees.overworld.HopseedTreeGenerator; +import com.progwml6.natura.world.worldgen.trees.overworld.SakuraTreeGenerator; +import com.progwml6.natura.world.worldgen.trees.overworld.WillowTreeGenerator; import slimeknights.mantle.block.EnumBlock; public class BlockOverworldSapling2 extends BlockSapling { - public static PropertyEnum FOLIAGE = PropertyEnum.create("foliage", SaplingType.class); + public static final PropertyEnum FOLIAGE = PropertyEnum.create("foliage", SaplingType.class); public BlockOverworldSapling2() { @@ -46,74 +45,25 @@ public BlockOverworldSapling2() } @Override - public void getSubBlocks(CreativeTabs tab, NonNullList list) - { - for (SaplingType type : SaplingType.values()) - { - list.add(new ItemStack(this, 1, this.getMetaFromState(this.getDefaultState().withProperty(FOLIAGE, type)))); - } - } - - @Nonnull - @Override - protected BlockStateContainer createBlockState() - { - // TYPE has to be included because of the BlockSapling constructor.. but it's never used. - return new BlockStateContainer(this, FOLIAGE, STAGE, TYPE); - } - - /** - * Convert the given metadata into a BlockState for this Block - */ - @Nonnull - @Override - public IBlockState getStateFromMeta(int meta) - { - if (meta < 0 || meta >= SaplingType.values().length) - { - meta = 0; - } - - SaplingType sapling = SaplingType.values()[meta]; - - return this.getDefaultState().withProperty(FOLIAGE, sapling); - } - - /** - * Convert the BlockState into the correct metadata value - */ - @Override - public int getMetaFromState(IBlockState state) - { - return state.getValue(FOLIAGE).ordinal(); - } - - @Override - public int damageDropped(IBlockState state) - { - return this.getMetaFromState(state); - } - - @Override - public boolean isReplaceable(IBlockAccess worldIn, @Nonnull BlockPos pos) + public boolean isReplaceable(@Nonnull IBlockAccess worldIn, @Nonnull BlockPos pos) { return false; } @Nonnull @Override - public EnumPlantType getPlantType(IBlockAccess world, BlockPos pos) + public ItemStack getPickBlock(@Nonnull IBlockState state, @Nonnull RayTraceResult target, @Nonnull World world, @Nonnull BlockPos pos, @Nonnull EntityPlayer player) { - return EnumPlantType.Plains; + IBlockState iblockstate = world.getBlockState(pos); + int meta = iblockstate.getBlock().getMetaFromState(iblockstate); + return new ItemStack(Item.getItemFromBlock(this), 1, meta); } @Nonnull @Override - public ItemStack getPickBlock(@Nonnull IBlockState state, RayTraceResult target, @Nonnull World world, @Nonnull BlockPos pos, EntityPlayer player) + public EnumPlantType getPlantType(@Nonnull IBlockAccess world, @Nonnull BlockPos pos) { - IBlockState iblockstate = world.getBlockState(pos); - int meta = iblockstate.getBlock().getMetaFromState(iblockstate); - return new ItemStack(Item.getItemFromBlock(this), 1, meta); + return EnumPlantType.Plains; } @Override @@ -129,37 +79,37 @@ public void generateTree(@Nonnull World worldIn, @Nonnull BlockPos pos, @Nonnull switch (state.getValue(FOLIAGE)) { - case WILLOW: - log = NaturaOverworld.overworldLog2.getDefaultState().withProperty(BlockOverworldLog2.TYPE, BlockOverworldLog2.LogType.WILLOW); - leaves = NaturaOverworld.overworldLeaves2.getDefaultState().withProperty(BlockOverworldLog2.TYPE, BlockOverworldLog2.LogType.WILLOW); + case WILLOW: + log = NaturaOverworld.overworldLog2.getDefaultState().withProperty(BlockOverworldLog2.TYPE, BlockOverworldLog2.LogType.WILLOW); + leaves = NaturaOverworld.overworldLeaves2.getDefaultState().withProperty(BlockOverworldLog2.TYPE, BlockOverworldLog2.LogType.WILLOW); - gen = new WillowTreeGenerator(4, 5, log, leaves, true, true); + gen = new WillowTreeGenerator(4, 5, log, leaves, true, true); - break; - case EUCALYPTUS: - log = NaturaOverworld.overworldLog2.getDefaultState().withProperty(BlockOverworldLog2.TYPE, BlockOverworldLog2.LogType.EUCALYPTUS); - leaves = NaturaOverworld.overworldLeaves2.getDefaultState().withProperty(BlockOverworldLog2.TYPE, BlockOverworldLog2.LogType.EUCALYPTUS); + break; + case EUCALYPTUS: + log = NaturaOverworld.overworldLog2.getDefaultState().withProperty(BlockOverworldLog2.TYPE, BlockOverworldLog2.LogType.EUCALYPTUS); + leaves = NaturaOverworld.overworldLeaves2.getDefaultState().withProperty(BlockOverworldLog2.TYPE, BlockOverworldLog2.LogType.EUCALYPTUS); - gen = new EucalyptusTreeGenerator(6, 3, log, leaves); + gen = new EucalyptusTreeGenerator(6, 3, log, leaves); - break; - case HOPSEED: - log = NaturaOverworld.overworldLog2.getDefaultState().withProperty(BlockOverworldLog2.TYPE, BlockOverworldLog2.LogType.HOPSEED); - leaves = NaturaOverworld.overworldLeaves2.getDefaultState().withProperty(BlockOverworldLog2.TYPE, BlockOverworldLog2.LogType.HOPSEED); + break; + case HOPSEED: + log = NaturaOverworld.overworldLog2.getDefaultState().withProperty(BlockOverworldLog2.TYPE, BlockOverworldLog2.LogType.HOPSEED); + leaves = NaturaOverworld.overworldLeaves2.getDefaultState().withProperty(BlockOverworldLog2.TYPE, BlockOverworldLog2.LogType.HOPSEED); - gen = new HopseedTreeGenerator(2, 3, log, leaves, true, true); + gen = new HopseedTreeGenerator(2, 3, log, leaves, true, true); - break; - case SAKURA: - log = NaturaOverworld.overworldLog2.getDefaultState().withProperty(BlockOverworldLog2.TYPE, BlockOverworldLog2.LogType.SAKURA); - leaves = NaturaOverworld.overworldLeaves2.getDefaultState().withProperty(BlockOverworldLog2.TYPE, BlockOverworldLog2.LogType.SAKURA); + break; + case SAKURA: + log = NaturaOverworld.overworldLog2.getDefaultState().withProperty(BlockOverworldLog2.TYPE, BlockOverworldLog2.LogType.SAKURA); + leaves = NaturaOverworld.overworldLeaves2.getDefaultState().withProperty(BlockOverworldLog2.TYPE, BlockOverworldLog2.LogType.SAKURA); - gen = new SakuraTreeGenerator(log, leaves, false, true); + gen = new SakuraTreeGenerator(log, leaves, false, true); - break; - default: - Natura.log.warn("BlockOverworldLog2 Warning: Invalid sapling meta/foliage, " + state.getValue(FOLIAGE) + ". Please report!"); - break; + break; + default: + Natura.log.warn("BlockOverworldLog2 Warning: Invalid sapling meta/foliage, " + state.getValue(FOLIAGE) + ". Please report!"); + break; } // replace sapling with air @@ -176,6 +126,55 @@ public void generateTree(@Nonnull World worldIn, @Nonnull BlockPos pos, @Nonnull } } + @Override + public int damageDropped(@Nonnull IBlockState state) + { + return this.getMetaFromState(state); + } + + @Override + public void getSubBlocks(@Nonnull CreativeTabs tab, @Nonnull NonNullList list) + { + for (SaplingType type : SaplingType.values()) + { + list.add(new ItemStack(this, 1, this.getMetaFromState(this.getDefaultState().withProperty(FOLIAGE, type)))); + } + } + + /** + * Convert the given metadata into a BlockState for this Block + */ + @Nonnull + @Override + public IBlockState getStateFromMeta(int meta) + { + if (meta < 0 || meta >= SaplingType.values().length) + { + meta = 0; + } + + SaplingType sapling = SaplingType.values()[meta]; + + return this.getDefaultState().withProperty(FOLIAGE, sapling); + } + + /** + * Convert the BlockState into the correct metadata value + */ + @Override + public int getMetaFromState(IBlockState state) + { + return state.getValue(FOLIAGE).ordinal(); + } + + @Nonnull + @Override + protected BlockStateContainer createBlockState() + { + // TYPE has to be included because of the BlockSapling constructor, but it's never used. + return new BlockStateContainer(this, FOLIAGE, STAGE, TYPE); + } + public enum SaplingType implements IStringSerializable, EnumBlock.IEnumMeta { WILLOW, EUCALYPTUS, HOPSEED, SAKURA; @@ -187,6 +186,7 @@ public enum SaplingType implements IStringSerializable, EnumBlock.IEnumMeta this.meta = this.ordinal(); } + @Nonnull @Override public String getName() { diff --git a/src/main/java/com/progwml6/natura/overworld/block/saplings/BlockRedwoodSapling.java b/src/main/java/com/progwml6/natura/overworld/block/saplings/BlockRedwoodSapling.java index f480a3cb..018d3b8e 100644 --- a/src/main/java/com/progwml6/natura/overworld/block/saplings/BlockRedwoodSapling.java +++ b/src/main/java/com/progwml6/natura/overworld/block/saplings/BlockRedwoodSapling.java @@ -48,74 +48,25 @@ public BlockRedwoodSapling() } @Override - public void getSubBlocks(CreativeTabs tab, NonNullList list) - { - for (SaplingType type : SaplingType.values()) - { - list.add(new ItemStack(this, 1, this.getMetaFromState(this.getDefaultState().withProperty(FOLIAGE, type)))); - } - } - - @Nonnull - @Override - protected BlockStateContainer createBlockState() - { - // TYPE has to be included because of the BlockSapling constructor, but it's never used. - return new BlockStateContainer(this, FOLIAGE, STAGE, TYPE); - } - - /** - * Convert the given metadata into a BlockState for this Block - */ - @Nonnull - @Override - public IBlockState getStateFromMeta(int meta) - { - if (meta < 0 || meta >= SaplingType.values().length) - { - meta = 0; - } - - SaplingType sapling = SaplingType.values()[meta]; - - return this.getDefaultState().withProperty(FOLIAGE, sapling); - } - - /** - * Convert the BlockState into the correct metadata value - */ - @Override - public int getMetaFromState(IBlockState state) - { - return state.getValue(FOLIAGE).ordinal(); - } - - @Override - public int damageDropped(IBlockState state) - { - return this.getMetaFromState(state); - } - - @Override - public boolean isReplaceable(IBlockAccess worldIn, @Nonnull BlockPos pos) + public boolean isReplaceable(@Nonnull IBlockAccess worldIn, @Nonnull BlockPos pos) { return false; } @Nonnull @Override - public EnumPlantType getPlantType(IBlockAccess world, BlockPos pos) + public ItemStack getPickBlock(@Nonnull IBlockState state, @Nonnull RayTraceResult target, @Nonnull World world, @Nonnull BlockPos pos, @Nonnull EntityPlayer player) { - return EnumPlantType.Plains; + IBlockState iblockstate = world.getBlockState(pos); + int meta = iblockstate.getBlock().getMetaFromState(iblockstate); + return new ItemStack(Item.getItemFromBlock(this), 1, meta); } @Nonnull @Override - public ItemStack getPickBlock(@Nonnull IBlockState state, RayTraceResult target, @Nonnull World world, @Nonnull BlockPos pos, EntityPlayer player) + public EnumPlantType getPlantType(@Nonnull IBlockAccess world, @Nonnull BlockPos pos) { - IBlockState iblockstate = world.getBlockState(pos); - int meta = iblockstate.getBlock().getMetaFromState(iblockstate); - return new ItemStack(Item.getItemFromBlock(this), 1, meta); + return EnumPlantType.Plains; } @Override @@ -165,17 +116,53 @@ public void generateTree(@Nonnull World worldIn, @Nonnull BlockPos pos, @Nonnull } } - private void replaceAirWithBlocks(World worldIn, IBlockState state) + @Override + public int damageDropped(@Nonnull IBlockState state) { - for (BlockPos pos : redwoodSaplingPositions) + return this.getMetaFromState(state); + } + + @Override + public void getSubBlocks(@Nonnull CreativeTabs tab, @Nonnull NonNullList list) + { + for (SaplingType type : SaplingType.values()) { - if (worldIn.isAirBlock(pos)) - { - worldIn.setBlockState(pos, state, 4); - } + list.add(new ItemStack(this, 1, this.getMetaFromState(this.getDefaultState().withProperty(FOLIAGE, type)))); } + } - redwoodSaplingPositions.clear(); + /** + * Convert the given metadata into a BlockState for this Block + */ + @Nonnull + @Override + public IBlockState getStateFromMeta(int meta) + { + if (meta < 0 || meta >= SaplingType.values().length) + { + meta = 0; + } + + SaplingType sapling = SaplingType.values()[meta]; + + return this.getDefaultState().withProperty(FOLIAGE, sapling); + } + + /** + * Convert the BlockState into the correct metadata value + */ + @Override + public int getMetaFromState(IBlockState state) + { + return state.getValue(FOLIAGE).ordinal(); + } + + @Nonnull + @Override + protected BlockStateContainer createBlockState() + { + // TYPE has to be included because of the BlockSapling constructor, but it's never used. + return new BlockStateContainer(this, FOLIAGE, STAGE, TYPE); } /** @@ -226,6 +213,19 @@ public void replaceBlocksWithAir(World worldIn, BlockPos pos) } } + private void replaceAirWithBlocks(World worldIn, IBlockState state) + { + for (BlockPos pos : redwoodSaplingPositions) + { + if (worldIn.isAirBlock(pos)) + { + worldIn.setBlockState(pos, state, 4); + } + } + + redwoodSaplingPositions.clear(); + } + public enum SaplingType implements IStringSerializable, EnumBlock.IEnumMeta { REDWOOD;