From b35b71b0208eb45a28f183ace14dca04e2bfcef6 Mon Sep 17 00:00:00 2001 From: Adubbz Date: Tue, 2 Apr 2013 15:08:57 +1100 Subject: [PATCH] Holy Tall grass no longer drops itself without using shears Fixed things wrongly having wooden footstep sounds Saplings now use the new bonemeal system added by Minecraft 1.5 Bonemeal now creates Holy Tall Grass when used on Holy Grass Fixed slabs not stacking Fixed leaf decay (Except for apple trees, don't know what is going on with them) --- .../biomesop/blocks/BlockAcaciaLeaves.java | 2 +- .../biomesop/blocks/BlockAcaciaSlab.java | 44 +++++++ .../biomesop/blocks/BlockAppleLeaves.java | 4 +- .../blocks/BlockAppleLeavesFruitless.java | 2 +- .../biomesop/blocks/BlockAutumnLeaves.java | 2 +- .../biomesop/blocks/BlockBambooLeaves.java | 2 +- .../biomesop/blocks/BlockBlueLeaves.java | 2 +- .../biomesop/blocks/BlockCherrySlab.java | 44 +++++++ .../biomesop/blocks/BlockDarkLeaves.java | 2 +- .../biomesop/blocks/BlockDarkSlab.java | 44 +++++++ .../biomesop/blocks/BlockDeadLeaves.java | 2 +- .../biomesop/blocks/BlockFirLeaves.java | 2 +- .../biomesop/blocks/BlockFirSlab.java | 44 +++++++ .../biomesop/blocks/BlockHolyLeaves.java | 2 +- .../biomesop/blocks/BlockHolySlab.java | 44 +++++++ .../biomesop/blocks/BlockHolyTallGrass.java | 25 +++- .../biomesop/blocks/BlockMagicSlab.java | 44 +++++++ .../biomesop/blocks/BlockMangroveLeaves.java | 2 +- .../biomesop/blocks/BlockMangroveSlab.java | 44 +++++++ .../biomesop/blocks/BlockMudBrickSlab.java | 44 +++++++ .../biomesop/blocks/BlockOrangeLeaves.java | 2 +- .../biomesop/blocks/BlockPalmLeaves.java | 2 +- .../biomesop/blocks/BlockPalmSlab.java | 44 +++++++ .../biomesop/blocks/BlockPinkLeaves.java | 2 +- .../biomesop/blocks/BlockRedLeaves.java | 2 +- .../blocks/BlockRedRockBrickSlab.java | 44 +++++++ .../blocks/BlockRedRockCobbleSlab.java | 44 +++++++ .../biomesop/blocks/BlockRedwoodLeaves.java | 2 +- .../biomesop/blocks/BlockRedwoodSlab.java | 44 +++++++ .../biomesop/blocks/BlockWhiteLeaves.java | 2 +- .../biomesop/blocks/BlockWillowLeaves.java | 2 +- .../biomesop/blocks/BlockWillowSlab.java | 44 +++++++ .../biomesop/helpers/BonemealUse.java | 115 +++++++++++++++++- .../tdwp_ftw/biomesop/mod_BiomesOPlenty.java | 13 +- 34 files changed, 737 insertions(+), 26 deletions(-) diff --git a/src/minecraft/tdwp_ftw/biomesop/blocks/BlockAcaciaLeaves.java b/src/minecraft/tdwp_ftw/biomesop/blocks/BlockAcaciaLeaves.java index 0c104bd5d..725619d0a 100644 --- a/src/minecraft/tdwp_ftw/biomesop/blocks/BlockAcaciaLeaves.java +++ b/src/minecraft/tdwp_ftw/biomesop/blocks/BlockAcaciaLeaves.java @@ -247,7 +247,7 @@ public class BlockAcaciaLeaves extends BlockLeavesBase private void removeLeaves(World par1World, int par2, int par3, int par4) { this.dropBlockAsItem(par1World, par2, par3, par4, par1World.getBlockMetadata(par2, par3, par4), 0); - par1World.setBlock(par2, par3, par4, this.blockID, 0, 2); + par1World.setBlockToAir(par2, par3, par4); } /** diff --git a/src/minecraft/tdwp_ftw/biomesop/blocks/BlockAcaciaSlab.java b/src/minecraft/tdwp_ftw/biomesop/blocks/BlockAcaciaSlab.java index 63bf70e6c..0f0235068 100644 --- a/src/minecraft/tdwp_ftw/biomesop/blocks/BlockAcaciaSlab.java +++ b/src/minecraft/tdwp_ftw/biomesop/blocks/BlockAcaciaSlab.java @@ -10,6 +10,7 @@ import net.minecraft.block.BlockHalfSlab; import net.minecraft.block.material.Material; import net.minecraft.client.renderer.texture.IconRegister; import net.minecraft.creativetab.CreativeTabs; +import net.minecraft.entity.player.EntityPlayer; import net.minecraft.item.ItemStack; import net.minecraft.world.IBlockAccess; import net.minecraft.world.World; @@ -79,6 +80,49 @@ public class BlockAcaciaSlab extends BlockHalfSlab { return new ItemStack(mod_BiomesOPlenty.acaciaSingleSlab.blockID, 2, par1 & 7); } + + /** + * Called upon block activation (right click on the block.) + */ + public boolean onBlockActivated(World world, int par2, int par3, int par4, EntityPlayer par5EntityPlayer, int par6, float par7, float par8, float par9) + { + if (par5EntityPlayer.getCurrentEquippedItem().itemID == this.blockID) + { + + if (world.getBlockMetadata(par2, par3, par4) == 0 /*0 = Slab at bottom half*/ ) + { + if (par6 == 1 /*1 = top of the block*/) + { + if (!par5EntityPlayer.capabilities.isCreativeMode) + { + --par5EntityPlayer.getCurrentEquippedItem().stackSize; + } + + world.playSoundEffect((double)((float)par2 + 0.5F), (double)((float)par3 + 0.5F), (double)((float)par4 + 0.5F), this.stepSound.getPlaceSound(), (this.stepSound.getVolume() + 1.0F) / 2.0F, this.stepSound.getPitch() * 0.8F); + world.setBlock(par2, par3, par4, mod_BiomesOPlenty.acaciaDoubleSlab.blockID); + + return true; + } + } + + if (world.getBlockMetadata(par2, par3, par4) == 8 /*8 = Slab at top half*/ ) + { + if (par6 == 0 /*0 = bottom of the block*/) + { + if (!par5EntityPlayer.capabilities.isCreativeMode) + { + --par5EntityPlayer.getCurrentEquippedItem().stackSize; + } + + world.playSoundEffect((double)((float)par2 + 0.5F), (double)((float)par3 + 0.5F), (double)((float)par4 + 0.5F), this.stepSound.getPlaceSound(), (this.stepSound.getVolume() + 1.0F) / 2.0F, this.stepSound.getPitch() * 0.8F); + world.setBlock(par2, par3, par4, mod_BiomesOPlenty.acaciaDoubleSlab.blockID); + + return true; + } + } + } + return false; + } /** * Returns the slab block name with step type. diff --git a/src/minecraft/tdwp_ftw/biomesop/blocks/BlockAppleLeaves.java b/src/minecraft/tdwp_ftw/biomesop/blocks/BlockAppleLeaves.java index 9da1e5ed9..93cea9a07 100644 --- a/src/minecraft/tdwp_ftw/biomesop/blocks/BlockAppleLeaves.java +++ b/src/minecraft/tdwp_ftw/biomesop/blocks/BlockAppleLeaves.java @@ -1,5 +1,6 @@ package tdwp_ftw.biomesop.blocks; +import java.util.ArrayList; import java.util.Random; import tdwp_ftw.biomesop.mod_BiomesOPlenty; @@ -16,6 +17,7 @@ import net.minecraft.stats.StatList; import net.minecraft.util.Icon; import net.minecraft.world.IBlockAccess; import net.minecraft.world.World; +import net.minecraftforge.common.IShearable; public class BlockAppleLeaves extends BlockLeavesBase { @@ -207,7 +209,7 @@ public class BlockAppleLeaves extends BlockLeavesBase private void removeLeaves(World par1World, int par2, int par3, int par4) { this.dropBlockAsItem(par1World, par2, par3, par4, par1World.getBlockMetadata(par2, par3, par4), 0); - par1World.setBlock(par2, par3, par4, this.blockID, 0, 2); + par1World.setBlockToAir(par2, par3, par4); } /** diff --git a/src/minecraft/tdwp_ftw/biomesop/blocks/BlockAppleLeavesFruitless.java b/src/minecraft/tdwp_ftw/biomesop/blocks/BlockAppleLeavesFruitless.java index 969126c63..a6f87dc13 100644 --- a/src/minecraft/tdwp_ftw/biomesop/blocks/BlockAppleLeavesFruitless.java +++ b/src/minecraft/tdwp_ftw/biomesop/blocks/BlockAppleLeavesFruitless.java @@ -207,7 +207,7 @@ public class BlockAppleLeavesFruitless extends BlockLeavesBase private void removeLeaves(World par1World, int par2, int par3, int par4) { this.dropBlockAsItem(par1World, par2, par3, par4, par1World.getBlockMetadata(par2, par3, par4), 0); - par1World.setBlock(par2, par3, par4, this.blockID, 0, 2); + par1World.setBlockToAir(par2, par3, par4); } /** diff --git a/src/minecraft/tdwp_ftw/biomesop/blocks/BlockAutumnLeaves.java b/src/minecraft/tdwp_ftw/biomesop/blocks/BlockAutumnLeaves.java index 6c47452f1..ab078dd52 100644 --- a/src/minecraft/tdwp_ftw/biomesop/blocks/BlockAutumnLeaves.java +++ b/src/minecraft/tdwp_ftw/biomesop/blocks/BlockAutumnLeaves.java @@ -209,7 +209,7 @@ public class BlockAutumnLeaves extends BlockLeavesBase private void removeLeaves(World par1World, int par2, int par3, int par4) { this.dropBlockAsItem(par1World, par2, par3, par4, par1World.getBlockMetadata(par2, par3, par4), 0); - par1World.setBlock(par2, par3, par4, this.blockID, 0, 2); + par1World.setBlockToAir(par2, par3, par4); } /** diff --git a/src/minecraft/tdwp_ftw/biomesop/blocks/BlockBambooLeaves.java b/src/minecraft/tdwp_ftw/biomesop/blocks/BlockBambooLeaves.java index 2e2107c22..94932a84a 100644 --- a/src/minecraft/tdwp_ftw/biomesop/blocks/BlockBambooLeaves.java +++ b/src/minecraft/tdwp_ftw/biomesop/blocks/BlockBambooLeaves.java @@ -210,7 +210,7 @@ public class BlockBambooLeaves extends BlockLeavesBase private void removeLeaves(World par1World, int par2, int par3, int par4) { this.dropBlockAsItem(par1World, par2, par3, par4, par1World.getBlockMetadata(par2, par3, par4), 0); - par1World.setBlock(par2, par3, par4, 0); + par1World.setBlockToAir(par2, par3, par4); } /** diff --git a/src/minecraft/tdwp_ftw/biomesop/blocks/BlockBlueLeaves.java b/src/minecraft/tdwp_ftw/biomesop/blocks/BlockBlueLeaves.java index b98f269fe..81dd8f4ac 100644 --- a/src/minecraft/tdwp_ftw/biomesop/blocks/BlockBlueLeaves.java +++ b/src/minecraft/tdwp_ftw/biomesop/blocks/BlockBlueLeaves.java @@ -205,7 +205,7 @@ public class BlockBlueLeaves extends BlockLeavesBase private void removeLeaves(World par1World, int par2, int par3, int par4) { this.dropBlockAsItem(par1World, par2, par3, par4, par1World.getBlockMetadata(par2, par3, par4), 0); - par1World.setBlock(par2, par3, par4, this.blockID, 0, 2); + par1World.setBlockToAir(par2, par3, par4); } /** diff --git a/src/minecraft/tdwp_ftw/biomesop/blocks/BlockCherrySlab.java b/src/minecraft/tdwp_ftw/biomesop/blocks/BlockCherrySlab.java index c6dc525d1..7277cdb47 100644 --- a/src/minecraft/tdwp_ftw/biomesop/blocks/BlockCherrySlab.java +++ b/src/minecraft/tdwp_ftw/biomesop/blocks/BlockCherrySlab.java @@ -9,6 +9,7 @@ import net.minecraft.block.BlockHalfSlab; import net.minecraft.block.material.Material; import net.minecraft.client.renderer.texture.IconRegister; import net.minecraft.creativetab.CreativeTabs; +import net.minecraft.entity.player.EntityPlayer; import net.minecraft.item.ItemStack; import net.minecraft.world.IBlockAccess; import net.minecraft.world.World; @@ -77,6 +78,49 @@ public class BlockCherrySlab extends BlockHalfSlab { return new ItemStack(mod_BiomesOPlenty.cherrySingleSlab.blockID, 2, par1 & 7); } + + /** + * Called upon block activation (right click on the block.) + */ + public boolean onBlockActivated(World world, int par2, int par3, int par4, EntityPlayer par5EntityPlayer, int par6, float par7, float par8, float par9) + { + if (par5EntityPlayer.getCurrentEquippedItem().itemID == this.blockID) + { + + if (world.getBlockMetadata(par2, par3, par4) == 0 /*0 = Slab at bottom half*/ ) + { + if (par6 == 1 /*1 = top of the block*/) + { + if (!par5EntityPlayer.capabilities.isCreativeMode) + { + --par5EntityPlayer.getCurrentEquippedItem().stackSize; + } + + world.playSoundEffect((double)((float)par2 + 0.5F), (double)((float)par3 + 0.5F), (double)((float)par4 + 0.5F), this.stepSound.getPlaceSound(), (this.stepSound.getVolume() + 1.0F) / 2.0F, this.stepSound.getPitch() * 0.8F); + world.setBlock(par2, par3, par4, mod_BiomesOPlenty.cherryDoubleSlab.blockID); + + return true; + } + } + + if (world.getBlockMetadata(par2, par3, par4) == 8 /*8 = Slab at top half*/ ) + { + if (par6 == 0 /*0 = bottom of the block*/) + { + if (!par5EntityPlayer.capabilities.isCreativeMode) + { + --par5EntityPlayer.getCurrentEquippedItem().stackSize; + } + + world.playSoundEffect((double)((float)par2 + 0.5F), (double)((float)par3 + 0.5F), (double)((float)par4 + 0.5F), this.stepSound.getPlaceSound(), (this.stepSound.getVolume() + 1.0F) / 2.0F, this.stepSound.getPitch() * 0.8F); + world.setBlock(par2, par3, par4, mod_BiomesOPlenty.cherryDoubleSlab.blockID); + + return true; + } + } + } + return false; + } /** * Returns the slab block name with step type. diff --git a/src/minecraft/tdwp_ftw/biomesop/blocks/BlockDarkLeaves.java b/src/minecraft/tdwp_ftw/biomesop/blocks/BlockDarkLeaves.java index 30b96cf04..d79c5c483 100644 --- a/src/minecraft/tdwp_ftw/biomesop/blocks/BlockDarkLeaves.java +++ b/src/minecraft/tdwp_ftw/biomesop/blocks/BlockDarkLeaves.java @@ -208,7 +208,7 @@ public class BlockDarkLeaves extends BlockLeavesBase private void removeLeaves(World par1World, int par2, int par3, int par4) { this.dropBlockAsItem(par1World, par2, par3, par4, par1World.getBlockMetadata(par2, par3, par4), 0); - par1World.setBlock(par2, par3, par4, this.blockID, 0, 2); + par1World.setBlockToAir(par2, par3, par4); } /** diff --git a/src/minecraft/tdwp_ftw/biomesop/blocks/BlockDarkSlab.java b/src/minecraft/tdwp_ftw/biomesop/blocks/BlockDarkSlab.java index 17335fd9f..4852c0eca 100644 --- a/src/minecraft/tdwp_ftw/biomesop/blocks/BlockDarkSlab.java +++ b/src/minecraft/tdwp_ftw/biomesop/blocks/BlockDarkSlab.java @@ -9,6 +9,7 @@ import net.minecraft.block.BlockHalfSlab; import net.minecraft.block.material.Material; import net.minecraft.client.renderer.texture.IconRegister; import net.minecraft.creativetab.CreativeTabs; +import net.minecraft.entity.player.EntityPlayer; import net.minecraft.item.ItemStack; import net.minecraft.world.IBlockAccess; import net.minecraft.world.World; @@ -77,6 +78,49 @@ public class BlockDarkSlab extends BlockHalfSlab { return new ItemStack(mod_BiomesOPlenty.darkSingleSlab.blockID, 2, par1 & 7); } + + /** + * Called upon block activation (right click on the block.) + */ + public boolean onBlockActivated(World world, int par2, int par3, int par4, EntityPlayer par5EntityPlayer, int par6, float par7, float par8, float par9) + { + if (par5EntityPlayer.getCurrentEquippedItem().itemID == this.blockID) + { + + if (world.getBlockMetadata(par2, par3, par4) == 0 /*0 = Slab at bottom half*/ ) + { + if (par6 == 1 /*1 = top of the block*/) + { + if (!par5EntityPlayer.capabilities.isCreativeMode) + { + --par5EntityPlayer.getCurrentEquippedItem().stackSize; + } + + world.playSoundEffect((double)((float)par2 + 0.5F), (double)((float)par3 + 0.5F), (double)((float)par4 + 0.5F), this.stepSound.getPlaceSound(), (this.stepSound.getVolume() + 1.0F) / 2.0F, this.stepSound.getPitch() * 0.8F); + world.setBlock(par2, par3, par4, mod_BiomesOPlenty.darkDoubleSlab.blockID); + + return true; + } + } + + if (world.getBlockMetadata(par2, par3, par4) == 8 /*8 = Slab at top half*/ ) + { + if (par6 == 0 /*0 = bottom of the block*/) + { + if (!par5EntityPlayer.capabilities.isCreativeMode) + { + --par5EntityPlayer.getCurrentEquippedItem().stackSize; + } + + world.playSoundEffect((double)((float)par2 + 0.5F), (double)((float)par3 + 0.5F), (double)((float)par4 + 0.5F), this.stepSound.getPlaceSound(), (this.stepSound.getVolume() + 1.0F) / 2.0F, this.stepSound.getPitch() * 0.8F); + world.setBlock(par2, par3, par4, mod_BiomesOPlenty.darkDoubleSlab.blockID); + + return true; + } + } + } + return false; + } /** * Returns the slab block name with step type. diff --git a/src/minecraft/tdwp_ftw/biomesop/blocks/BlockDeadLeaves.java b/src/minecraft/tdwp_ftw/biomesop/blocks/BlockDeadLeaves.java index bab50ffcb..ef8af7cd3 100644 --- a/src/minecraft/tdwp_ftw/biomesop/blocks/BlockDeadLeaves.java +++ b/src/minecraft/tdwp_ftw/biomesop/blocks/BlockDeadLeaves.java @@ -208,7 +208,7 @@ public class BlockDeadLeaves extends BlockLeavesBase private void removeLeaves(World par1World, int par2, int par3, int par4) { this.dropBlockAsItem(par1World, par2, par3, par4, par1World.getBlockMetadata(par2, par3, par4), 0); - par1World.setBlock(par2, par3, par4, this.blockID); + par1World.setBlockToAir(par2, par3, par4); } /** diff --git a/src/minecraft/tdwp_ftw/biomesop/blocks/BlockFirLeaves.java b/src/minecraft/tdwp_ftw/biomesop/blocks/BlockFirLeaves.java index e2125df4b..309785567 100644 --- a/src/minecraft/tdwp_ftw/biomesop/blocks/BlockFirLeaves.java +++ b/src/minecraft/tdwp_ftw/biomesop/blocks/BlockFirLeaves.java @@ -208,7 +208,7 @@ public class BlockFirLeaves extends BlockLeavesBase private void removeLeaves(World par1World, int par2, int par3, int par4) { this.dropBlockAsItem(par1World, par2, par3, par4, par1World.getBlockMetadata(par2, par3, par4), 0); - par1World.setBlock(par2, par3, par4, 0); + par1World.setBlockToAir(par2, par3, par4); } /** diff --git a/src/minecraft/tdwp_ftw/biomesop/blocks/BlockFirSlab.java b/src/minecraft/tdwp_ftw/biomesop/blocks/BlockFirSlab.java index ba4cb138d..d1ab7c232 100644 --- a/src/minecraft/tdwp_ftw/biomesop/blocks/BlockFirSlab.java +++ b/src/minecraft/tdwp_ftw/biomesop/blocks/BlockFirSlab.java @@ -9,6 +9,7 @@ import net.minecraft.block.BlockHalfSlab; import net.minecraft.block.material.Material; import net.minecraft.client.renderer.texture.IconRegister; import net.minecraft.creativetab.CreativeTabs; +import net.minecraft.entity.player.EntityPlayer; import net.minecraft.item.ItemStack; import net.minecraft.world.IBlockAccess; import net.minecraft.world.World; @@ -79,6 +80,49 @@ public class BlockFirSlab extends BlockHalfSlab { return new ItemStack(mod_BiomesOPlenty.firSingleSlab.blockID, 2, par1 & 7); } + + /** + * Called upon block activation (right click on the block.) + */ + public boolean onBlockActivated(World world, int par2, int par3, int par4, EntityPlayer par5EntityPlayer, int par6, float par7, float par8, float par9) + { + if (par5EntityPlayer.getCurrentEquippedItem().itemID == this.blockID) + { + + if (world.getBlockMetadata(par2, par3, par4) == 0 /*0 = Slab at bottom half*/ ) + { + if (par6 == 1 /*1 = top of the block*/) + { + if (!par5EntityPlayer.capabilities.isCreativeMode) + { + --par5EntityPlayer.getCurrentEquippedItem().stackSize; + } + + world.playSoundEffect((double)((float)par2 + 0.5F), (double)((float)par3 + 0.5F), (double)((float)par4 + 0.5F), this.stepSound.getPlaceSound(), (this.stepSound.getVolume() + 1.0F) / 2.0F, this.stepSound.getPitch() * 0.8F); + world.setBlock(par2, par3, par4, mod_BiomesOPlenty.firDoubleSlab.blockID); + + return true; + } + } + + if (world.getBlockMetadata(par2, par3, par4) == 8 /*8 = Slab at top half*/ ) + { + if (par6 == 0 /*0 = bottom of the block*/) + { + if (!par5EntityPlayer.capabilities.isCreativeMode) + { + --par5EntityPlayer.getCurrentEquippedItem().stackSize; + } + + world.playSoundEffect((double)((float)par2 + 0.5F), (double)((float)par3 + 0.5F), (double)((float)par4 + 0.5F), this.stepSound.getPlaceSound(), (this.stepSound.getVolume() + 1.0F) / 2.0F, this.stepSound.getPitch() * 0.8F); + world.setBlock(par2, par3, par4, mod_BiomesOPlenty.firDoubleSlab.blockID); + + return true; + } + } + } + return false; + } /** * Returns the slab block name with step type. diff --git a/src/minecraft/tdwp_ftw/biomesop/blocks/BlockHolyLeaves.java b/src/minecraft/tdwp_ftw/biomesop/blocks/BlockHolyLeaves.java index 14e53a9e8..bedbfe0bb 100644 --- a/src/minecraft/tdwp_ftw/biomesop/blocks/BlockHolyLeaves.java +++ b/src/minecraft/tdwp_ftw/biomesop/blocks/BlockHolyLeaves.java @@ -208,7 +208,7 @@ public class BlockHolyLeaves extends BlockLeavesBase private void removeLeaves(World par1World, int par2, int par3, int par4) { this.dropBlockAsItem(par1World, par2, par3, par4, par1World.getBlockMetadata(par2, par3, par4), 0); - par1World.setBlock(par2, par3, par4, 0); + par1World.setBlockToAir(par2, par3, par4); } /** diff --git a/src/minecraft/tdwp_ftw/biomesop/blocks/BlockHolySlab.java b/src/minecraft/tdwp_ftw/biomesop/blocks/BlockHolySlab.java index ae4b8b193..2392de84f 100644 --- a/src/minecraft/tdwp_ftw/biomesop/blocks/BlockHolySlab.java +++ b/src/minecraft/tdwp_ftw/biomesop/blocks/BlockHolySlab.java @@ -9,6 +9,7 @@ import net.minecraft.block.BlockHalfSlab; import net.minecraft.block.material.Material; import net.minecraft.client.renderer.texture.IconRegister; import net.minecraft.creativetab.CreativeTabs; +import net.minecraft.entity.player.EntityPlayer; import net.minecraft.item.ItemStack; import net.minecraft.world.IBlockAccess; import net.minecraft.world.World; @@ -77,6 +78,49 @@ public class BlockHolySlab extends BlockHalfSlab { return new ItemStack(mod_BiomesOPlenty.holySingleSlab.blockID, 2, par1 & 7); } + + /** + * Called upon block activation (right click on the block.) + */ + public boolean onBlockActivated(World world, int par2, int par3, int par4, EntityPlayer par5EntityPlayer, int par6, float par7, float par8, float par9) + { + if (par5EntityPlayer.getCurrentEquippedItem().itemID == this.blockID) + { + + if (world.getBlockMetadata(par2, par3, par4) == 0 /*0 = Slab at bottom half*/ ) + { + if (par6 == 1 /*1 = top of the block*/) + { + if (!par5EntityPlayer.capabilities.isCreativeMode) + { + --par5EntityPlayer.getCurrentEquippedItem().stackSize; + } + + world.playSoundEffect((double)((float)par2 + 0.5F), (double)((float)par3 + 0.5F), (double)((float)par4 + 0.5F), this.stepSound.getPlaceSound(), (this.stepSound.getVolume() + 1.0F) / 2.0F, this.stepSound.getPitch() * 0.8F); + world.setBlock(par2, par3, par4, mod_BiomesOPlenty.holyDoubleSlab.blockID); + + return true; + } + } + + if (world.getBlockMetadata(par2, par3, par4) == 8 /*8 = Slab at top half*/ ) + { + if (par6 == 0 /*0 = bottom of the block*/) + { + if (!par5EntityPlayer.capabilities.isCreativeMode) + { + --par5EntityPlayer.getCurrentEquippedItem().stackSize; + } + + world.playSoundEffect((double)((float)par2 + 0.5F), (double)((float)par3 + 0.5F), (double)((float)par4 + 0.5F), this.stepSound.getPlaceSound(), (this.stepSound.getVolume() + 1.0F) / 2.0F, this.stepSound.getPitch() * 0.8F); + world.setBlock(par2, par3, par4, mod_BiomesOPlenty.holyDoubleSlab.blockID); + + return true; + } + } + } + return false; + } /** * Returns the slab block name with step type. diff --git a/src/minecraft/tdwp_ftw/biomesop/blocks/BlockHolyTallGrass.java b/src/minecraft/tdwp_ftw/biomesop/blocks/BlockHolyTallGrass.java index 793d7d1c8..b93225609 100644 --- a/src/minecraft/tdwp_ftw/biomesop/blocks/BlockHolyTallGrass.java +++ b/src/minecraft/tdwp_ftw/biomesop/blocks/BlockHolyTallGrass.java @@ -1,5 +1,6 @@ package tdwp_ftw.biomesop.blocks; +import java.util.ArrayList; import java.util.Random; import tdwp_ftw.biomesop.mod_BiomesOPlenty; @@ -7,10 +8,12 @@ import net.minecraft.block.Block; import net.minecraft.block.material.Material; import net.minecraft.client.renderer.texture.IconRegister; import net.minecraft.creativetab.CreativeTabs; +import net.minecraft.item.ItemStack; import net.minecraft.util.AxisAlignedBB; import net.minecraft.world.World; +import net.minecraftforge.common.IShearable; -public class BlockHolyTallGrass extends Block +public class BlockHolyTallGrass extends Block implements IShearable { protected BlockHolyTallGrass(int par1, Material par3Material) { @@ -32,6 +35,14 @@ public class BlockHolyTallGrass extends Block { this(par1, Material.plants); } + + /** + * Returns the ID of the items to drop on destruction. + */ + public int idDropped(int par1, Random par2Random, int par3) + { + return -1; + } /** * Checks to see if its valid to put this block at the specified coordinates. Args: world, x, y, z @@ -118,4 +129,16 @@ public class BlockHolyTallGrass extends Block { return 1; } + + public boolean isShearable(ItemStack item, World world, int x, int y, int z) + { + return true; + } + + public ArrayList onSheared(ItemStack item, World world, int x, int y, int z, int fortune) + { + ArrayList ret = new ArrayList(); + ret.add(new ItemStack(this, 1, world.getBlockMetadata(x, y, z))); + return ret; + } } diff --git a/src/minecraft/tdwp_ftw/biomesop/blocks/BlockMagicSlab.java b/src/minecraft/tdwp_ftw/biomesop/blocks/BlockMagicSlab.java index 15a3cae1f..6c42e1d0c 100644 --- a/src/minecraft/tdwp_ftw/biomesop/blocks/BlockMagicSlab.java +++ b/src/minecraft/tdwp_ftw/biomesop/blocks/BlockMagicSlab.java @@ -9,6 +9,7 @@ import net.minecraft.block.BlockHalfSlab; import net.minecraft.block.material.Material; import net.minecraft.client.renderer.texture.IconRegister; import net.minecraft.creativetab.CreativeTabs; +import net.minecraft.entity.player.EntityPlayer; import net.minecraft.item.ItemStack; import net.minecraft.world.IBlockAccess; import net.minecraft.world.World; @@ -76,6 +77,49 @@ public class BlockMagicSlab extends BlockHalfSlab { return new ItemStack(mod_BiomesOPlenty.magicSingleSlab.blockID, 2, par1 & 7); } + + /** + * Called upon block activation (right click on the block.) + */ + public boolean onBlockActivated(World world, int par2, int par3, int par4, EntityPlayer par5EntityPlayer, int par6, float par7, float par8, float par9) + { + if (par5EntityPlayer.getCurrentEquippedItem().itemID == this.blockID) + { + + if (world.getBlockMetadata(par2, par3, par4) == 0 /*0 = Slab at bottom half*/ ) + { + if (par6 == 1 /*1 = top of the block*/) + { + if (!par5EntityPlayer.capabilities.isCreativeMode) + { + --par5EntityPlayer.getCurrentEquippedItem().stackSize; + } + + world.playSoundEffect((double)((float)par2 + 0.5F), (double)((float)par3 + 0.5F), (double)((float)par4 + 0.5F), this.stepSound.getPlaceSound(), (this.stepSound.getVolume() + 1.0F) / 2.0F, this.stepSound.getPitch() * 0.8F); + world.setBlock(par2, par3, par4, mod_BiomesOPlenty.magicDoubleSlab.blockID); + + return true; + } + } + + if (world.getBlockMetadata(par2, par3, par4) == 8 /*8 = Slab at top half*/ ) + { + if (par6 == 0 /*0 = bottom of the block*/) + { + if (!par5EntityPlayer.capabilities.isCreativeMode) + { + --par5EntityPlayer.getCurrentEquippedItem().stackSize; + } + + world.playSoundEffect((double)((float)par2 + 0.5F), (double)((float)par3 + 0.5F), (double)((float)par4 + 0.5F), this.stepSound.getPlaceSound(), (this.stepSound.getVolume() + 1.0F) / 2.0F, this.stepSound.getPitch() * 0.8F); + world.setBlock(par2, par3, par4, mod_BiomesOPlenty.magicDoubleSlab.blockID); + + return true; + } + } + } + return false; + } /** * Returns the slab block name with step type. diff --git a/src/minecraft/tdwp_ftw/biomesop/blocks/BlockMangroveLeaves.java b/src/minecraft/tdwp_ftw/biomesop/blocks/BlockMangroveLeaves.java index 027a45406..e49a23c9b 100644 --- a/src/minecraft/tdwp_ftw/biomesop/blocks/BlockMangroveLeaves.java +++ b/src/minecraft/tdwp_ftw/biomesop/blocks/BlockMangroveLeaves.java @@ -248,7 +248,7 @@ public class BlockMangroveLeaves extends BlockLeavesBase private void removeLeaves(World par1World, int par2, int par3, int par4) { this.dropBlockAsItem(par1World, par2, par3, par4, par1World.getBlockMetadata(par2, par3, par4), 0); - par1World.setBlock(par2, par3, par4, 0); + par1World.setBlockToAir(par2, par3, par4); } /** diff --git a/src/minecraft/tdwp_ftw/biomesop/blocks/BlockMangroveSlab.java b/src/minecraft/tdwp_ftw/biomesop/blocks/BlockMangroveSlab.java index 0111a6f0c..9fbb0435c 100644 --- a/src/minecraft/tdwp_ftw/biomesop/blocks/BlockMangroveSlab.java +++ b/src/minecraft/tdwp_ftw/biomesop/blocks/BlockMangroveSlab.java @@ -9,6 +9,7 @@ import net.minecraft.block.BlockHalfSlab; import net.minecraft.block.material.Material; import net.minecraft.client.renderer.texture.IconRegister; import net.minecraft.creativetab.CreativeTabs; +import net.minecraft.entity.player.EntityPlayer; import net.minecraft.item.ItemStack; import net.minecraft.world.IBlockAccess; import net.minecraft.world.World; @@ -77,6 +78,49 @@ public class BlockMangroveSlab extends BlockHalfSlab { return new ItemStack(mod_BiomesOPlenty.mangroveSingleSlab.blockID, 2, par1 & 7); } + + /** + * Called upon block activation (right click on the block.) + */ + public boolean onBlockActivated(World world, int par2, int par3, int par4, EntityPlayer par5EntityPlayer, int par6, float par7, float par8, float par9) + { + if (par5EntityPlayer.getCurrentEquippedItem().itemID == this.blockID) + { + + if (world.getBlockMetadata(par2, par3, par4) == 0 /*0 = Slab at bottom half*/ ) + { + if (par6 == 1 /*1 = top of the block*/) + { + if (!par5EntityPlayer.capabilities.isCreativeMode) + { + --par5EntityPlayer.getCurrentEquippedItem().stackSize; + } + + world.playSoundEffect((double)((float)par2 + 0.5F), (double)((float)par3 + 0.5F), (double)((float)par4 + 0.5F), this.stepSound.getPlaceSound(), (this.stepSound.getVolume() + 1.0F) / 2.0F, this.stepSound.getPitch() * 0.8F); + world.setBlock(par2, par3, par4, mod_BiomesOPlenty.mangroveDoubleSlab.blockID); + + return true; + } + } + + if (world.getBlockMetadata(par2, par3, par4) == 8 /*8 = Slab at top half*/ ) + { + if (par6 == 0 /*0 = bottom of the block*/) + { + if (!par5EntityPlayer.capabilities.isCreativeMode) + { + --par5EntityPlayer.getCurrentEquippedItem().stackSize; + } + + world.playSoundEffect((double)((float)par2 + 0.5F), (double)((float)par3 + 0.5F), (double)((float)par4 + 0.5F), this.stepSound.getPlaceSound(), (this.stepSound.getVolume() + 1.0F) / 2.0F, this.stepSound.getPitch() * 0.8F); + world.setBlock(par2, par3, par4, mod_BiomesOPlenty.mangroveDoubleSlab.blockID); + + return true; + } + } + } + return false; + } /** * Returns the slab block name with step type. diff --git a/src/minecraft/tdwp_ftw/biomesop/blocks/BlockMudBrickSlab.java b/src/minecraft/tdwp_ftw/biomesop/blocks/BlockMudBrickSlab.java index 19eb7c07d..5f37061fb 100644 --- a/src/minecraft/tdwp_ftw/biomesop/blocks/BlockMudBrickSlab.java +++ b/src/minecraft/tdwp_ftw/biomesop/blocks/BlockMudBrickSlab.java @@ -9,6 +9,7 @@ import net.minecraft.block.BlockHalfSlab; import net.minecraft.block.material.Material; import net.minecraft.client.renderer.texture.IconRegister; import net.minecraft.creativetab.CreativeTabs; +import net.minecraft.entity.player.EntityPlayer; import net.minecraft.item.ItemStack; import net.minecraft.world.IBlockAccess; import net.minecraft.world.World; @@ -76,6 +77,49 @@ public class BlockMudBrickSlab extends BlockHalfSlab { return new ItemStack(mod_BiomesOPlenty.mudBrickSingleSlab.blockID, 2, par1 & 7); } + + /** + * Called upon block activation (right click on the block.) + */ + public boolean onBlockActivated(World world, int par2, int par3, int par4, EntityPlayer par5EntityPlayer, int par6, float par7, float par8, float par9) + { + if (par5EntityPlayer.getCurrentEquippedItem().itemID == this.blockID) + { + + if (world.getBlockMetadata(par2, par3, par4) == 0 /*0 = Slab at bottom half*/ ) + { + if (par6 == 1 /*1 = top of the block*/) + { + if (!par5EntityPlayer.capabilities.isCreativeMode) + { + --par5EntityPlayer.getCurrentEquippedItem().stackSize; + } + + world.playSoundEffect((double)((float)par2 + 0.5F), (double)((float)par3 + 0.5F), (double)((float)par4 + 0.5F), this.stepSound.getPlaceSound(), (this.stepSound.getVolume() + 1.0F) / 2.0F, this.stepSound.getPitch() * 0.8F); + world.setBlock(par2, par3, par4, mod_BiomesOPlenty.mudBrickDoubleSlab.blockID); + + return true; + } + } + + if (world.getBlockMetadata(par2, par3, par4) == 8 /*8 = Slab at top half*/ ) + { + if (par6 == 0 /*0 = bottom of the block*/) + { + if (!par5EntityPlayer.capabilities.isCreativeMode) + { + --par5EntityPlayer.getCurrentEquippedItem().stackSize; + } + + world.playSoundEffect((double)((float)par2 + 0.5F), (double)((float)par3 + 0.5F), (double)((float)par4 + 0.5F), this.stepSound.getPlaceSound(), (this.stepSound.getVolume() + 1.0F) / 2.0F, this.stepSound.getPitch() * 0.8F); + world.setBlock(par2, par3, par4, mod_BiomesOPlenty.mudBrickDoubleSlab.blockID); + + return true; + } + } + } + return false; + } /** * Returns the slab block name with step type. diff --git a/src/minecraft/tdwp_ftw/biomesop/blocks/BlockOrangeLeaves.java b/src/minecraft/tdwp_ftw/biomesop/blocks/BlockOrangeLeaves.java index a12c9e9e6..cf11090ea 100644 --- a/src/minecraft/tdwp_ftw/biomesop/blocks/BlockOrangeLeaves.java +++ b/src/minecraft/tdwp_ftw/biomesop/blocks/BlockOrangeLeaves.java @@ -208,7 +208,7 @@ public class BlockOrangeLeaves extends BlockLeavesBase private void removeLeaves(World par1World, int par2, int par3, int par4) { this.dropBlockAsItem(par1World, par2, par3, par4, par1World.getBlockMetadata(par2, par3, par4), 0); - par1World.setBlock(par2, par3, par4, 0); + par1World.setBlockToAir(par2, par3, par4); } /** diff --git a/src/minecraft/tdwp_ftw/biomesop/blocks/BlockPalmLeaves.java b/src/minecraft/tdwp_ftw/biomesop/blocks/BlockPalmLeaves.java index 70a6d67f6..e39b189c1 100644 --- a/src/minecraft/tdwp_ftw/biomesop/blocks/BlockPalmLeaves.java +++ b/src/minecraft/tdwp_ftw/biomesop/blocks/BlockPalmLeaves.java @@ -248,7 +248,7 @@ public class BlockPalmLeaves extends BlockLeavesBase private void removeLeaves(World par1World, int par2, int par3, int par4) { this.dropBlockAsItem(par1World, par2, par3, par4, par1World.getBlockMetadata(par2, par3, par4), 0); - par1World.setBlock(par2, par3, par4, 0); + par1World.setBlockToAir(par2, par3, par4); } /** diff --git a/src/minecraft/tdwp_ftw/biomesop/blocks/BlockPalmSlab.java b/src/minecraft/tdwp_ftw/biomesop/blocks/BlockPalmSlab.java index 0fa4b6fb7..44dbebf0d 100644 --- a/src/minecraft/tdwp_ftw/biomesop/blocks/BlockPalmSlab.java +++ b/src/minecraft/tdwp_ftw/biomesop/blocks/BlockPalmSlab.java @@ -9,6 +9,7 @@ import net.minecraft.block.BlockHalfSlab; import net.minecraft.block.material.Material; import net.minecraft.client.renderer.texture.IconRegister; import net.minecraft.creativetab.CreativeTabs; +import net.minecraft.entity.player.EntityPlayer; import net.minecraft.item.ItemStack; import net.minecraft.world.IBlockAccess; import net.minecraft.world.World; @@ -77,6 +78,49 @@ public class BlockPalmSlab extends BlockHalfSlab { return new ItemStack(mod_BiomesOPlenty.palmSingleSlab.blockID, 2, par1 & 7); } + + /** + * Called upon block activation (right click on the block.) + */ + public boolean onBlockActivated(World world, int par2, int par3, int par4, EntityPlayer par5EntityPlayer, int par6, float par7, float par8, float par9) + { + if (par5EntityPlayer.getCurrentEquippedItem().itemID == this.blockID) + { + + if (world.getBlockMetadata(par2, par3, par4) == 0 /*0 = Slab at bottom half*/ ) + { + if (par6 == 1 /*1 = top of the block*/) + { + if (!par5EntityPlayer.capabilities.isCreativeMode) + { + --par5EntityPlayer.getCurrentEquippedItem().stackSize; + } + + world.playSoundEffect((double)((float)par2 + 0.5F), (double)((float)par3 + 0.5F), (double)((float)par4 + 0.5F), this.stepSound.getPlaceSound(), (this.stepSound.getVolume() + 1.0F) / 2.0F, this.stepSound.getPitch() * 0.8F); + world.setBlock(par2, par3, par4, mod_BiomesOPlenty.palmDoubleSlab.blockID); + + return true; + } + } + + if (world.getBlockMetadata(par2, par3, par4) == 8 /*8 = Slab at top half*/ ) + { + if (par6 == 0 /*0 = bottom of the block*/) + { + if (!par5EntityPlayer.capabilities.isCreativeMode) + { + --par5EntityPlayer.getCurrentEquippedItem().stackSize; + } + + world.playSoundEffect((double)((float)par2 + 0.5F), (double)((float)par3 + 0.5F), (double)((float)par4 + 0.5F), this.stepSound.getPlaceSound(), (this.stepSound.getVolume() + 1.0F) / 2.0F, this.stepSound.getPitch() * 0.8F); + world.setBlock(par2, par3, par4, mod_BiomesOPlenty.palmDoubleSlab.blockID); + + return true; + } + } + } + return false; + } /** * Returns the slab block name with step type. diff --git a/src/minecraft/tdwp_ftw/biomesop/blocks/BlockPinkLeaves.java b/src/minecraft/tdwp_ftw/biomesop/blocks/BlockPinkLeaves.java index f88f2d171..45d4927db 100644 --- a/src/minecraft/tdwp_ftw/biomesop/blocks/BlockPinkLeaves.java +++ b/src/minecraft/tdwp_ftw/biomesop/blocks/BlockPinkLeaves.java @@ -208,7 +208,7 @@ public class BlockPinkLeaves extends BlockLeavesBase private void removeLeaves(World par1World, int par2, int par3, int par4) { this.dropBlockAsItem(par1World, par2, par3, par4, par1World.getBlockMetadata(par2, par3, par4), 0); - par1World.setBlock(par2, par3, par4, 0); + par1World.setBlockToAir(par2, par3, par4); } /** diff --git a/src/minecraft/tdwp_ftw/biomesop/blocks/BlockRedLeaves.java b/src/minecraft/tdwp_ftw/biomesop/blocks/BlockRedLeaves.java index 96c42da57..7c54942af 100644 --- a/src/minecraft/tdwp_ftw/biomesop/blocks/BlockRedLeaves.java +++ b/src/minecraft/tdwp_ftw/biomesop/blocks/BlockRedLeaves.java @@ -208,7 +208,7 @@ public class BlockRedLeaves extends BlockLeavesBase private void removeLeaves(World par1World, int par2, int par3, int par4) { this.dropBlockAsItem(par1World, par2, par3, par4, par1World.getBlockMetadata(par2, par3, par4), 0); - par1World.setBlock(par2, par3, par4, 0); + par1World.setBlockToAir(par2, par3, par4); } /** diff --git a/src/minecraft/tdwp_ftw/biomesop/blocks/BlockRedRockBrickSlab.java b/src/minecraft/tdwp_ftw/biomesop/blocks/BlockRedRockBrickSlab.java index 2dfcd5247..ce63732fe 100644 --- a/src/minecraft/tdwp_ftw/biomesop/blocks/BlockRedRockBrickSlab.java +++ b/src/minecraft/tdwp_ftw/biomesop/blocks/BlockRedRockBrickSlab.java @@ -9,6 +9,7 @@ import net.minecraft.block.BlockHalfSlab; import net.minecraft.block.material.Material; import net.minecraft.client.renderer.texture.IconRegister; import net.minecraft.creativetab.CreativeTabs; +import net.minecraft.entity.player.EntityPlayer; import net.minecraft.item.ItemStack; import net.minecraft.world.IBlockAccess; import net.minecraft.world.World; @@ -76,6 +77,49 @@ public class BlockRedRockBrickSlab extends BlockHalfSlab { return new ItemStack(mod_BiomesOPlenty.redRockBrickSingleSlab.blockID, 2, par1 & 7); } + + /** + * Called upon block activation (right click on the block.) + */ + public boolean onBlockActivated(World world, int par2, int par3, int par4, EntityPlayer par5EntityPlayer, int par6, float par7, float par8, float par9) + { + if (par5EntityPlayer.getCurrentEquippedItem().itemID == this.blockID) + { + + if (world.getBlockMetadata(par2, par3, par4) == 0 /*0 = Slab at bottom half*/ ) + { + if (par6 == 1 /*1 = top of the block*/) + { + if (!par5EntityPlayer.capabilities.isCreativeMode) + { + --par5EntityPlayer.getCurrentEquippedItem().stackSize; + } + + world.playSoundEffect((double)((float)par2 + 0.5F), (double)((float)par3 + 0.5F), (double)((float)par4 + 0.5F), this.stepSound.getPlaceSound(), (this.stepSound.getVolume() + 1.0F) / 2.0F, this.stepSound.getPitch() * 0.8F); + world.setBlock(par2, par3, par4, mod_BiomesOPlenty.redRockBrickDoubleSlab.blockID); + + return true; + } + } + + if (world.getBlockMetadata(par2, par3, par4) == 8 /*8 = Slab at top half*/ ) + { + if (par6 == 0 /*0 = bottom of the block*/) + { + if (!par5EntityPlayer.capabilities.isCreativeMode) + { + --par5EntityPlayer.getCurrentEquippedItem().stackSize; + } + + world.playSoundEffect((double)((float)par2 + 0.5F), (double)((float)par3 + 0.5F), (double)((float)par4 + 0.5F), this.stepSound.getPlaceSound(), (this.stepSound.getVolume() + 1.0F) / 2.0F, this.stepSound.getPitch() * 0.8F); + world.setBlock(par2, par3, par4, mod_BiomesOPlenty.redRockBrickDoubleSlab.blockID); + + return true; + } + } + } + return false; + } /** * Returns the slab block name with step type. diff --git a/src/minecraft/tdwp_ftw/biomesop/blocks/BlockRedRockCobbleSlab.java b/src/minecraft/tdwp_ftw/biomesop/blocks/BlockRedRockCobbleSlab.java index 4d57859b0..4cd9482ba 100644 --- a/src/minecraft/tdwp_ftw/biomesop/blocks/BlockRedRockCobbleSlab.java +++ b/src/minecraft/tdwp_ftw/biomesop/blocks/BlockRedRockCobbleSlab.java @@ -9,6 +9,7 @@ import net.minecraft.block.BlockHalfSlab; import net.minecraft.block.material.Material; import net.minecraft.client.renderer.texture.IconRegister; import net.minecraft.creativetab.CreativeTabs; +import net.minecraft.entity.player.EntityPlayer; import net.minecraft.item.ItemStack; import net.minecraft.world.IBlockAccess; import net.minecraft.world.World; @@ -76,6 +77,49 @@ public class BlockRedRockCobbleSlab extends BlockHalfSlab { return new ItemStack(mod_BiomesOPlenty.redRockCobbleSingleSlab.blockID, 2, par1 & 7); } + + /** + * Called upon block activation (right click on the block.) + */ + public boolean onBlockActivated(World world, int par2, int par3, int par4, EntityPlayer par5EntityPlayer, int par6, float par7, float par8, float par9) + { + if (par5EntityPlayer.getCurrentEquippedItem().itemID == this.blockID) + { + + if (world.getBlockMetadata(par2, par3, par4) == 0 /*0 = Slab at bottom half*/ ) + { + if (par6 == 1 /*1 = top of the block*/) + { + if (!par5EntityPlayer.capabilities.isCreativeMode) + { + --par5EntityPlayer.getCurrentEquippedItem().stackSize; + } + + world.playSoundEffect((double)((float)par2 + 0.5F), (double)((float)par3 + 0.5F), (double)((float)par4 + 0.5F), this.stepSound.getPlaceSound(), (this.stepSound.getVolume() + 1.0F) / 2.0F, this.stepSound.getPitch() * 0.8F); + world.setBlock(par2, par3, par4, mod_BiomesOPlenty.redRockCobbleDoubleSlab.blockID); + + return true; + } + } + + if (world.getBlockMetadata(par2, par3, par4) == 8 /*8 = Slab at top half*/ ) + { + if (par6 == 0 /*0 = bottom of the block*/) + { + if (!par5EntityPlayer.capabilities.isCreativeMode) + { + --par5EntityPlayer.getCurrentEquippedItem().stackSize; + } + + world.playSoundEffect((double)((float)par2 + 0.5F), (double)((float)par3 + 0.5F), (double)((float)par4 + 0.5F), this.stepSound.getPlaceSound(), (this.stepSound.getVolume() + 1.0F) / 2.0F, this.stepSound.getPitch() * 0.8F); + world.setBlock(par2, par3, par4, mod_BiomesOPlenty.redRockCobbleDoubleSlab.blockID); + + return true; + } + } + } + return false; + } /** * Returns the slab block name with step type. diff --git a/src/minecraft/tdwp_ftw/biomesop/blocks/BlockRedwoodLeaves.java b/src/minecraft/tdwp_ftw/biomesop/blocks/BlockRedwoodLeaves.java index 30a7c6ce4..1ae4e18b5 100644 --- a/src/minecraft/tdwp_ftw/biomesop/blocks/BlockRedwoodLeaves.java +++ b/src/minecraft/tdwp_ftw/biomesop/blocks/BlockRedwoodLeaves.java @@ -248,7 +248,7 @@ public class BlockRedwoodLeaves extends BlockLeavesBase private void removeLeaves(World par1World, int par2, int par3, int par4) { this.dropBlockAsItem(par1World, par2, par3, par4, par1World.getBlockMetadata(par2, par3, par4), 0); - par1World.setBlock(par2, par3, par4, 0); + par1World.setBlockToAir(par2, par3, par4); } /** diff --git a/src/minecraft/tdwp_ftw/biomesop/blocks/BlockRedwoodSlab.java b/src/minecraft/tdwp_ftw/biomesop/blocks/BlockRedwoodSlab.java index eaf9c7c0f..66fdf40c7 100644 --- a/src/minecraft/tdwp_ftw/biomesop/blocks/BlockRedwoodSlab.java +++ b/src/minecraft/tdwp_ftw/biomesop/blocks/BlockRedwoodSlab.java @@ -9,6 +9,7 @@ import net.minecraft.block.BlockHalfSlab; import net.minecraft.block.material.Material; import net.minecraft.client.renderer.texture.IconRegister; import net.minecraft.creativetab.CreativeTabs; +import net.minecraft.entity.player.EntityPlayer; import net.minecraft.item.ItemStack; import net.minecraft.world.IBlockAccess; import net.minecraft.world.World; @@ -77,6 +78,49 @@ public class BlockRedwoodSlab extends BlockHalfSlab { return new ItemStack(mod_BiomesOPlenty.redwoodSingleSlab.blockID, 2, par1 & 7); } + + /** + * Called upon block activation (right click on the block.) + */ + public boolean onBlockActivated(World world, int par2, int par3, int par4, EntityPlayer par5EntityPlayer, int par6, float par7, float par8, float par9) + { + if (par5EntityPlayer.getCurrentEquippedItem().itemID == this.blockID) + { + + if (world.getBlockMetadata(par2, par3, par4) == 0 /*0 = Slab at bottom half*/ ) + { + if (par6 == 1 /*1 = top of the block*/) + { + if (!par5EntityPlayer.capabilities.isCreativeMode) + { + --par5EntityPlayer.getCurrentEquippedItem().stackSize; + } + + world.playSoundEffect((double)((float)par2 + 0.5F), (double)((float)par3 + 0.5F), (double)((float)par4 + 0.5F), this.stepSound.getPlaceSound(), (this.stepSound.getVolume() + 1.0F) / 2.0F, this.stepSound.getPitch() * 0.8F); + world.setBlock(par2, par3, par4, mod_BiomesOPlenty.redwoodDoubleSlab.blockID); + + return true; + } + } + + if (world.getBlockMetadata(par2, par3, par4) == 8 /*8 = Slab at top half*/ ) + { + if (par6 == 0 /*0 = bottom of the block*/) + { + if (!par5EntityPlayer.capabilities.isCreativeMode) + { + --par5EntityPlayer.getCurrentEquippedItem().stackSize; + } + + world.playSoundEffect((double)((float)par2 + 0.5F), (double)((float)par3 + 0.5F), (double)((float)par4 + 0.5F), this.stepSound.getPlaceSound(), (this.stepSound.getVolume() + 1.0F) / 2.0F, this.stepSound.getPitch() * 0.8F); + world.setBlock(par2, par3, par4, mod_BiomesOPlenty.redwoodDoubleSlab.blockID); + + return true; + } + } + } + return false; + } /** * Returns the slab block name with step type. diff --git a/src/minecraft/tdwp_ftw/biomesop/blocks/BlockWhiteLeaves.java b/src/minecraft/tdwp_ftw/biomesop/blocks/BlockWhiteLeaves.java index 51cdb2877..8c6622d11 100644 --- a/src/minecraft/tdwp_ftw/biomesop/blocks/BlockWhiteLeaves.java +++ b/src/minecraft/tdwp_ftw/biomesop/blocks/BlockWhiteLeaves.java @@ -208,7 +208,7 @@ public class BlockWhiteLeaves extends BlockLeavesBase private void removeLeaves(World par1World, int par2, int par3, int par4) { this.dropBlockAsItem(par1World, par2, par3, par4, par1World.getBlockMetadata(par2, par3, par4), 0); - par1World.setBlock(par2, par3, par4, 0); + par1World.setBlockToAir(par2, par3, par4); } /** diff --git a/src/minecraft/tdwp_ftw/biomesop/blocks/BlockWillowLeaves.java b/src/minecraft/tdwp_ftw/biomesop/blocks/BlockWillowLeaves.java index fdcbb072f..3497d5341 100644 --- a/src/minecraft/tdwp_ftw/biomesop/blocks/BlockWillowLeaves.java +++ b/src/minecraft/tdwp_ftw/biomesop/blocks/BlockWillowLeaves.java @@ -248,7 +248,7 @@ public class BlockWillowLeaves extends BlockLeavesBase private void removeLeaves(World par1World, int par2, int par3, int par4) { this.dropBlockAsItem(par1World, par2, par3, par4, par1World.getBlockMetadata(par2, par3, par4), 0); - par1World.setBlock(par2, par3, par4, 0); + par1World.setBlockToAir(par2, par3, par4); } /** diff --git a/src/minecraft/tdwp_ftw/biomesop/blocks/BlockWillowSlab.java b/src/minecraft/tdwp_ftw/biomesop/blocks/BlockWillowSlab.java index 9a3d50be2..c92641090 100644 --- a/src/minecraft/tdwp_ftw/biomesop/blocks/BlockWillowSlab.java +++ b/src/minecraft/tdwp_ftw/biomesop/blocks/BlockWillowSlab.java @@ -9,6 +9,7 @@ import net.minecraft.block.BlockHalfSlab; import net.minecraft.block.material.Material; import net.minecraft.client.renderer.texture.IconRegister; import net.minecraft.creativetab.CreativeTabs; +import net.minecraft.entity.player.EntityPlayer; import net.minecraft.item.ItemStack; import net.minecraft.world.IBlockAccess; import net.minecraft.world.World; @@ -78,6 +79,49 @@ public class BlockWillowSlab extends BlockHalfSlab { return new ItemStack(mod_BiomesOPlenty.willowSingleSlab.blockID, 2, par1 & 7); } + + /** + * Called upon block activation (right click on the block.) + */ + public boolean onBlockActivated(World world, int par2, int par3, int par4, EntityPlayer par5EntityPlayer, int par6, float par7, float par8, float par9) + { + if (par5EntityPlayer.getCurrentEquippedItem().itemID == this.blockID) + { + + if (world.getBlockMetadata(par2, par3, par4) == 0 /*0 = Slab at bottom half*/ ) + { + if (par6 == 1 /*1 = top of the block*/) + { + if (!par5EntityPlayer.capabilities.isCreativeMode) + { + --par5EntityPlayer.getCurrentEquippedItem().stackSize; + } + + world.playSoundEffect((double)((float)par2 + 0.5F), (double)((float)par3 + 0.5F), (double)((float)par4 + 0.5F), this.stepSound.getPlaceSound(), (this.stepSound.getVolume() + 1.0F) / 2.0F, this.stepSound.getPitch() * 0.8F); + world.setBlock(par2, par3, par4, mod_BiomesOPlenty.willowDoubleSlab.blockID); + + return true; + } + } + + if (world.getBlockMetadata(par2, par3, par4) == 8 /*8 = Slab at top half*/ ) + { + if (par6 == 0 /*0 = bottom of the block*/) + { + if (!par5EntityPlayer.capabilities.isCreativeMode) + { + --par5EntityPlayer.getCurrentEquippedItem().stackSize; + } + + world.playSoundEffect((double)((float)par2 + 0.5F), (double)((float)par3 + 0.5F), (double)((float)par4 + 0.5F), this.stepSound.getPlaceSound(), (this.stepSound.getVolume() + 1.0F) / 2.0F, this.stepSound.getPitch() * 0.8F); + world.setBlock(par2, par3, par4, mod_BiomesOPlenty.willowDoubleSlab.blockID); + + return true; + } + } + } + return false; + } /** * Returns the slab block name with step type. diff --git a/src/minecraft/tdwp_ftw/biomesop/helpers/BonemealUse.java b/src/minecraft/tdwp_ftw/biomesop/helpers/BonemealUse.java index baa44c5aa..307247852 100644 --- a/src/minecraft/tdwp_ftw/biomesop/helpers/BonemealUse.java +++ b/src/minecraft/tdwp_ftw/biomesop/helpers/BonemealUse.java @@ -17,9 +17,13 @@ import tdwp_ftw.biomesop.blocks.BlockDarkSapling; import tdwp_ftw.biomesop.blocks.BlockMagicSapling; import tdwp_ftw.biomesop.blocks.BlockMangroveSapling; import tdwp_ftw.biomesop.blocks.BlockAcaciaSapling; +import net.minecraft.block.Block; +import net.minecraft.block.BlockSapling; import net.minecraft.entity.player.EntityPlayer; +import net.minecraftforge.common.ForgeHooks; import net.minecraftforge.event.ForgeSubscribe; +import net.minecraftforge.event.Event.Result; import net.minecraftforge.event.entity.player.BonemealEvent; public class BonemealUse @@ -28,75 +32,120 @@ public class BonemealUse @ForgeSubscribe public void onUseBonemeal(BonemealEvent event) { + event.setResult(Result.ALLOW); + if (event.ID == mod_BiomesOPlenty.firSapling.blockID) { if (!event.world.isRemote) { + if ((double)event.world.rand.nextFloat() < 0.45D) + { ((BlockFirSapling)mod_BiomesOPlenty.firSapling).growTree(event.world, event.X, event.Y, event.Z, event.world.rand); + } } } if (event.ID == mod_BiomesOPlenty.redwoodSapling.blockID) { + event.setResult(Result.ALLOW); + if (!event.world.isRemote) { + if ((double)event.world.rand.nextFloat() < 0.45D) + { ((BlockRedwoodSapling)mod_BiomesOPlenty.redwoodSapling).growTree(event.world, event.X, event.Y, event.Z, event.world.rand); + } } } if (event.ID == mod_BiomesOPlenty.palmSapling.blockID) { + event.setResult(Result.ALLOW); + if (!event.world.isRemote) { + if ((double)event.world.rand.nextFloat() < 0.45D) + { ((BlockPalmSapling)mod_BiomesOPlenty.palmSapling).growTree(event.world, event.X, event.Y, event.Z, event.world.rand); + } } } if (event.ID == mod_BiomesOPlenty.redSapling.blockID) { + event.setResult(Result.ALLOW); + if (!event.world.isRemote) { + if ((double)event.world.rand.nextFloat() < 0.45D) + { ((BlockRedSapling)mod_BiomesOPlenty.redSapling).growTree(event.world, event.X, event.Y, event.Z, event.world.rand); + } } } if (event.ID == mod_BiomesOPlenty.orangeSapling.blockID) { + event.setResult(Result.ALLOW); + if (!event.world.isRemote) { + if ((double)event.world.rand.nextFloat() < 0.45D) + { ((BlockOrangeSapling)mod_BiomesOPlenty.orangeSapling).growTree(event.world, event.X, event.Y, event.Z, event.world.rand); + } } } if (event.ID == mod_BiomesOPlenty.yellowSapling.blockID) { + event.setResult(Result.ALLOW); + if (!event.world.isRemote) { + if ((double)event.world.rand.nextFloat() < 0.45D) + { ((BlockYellowSapling)mod_BiomesOPlenty.yellowSapling).growTree(event.world, event.X, event.Y, event.Z, event.world.rand); + } } } if (event.ID == mod_BiomesOPlenty.brownSapling.blockID) { + event.setResult(Result.ALLOW); + if (!event.world.isRemote) { + if ((double)event.world.rand.nextFloat() < 0.45D) + { ((BlockBrownSapling)mod_BiomesOPlenty.brownSapling).growTree(event.world, event.X, event.Y, event.Z, event.world.rand); + } } } if (event.ID == mod_BiomesOPlenty.willowSapling.blockID) { + event.setResult(Result.ALLOW); + if (!event.world.isRemote) { + if ((double)event.world.rand.nextFloat() < 0.45D) + { ((BlockWillowSapling)mod_BiomesOPlenty.willowSapling).growTree(event.world, event.X, event.Y, event.Z, event.world.rand); + } } } if (event.ID == mod_BiomesOPlenty.appleSapling.blockID) { + event.setResult(Result.ALLOW); + if (!event.world.isRemote) { + if ((double)event.world.rand.nextFloat() < 0.45D) + { ((BlockAppleSapling)mod_BiomesOPlenty.appleSapling).growTree(event.world, event.X, event.Y, event.Z, event.world.rand); + } } } @@ -104,55 +153,119 @@ public class BonemealUse { if (!event.world.isRemote) { + if ((double)event.world.rand.nextFloat() < 0.45D) + { ((BlockOriginSapling)mod_BiomesOPlenty.originSapling).growTree(event.world, event.X, event.Y, event.Z, event.world.rand); + } } } if (event.ID == mod_BiomesOPlenty.pinkSapling.blockID) { + event.setResult(Result.ALLOW); + if (!event.world.isRemote) { + if ((double)event.world.rand.nextFloat() < 0.45D) + { ((BlockPinkSapling)mod_BiomesOPlenty.pinkSapling).growTree(event.world, event.X, event.Y, event.Z, event.world.rand); + } } } if (event.ID == mod_BiomesOPlenty.whiteSapling.blockID) { + event.setResult(Result.ALLOW); + if (!event.world.isRemote) { + if ((double)event.world.rand.nextFloat() < 0.45D) + { ((BlockWhiteSapling)mod_BiomesOPlenty.whiteSapling).growTree(event.world, event.X, event.Y, event.Z, event.world.rand); + } } } if (event.ID == mod_BiomesOPlenty.darkSapling.blockID) { + event.setResult(Result.ALLOW); + if (!event.world.isRemote) { + if ((double)event.world.rand.nextFloat() < 0.45D) + { ((BlockDarkSapling)mod_BiomesOPlenty.darkSapling).growTree(event.world, event.X, event.Y, event.Z, event.world.rand); + } } } if (event.ID == mod_BiomesOPlenty.magicSapling.blockID) { + event.setResult(Result.ALLOW); + if (!event.world.isRemote) { - ((BlockMagicSapling)mod_BiomesOPlenty.magicSapling).growTree(event.world, event.X, event.Y, event.Z, event.world.rand); + if ((double)event.world.rand.nextFloat() < 0.45D) + { + ((BlockMagicSapling)mod_BiomesOPlenty.magicSapling).func_96477_c(event.world, event.X, event.Y, event.Z, event.world.rand); + } } } if (event.ID == mod_BiomesOPlenty.mangroveSapling.blockID) { + event.setResult(Result.ALLOW); + if (!event.world.isRemote) { + if ((double)event.world.rand.nextFloat() < 0.45D) + { ((BlockMangroveSapling)mod_BiomesOPlenty.mangroveSapling).growTree(event.world, event.X, event.Y, event.Z, event.world.rand); + } } } if (event.ID == mod_BiomesOPlenty.acaciaSapling.blockID) { + event.setResult(Result.ALLOW); + if (!event.world.isRemote) { + if ((double)event.world.rand.nextFloat() < 0.45D) + { ((BlockAcaciaSapling)mod_BiomesOPlenty.acaciaSapling).growTree(event.world, event.X, event.Y, event.Z, event.world.rand); + } + } + } + + if (event.ID == mod_BiomesOPlenty.holyGrass.blockID) + { + int var13 = event.X; + int var14 = event.Y + 1; + int var15 = event.Z; + + for (int i1 = 0; i1 < 128; ++i1) + { + + for (int i2 = 0; i2 < i1 / 16; ++i2) + { + var13 += event.world.rand.nextInt(3) - 1; + var14 += (event.world.rand.nextInt(3) - 1) * event.world.rand.nextInt(3) / 2; + var15 += event.world.rand.nextInt(3) - 1; + } + + if (event.world.getBlockId(var13, var14, var15) == 0) + { + if (mod_BiomesOPlenty.holyTallGrass.canBlockStay(event.world, var13, var14, var15)) + { + event.setResult(Result.ALLOW); + + if (!event.world.isRemote) + { + event.world.setBlock(var13, var14, var15, mod_BiomesOPlenty.holyTallGrass.blockID, 0, 0x02); + } + } + } } } } diff --git a/src/minecraft/tdwp_ftw/biomesop/mod_BiomesOPlenty.java b/src/minecraft/tdwp_ftw/biomesop/mod_BiomesOPlenty.java index 5f14e3f4e..279b592cf 100644 --- a/src/minecraft/tdwp_ftw/biomesop/mod_BiomesOPlenty.java +++ b/src/minecraft/tdwp_ftw/biomesop/mod_BiomesOPlenty.java @@ -11,6 +11,7 @@ import net.minecraft.entity.player.EntityPlayer; import net.minecraft.item.EnumArmorMaterial; import net.minecraft.item.EnumToolMaterial; import net.minecraft.item.Item; +import net.minecraft.item.ItemSlab; import net.minecraft.item.ItemStack; import net.minecraft.potion.Potion; import net.minecraft.util.WeightedRandomChestContent; @@ -508,14 +509,14 @@ public class mod_BiomesOPlenty mediumGrass = (BlockMediumGrass)(new BlockMediumGrass(mediumGrassID)).setHardness(0.0F).setStepSound(Block.soundGrassFootstep).setUnlocalizedName("mediumGrass"); duneGrass = (new BlockDuneGrass(duneGrassID)).setHardness(0.0F).setStepSound(Block.soundGrassFootstep).setUnlocalizedName("duneGrass"); desertSprouts = (new BlockDesertSprouts(desertSproutsID)).setHardness(0.0F).setStepSound(Block.soundGrassFootstep).setUnlocalizedName("desertSprouts"); - redRockCobbleDoubleSlab = (BlockHalfSlab)(new BlockRedRockCobbleSlab(redRockCobbleDoubleSlabID, true)).setHardness(1.6F).setResistance(7.5F).setStepSound(Block.soundWoodFootstep).setUnlocalizedName("redRockCobbleSlab"); - redRockCobbleSingleSlab = (BlockHalfSlab)(new BlockRedRockCobbleSlab(redRockCobbleSingleSlabID, false)).setHardness(1.6F).setResistance(7.5F).setStepSound(Block.soundWoodFootstep).setUnlocalizedName("redRockCobbleSlab"); + redRockCobbleDoubleSlab = (BlockHalfSlab)(new BlockRedRockCobbleSlab(redRockCobbleDoubleSlabID, true)).setHardness(1.6F).setResistance(7.5F).setStepSound(Block.soundStoneFootstep).setUnlocalizedName("redRockCobbleSlab"); + redRockCobbleSingleSlab = (BlockHalfSlab)(new BlockRedRockCobbleSlab(redRockCobbleSingleSlabID, false)).setHardness(1.6F).setResistance(7.5F).setStepSound(Block.soundStoneFootstep).setUnlocalizedName("redRockCobbleSlab"); redRockCobbleStairs = (new BlockRedRockCobbleStairs(redRockCobbleStairsID, redRockCobble)).setUnlocalizedName("redRockCobbleStairs"); - redRockBrickDoubleSlab = (BlockHalfSlab)(new BlockRedRockBrickSlab(redRockBrickDoubleSlabID, true)).setHardness(1.1F).setResistance(7.0F).setStepSound(Block.soundWoodFootstep).setUnlocalizedName("redRockBrickSlab"); - redRockBrickSingleSlab = (BlockHalfSlab)(new BlockRedRockBrickSlab(redRockBrickSingleSlabID, false)).setHardness(1.1F).setResistance(7.0F).setStepSound(Block.soundWoodFootstep).setUnlocalizedName("redRockBrickSlab"); + redRockBrickDoubleSlab = (BlockHalfSlab)(new BlockRedRockBrickSlab(redRockBrickDoubleSlabID, true)).setHardness(1.1F).setResistance(7.0F).setStepSound(Block.soundStoneFootstep).setUnlocalizedName("redRockBrickSlab"); + redRockBrickSingleSlab = (BlockHalfSlab)(new BlockRedRockBrickSlab(redRockBrickSingleSlabID, false)).setHardness(1.1F).setResistance(7.0F).setStepSound(Block.soundStoneFootstep).setUnlocalizedName("redRockBrickSlab"); redRockBrickStairs = (new BlockRedRockBrickStairs(redRockBrickStairsID, redRockBrick)).setUnlocalizedName("redRockBrickStairs"); - mudBrickDoubleSlab = (BlockHalfSlab)(new BlockMudBrickSlab(mudBrickDoubleSlabID, true)).setHardness(1.0F).setResistance(2.0F).setStepSound(Block.soundWoodFootstep).setUnlocalizedName("mudBrickSlab"); - mudBrickSingleSlab = (BlockHalfSlab)(new BlockMudBrickSlab(mudBrickSingleSlabID, false)).setHardness(1.0F).setResistance(2.0F).setStepSound(Block.soundWoodFootstep).setUnlocalizedName("mudBrickSlab"); + mudBrickDoubleSlab = (BlockHalfSlab)(new BlockMudBrickSlab(mudBrickDoubleSlabID, true)).setHardness(1.0F).setResistance(2.0F).setStepSound(Block.soundStoneFootstep).setUnlocalizedName("mudBrickSlab"); + mudBrickSingleSlab = (BlockHalfSlab)(new BlockMudBrickSlab(mudBrickSingleSlabID, false)).setHardness(1.0F).setResistance(2.0F).setStepSound(Block.soundStoneFootstep).setUnlocalizedName("mudBrickSlab"); mudBrickStairs = (new BlockMudBrickStairs(mudBrickStairsID, mudBrickBlock)).setUnlocalizedName("mudBrickStairs"); mangroveSapling = (new BlockMangroveSapling(mangroveSaplingID)).setHardness(0.0F).setStepSound(Block.soundGrassFootstep).setUnlocalizedName("mangroveSapling"); hardSand = (new BlockHardSand(hardSandID)).setHardness(0.7F).setStepSound(Block.soundSandFootstep).setUnlocalizedName("hardSand");