diff --git a/src/main/java/com/progwml6/natura/overworld/block/crops/BlockOverworldCrops.java b/src/main/java/com/progwml6/natura/overworld/block/crops/BlockOverworldCrops.java index e9c8cd02..227b5dcc 100644 --- a/src/main/java/com/progwml6/natura/overworld/block/crops/BlockOverworldCrops.java +++ b/src/main/java/com/progwml6/natura/overworld/block/crops/BlockOverworldCrops.java @@ -19,6 +19,7 @@ import net.minecraft.util.math.MathHelper; import net.minecraft.world.IBlockAccess; import net.minecraft.world.World; +import net.minecraftforge.common.ForgeHooks; public abstract class BlockOverworldCrops extends BlockBush implements IGrowable { @@ -79,9 +80,11 @@ public void updateTick(World worldIn, BlockPos pos, IBlockState state, Random ra { float f = getGrowthChance(this, worldIn, pos); - if (rand.nextInt((int) (25.0F / f) + 1) == 0) + if (ForgeHooks.onCropsGrowPre(worldIn, pos, state, rand.nextInt((int) (25.0F / f) + 1) == 0)) { worldIn.setBlockState(pos, this.withAge(i + 1), 2); + + ForgeHooks.onCropsGrowPost(worldIn, pos, state, worldIn.getBlockState(pos)); } } } 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 1bf07413..ec0e2052 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 @@ -151,7 +151,7 @@ public void generateTree(@Nonnull World worldIn, @Nonnull BlockPos pos, @Nonnull } // replace saplings with air - worldIn.setBlockToAir(pos); + this.replaceBlocksWithAir(worldIn, pos); // try generating gen.generateTree(rand, worldIn, pos); @@ -192,6 +192,23 @@ public boolean isRedwoodComplete(World worldIn, BlockPos pos, SaplingType type) return iblockstate.getBlock() == this && iblockstate.getValue(FOLIAGE) == type; } + /** + * Replaces redwood sapling's with air + */ + public void replaceBlocksWithAir(World worldIn, BlockPos pos) + { + for (int x = -3; x <= 3; x++) + { + for (int z = -3; z <= 3; z++) + { + if (this.isRedwoodComplete(worldIn, pos.add(x, 0, z), SaplingType.REDWOOD)) + { + worldIn.setBlockToAir(pos.add(x, 0, z)); + } + } + } + } + public enum SaplingType implements IStringSerializable, EnumBlock.IEnumMeta { REDWOOD;