diff --git a/src/minecraft/tdwp_ftw/biomesop/blocks/BlockAcaciaLeaves.java b/src/minecraft/tdwp_ftw/biomesop/blocks/BlockAcaciaLeaves.java index 0c104bd5d..326533381 100644 --- a/src/minecraft/tdwp_ftw/biomesop/blocks/BlockAcaciaLeaves.java +++ b/src/minecraft/tdwp_ftw/biomesop/blocks/BlockAcaciaLeaves.java @@ -2,6 +2,9 @@ package tdwp_ftw.biomesop.blocks; import java.util.Random; +import cpw.mods.fml.relauncher.Side; +import cpw.mods.fml.relauncher.SideOnly; + import tdwp_ftw.biomesop.mod_BiomesOPlenty; import net.minecraft.client.renderer.texture.IconRegister; @@ -93,22 +96,23 @@ public class BlockAcaciaLeaves extends BlockLeavesBase */ public void breakBlock(World par1World, int par2, int par3, int par4, int par5, int par6) { - byte b0 = 1; - int j1 = b0 + 1; + byte var7 = 1; + int var8 = var7 + 1; - if (par1World.checkChunksExist(par2 - j1, par3 - j1, par4 - j1, par2 + j1, par3 + j1, par4 + j1)) + if (par1World.checkChunksExist(par2 - var8, par3 - var8, par4 - var8, par2 + var8, par3 + var8, par4 + var8)) { - for (int k1 = -b0; k1 <= b0; ++k1) + for (int var9 = -var7; var9 <= var7; ++var9) { - for (int l1 = -b0; l1 <= b0; ++l1) + for (int var10 = -var7; var10 <= var7; ++var10) { - for (int i2 = -b0; i2 <= b0; ++i2) + for (int var11 = -var7; var11 <= var7; ++var11) { - int j2 = par1World.getBlockId(par2 + k1, par3 + l1, par4 + i2); + int var12 = par1World.getBlockId(par2 + var9, par3 + var10, par4 + var11); - if (Block.blocksList[j2] != null) + if (var12 == mod_BiomesOPlenty.acaciaLeaves.blockID) { - Block.blocksList[j2].beginLeavesDecay(par1World, par2 + k1, par3 + l1, par4 + i2); + int var13 = par1World.getBlockMetadata(par2 + var9, par3 + var10, par4 + var11); + par1World.setBlockMetadataWithNotify(par2 + var9, par3 + var10, par4 + var11, var13 | 8, 2); } } } @@ -220,7 +224,7 @@ public class BlockAcaciaLeaves extends BlockLeavesBase if (var12 >= 0) { - par1World.setBlockMetadataWithNotify(par2, par3, par4, var6 & -9, 4); + par1World.setBlockMetadataWithNotify(par2, par3, par4, var6 & -9, 2); } else { @@ -247,7 +251,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.setBlock(par2, par3, par4, 0); } /** 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..ca6f70613 100644 --- a/src/minecraft/tdwp_ftw/biomesop/blocks/BlockAppleLeaves.java +++ b/src/minecraft/tdwp_ftw/biomesop/blocks/BlockAppleLeaves.java @@ -1,7 +1,11 @@ package tdwp_ftw.biomesop.blocks; +import java.util.ArrayList; import java.util.Random; +import cpw.mods.fml.relauncher.Side; +import cpw.mods.fml.relauncher.SideOnly; + import tdwp_ftw.biomesop.mod_BiomesOPlenty; import net.minecraft.client.renderer.texture.IconRegister; @@ -16,6 +20,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 { @@ -53,22 +58,23 @@ public class BlockAppleLeaves extends BlockLeavesBase */ public void breakBlock(World par1World, int par2, int par3, int par4, int par5, int par6) { - byte b0 = 1; - int j1 = b0 + 1; + byte var7 = 1; + int var8 = var7 + 1; - if (par1World.checkChunksExist(par2 - j1, par3 - j1, par4 - j1, par2 + j1, par3 + j1, par4 + j1)) + if (par1World.checkChunksExist(par2 - var8, par3 - var8, par4 - var8, par2 + var8, par3 + var8, par4 + var8)) { - for (int k1 = -b0; k1 <= b0; ++k1) + for (int var9 = -var7; var9 <= var7; ++var9) { - for (int l1 = -b0; l1 <= b0; ++l1) + for (int var10 = -var7; var10 <= var7; ++var10) { - for (int i2 = -b0; i2 <= b0; ++i2) + for (int var11 = -var7; var11 <= var7; ++var11) { - int j2 = par1World.getBlockId(par2 + k1, par3 + l1, par4 + i2); + int var12 = par1World.getBlockId(par2 + var9, par3 + var10, par4 + var11); - if (Block.blocksList[j2] != null) + if (var12 == mod_BiomesOPlenty.appleLeaves.blockID) { - Block.blocksList[j2].beginLeavesDecay(par1World, par2 + k1, par3 + l1, par4 + i2); + int var13 = par1World.getBlockMetadata(par2 + var9, par3 + var10, par4 + var11); + par1World.setBlockMetadataWithNotify(par2 + var9, par3 + var10, par4 + var11, var13 | 8, 2); } } } @@ -118,7 +124,7 @@ public class BlockAppleLeaves extends BlockLeavesBase { this.adjacentTreeBlocks[(var12 + var11) * var10 + (var13 + var11) * var9 + var14 + var11] = 0; } - else if (var15 == mod_BiomesOPlenty.appleLeaves.blockID || var15 == mod_BiomesOPlenty.appleLeavesFruitless.blockID) + else if (var15 == mod_BiomesOPlenty.appleLeaves.blockID || var15 == mod_BiomesOPlenty.appleLeaves.blockID) { this.adjacentTreeBlocks[(var12 + var11) * var10 + (var13 + var11) * var9 + var14 + var11] = -2; } @@ -180,7 +186,7 @@ public class BlockAppleLeaves extends BlockLeavesBase if (var12 >= 0) { - par1World.setBlockMetadataWithNotify(par2, par3, par4, var6 & -9, 4); + par1World.setBlockMetadataWithNotify(par2, par3, par4, var6 & -9, 2); } else { @@ -207,7 +213,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.setBlock(par2, par3, par4, 0); } /** diff --git a/src/minecraft/tdwp_ftw/biomesop/blocks/BlockAppleLeavesFruitless.java b/src/minecraft/tdwp_ftw/biomesop/blocks/BlockAppleLeavesFruitless.java index 969126c63..be5450396 100644 --- a/src/minecraft/tdwp_ftw/biomesop/blocks/BlockAppleLeavesFruitless.java +++ b/src/minecraft/tdwp_ftw/biomesop/blocks/BlockAppleLeavesFruitless.java @@ -2,6 +2,9 @@ package tdwp_ftw.biomesop.blocks; import java.util.Random; +import cpw.mods.fml.relauncher.Side; +import cpw.mods.fml.relauncher.SideOnly; + import tdwp_ftw.biomesop.mod_BiomesOPlenty; import net.minecraft.block.Block; @@ -53,22 +56,23 @@ public class BlockAppleLeavesFruitless extends BlockLeavesBase */ public void breakBlock(World par1World, int par2, int par3, int par4, int par5, int par6) { - byte b0 = 1; - int j1 = b0 + 1; + byte var7 = 1; + int var8 = var7 + 1; - if (par1World.checkChunksExist(par2 - j1, par3 - j1, par4 - j1, par2 + j1, par3 + j1, par4 + j1)) + if (par1World.checkChunksExist(par2 - var8, par3 - var8, par4 - var8, par2 + var8, par3 + var8, par4 + var8)) { - for (int k1 = -b0; k1 <= b0; ++k1) + for (int var9 = -var7; var9 <= var7; ++var9) { - for (int l1 = -b0; l1 <= b0; ++l1) + for (int var10 = -var7; var10 <= var7; ++var10) { - for (int i2 = -b0; i2 <= b0; ++i2) + for (int var11 = -var7; var11 <= var7; ++var11) { - int j2 = par1World.getBlockId(par2 + k1, par3 + l1, par4 + i2); + int var12 = par1World.getBlockId(par2 + var9, par3 + var10, par4 + var11); - if (Block.blocksList[j2] != null) + if (var12 == mod_BiomesOPlenty.appleLeavesFruitless.blockID) { - Block.blocksList[j2].beginLeavesDecay(par1World, par2 + k1, par3 + l1, par4 + i2); + int var13 = par1World.getBlockMetadata(par2 + var9, par3 + var10, par4 + var11); + par1World.setBlockMetadataWithNotify(par2 + var9, par3 + var10, par4 + var11, var13 | 8, 2); } } } @@ -180,7 +184,7 @@ public class BlockAppleLeavesFruitless extends BlockLeavesBase if (var12 >= 0) { - par1World.setBlockMetadataWithNotify(par2, par3, par4, var6 & -9, 4); + par1World.setBlockMetadataWithNotify(par2, par3, par4, var6 & -9, 2); } else { @@ -207,7 +211,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.setBlock(par2, par3, par4, 0); } /** diff --git a/src/minecraft/tdwp_ftw/biomesop/blocks/BlockAutumnLeaves.java b/src/minecraft/tdwp_ftw/biomesop/blocks/BlockAutumnLeaves.java index 6c47452f1..adee038a9 100644 --- a/src/minecraft/tdwp_ftw/biomesop/blocks/BlockAutumnLeaves.java +++ b/src/minecraft/tdwp_ftw/biomesop/blocks/BlockAutumnLeaves.java @@ -2,6 +2,9 @@ package tdwp_ftw.biomesop.blocks; import java.util.Random; +import cpw.mods.fml.relauncher.Side; +import cpw.mods.fml.relauncher.SideOnly; + import tdwp_ftw.biomesop.mod_BiomesOPlenty; import net.minecraft.client.renderer.texture.IconRegister; @@ -55,22 +58,23 @@ public class BlockAutumnLeaves extends BlockLeavesBase */ public void breakBlock(World par1World, int par2, int par3, int par4, int par5, int par6) { - byte b0 = 1; - int j1 = b0 + 1; + byte var7 = 1; + int var8 = var7 + 1; - if (par1World.checkChunksExist(par2 - j1, par3 - j1, par4 - j1, par2 + j1, par3 + j1, par4 + j1)) + if (par1World.checkChunksExist(par2 - var8, par3 - var8, par4 - var8, par2 + var8, par3 + var8, par4 + var8)) { - for (int k1 = -b0; k1 <= b0; ++k1) + for (int var9 = -var7; var9 <= var7; ++var9) { - for (int l1 = -b0; l1 <= b0; ++l1) + for (int var10 = -var7; var10 <= var7; ++var10) { - for (int i2 = -b0; i2 <= b0; ++i2) + for (int var11 = -var7; var11 <= var7; ++var11) { - int j2 = par1World.getBlockId(par2 + k1, par3 + l1, par4 + i2); + int var12 = par1World.getBlockId(par2 + var9, par3 + var10, par4 + var11); - if (Block.blocksList[j2] != null) + if (var12 == mod_BiomesOPlenty.autumnLeaves.blockID) { - Block.blocksList[j2].beginLeavesDecay(par1World, par2 + k1, par3 + l1, par4 + i2); + int var13 = par1World.getBlockMetadata(par2 + var9, par3 + var10, par4 + var11); + par1World.setBlockMetadataWithNotify(par2 + var9, par3 + var10, par4 + var11, var13 | 8, 2); } } } @@ -182,7 +186,7 @@ public class BlockAutumnLeaves extends BlockLeavesBase if (var12 >= 0) { - par1World.setBlockMetadataWithNotify(par2, par3, par4, var6 & -9, 4); + par1World.setBlockMetadataWithNotify(par2, par3, par4, var6 & -9, 2); } else { @@ -209,7 +213,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.setBlock(par2, par3, par4, 0); } /** diff --git a/src/minecraft/tdwp_ftw/biomesop/blocks/BlockBambooLeaves.java b/src/minecraft/tdwp_ftw/biomesop/blocks/BlockBambooLeaves.java index 2e2107c22..e5acd46ad 100644 --- a/src/minecraft/tdwp_ftw/biomesop/blocks/BlockBambooLeaves.java +++ b/src/minecraft/tdwp_ftw/biomesop/blocks/BlockBambooLeaves.java @@ -2,6 +2,9 @@ package tdwp_ftw.biomesop.blocks; import java.util.Random; +import cpw.mods.fml.relauncher.Side; +import cpw.mods.fml.relauncher.SideOnly; + import tdwp_ftw.biomesop.mod_BiomesOPlenty; import net.minecraft.block.Block; @@ -210,7 +213,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..beaf19c80 100644 --- a/src/minecraft/tdwp_ftw/biomesop/blocks/BlockBlueLeaves.java +++ b/src/minecraft/tdwp_ftw/biomesop/blocks/BlockBlueLeaves.java @@ -2,6 +2,9 @@ package tdwp_ftw.biomesop.blocks; import java.util.Random; +import cpw.mods.fml.relauncher.Side; +import cpw.mods.fml.relauncher.SideOnly; + import tdwp_ftw.biomesop.mod_BiomesOPlenty; import net.minecraft.client.renderer.texture.IconRegister; @@ -49,24 +52,28 @@ public class BlockBlueLeaves extends BlockLeavesBase return blockIcon[(!isOpaqueCube() ? 0 : 1)]; } + /** + * ejects contained items into the world, and notifies neighbours of an update, as appropriate + */ public void breakBlock(World par1World, int par2, int par3, int par4, int par5, int par6) { - byte b0 = 1; - int j1 = b0 + 1; + byte var7 = 1; + int var8 = var7 + 1; - if (par1World.checkChunksExist(par2 - j1, par3 - j1, par4 - j1, par2 + j1, par3 + j1, par4 + j1)) + if (par1World.checkChunksExist(par2 - var8, par3 - var8, par4 - var8, par2 + var8, par3 + var8, par4 + var8)) { - for (int k1 = -b0; k1 <= b0; ++k1) + for (int var9 = -var7; var9 <= var7; ++var9) { - for (int l1 = -b0; l1 <= b0; ++l1) + for (int var10 = -var7; var10 <= var7; ++var10) { - for (int i2 = -b0; i2 <= b0; ++i2) + for (int var11 = -var7; var11 <= var7; ++var11) { - int j2 = par1World.getBlockId(par2 + k1, par3 + l1, par4 + i2); + int var12 = par1World.getBlockId(par2 + var9, par3 + var10, par4 + var11); - if (Block.blocksList[j2] != null) + if (var12 == mod_BiomesOPlenty.blueLeaves.blockID) { - Block.blocksList[j2].beginLeavesDecay(par1World, par2 + k1, par3 + l1, par4 + i2); + int var13 = par1World.getBlockMetadata(par2 + var9, par3 + var10, par4 + var11); + par1World.setBlockMetadataWithNotify(par2 + var9, par3 + var10, par4 + var11, var13 | 8, 2); } } } @@ -178,7 +185,7 @@ public class BlockBlueLeaves extends BlockLeavesBase if (var12 >= 0) { - par1World.setBlockMetadataWithNotify(par2, par3, par4, var6 & -9, 4); + par1World.setBlockMetadataWithNotify(par2, par3, par4, var6 & -9, 2); } else { @@ -205,7 +212,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.setBlock(par2, par3, par4, 0); } /** 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..ba9c21464 100644 --- a/src/minecraft/tdwp_ftw/biomesop/blocks/BlockDarkLeaves.java +++ b/src/minecraft/tdwp_ftw/biomesop/blocks/BlockDarkLeaves.java @@ -2,6 +2,9 @@ package tdwp_ftw.biomesop.blocks; import java.util.Random; +import cpw.mods.fml.relauncher.Side; +import cpw.mods.fml.relauncher.SideOnly; + import tdwp_ftw.biomesop.mod_BiomesOPlenty; import net.minecraft.client.renderer.texture.IconRegister; @@ -54,22 +57,23 @@ public class BlockDarkLeaves extends BlockLeavesBase */ public void breakBlock(World par1World, int par2, int par3, int par4, int par5, int par6) { - byte b0 = 1; - int j1 = b0 + 1; + byte var7 = 1; + int var8 = var7 + 1; - if (par1World.checkChunksExist(par2 - j1, par3 - j1, par4 - j1, par2 + j1, par3 + j1, par4 + j1)) + if (par1World.checkChunksExist(par2 - var8, par3 - var8, par4 - var8, par2 + var8, par3 + var8, par4 + var8)) { - for (int k1 = -b0; k1 <= b0; ++k1) + for (int var9 = -var7; var9 <= var7; ++var9) { - for (int l1 = -b0; l1 <= b0; ++l1) + for (int var10 = -var7; var10 <= var7; ++var10) { - for (int i2 = -b0; i2 <= b0; ++i2) + for (int var11 = -var7; var11 <= var7; ++var11) { - int j2 = par1World.getBlockId(par2 + k1, par3 + l1, par4 + i2); + int var12 = par1World.getBlockId(par2 + var9, par3 + var10, par4 + var11); - if (Block.blocksList[j2] != null) + if (var12 == mod_BiomesOPlenty.darkLeaves.blockID) { - Block.blocksList[j2].beginLeavesDecay(par1World, par2 + k1, par3 + l1, par4 + i2); + int var13 = par1World.getBlockMetadata(par2 + var9, par3 + var10, par4 + var11); + par1World.setBlockMetadataWithNotify(par2 + var9, par3 + var10, par4 + var11, var13 | 8, 2); } } } @@ -181,7 +185,7 @@ public class BlockDarkLeaves extends BlockLeavesBase if (var12 >= 0) { - par1World.setBlockMetadataWithNotify(par2, par3, par4, var6 & -9, 4); + par1World.setBlockMetadataWithNotify(par2, par3, par4, var6 & -9, 2); } else { @@ -208,7 +212,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.setBlock(par2, par3, par4, 0); } /** 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..aec955859 100644 --- a/src/minecraft/tdwp_ftw/biomesop/blocks/BlockDeadLeaves.java +++ b/src/minecraft/tdwp_ftw/biomesop/blocks/BlockDeadLeaves.java @@ -2,6 +2,9 @@ package tdwp_ftw.biomesop.blocks; import java.util.Random; +import cpw.mods.fml.relauncher.Side; +import cpw.mods.fml.relauncher.SideOnly; + import tdwp_ftw.biomesop.mod_BiomesOPlenty; import net.minecraft.client.renderer.texture.IconRegister; @@ -54,22 +57,23 @@ public class BlockDeadLeaves extends BlockLeavesBase */ public void breakBlock(World par1World, int par2, int par3, int par4, int par5, int par6) { - byte b0 = 1; - int j1 = b0 + 1; + byte var7 = 1; + int var8 = var7 + 1; - if (par1World.checkChunksExist(par2 - j1, par3 - j1, par4 - j1, par2 + j1, par3 + j1, par4 + j1)) + if (par1World.checkChunksExist(par2 - var8, par3 - var8, par4 - var8, par2 + var8, par3 + var8, par4 + var8)) { - for (int k1 = -b0; k1 <= b0; ++k1) + for (int var9 = -var7; var9 <= var7; ++var9) { - for (int l1 = -b0; l1 <= b0; ++l1) + for (int var10 = -var7; var10 <= var7; ++var10) { - for (int i2 = -b0; i2 <= b0; ++i2) + for (int var11 = -var7; var11 <= var7; ++var11) { - int j2 = par1World.getBlockId(par2 + k1, par3 + l1, par4 + i2); + int var12 = par1World.getBlockId(par2 + var9, par3 + var10, par4 + var11); - if (Block.blocksList[j2] != null) + if (var12 == mod_BiomesOPlenty.deadLeaves.blockID) { - Block.blocksList[j2].beginLeavesDecay(par1World, par2 + k1, par3 + l1, par4 + i2); + int var13 = par1World.getBlockMetadata(par2 + var9, par3 + var10, par4 + var11); + par1World.setBlockMetadataWithNotify(par2 + var9, par3 + var10, par4 + var11, var13 | 8, 2); } } } @@ -181,7 +185,7 @@ public class BlockDeadLeaves extends BlockLeavesBase if (var12 >= 0) { - par1World.setBlockMetadataWithNotify(par2, par3, par4, var6 & -9, 4); + par1World.setBlockMetadataWithNotify(par2, par3, par4, var6 & -9, 2); } else { @@ -208,7 +212,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.setBlock(par2, par3, par4, 0); } /** diff --git a/src/minecraft/tdwp_ftw/biomesop/blocks/BlockFirLeaves.java b/src/minecraft/tdwp_ftw/biomesop/blocks/BlockFirLeaves.java index e2125df4b..9c86f352b 100644 --- a/src/minecraft/tdwp_ftw/biomesop/blocks/BlockFirLeaves.java +++ b/src/minecraft/tdwp_ftw/biomesop/blocks/BlockFirLeaves.java @@ -2,6 +2,9 @@ package tdwp_ftw.biomesop.blocks; import java.util.Random; +import cpw.mods.fml.relauncher.Side; +import cpw.mods.fml.relauncher.SideOnly; + import tdwp_ftw.biomesop.mod_BiomesOPlenty; import net.minecraft.block.Block; @@ -208,7 +211,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..eaaae6ef9 100644 --- a/src/minecraft/tdwp_ftw/biomesop/blocks/BlockHolyLeaves.java +++ b/src/minecraft/tdwp_ftw/biomesop/blocks/BlockHolyLeaves.java @@ -2,6 +2,9 @@ package tdwp_ftw.biomesop.blocks; import java.util.Random; +import cpw.mods.fml.relauncher.Side; +import cpw.mods.fml.relauncher.SideOnly; + import tdwp_ftw.biomesop.mod_BiomesOPlenty; import net.minecraft.block.Block; @@ -48,7 +51,7 @@ public class BlockHolyLeaves extends BlockLeavesBase { return blockIcon[(!isOpaqueCube() ? 0 : 1)]; } - /** + /** * ejects contained items into the world, and notifies neighbours of an update, as appropriate */ public void breakBlock(World par1World, int par2, int par3, int par4, int par5, int par6) @@ -208,7 +211,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..b7b350440 100644 --- a/src/minecraft/tdwp_ftw/biomesop/blocks/BlockMangroveLeaves.java +++ b/src/minecraft/tdwp_ftw/biomesop/blocks/BlockMangroveLeaves.java @@ -2,6 +2,9 @@ package tdwp_ftw.biomesop.blocks; import java.util.Random; +import cpw.mods.fml.relauncher.Side; +import cpw.mods.fml.relauncher.SideOnly; + import tdwp_ftw.biomesop.mod_BiomesOPlenty; import net.minecraft.block.Block; @@ -248,7 +251,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..d22467d86 100644 --- a/src/minecraft/tdwp_ftw/biomesop/blocks/BlockOrangeLeaves.java +++ b/src/minecraft/tdwp_ftw/biomesop/blocks/BlockOrangeLeaves.java @@ -2,6 +2,9 @@ package tdwp_ftw.biomesop.blocks; import java.util.Random; +import cpw.mods.fml.relauncher.Side; +import cpw.mods.fml.relauncher.SideOnly; + import tdwp_ftw.biomesop.mod_BiomesOPlenty; import net.minecraft.block.Block; @@ -208,7 +211,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..ef0ce4cea 100644 --- a/src/minecraft/tdwp_ftw/biomesop/blocks/BlockPalmLeaves.java +++ b/src/minecraft/tdwp_ftw/biomesop/blocks/BlockPalmLeaves.java @@ -2,6 +2,9 @@ package tdwp_ftw.biomesop.blocks; import java.util.Random; +import cpw.mods.fml.relauncher.Side; +import cpw.mods.fml.relauncher.SideOnly; + import tdwp_ftw.biomesop.mod_BiomesOPlenty; import net.minecraft.block.Block; @@ -248,7 +251,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..02ec1d739 100644 --- a/src/minecraft/tdwp_ftw/biomesop/blocks/BlockPinkLeaves.java +++ b/src/minecraft/tdwp_ftw/biomesop/blocks/BlockPinkLeaves.java @@ -2,6 +2,9 @@ package tdwp_ftw.biomesop.blocks; import java.util.Random; +import cpw.mods.fml.relauncher.Side; +import cpw.mods.fml.relauncher.SideOnly; + import tdwp_ftw.biomesop.mod_BiomesOPlenty; import net.minecraft.block.Block; @@ -208,7 +211,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..cc893dfae 100644 --- a/src/minecraft/tdwp_ftw/biomesop/blocks/BlockRedLeaves.java +++ b/src/minecraft/tdwp_ftw/biomesop/blocks/BlockRedLeaves.java @@ -2,6 +2,9 @@ package tdwp_ftw.biomesop.blocks; import java.util.Random; +import cpw.mods.fml.relauncher.Side; +import cpw.mods.fml.relauncher.SideOnly; + import tdwp_ftw.biomesop.mod_BiomesOPlenty; import net.minecraft.block.Block; @@ -208,7 +211,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..7cba67977 100644 --- a/src/minecraft/tdwp_ftw/biomesop/blocks/BlockRedwoodLeaves.java +++ b/src/minecraft/tdwp_ftw/biomesop/blocks/BlockRedwoodLeaves.java @@ -2,6 +2,9 @@ package tdwp_ftw.biomesop.blocks; import java.util.Random; +import cpw.mods.fml.relauncher.Side; +import cpw.mods.fml.relauncher.SideOnly; + import tdwp_ftw.biomesop.mod_BiomesOPlenty; import net.minecraft.block.Block; @@ -248,7 +251,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..ea1a1e544 100644 --- a/src/minecraft/tdwp_ftw/biomesop/blocks/BlockWhiteLeaves.java +++ b/src/minecraft/tdwp_ftw/biomesop/blocks/BlockWhiteLeaves.java @@ -2,6 +2,9 @@ package tdwp_ftw.biomesop.blocks; import java.util.Random; +import cpw.mods.fml.relauncher.Side; +import cpw.mods.fml.relauncher.SideOnly; + import tdwp_ftw.biomesop.mod_BiomesOPlenty; import net.minecraft.block.Block; @@ -208,7 +211,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..64d33aa87 100644 --- a/src/minecraft/tdwp_ftw/biomesop/blocks/BlockWillowLeaves.java +++ b/src/minecraft/tdwp_ftw/biomesop/blocks/BlockWillowLeaves.java @@ -2,6 +2,9 @@ package tdwp_ftw.biomesop.blocks; import java.util.Random; +import cpw.mods.fml.relauncher.Side; +import cpw.mods.fml.relauncher.SideOnly; + import tdwp_ftw.biomesop.mod_BiomesOPlenty; import net.minecraft.block.Block; @@ -248,7 +251,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..d3612d0f2 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,121 @@ public class BonemealUse @ForgeSubscribe public void onUseBonemeal(BonemealEvent event) { + if (event.ID == mod_BiomesOPlenty.firSapling.blockID) { + event.setResult(Result.ALLOW); + 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 +154,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 29f5c3adf..31ffb2473 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");