diff --git a/src/minecraft/biomesoplenty/blocks/BlockBOPAppleLeaves.java b/src/minecraft/biomesoplenty/blocks/BlockBOPAppleLeaves.java index 17de21b6e..0e83cd620 100644 --- a/src/minecraft/biomesoplenty/blocks/BlockBOPAppleLeaves.java +++ b/src/minecraft/biomesoplenty/blocks/BlockBOPAppleLeaves.java @@ -145,4 +145,10 @@ public class BlockBOPAppleLeaves extends BlockLeavesBase implements IShearable { return true; } + + @Override + public boolean isLeaves(World world, int x, int y, int z) + { + return true; + } } diff --git a/src/minecraft/biomesoplenty/blocks/BlockBOPColorizedLeaves.java b/src/minecraft/biomesoplenty/blocks/BlockBOPColorizedLeaves.java index f73cce77c..82a2eed43 100644 --- a/src/minecraft/biomesoplenty/blocks/BlockBOPColorizedLeaves.java +++ b/src/minecraft/biomesoplenty/blocks/BlockBOPColorizedLeaves.java @@ -155,4 +155,10 @@ public class BlockBOPColorizedLeaves extends BlockLeavesBase implements IShearab { return true; } + + @Override + public boolean isLeaves(World world, int x, int y, int z) + { + return true; + } } diff --git a/src/minecraft/biomesoplenty/blocks/BlockBOPLeaves.java b/src/minecraft/biomesoplenty/blocks/BlockBOPLeaves.java index 9ba6b1d76..d135b50c3 100644 --- a/src/minecraft/biomesoplenty/blocks/BlockBOPLeaves.java +++ b/src/minecraft/biomesoplenty/blocks/BlockBOPLeaves.java @@ -129,4 +129,10 @@ public class BlockBOPLeaves extends BlockLeavesBase implements IShearable { return true; } + + @Override + public boolean isLeaves(World world, int x, int y, int z) + { + return true; + } } diff --git a/src/minecraft/biomesoplenty/helpers/BonemealUse.java b/src/minecraft/biomesoplenty/helpers/BonemealUse.java index d10cd6ee0..c169ca07a 100644 --- a/src/minecraft/biomesoplenty/helpers/BonemealUse.java +++ b/src/minecraft/biomesoplenty/helpers/BonemealUse.java @@ -5,6 +5,7 @@ import net.minecraftforge.event.Event.Result; import net.minecraftforge.event.ForgeSubscribe; import net.minecraftforge.event.entity.player.BonemealEvent; import biomesoplenty.api.Blocks; +import biomesoplenty.blocks.BlockBOPColorizedSapling; import biomesoplenty.blocks.BlockBOPSapling; import biomesoplenty.worldgen.WorldGenGiantFlowerRed; import biomesoplenty.worldgen.WorldGenGiantFlowerYellow; @@ -15,57 +16,53 @@ public class BonemealUse @ForgeSubscribe public void onUseBonemeal(BonemealEvent event) { + int meta = event.world.getBlockMetadata(event.X, event.Y, event.Z); if (event.ID == Blocks.saplings.get().blockID) { event.setResult(Result.ALLOW); + if (!event.world.isRemote) + { + + switch (meta) + { + case 3: // Magic Sapling + if ((double)event.world.rand.nextFloat() < 0.10D) + ((BlockBOPSapling)Blocks.saplings.get()).growTree(event.world, event.X, event.Y, event.Z, event.world.rand); + break; + + case 7: // Holy Sapling + if ((double)event.world.rand.nextFloat() < 0.15D) + ((BlockBOPSapling)Blocks.saplings.get()).growTree(event.world, event.X, event.Y, event.Z, event.world.rand); + break; + + case 9: // Origin Sapling + ((BlockBOPSapling)Blocks.saplings.get()).growTree(event.world, event.X, event.Y, event.Z, event.world.rand); + break; + + default: + if ((double)event.world.rand.nextFloat() < 0.45D) + ((BlockBOPSapling)Blocks.saplings.get()).growTree(event.world, event.X, event.Y, event.Z, event.world.rand); + break; + } + + + } + } + else if (event.ID == Blocks.colorizedSaplings.get().blockID) + { + event.setResult(Result.ALLOW); + if (!event.world.isRemote) { if ((double)event.world.rand.nextFloat() < 0.45D) { - ((BlockBOPSapling)Blocks.saplings.get()).growTree(event.world, event.X, event.Y, event.Z, event.world.rand); + ((BlockBOPColorizedSapling)Blocks.colorizedSaplings.get()).growTree(event.world, event.X, event.Y, event.Z, event.world.rand); } } } - - if (event.ID == Blocks.saplings.get().blockID) // Origin - { - event.setResult(Result.ALLOW); - - if (!event.world.isRemote) - { - ((BlockBOPSapling)Blocks.saplings.get()).growTree(event.world, event.X, event.Y, event.Z, event.world.rand); - } - } - - if (event.ID == Blocks.saplings.get().blockID) // Holy - { - event.setResult(Result.ALLOW); - - if (!event.world.isRemote) - { - if ((double)event.world.rand.nextFloat() < 0.15D) - { - ((BlockBOPSapling)Blocks.saplings.get()).growTree(event.world, event.X, event.Y, event.Z, event.world.rand); - } - } - } - - if (event.ID == Blocks.saplings.get().blockID) // MAGIC - { - event.setResult(Result.ALLOW); - - if (!event.world.isRemote) - { - if ((double)event.world.rand.nextFloat() < 0.10D) - { - ((BlockBOPSapling)Blocks.saplings.get()).growTree(event.world, event.X, event.Y, event.Z, event.world.rand); - } - } - } - - if (event.ID == Block.plantRed.blockID) + else if (event.ID == Block.plantRed.blockID) { event.setResult(Result.ALLOW); @@ -78,8 +75,7 @@ public class BonemealUse } } } - - if (event.ID == Block.plantYellow.blockID) + else if (event.ID == Block.plantYellow.blockID) { event.setResult(Result.ALLOW); @@ -92,8 +88,7 @@ public class BonemealUse } } } - - if (event.ID == Blocks.holyGrass.get().blockID) + else if (event.ID == Blocks.holyGrass.get().blockID) { int var13 = event.X; int var14 = event.Y + 1; diff --git a/src/minecraft/biomesoplenty/items/ItemBOPLog.java b/src/minecraft/biomesoplenty/items/ItemBOPLog.java index 0b8feb844..2e637377b 100644 --- a/src/minecraft/biomesoplenty/items/ItemBOPLog.java +++ b/src/minecraft/biomesoplenty/items/ItemBOPLog.java @@ -24,6 +24,6 @@ public class ItemBOPLog extends ItemBlock public String getUnlocalizedName(ItemStack itemStack) { BlockBOPLog block = (BlockBOPLog)Block.blocksList[itemStack.itemID]; - return block.getWoodType(itemStack.getItemDamage()); + return block.getWoodType(itemStack.getItemDamage()) + "Wood"; } } diff --git a/src/minecraft/biomesoplenty/worldgen/WorldGenApple.java b/src/minecraft/biomesoplenty/worldgen/WorldGenApple.java index e3f143fd8..f44ea635a 100644 --- a/src/minecraft/biomesoplenty/worldgen/WorldGenApple.java +++ b/src/minecraft/biomesoplenty/worldgen/WorldGenApple.java @@ -19,7 +19,7 @@ public class WorldGenApple extends WorldGenerator public boolean generate(World par1World, Random par2Random, int par3, int par4, int par5) { int var6 = par2Random.nextInt(3) + 5; - boolean var7 = true; + boolean flag = true; if (par4 >= 1 && par4 + var6 + 1 <= 256) { @@ -43,28 +43,30 @@ public class WorldGenApple extends WorldGenerator var9 = 2; } - for (var10 = par3 - var9; var10 <= par3 + var9 && var7; ++var10) + for (var10 = par3 - var9; var10 <= par3 + var9 && flag; ++var10) { - for (var11 = par5 - var9; var11 <= par5 + var9 && var7; ++var11) + for (var11 = par5 - var9; var11 <= par5 + var9 && flag; ++var11) { if (var8 >= 0 && var8 < 256) { var12 = par1World.getBlockId(var10, var8, var11); + + Block block = Block.blocksList[var12]; - if (var12 != 0 && var12 != Blocks.leavesFruit.get().blockID) + if (var12 != 0 && (block != null && !block.isLeaves(par1World, var10, var8, var11))) { - var7 = false; + flag = false; } } else { - var7 = false; + flag = false; } } } } - if (!var7) + if (!flag) { return false; } @@ -110,8 +112,10 @@ public class WorldGenApple extends WorldGenerator for (var16 = 0; var16 < var6; ++var16) { var10 = par1World.getBlockId(par3, par4 + var16, par5); + + Block block = Block.blocksList[var10]; - if (var10 == 0 || var10 == Blocks.leavesFruit.get().blockID) + if (var10 == 0 || block == null || block.isLeaves(par1World, par3, par4 + var16, par5)) { this.setBlockAndMetadata(par1World, par3, par4 + var16, par5, Block.wood.blockID, 0); }