diff --git a/src/minecraft/tdwp_ftw/biomesop/blocks/BlockAcaciaLeaves.java b/src/minecraft/tdwp_ftw/biomesop/blocks/BlockAcaciaLeaves.java index 8a3443bdd..40a43c76d 100644 --- a/src/minecraft/tdwp_ftw/biomesop/blocks/BlockAcaciaLeaves.java +++ b/src/minecraft/tdwp_ftw/biomesop/blocks/BlockAcaciaLeaves.java @@ -1,28 +1,26 @@ 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 tdwp_ftw.biomesop.declarations.BOPBlocks; - -import net.minecraft.client.renderer.texture.IconRegister; import net.minecraft.block.Block; import net.minecraft.block.BlockLeavesBase; import net.minecraft.block.material.Material; -import net.minecraft.creativetab.CreativeTabs; +import net.minecraft.client.renderer.texture.IconRegister; import net.minecraft.entity.player.EntityPlayer; -import net.minecraft.item.Item; import net.minecraft.item.ItemStack; -import net.minecraft.stats.StatList; import net.minecraft.util.Icon; import net.minecraft.world.ColorizerFoliage; import net.minecraft.world.IBlockAccess; import net.minecraft.world.World; +import net.minecraftforge.common.IShearable; +import tdwp_ftw.biomesop.mod_BiomesOPlenty; +import tdwp_ftw.biomesop.declarations.BOPBlocks; -public class BlockAcaciaLeaves extends BlockLeavesBase +public class BlockAcaciaLeaves extends BlockLeavesBase implements IShearable { /** * The base index in terrain.png corresponding to the fancy version of the leaf texture. This is stored so we can @@ -41,18 +39,21 @@ public class BlockAcaciaLeaves extends BlockLeavesBase this.setCreativeTab(mod_BiomesOPlenty.tabBiomesOPlenty); } - @Override + @Override + @SideOnly(Side.CLIENT) public void registerIcons(IconRegister par1IconRegister) { this.blockIcon[0] = par1IconRegister.registerIcon("BiomesOPlenty:acacialeaves1"); this.blockIcon[1] = par1IconRegister.registerIcon("BiomesOPlenty:acacialeaves2"); } + @SideOnly(Side.CLIENT) public Icon getBlockTextureFromSideAndMetadata(int par1, int par2) { return blockIcon[(!isOpaqueCube() ? 0 : 1)]; } + @SideOnly(Side.CLIENT) public int getBlockColor() { double var1 = 0.5D; @@ -63,6 +64,7 @@ public class BlockAcaciaLeaves extends BlockLeavesBase /** * Returns the color this block should be rendered. Used by leaves. */ + @SideOnly(Side.CLIENT) public int getRenderColor(int par1) { return (par1 & 3) == 1 ? ColorizerFoliage.getFoliageColorPine() : ((par1 & 3) == 2 ? ColorizerFoliage.getFoliageColorBirch() : ColorizerFoliage.getFoliageColorBasic()); @@ -72,6 +74,7 @@ public class BlockAcaciaLeaves extends BlockLeavesBase * Returns a integer with hex for 0xrrggbb with this color multiplied against the blocks color. Note only called * when first determining what to render. */ + @SideOnly(Side.CLIENT) public int colorMultiplier(IBlockAccess par1IBlockAccess, int par2, int par3, int par4) { int var6 = 0; @@ -238,6 +241,7 @@ public class BlockAcaciaLeaves extends BlockLeavesBase /** * A randomly called display update to be able to add particles or other items for display */ + @SideOnly(Side.CLIENT) public void randomDisplayTick(World par1World, int par2, int par3, int par4, Random par5Random) { if (par1World.canLightningStrikeAt(par2, par3 + 1, par4) && !par1World.doesBlockHaveSolidTopSurface(par2, par3 - 1, par4) && par5Random.nextInt(15) == 1) @@ -252,7 +256,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, 0); + par1World.setBlockToAir(par2, par3, par4); } /** @@ -299,15 +303,7 @@ public class BlockAcaciaLeaves extends BlockLeavesBase */ public void harvestBlock(World par1World, EntityPlayer par2EntityPlayer, int par3, int par4, int par5, int par6) { - if (!par1World.isRemote && par2EntityPlayer.getCurrentEquippedItem() != null && par2EntityPlayer.getCurrentEquippedItem().itemID == Item.shears.itemID) - { - par2EntityPlayer.addStat(StatList.mineBlockStatArray[this.blockID], 1); - this.dropBlockAsItem_do(par1World, par3, par4, par5, new ItemStack(BOPBlocks.acaciaLeaves.blockID, 1, par6 & 3)); - } - else - { - super.harvestBlock(par1World, par2EntityPlayer, par3, par4, par5, par6); - } + super.harvestBlock(par1World, par2EntityPlayer, par3, par4, par5, par6); } /** @@ -332,8 +328,23 @@ public class BlockAcaciaLeaves extends BlockLeavesBase /** * Pass true to draw this block using fancy graphics, or false for fast graphics. */ + @SideOnly(Side.CLIENT) public void setGraphicsLevel(boolean par1) { this.graphicsLevel = par1; } + + @Override + public boolean isShearable(ItemStack item, World world, int x, int y, int z) + { + return true; + } + + @Override + 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) & 3)); + return ret; + } } diff --git a/src/minecraft/tdwp_ftw/biomesop/blocks/BlockAppleLeaves.java b/src/minecraft/tdwp_ftw/biomesop/blocks/BlockAppleLeaves.java index 66db8a987..37998d5e1 100644 --- a/src/minecraft/tdwp_ftw/biomesop/blocks/BlockAppleLeaves.java +++ b/src/minecraft/tdwp_ftw/biomesop/blocks/BlockAppleLeaves.java @@ -6,14 +6,10 @@ import java.util.Random; import cpw.mods.fml.relauncher.Side; import cpw.mods.fml.relauncher.SideOnly; -import tdwp_ftw.biomesop.mod_BiomesOPlenty; -import tdwp_ftw.biomesop.declarations.BOPBlocks; - -import net.minecraft.client.renderer.texture.IconRegister; import net.minecraft.block.Block; import net.minecraft.block.BlockLeavesBase; import net.minecraft.block.material.Material; -import net.minecraft.creativetab.CreativeTabs; +import net.minecraft.client.renderer.texture.IconRegister; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.item.Item; import net.minecraft.item.ItemStack; @@ -22,8 +18,10 @@ import net.minecraft.util.Icon; import net.minecraft.world.IBlockAccess; import net.minecraft.world.World; import net.minecraftforge.common.IShearable; +import tdwp_ftw.biomesop.mod_BiomesOPlenty; +import tdwp_ftw.biomesop.declarations.BOPBlocks; -public class BlockAppleLeaves extends BlockLeavesBase +public class BlockAppleLeaves extends BlockLeavesBase implements IShearable { /** * The base index in terrain.png corresponding to the fancy version of the leaf texture. This is stored so we can @@ -43,12 +41,14 @@ public class BlockAppleLeaves extends BlockLeavesBase } @Override + @SideOnly(Side.CLIENT) public void registerIcons(IconRegister par1IconRegister) { this.blockIcon[0] = par1IconRegister.registerIcon("BiomesOPlenty:appleleaves1"); this.blockIcon[1] = par1IconRegister.registerIcon("BiomesOPlenty:appleleaves2"); } + @SideOnly(Side.CLIENT) public Icon getBlockTextureFromSideAndMetadata(int par1, int par2) { return blockIcon[(!isOpaqueCube() ? 0 : 1)]; @@ -200,6 +200,7 @@ public class BlockAppleLeaves extends BlockLeavesBase /** * A randomly called display update to be able to add particles or other items for display */ + @SideOnly(Side.CLIENT) public void randomDisplayTick(World par1World, int par2, int par3, int par4, Random par5Random) { if (par1World.canLightningStrikeAt(par2, par3 + 1, par4) && !par1World.doesBlockHaveSolidTopSurface(par2, par3 - 1, par4) && par5Random.nextInt(15) == 1) @@ -266,15 +267,7 @@ public class BlockAppleLeaves extends BlockLeavesBase */ public void harvestBlock(World par1World, EntityPlayer par2EntityPlayer, int par3, int par4, int par5, int par6) { - if (!par1World.isRemote && par2EntityPlayer.getCurrentEquippedItem() != null && par2EntityPlayer.getCurrentEquippedItem().itemID == Item.shears.itemID) - { - par2EntityPlayer.addStat(StatList.mineBlockStatArray[this.blockID], 1); - this.dropBlockAsItem_do(par1World, par3, par4, par5, new ItemStack(BOPBlocks.appleLeaves.blockID, 1, par6 & 3)); - } - else - { - super.harvestBlock(par1World, par2EntityPlayer, par3, par4, par5, par6); - } + super.harvestBlock(par1World, par2EntityPlayer, par3, par4, par5, par6); } /** @@ -298,8 +291,23 @@ public class BlockAppleLeaves extends BlockLeavesBase /** * Pass true to draw this block using fancy graphics, or false for fast graphics. */ + @SideOnly(Side.CLIENT) public void setGraphicsLevel(boolean par1) { this.graphicsLevel = par1; } + + @Override + public boolean isShearable(ItemStack item, World world, int x, int y, int z) + { + return true; + } + + @Override + 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) & 3)); + return ret; + } } diff --git a/src/minecraft/tdwp_ftw/biomesop/blocks/BlockAppleLeavesFruitless.java b/src/minecraft/tdwp_ftw/biomesop/blocks/BlockAppleLeavesFruitless.java index 540e7c248..1ad859c0a 100644 --- a/src/minecraft/tdwp_ftw/biomesop/blocks/BlockAppleLeavesFruitless.java +++ b/src/minecraft/tdwp_ftw/biomesop/blocks/BlockAppleLeavesFruitless.java @@ -1,27 +1,25 @@ 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 tdwp_ftw.biomesop.declarations.BOPBlocks; - import net.minecraft.block.Block; import net.minecraft.block.BlockLeavesBase; 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.Item; import net.minecraft.item.ItemStack; -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; +import tdwp_ftw.biomesop.mod_BiomesOPlenty; +import tdwp_ftw.biomesop.declarations.BOPBlocks; +import cpw.mods.fml.relauncher.Side; +import cpw.mods.fml.relauncher.SideOnly; -public class BlockAppleLeavesFruitless extends BlockLeavesBase +public class BlockAppleLeavesFruitless extends BlockLeavesBase implements IShearable { /** * The base index in terrain.png corresponding to the fancy version of the leaf texture. This is stored so we can @@ -41,12 +39,14 @@ public class BlockAppleLeavesFruitless extends BlockLeavesBase } @Override + @SideOnly(Side.CLIENT) public void registerIcons(IconRegister par1IconRegister) { this.blockIcon[0] = par1IconRegister.registerIcon("BiomesOPlenty:appleleaves3"); this.blockIcon[1] = par1IconRegister.registerIcon("BiomesOPlenty:appleleaves4"); } + @SideOnly(Side.CLIENT) public Icon getBlockTextureFromSideAndMetadata(int par1, int par2) { return blockIcon[(!isOpaqueCube() ? 0 : 1)]; @@ -198,6 +198,7 @@ public class BlockAppleLeavesFruitless extends BlockLeavesBase /** * A randomly called display update to be able to add particles or other items for display */ + @SideOnly(Side.CLIENT) public void randomDisplayTick(World par1World, int par2, int par3, int par4, Random par5Random) { if (par1World.canLightningStrikeAt(par2, par3 + 1, par4) && !par1World.doesBlockHaveSolidTopSurface(par2, par3 - 1, par4) && par5Random.nextInt(15) == 1) @@ -264,15 +265,7 @@ public class BlockAppleLeavesFruitless extends BlockLeavesBase */ public void harvestBlock(World par1World, EntityPlayer par2EntityPlayer, int par3, int par4, int par5, int par6) { - if (!par1World.isRemote && par2EntityPlayer.getCurrentEquippedItem() != null && par2EntityPlayer.getCurrentEquippedItem().itemID == Item.shears.itemID) - { - par2EntityPlayer.addStat(StatList.mineBlockStatArray[this.blockID], 1); - this.dropBlockAsItem_do(par1World, par3, par4, par5, new ItemStack(BOPBlocks.appleLeavesFruitless.blockID, 1, par6 & 3)); - } - else - { - super.harvestBlock(par1World, par2EntityPlayer, par3, par4, par5, par6); - } + super.harvestBlock(par1World, par2EntityPlayer, par3, par4, par5, par6); } /** @@ -296,8 +289,23 @@ public class BlockAppleLeavesFruitless extends BlockLeavesBase /** * Pass true to draw this block using fancy graphics, or false for fast graphics. */ + @SideOnly(Side.CLIENT) public void setGraphicsLevel(boolean par1) { this.graphicsLevel = par1; } + + @Override + public boolean isShearable(ItemStack item, World world, int x, int y, int z) + { + return true; + } + + @Override + 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) & 3)); + return ret; + } } diff --git a/src/minecraft/tdwp_ftw/biomesop/blocks/BlockAutumnLeaves.java b/src/minecraft/tdwp_ftw/biomesop/blocks/BlockAutumnLeaves.java index d1c3c489c..a898c5b38 100644 --- a/src/minecraft/tdwp_ftw/biomesop/blocks/BlockAutumnLeaves.java +++ b/src/minecraft/tdwp_ftw/biomesop/blocks/BlockAutumnLeaves.java @@ -1,29 +1,24 @@ 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 tdwp_ftw.biomesop.declarations.BOPBlocks; - -import net.minecraft.client.renderer.texture.IconRegister; import net.minecraft.block.Block; import net.minecraft.block.BlockLeavesBase; import net.minecraft.block.material.Material; -import net.minecraft.creativetab.CreativeTabs; +import net.minecraft.client.renderer.texture.IconRegister; import net.minecraft.entity.player.EntityPlayer; -import net.minecraft.item.Item; import net.minecraft.item.ItemStack; -import net.minecraft.stats.StatList; import net.minecraft.util.Icon; -import net.minecraft.world.ColorizerFoliage; import net.minecraft.world.IBlockAccess; import net.minecraft.world.World; +import net.minecraftforge.common.IShearable; +import tdwp_ftw.biomesop.mod_BiomesOPlenty; +import tdwp_ftw.biomesop.declarations.BOPBlocks; +import cpw.mods.fml.relauncher.Side; +import cpw.mods.fml.relauncher.SideOnly; - -public class BlockAutumnLeaves extends BlockLeavesBase +public class BlockAutumnLeaves extends BlockLeavesBase implements IShearable { /** * The base index in terrain.png corresponding to the fancy version of the leaf texture. This is stored so we can @@ -43,12 +38,14 @@ public class BlockAutumnLeaves extends BlockLeavesBase } @Override + @SideOnly(Side.CLIENT) public void registerIcons(IconRegister par1IconRegister) { this.blockIcon[0] = par1IconRegister.registerIcon("BiomesOPlenty:autumnleaves1"); this.blockIcon[1] = par1IconRegister.registerIcon("BiomesOPlenty:autumnleaves2"); } + @SideOnly(Side.CLIENT) public Icon getBlockTextureFromSideAndMetadata(int par1, int par2) { return blockIcon[(!isOpaqueCube() ? 0 : 1)]; @@ -200,6 +197,7 @@ public class BlockAutumnLeaves extends BlockLeavesBase /** * A randomly called display update to be able to add particles or other items for display */ + @SideOnly(Side.CLIENT) public void randomDisplayTick(World par1World, int par2, int par3, int par4, Random par5Random) { if (par1World.canLightningStrikeAt(par2, par3 + 1, par4) && !par1World.doesBlockHaveSolidTopSurface(par2, par3 - 1, par4) && par5Random.nextInt(15) == 1) @@ -261,15 +259,7 @@ public class BlockAutumnLeaves extends BlockLeavesBase */ public void harvestBlock(World par1World, EntityPlayer par2EntityPlayer, int par3, int par4, int par5, int par6) { - if (!par1World.isRemote && par2EntityPlayer.getCurrentEquippedItem() != null && par2EntityPlayer.getCurrentEquippedItem().itemID == Item.shears.itemID) - { - par2EntityPlayer.addStat(StatList.mineBlockStatArray[this.blockID], 1); - this.dropBlockAsItem_do(par1World, par3, par4, par5, new ItemStack(BOPBlocks.autumnLeaves.blockID, 1, par6 & 3)); - } - else - { - super.harvestBlock(par1World, par2EntityPlayer, par3, par4, par5, par6); - } + super.harvestBlock(par1World, par2EntityPlayer, par3, par4, par5, par6); } /** @@ -284,13 +274,7 @@ public class BlockAutumnLeaves extends BlockLeavesBase public boolean isOpaqueCube() { return Block.leaves.isOpaqueCube(); } - - //@Override - //public int getBlockTextureFromSideAndMetadata(int side, int metadata) { - - //return blockIndexInTexture + (isOpaqueCube() ? 1 : 0); - //} - + public boolean shouldSideBeRendered(IBlockAccess par1IBlockAccess, int par2, int par3, int par4, int par5) { return true; @@ -299,8 +283,23 @@ public class BlockAutumnLeaves extends BlockLeavesBase /** * Pass true to draw this block using fancy graphics, or false for fast graphics. */ + @SideOnly(Side.CLIENT) public void setGraphicsLevel(boolean par1) { this.graphicsLevel = par1; } + + @Override + public boolean isShearable(ItemStack item, World world, int x, int y, int z) + { + return true; + } + + @Override + 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) & 3)); + return ret; + } } diff --git a/src/minecraft/tdwp_ftw/biomesop/blocks/BlockBambooLeaves.java b/src/minecraft/tdwp_ftw/biomesop/blocks/BlockBambooLeaves.java index 51bfc88f3..8eff5a630 100644 --- a/src/minecraft/tdwp_ftw/biomesop/blocks/BlockBambooLeaves.java +++ b/src/minecraft/tdwp_ftw/biomesop/blocks/BlockBambooLeaves.java @@ -1,29 +1,24 @@ 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 tdwp_ftw.biomesop.declarations.BOPBlocks; - import net.minecraft.block.Block; import net.minecraft.block.BlockLeavesBase; 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.Item; import net.minecraft.item.ItemStack; -import net.minecraft.stats.StatList; import net.minecraft.util.Icon; -import net.minecraft.world.ColorizerFoliage; import net.minecraft.world.IBlockAccess; import net.minecraft.world.World; +import net.minecraftforge.common.IShearable; +import tdwp_ftw.biomesop.mod_BiomesOPlenty; +import tdwp_ftw.biomesop.declarations.BOPBlocks; +import cpw.mods.fml.relauncher.Side; +import cpw.mods.fml.relauncher.SideOnly; - -public class BlockBambooLeaves extends BlockLeavesBase +public class BlockBambooLeaves extends BlockLeavesBase implements IShearable { /** * The base index in terrain.png corresponding to the fancy version of the leaf texture. This is stored so we can @@ -43,12 +38,14 @@ public class BlockBambooLeaves extends BlockLeavesBase } @Override + @SideOnly(Side.CLIENT) public void registerIcons(IconRegister par1IconRegister) { this.blockIcon[0] = par1IconRegister.registerIcon("BiomesOPlenty:bambooleaves1"); this.blockIcon[1] = par1IconRegister.registerIcon("BiomesOPlenty:bambooleaves2"); } + @SideOnly(Side.CLIENT) public Icon getBlockTextureFromSideAndMetadata(int par1, int par2) { return blockIcon[(!isOpaqueCube() ? 0 : 1)]; @@ -200,6 +197,7 @@ public class BlockBambooLeaves extends BlockLeavesBase /** * A randomly called display update to be able to add particles or other items for display */ + @SideOnly(Side.CLIENT) public void randomDisplayTick(World par1World, int par2, int par3, int par4, Random par5Random) { if (par1World.canLightningStrikeAt(par2, par3 + 1, par4) && !par1World.doesBlockHaveSolidTopSurface(par2, par3 - 1, par4) && par5Random.nextInt(15) == 1) @@ -261,15 +259,7 @@ public class BlockBambooLeaves extends BlockLeavesBase */ public void harvestBlock(World par1World, EntityPlayer par2EntityPlayer, int par3, int par4, int par5, int par6) { - if (!par1World.isRemote && par2EntityPlayer.getCurrentEquippedItem() != null && par2EntityPlayer.getCurrentEquippedItem().itemID == Item.shears.itemID) - { - par2EntityPlayer.addStat(StatList.mineBlockStatArray[this.blockID], 1); - this.dropBlockAsItem_do(par1World, par3, par4, par5, new ItemStack(BOPBlocks.bambooLeaves.blockID, 1, par6 & 3)); - } - else - { - super.harvestBlock(par1World, par2EntityPlayer, par3, par4, par5, par6); - } + super.harvestBlock(par1World, par2EntityPlayer, par3, par4, par5, par6); } /** @@ -284,13 +274,7 @@ public class BlockBambooLeaves extends BlockLeavesBase public boolean isOpaqueCube() { return Block.leaves.isOpaqueCube(); } - - /*@Override - public int getBlockTextureFromSideAndMetadata(int side, int metadata) { - - return blockIndexInTexture + (isOpaqueCube() ? 1 : 0); - }*/ - + public boolean shouldSideBeRendered(IBlockAccess par1IBlockAccess, int par2, int par3, int par4, int par5) { return true; @@ -299,8 +283,23 @@ public class BlockBambooLeaves extends BlockLeavesBase /** * Pass true to draw this block using fancy graphics, or false for fast graphics. */ + @SideOnly(Side.CLIENT) public void setGraphicsLevel(boolean par1) { this.graphicsLevel = par1; } + + @Override + public boolean isShearable(ItemStack item, World world, int x, int y, int z) + { + return true; + } + + @Override + 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) & 3)); + return ret; + } } diff --git a/src/minecraft/tdwp_ftw/biomesop/blocks/BlockBlueLeaves.java b/src/minecraft/tdwp_ftw/biomesop/blocks/BlockBlueLeaves.java index 63369761e..96fe12ba1 100644 --- a/src/minecraft/tdwp_ftw/biomesop/blocks/BlockBlueLeaves.java +++ b/src/minecraft/tdwp_ftw/biomesop/blocks/BlockBlueLeaves.java @@ -1,28 +1,24 @@ 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 tdwp_ftw.biomesop.declarations.BOPBlocks; - -import net.minecraft.client.renderer.texture.IconRegister; import net.minecraft.block.Block; import net.minecraft.block.BlockLeavesBase; import net.minecraft.block.material.Material; -import net.minecraft.creativetab.CreativeTabs; +import net.minecraft.client.renderer.texture.IconRegister; import net.minecraft.entity.player.EntityPlayer; -import net.minecraft.item.Item; import net.minecraft.item.ItemStack; -import net.minecraft.stats.StatList; import net.minecraft.util.Icon; -import net.minecraft.world.ColorizerFoliage; import net.minecraft.world.IBlockAccess; import net.minecraft.world.World; +import net.minecraftforge.common.IShearable; +import tdwp_ftw.biomesop.mod_BiomesOPlenty; +import tdwp_ftw.biomesop.declarations.BOPBlocks; +import cpw.mods.fml.relauncher.Side; +import cpw.mods.fml.relauncher.SideOnly; -public class BlockBlueLeaves extends BlockLeavesBase +public class BlockBlueLeaves extends BlockLeavesBase implements IShearable { /** * The base index in terrain.png corresponding to the fancy version of the leaf texture. This is stored so we can @@ -42,12 +38,14 @@ public class BlockBlueLeaves extends BlockLeavesBase } @Override + @SideOnly(Side.CLIENT) public void registerIcons(IconRegister par1IconRegister) { this.blockIcon[0] = par1IconRegister.registerIcon("BiomesOPlenty:blueleaves1"); this.blockIcon[1] = par1IconRegister.registerIcon("BiomesOPlenty:blueleaves2"); } + @SideOnly(Side.CLIENT) public Icon getBlockTextureFromSideAndMetadata(int par1, int par2) { return blockIcon[(!isOpaqueCube() ? 0 : 1)]; @@ -199,6 +197,7 @@ public class BlockBlueLeaves extends BlockLeavesBase /** * A randomly called display update to be able to add particles or other items for display */ + @SideOnly(Side.CLIENT) public void randomDisplayTick(World par1World, int par2, int par3, int par4, Random par5Random) { if (par1World.canLightningStrikeAt(par2, par3 + 1, par4) && !par1World.doesBlockHaveSolidTopSurface(par2, par3 - 1, par4) && par5Random.nextInt(15) == 1) @@ -260,15 +259,7 @@ public class BlockBlueLeaves extends BlockLeavesBase */ public void harvestBlock(World par1World, EntityPlayer par2EntityPlayer, int par3, int par4, int par5, int par6) { - if (!par1World.isRemote && par2EntityPlayer.getCurrentEquippedItem() != null && par2EntityPlayer.getCurrentEquippedItem().itemID == Item.shears.itemID) - { - par2EntityPlayer.addStat(StatList.mineBlockStatArray[this.blockID], 1); - this.dropBlockAsItem_do(par1World, par3, par4, par5, new ItemStack(BOPBlocks.blueLeaves.blockID, 1, par6 & 3)); - } - else - { - super.harvestBlock(par1World, par2EntityPlayer, par3, par4, par5, par6); - } + super.harvestBlock(par1World, par2EntityPlayer, par3, par4, par5, par6); } /** @@ -283,13 +274,7 @@ public class BlockBlueLeaves extends BlockLeavesBase public boolean isOpaqueCube() { return Block.leaves.isOpaqueCube(); } - - //@Override - //public int getBlockTextureFromSideAndMetadata(int side, int metadata) { - - //return blockIndexInTexture + (isOpaqueCube() ? 1 : 0); - //} - + public boolean shouldSideBeRendered(IBlockAccess par1IBlockAccess, int par2, int par3, int par4, int par5) { return true; @@ -298,8 +283,23 @@ public class BlockBlueLeaves extends BlockLeavesBase /** * Pass true to draw this block using fancy graphics, or false for fast graphics. */ + @SideOnly(Side.CLIENT) public void setGraphicsLevel(boolean par1) { this.graphicsLevel = par1; } + + @Override + public boolean isShearable(ItemStack item, World world, int x, int y, int z) + { + return true; + } + + @Override + 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) & 3)); + return ret; + } } diff --git a/src/minecraft/tdwp_ftw/biomesop/blocks/BlockDarkLeaves.java b/src/minecraft/tdwp_ftw/biomesop/blocks/BlockDarkLeaves.java index 8b2d30a8f..d9e1c4855 100644 --- a/src/minecraft/tdwp_ftw/biomesop/blocks/BlockDarkLeaves.java +++ b/src/minecraft/tdwp_ftw/biomesop/blocks/BlockDarkLeaves.java @@ -1,28 +1,24 @@ 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 tdwp_ftw.biomesop.declarations.BOPBlocks; - -import net.minecraft.client.renderer.texture.IconRegister; import net.minecraft.block.Block; import net.minecraft.block.BlockLeavesBase; import net.minecraft.block.material.Material; -import net.minecraft.creativetab.CreativeTabs; +import net.minecraft.client.renderer.texture.IconRegister; import net.minecraft.entity.player.EntityPlayer; -import net.minecraft.item.Item; import net.minecraft.item.ItemStack; -import net.minecraft.stats.StatList; import net.minecraft.util.Icon; -import net.minecraft.world.ColorizerFoliage; import net.minecraft.world.IBlockAccess; import net.minecraft.world.World; +import net.minecraftforge.common.IShearable; +import tdwp_ftw.biomesop.mod_BiomesOPlenty; +import tdwp_ftw.biomesop.declarations.BOPBlocks; +import cpw.mods.fml.relauncher.Side; +import cpw.mods.fml.relauncher.SideOnly; -public class BlockDarkLeaves extends BlockLeavesBase +public class BlockDarkLeaves extends BlockLeavesBase implements IShearable { /** * The base index in terrain.png corresponding to the fancy version of the leaf texture. This is stored so we can @@ -42,12 +38,14 @@ public class BlockDarkLeaves extends BlockLeavesBase } @Override + @SideOnly(Side.CLIENT) public void registerIcons(IconRegister par1IconRegister) { this.blockIcon[0] = par1IconRegister.registerIcon("BiomesOPlenty:darkleaves1"); this.blockIcon[1] = par1IconRegister.registerIcon("BiomesOPlenty:darkleaves2"); } + @SideOnly(Side.CLIENT) public Icon getBlockTextureFromSideAndMetadata(int par1, int par2) { return blockIcon[(!isOpaqueCube() ? 0 : 1)]; @@ -199,6 +197,7 @@ public class BlockDarkLeaves extends BlockLeavesBase /** * A randomly called display update to be able to add particles or other items for display */ + @SideOnly(Side.CLIENT) public void randomDisplayTick(World par1World, int par2, int par3, int par4, Random par5Random) { if (par1World.canLightningStrikeAt(par2, par3 + 1, par4) && !par1World.doesBlockHaveSolidTopSurface(par2, par3 - 1, par4) && par5Random.nextInt(15) == 1) @@ -260,15 +259,7 @@ public class BlockDarkLeaves extends BlockLeavesBase */ public void harvestBlock(World par1World, EntityPlayer par2EntityPlayer, int par3, int par4, int par5, int par6) { - if (!par1World.isRemote && par2EntityPlayer.getCurrentEquippedItem() != null && par2EntityPlayer.getCurrentEquippedItem().itemID == Item.shears.itemID) - { - par2EntityPlayer.addStat(StatList.mineBlockStatArray[this.blockID], 1); - this.dropBlockAsItem_do(par1World, par3, par4, par5, new ItemStack(BOPBlocks.darkLeaves.blockID, 1, par6 & 3)); - } - else - { - super.harvestBlock(par1World, par2EntityPlayer, par3, par4, par5, par6); - } + super.harvestBlock(par1World, par2EntityPlayer, par3, par4, par5, par6); } /** @@ -283,13 +274,7 @@ public class BlockDarkLeaves extends BlockLeavesBase public boolean isOpaqueCube() { return Block.leaves.isOpaqueCube(); } - - //@Override - //public int getBlockTextureFromSideAndMetadata(int side, int metadata) { - - //return blockIndexInTexture + (isOpaqueCube() ? 1 : 0); - //} - + public boolean shouldSideBeRendered(IBlockAccess par1IBlockAccess, int par2, int par3, int par4, int par5) { return true; @@ -298,8 +283,23 @@ public class BlockDarkLeaves extends BlockLeavesBase /** * Pass true to draw this block using fancy graphics, or false for fast graphics. */ + @SideOnly(Side.CLIENT) public void setGraphicsLevel(boolean par1) { this.graphicsLevel = par1; } + + @Override + public boolean isShearable(ItemStack item, World world, int x, int y, int z) + { + return true; + } + + @Override + 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) & 3)); + return ret; + } } diff --git a/src/minecraft/tdwp_ftw/biomesop/blocks/BlockDeadLeaves.java b/src/minecraft/tdwp_ftw/biomesop/blocks/BlockDeadLeaves.java index 8c44d49aa..3c1ff5b29 100644 --- a/src/minecraft/tdwp_ftw/biomesop/blocks/BlockDeadLeaves.java +++ b/src/minecraft/tdwp_ftw/biomesop/blocks/BlockDeadLeaves.java @@ -1,28 +1,24 @@ 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 tdwp_ftw.biomesop.declarations.BOPBlocks; - -import net.minecraft.client.renderer.texture.IconRegister; import net.minecraft.block.Block; import net.minecraft.block.BlockLeavesBase; import net.minecraft.block.material.Material; -import net.minecraft.creativetab.CreativeTabs; +import net.minecraft.client.renderer.texture.IconRegister; import net.minecraft.entity.player.EntityPlayer; -import net.minecraft.item.Item; import net.minecraft.item.ItemStack; -import net.minecraft.stats.StatList; import net.minecraft.util.Icon; -import net.minecraft.world.ColorizerFoliage; import net.minecraft.world.IBlockAccess; import net.minecraft.world.World; +import net.minecraftforge.common.IShearable; +import tdwp_ftw.biomesop.mod_BiomesOPlenty; +import tdwp_ftw.biomesop.declarations.BOPBlocks; +import cpw.mods.fml.relauncher.Side; +import cpw.mods.fml.relauncher.SideOnly; -public class BlockDeadLeaves extends BlockLeavesBase +public class BlockDeadLeaves extends BlockLeavesBase implements IShearable { /** * The base index in terrain.png corresponding to the fancy version of the leaf texture. This is stored so we can @@ -42,12 +38,14 @@ public class BlockDeadLeaves extends BlockLeavesBase } @Override + @SideOnly(Side.CLIENT) public void registerIcons(IconRegister par1IconRegister) { this.blockIcon[0] = par1IconRegister.registerIcon("BiomesOPlenty:deadleaves1"); this.blockIcon[1] = par1IconRegister.registerIcon("BiomesOPlenty:deadleaves2"); } + @SideOnly(Side.CLIENT) public Icon getBlockTextureFromSideAndMetadata(int par1, int par2) { return blockIcon[(!isOpaqueCube() ? 0 : 1)]; @@ -199,6 +197,7 @@ public class BlockDeadLeaves extends BlockLeavesBase /** * A randomly called display update to be able to add particles or other items for display */ + @SideOnly(Side.CLIENT) public void randomDisplayTick(World par1World, int par2, int par3, int par4, Random par5Random) { if (par1World.canLightningStrikeAt(par2, par3 + 1, par4) && !par1World.doesBlockHaveSolidTopSurface(par2, par3 - 1, par4) && par5Random.nextInt(15) == 1) @@ -260,15 +259,7 @@ public class BlockDeadLeaves extends BlockLeavesBase */ public void harvestBlock(World par1World, EntityPlayer par2EntityPlayer, int par3, int par4, int par5, int par6) { - if (!par1World.isRemote && par2EntityPlayer.getCurrentEquippedItem() != null && par2EntityPlayer.getCurrentEquippedItem().itemID == Item.shears.itemID) - { - par2EntityPlayer.addStat(StatList.mineBlockStatArray[this.blockID], 1); - this.dropBlockAsItem_do(par1World, par3, par4, par5, new ItemStack(BOPBlocks.deadLeaves.blockID, 1, par6 & 3)); - } - else - { - super.harvestBlock(par1World, par2EntityPlayer, par3, par4, par5, par6); - } + super.harvestBlock(par1World, par2EntityPlayer, par3, par4, par5, par6); } /** @@ -283,13 +274,7 @@ public class BlockDeadLeaves extends BlockLeavesBase public boolean isOpaqueCube() { return Block.leaves.isOpaqueCube(); } - - //@Override - //public int getBlockTextureFromSideAndMetadata(int side, int metadata) { - - //return blockIndexInTexture + (isOpaqueCube() ? 1 : 0); - //} - + public boolean shouldSideBeRendered(IBlockAccess par1IBlockAccess, int par2, int par3, int par4, int par5) { return true; @@ -298,8 +283,23 @@ public class BlockDeadLeaves extends BlockLeavesBase /** * Pass true to draw this block using fancy graphics, or false for fast graphics. */ + @SideOnly(Side.CLIENT) public void setGraphicsLevel(boolean par1) { this.graphicsLevel = par1; } + + @Override + public boolean isShearable(ItemStack item, World world, int x, int y, int z) + { + return true; + } + + @Override + 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) & 3)); + return ret; + } } diff --git a/src/minecraft/tdwp_ftw/biomesop/blocks/BlockFirLeaves.java b/src/minecraft/tdwp_ftw/biomesop/blocks/BlockFirLeaves.java index ed4aafec9..2c1c09fac 100644 --- a/src/minecraft/tdwp_ftw/biomesop/blocks/BlockFirLeaves.java +++ b/src/minecraft/tdwp_ftw/biomesop/blocks/BlockFirLeaves.java @@ -1,27 +1,24 @@ 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 tdwp_ftw.biomesop.declarations.BOPBlocks; - import net.minecraft.block.Block; import net.minecraft.block.BlockLeavesBase; 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.Item; import net.minecraft.item.ItemStack; -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; +import tdwp_ftw.biomesop.mod_BiomesOPlenty; +import tdwp_ftw.biomesop.declarations.BOPBlocks; +import cpw.mods.fml.relauncher.Side; +import cpw.mods.fml.relauncher.SideOnly; -public class BlockFirLeaves extends BlockLeavesBase +public class BlockFirLeaves extends BlockLeavesBase implements IShearable { /** * The base index in terrain.png corresponding to the fancy version of the leaf texture. This is stored so we can @@ -41,12 +38,14 @@ public class BlockFirLeaves extends BlockLeavesBase } @Override + @SideOnly(Side.CLIENT) public void registerIcons(IconRegister par1IconRegister) { this.blockIcon[0] = par1IconRegister.registerIcon("BiomesOPlenty:firleaves1"); this.blockIcon[1] = par1IconRegister.registerIcon("BiomesOPlenty:firleaves2"); } + @SideOnly(Side.CLIENT) public Icon getBlockTextureFromSideAndMetadata(int par1, int par2) { return blockIcon[(!isOpaqueCube() ? 0 : 1)]; @@ -198,6 +197,7 @@ public class BlockFirLeaves extends BlockLeavesBase /** * A randomly called display update to be able to add particles or other items for display */ + @SideOnly(Side.CLIENT) public void randomDisplayTick(World par1World, int par2, int par3, int par4, Random par5Random) { if (par1World.canLightningStrikeAt(par2, par3 + 1, par4) && !par1World.doesBlockHaveSolidTopSurface(par2, par3 - 1, par4) && par5Random.nextInt(15) == 1) @@ -259,15 +259,7 @@ public class BlockFirLeaves extends BlockLeavesBase */ public void harvestBlock(World par1World, EntityPlayer par2EntityPlayer, int par3, int par4, int par5, int par6) { - if (!par1World.isRemote && par2EntityPlayer.getCurrentEquippedItem() != null && par2EntityPlayer.getCurrentEquippedItem().itemID == Item.shears.itemID) - { - par2EntityPlayer.addStat(StatList.mineBlockStatArray[this.blockID], 1); - this.dropBlockAsItem_do(par1World, par3, par4, par5, new ItemStack(BOPBlocks.firLeaves.blockID, 1, par6 & 3)); - } - else - { - super.harvestBlock(par1World, par2EntityPlayer, par3, par4, par5, par6); - } + super.harvestBlock(par1World, par2EntityPlayer, par3, par4, par5, par6); } /** @@ -282,13 +274,7 @@ public class BlockFirLeaves extends BlockLeavesBase public boolean isOpaqueCube() { return Block.leaves.isOpaqueCube(); } - - @Override - //public int getBlockTextureFromSideAndMetadata(int side, int metadata) { - // - // return blockIndexInTexture + (isOpaqueCube() ? 1 : 0); - //} - + public boolean shouldSideBeRendered(IBlockAccess par1IBlockAccess, int par2, int par3, int par4, int par5) { return true; @@ -297,8 +283,23 @@ public class BlockFirLeaves extends BlockLeavesBase /** * Pass true to draw this block using fancy graphics, or false for fast graphics. */ + @SideOnly(Side.CLIENT) public void setGraphicsLevel(boolean par1) { this.graphicsLevel = par1; } + + @Override + public boolean isShearable(ItemStack item, World world, int x, int y, int z) + { + return true; + } + + @Override + 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) & 3)); + return ret; + } } diff --git a/src/minecraft/tdwp_ftw/biomesop/blocks/BlockHolyLeaves.java b/src/minecraft/tdwp_ftw/biomesop/blocks/BlockHolyLeaves.java index f216420d2..23c315256 100644 --- a/src/minecraft/tdwp_ftw/biomesop/blocks/BlockHolyLeaves.java +++ b/src/minecraft/tdwp_ftw/biomesop/blocks/BlockHolyLeaves.java @@ -1,28 +1,24 @@ 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 tdwp_ftw.biomesop.declarations.BOPBlocks; - import net.minecraft.block.Block; import net.minecraft.block.BlockLeavesBase; 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.Item; import net.minecraft.item.ItemStack; -import net.minecraft.stats.StatList; import net.minecraft.util.Icon; -import net.minecraft.world.ColorizerFoliage; import net.minecraft.world.IBlockAccess; import net.minecraft.world.World; +import net.minecraftforge.common.IShearable; +import tdwp_ftw.biomesop.mod_BiomesOPlenty; +import tdwp_ftw.biomesop.declarations.BOPBlocks; +import cpw.mods.fml.relauncher.Side; +import cpw.mods.fml.relauncher.SideOnly; -public class BlockHolyLeaves extends BlockLeavesBase +public class BlockHolyLeaves extends BlockLeavesBase implements IShearable { /** * The base index in terrain.png corresponding to the fancy version of the leaf texture. This is stored so we can @@ -42,12 +38,14 @@ public class BlockHolyLeaves extends BlockLeavesBase } @Override + @SideOnly(Side.CLIENT) public void registerIcons(IconRegister par1IconRegister) { this.blockIcon[0] = par1IconRegister.registerIcon("BiomesOPlenty:holyleaves1"); this.blockIcon[1] = par1IconRegister.registerIcon("BiomesOPlenty:holyleaves2"); } + @SideOnly(Side.CLIENT) public Icon getBlockTextureFromSideAndMetadata(int par1, int par2) { return blockIcon[(!isOpaqueCube() ? 0 : 1)]; @@ -198,6 +196,7 @@ public class BlockHolyLeaves extends BlockLeavesBase /** * A randomly called display update to be able to add particles or other items for display */ + @SideOnly(Side.CLIENT) public void randomDisplayTick(World par1World, int par2, int par3, int par4, Random par5Random) { if (par1World.canLightningStrikeAt(par2, par3 + 1, par4) && !par1World.doesBlockHaveSolidTopSurface(par2, par3 - 1, par4) && par5Random.nextInt(15) == 1) @@ -259,15 +258,7 @@ public class BlockHolyLeaves extends BlockLeavesBase */ public void harvestBlock(World par1World, EntityPlayer par2EntityPlayer, int par3, int par4, int par5, int par6) { - if (!par1World.isRemote && par2EntityPlayer.getCurrentEquippedItem() != null && par2EntityPlayer.getCurrentEquippedItem().itemID == Item.shears.itemID) - { - par2EntityPlayer.addStat(StatList.mineBlockStatArray[this.blockID], 1); - this.dropBlockAsItem_do(par1World, par3, par4, par5, new ItemStack(BOPBlocks.holyLeaves.blockID, 1, par6 & 3)); - } - else - { - super.harvestBlock(par1World, par2EntityPlayer, par3, par4, par5, par6); - } + super.harvestBlock(par1World, par2EntityPlayer, par3, par4, par5, par6); } /** @@ -282,13 +273,7 @@ public class BlockHolyLeaves extends BlockLeavesBase public boolean isOpaqueCube() { return Block.leaves.isOpaqueCube(); } - - /*@Override - public int getBlockTextureFromSideAndMetadata(int side, int metadata) { - - return blockIndexInTexture + (isOpaqueCube() ? 1 : 0); - }*/ - + public boolean shouldSideBeRendered(IBlockAccess par1IBlockAccess, int par2, int par3, int par4, int par5) { return true; @@ -297,8 +282,23 @@ public class BlockHolyLeaves extends BlockLeavesBase /** * Pass true to draw this block using fancy graphics, or false for fast graphics. */ + @SideOnly(Side.CLIENT) public void setGraphicsLevel(boolean par1) { this.graphicsLevel = par1; } + + @Override + public boolean isShearable(ItemStack item, World world, int x, int y, int z) + { + return true; + } + + @Override + 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) & 3)); + return ret; + } } diff --git a/src/minecraft/tdwp_ftw/biomesop/blocks/BlockMangroveLeaves.java b/src/minecraft/tdwp_ftw/biomesop/blocks/BlockMangroveLeaves.java index 2a6f8d79e..51eea5f75 100644 --- a/src/minecraft/tdwp_ftw/biomesop/blocks/BlockMangroveLeaves.java +++ b/src/minecraft/tdwp_ftw/biomesop/blocks/BlockMangroveLeaves.java @@ -1,28 +1,25 @@ 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 tdwp_ftw.biomesop.declarations.BOPBlocks; - import net.minecraft.block.Block; import net.minecraft.block.BlockLeavesBase; 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.Item; import net.minecraft.item.ItemStack; -import net.minecraft.stats.StatList; import net.minecraft.util.Icon; import net.minecraft.world.ColorizerFoliage; import net.minecraft.world.IBlockAccess; import net.minecraft.world.World; +import net.minecraftforge.common.IShearable; +import tdwp_ftw.biomesop.mod_BiomesOPlenty; +import tdwp_ftw.biomesop.declarations.BOPBlocks; +import cpw.mods.fml.relauncher.Side; +import cpw.mods.fml.relauncher.SideOnly; -public class BlockMangroveLeaves extends BlockLeavesBase +public class BlockMangroveLeaves extends BlockLeavesBase implements IShearable { /** * The base index in terrain.png corresponding to the fancy version of the leaf texture. This is stored so we can @@ -42,17 +39,20 @@ public class BlockMangroveLeaves extends BlockLeavesBase } @Override + @SideOnly(Side.CLIENT) public void registerIcons(IconRegister par1IconRegister) { this.blockIcon[0] = par1IconRegister.registerIcon("BiomesOPlenty:mangroveleaves1"); this.blockIcon[1] = par1IconRegister.registerIcon("BiomesOPlenty:mangroveleaves2"); } + @SideOnly(Side.CLIENT) public Icon getBlockTextureFromSideAndMetadata(int par1, int par2) { return blockIcon[(!isOpaqueCube() ? 0 : 1)]; } + @SideOnly(Side.CLIENT) public int getBlockColor() { double var1 = 0.5D; @@ -63,6 +63,7 @@ public class BlockMangroveLeaves extends BlockLeavesBase /** * Returns the color this block should be rendered. Used by leaves. */ + @SideOnly(Side.CLIENT) public int getRenderColor(int par1) { return (par1 & 3) == 1 ? ColorizerFoliage.getFoliageColorPine() : ((par1 & 3) == 2 ? ColorizerFoliage.getFoliageColorBirch() : ColorizerFoliage.getFoliageColorBasic()); @@ -72,6 +73,7 @@ public class BlockMangroveLeaves extends BlockLeavesBase * Returns a integer with hex for 0xrrggbb with this color multiplied against the blocks color. Note only called * when first determining what to render. */ + @SideOnly(Side.CLIENT) public int colorMultiplier(IBlockAccess par1IBlockAccess, int par2, int par3, int par4) { int var6 = 0; @@ -238,6 +240,7 @@ public class BlockMangroveLeaves extends BlockLeavesBase /** * A randomly called display update to be able to add particles or other items for display */ + @SideOnly(Side.CLIENT) public void randomDisplayTick(World par1World, int par2, int par3, int par4, Random par5Random) { if (par1World.canLightningStrikeAt(par2, par3 + 1, par4) && !par1World.doesBlockHaveSolidTopSurface(par2, par3 - 1, par4) && par5Random.nextInt(15) == 1) @@ -299,15 +302,7 @@ public class BlockMangroveLeaves extends BlockLeavesBase */ public void harvestBlock(World par1World, EntityPlayer par2EntityPlayer, int par3, int par4, int par5, int par6) { - if (!par1World.isRemote && par2EntityPlayer.getCurrentEquippedItem() != null && par2EntityPlayer.getCurrentEquippedItem().itemID == Item.shears.itemID) - { - par2EntityPlayer.addStat(StatList.mineBlockStatArray[this.blockID], 1); - this.dropBlockAsItem_do(par1World, par3, par4, par5, new ItemStack(BOPBlocks.mangroveLeaves.blockID, 1, par6 & 3)); - } - else - { super.harvestBlock(par1World, par2EntityPlayer, par3, par4, par5, par6); - } } /** @@ -322,13 +317,7 @@ public class BlockMangroveLeaves extends BlockLeavesBase public boolean isOpaqueCube() { return Block.leaves.isOpaqueCube(); } - - /*@Override - public int getBlockTextureFromSideAndMetadata(int side, int metadata) { - - return blockIndexInTexture + (isOpaqueCube() ? 1 : 0); - }*/ - + public boolean shouldSideBeRendered(IBlockAccess par1IBlockAccess, int par2, int par3, int par4, int par5) { return true; @@ -337,8 +326,23 @@ public class BlockMangroveLeaves extends BlockLeavesBase /** * Pass true to draw this block using fancy graphics, or false for fast graphics. */ + @SideOnly(Side.CLIENT) public void setGraphicsLevel(boolean par1) { this.graphicsLevel = par1; } + + @Override + public boolean isShearable(ItemStack item, World world, int x, int y, int z) + { + return true; + } + + @Override + 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) & 3)); + return ret; + } } diff --git a/src/minecraft/tdwp_ftw/biomesop/blocks/BlockOrangeLeaves.java b/src/minecraft/tdwp_ftw/biomesop/blocks/BlockOrangeLeaves.java index 19c3dae0a..460491c5b 100644 --- a/src/minecraft/tdwp_ftw/biomesop/blocks/BlockOrangeLeaves.java +++ b/src/minecraft/tdwp_ftw/biomesop/blocks/BlockOrangeLeaves.java @@ -1,27 +1,25 @@ 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 tdwp_ftw.biomesop.declarations.BOPBlocks; - import net.minecraft.block.Block; import net.minecraft.block.BlockLeavesBase; 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.Item; import net.minecraft.item.ItemStack; -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; +import tdwp_ftw.biomesop.mod_BiomesOPlenty; +import tdwp_ftw.biomesop.declarations.BOPBlocks; +import cpw.mods.fml.relauncher.Side; +import cpw.mods.fml.relauncher.SideOnly; -public class BlockOrangeLeaves extends BlockLeavesBase +public class BlockOrangeLeaves extends BlockLeavesBase implements IShearable { /** * The base index in terrain.png corresponding to the fancy version of the leaf texture. This is stored so we can @@ -41,12 +39,14 @@ public class BlockOrangeLeaves extends BlockLeavesBase } @Override + @SideOnly(Side.CLIENT) public void registerIcons(IconRegister par1IconRegister) { this.blockIcon[0] = par1IconRegister.registerIcon("BiomesOPlenty:orangeleaves1"); this.blockIcon[1] = par1IconRegister.registerIcon("BiomesOPlenty:orangeleaves2"); } + @SideOnly(Side.CLIENT) public Icon getBlockTextureFromSideAndMetadata(int par1, int par2) { return blockIcon[(!isOpaqueCube() ? 0 : 1)]; @@ -198,6 +198,7 @@ public class BlockOrangeLeaves extends BlockLeavesBase /** * A randomly called display update to be able to add particles or other items for display */ + @SideOnly(Side.CLIENT) public void randomDisplayTick(World par1World, int par2, int par3, int par4, Random par5Random) { if (par1World.canLightningStrikeAt(par2, par3 + 1, par4) && !par1World.doesBlockHaveSolidTopSurface(par2, par3 - 1, par4) && par5Random.nextInt(15) == 1) @@ -264,15 +265,7 @@ public class BlockOrangeLeaves extends BlockLeavesBase */ public void harvestBlock(World par1World, EntityPlayer par2EntityPlayer, int par3, int par4, int par5, int par6) { - if (!par1World.isRemote && par2EntityPlayer.getCurrentEquippedItem() != null && par2EntityPlayer.getCurrentEquippedItem().itemID == Item.shears.itemID) - { - par2EntityPlayer.addStat(StatList.mineBlockStatArray[this.blockID], 1); - this.dropBlockAsItem_do(par1World, par3, par4, par5, new ItemStack(BOPBlocks.orangeLeaves.blockID, 1, par6 & 3)); - } - else - { - super.harvestBlock(par1World, par2EntityPlayer, par3, par4, par5, par6); - } + super.harvestBlock(par1World, par2EntityPlayer, par3, par4, par5, par6); } /** @@ -287,13 +280,7 @@ public class BlockOrangeLeaves extends BlockLeavesBase public boolean isOpaqueCube() { return Block.leaves.isOpaqueCube(); } - - /*@Override - public int getBlockTextureFromSideAndMetadata(int side, int metadata) { - - return blockIndexInTexture + (isOpaqueCube() ? 1 : 0); - }*/ - + public boolean shouldSideBeRendered(IBlockAccess par1IBlockAccess, int par2, int par3, int par4, int par5) { return true; @@ -302,8 +289,23 @@ public class BlockOrangeLeaves extends BlockLeavesBase /** * Pass true to draw this block using fancy graphics, or false for fast graphics. */ + @SideOnly(Side.CLIENT) public void setGraphicsLevel(boolean par1) { this.graphicsLevel = par1; } + + @Override + public boolean isShearable(ItemStack item, World world, int x, int y, int z) + { + return true; + } + + @Override + 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) & 3)); + return ret; + } } diff --git a/src/minecraft/tdwp_ftw/biomesop/blocks/BlockOriginLeaves.java b/src/minecraft/tdwp_ftw/biomesop/blocks/BlockOriginLeaves.java index 8c4365538..a9560ea7b 100644 --- a/src/minecraft/tdwp_ftw/biomesop/blocks/BlockOriginLeaves.java +++ b/src/minecraft/tdwp_ftw/biomesop/blocks/BlockOriginLeaves.java @@ -1,24 +1,24 @@ package tdwp_ftw.biomesop.blocks; +import java.util.ArrayList; import java.util.Random; -import tdwp_ftw.biomesop.mod_BiomesOPlenty; -import tdwp_ftw.biomesop.declarations.BOPBlocks; - import net.minecraft.block.Block; import net.minecraft.block.BlockLeavesBase; 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.Item; import net.minecraft.item.ItemStack; -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; +import tdwp_ftw.biomesop.mod_BiomesOPlenty; +import tdwp_ftw.biomesop.declarations.BOPBlocks; +import cpw.mods.fml.relauncher.Side; +import cpw.mods.fml.relauncher.SideOnly; -public class BlockOriginLeaves extends BlockLeavesBase +public class BlockOriginLeaves extends BlockLeavesBase implements IShearable { /** * The base index in terrain.png corresponding to the fancy version of the leaf texture. This is stored so we can @@ -38,12 +38,14 @@ public class BlockOriginLeaves extends BlockLeavesBase } @Override + @SideOnly(Side.CLIENT) public void registerIcons(IconRegister par1IconRegister) { this.blockIcon[0] = par1IconRegister.registerIcon("BiomesOPlenty:originleaves1"); this.blockIcon[1] = par1IconRegister.registerIcon("BiomesOPlenty:originleaves2"); } + @SideOnly(Side.CLIENT) public Icon getBlockTextureFromSideAndMetadata(int par1, int par2) { return blockIcon[(!isOpaqueCube() ? 0 : 1)]; @@ -195,6 +197,7 @@ public class BlockOriginLeaves extends BlockLeavesBase /** * A randomly called display update to be able to add particles or other items for display */ + @SideOnly(Side.CLIENT) public void randomDisplayTick(World par1World, int par2, int par3, int par4, Random par5Random) { if (par1World.canLightningStrikeAt(par2, par3 + 1, par4) && !par1World.doesBlockHaveSolidTopSurface(par2, par3 - 1, par4) && par5Random.nextInt(15) == 1) @@ -256,15 +259,7 @@ public class BlockOriginLeaves extends BlockLeavesBase */ public void harvestBlock(World par1World, EntityPlayer par2EntityPlayer, int par3, int par4, int par5, int par6) { - if (!par1World.isRemote && par2EntityPlayer.getCurrentEquippedItem() != null && par2EntityPlayer.getCurrentEquippedItem().itemID == Item.shears.itemID) - { - par2EntityPlayer.addStat(StatList.mineBlockStatArray[this.blockID], 1); - this.dropBlockAsItem_do(par1World, par3, par4, par5, new ItemStack(BOPBlocks.originLeaves.blockID, 1, par6 & 3)); - } - else - { super.harvestBlock(par1World, par2EntityPlayer, par3, par4, par5, par6); - } } /** @@ -279,13 +274,7 @@ public class BlockOriginLeaves extends BlockLeavesBase public boolean isOpaqueCube() { return Block.leaves.isOpaqueCube(); } - - /*@Override - public int getBlockTextureFromSideAndMetadata(int side, int metadata) { - - return blockIndexInTexture + (isOpaqueCube() ? 1 : 0); - }*/ - + public boolean shouldSideBeRendered(IBlockAccess par1IBlockAccess, int par2, int par3, int par4, int par5) { return true; @@ -294,8 +283,23 @@ public class BlockOriginLeaves extends BlockLeavesBase /** * Pass true to draw this block using fancy graphics, or false for fast graphics. */ + @SideOnly(Side.CLIENT) public void setGraphicsLevel(boolean par1) { this.graphicsLevel = par1; } + + @Override + public boolean isShearable(ItemStack item, World world, int x, int y, int z) + { + return true; + } + + @Override + 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) & 3)); + return ret; + } } diff --git a/src/minecraft/tdwp_ftw/biomesop/blocks/BlockPalmLeaves.java b/src/minecraft/tdwp_ftw/biomesop/blocks/BlockPalmLeaves.java index d256fb9d0..07a46ea07 100644 --- a/src/minecraft/tdwp_ftw/biomesop/blocks/BlockPalmLeaves.java +++ b/src/minecraft/tdwp_ftw/biomesop/blocks/BlockPalmLeaves.java @@ -1,28 +1,25 @@ 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 tdwp_ftw.biomesop.declarations.BOPBlocks; - import net.minecraft.block.Block; import net.minecraft.block.BlockLeavesBase; 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.Item; import net.minecraft.item.ItemStack; -import net.minecraft.stats.StatList; import net.minecraft.util.Icon; import net.minecraft.world.ColorizerFoliage; import net.minecraft.world.IBlockAccess; import net.minecraft.world.World; +import net.minecraftforge.common.IShearable; +import tdwp_ftw.biomesop.mod_BiomesOPlenty; +import tdwp_ftw.biomesop.declarations.BOPBlocks; +import cpw.mods.fml.relauncher.Side; +import cpw.mods.fml.relauncher.SideOnly; -public class BlockPalmLeaves extends BlockLeavesBase +public class BlockPalmLeaves extends BlockLeavesBase implements IShearable { /** * The base index in terrain.png corresponding to the fancy version of the leaf texture. This is stored so we can @@ -42,17 +39,20 @@ public class BlockPalmLeaves extends BlockLeavesBase } @Override + @SideOnly(Side.CLIENT) public void registerIcons(IconRegister par1IconRegister) { this.blockIcon[0] = par1IconRegister.registerIcon("BiomesOPlenty:palmleaves1"); this.blockIcon[1] = par1IconRegister.registerIcon("BiomesOPlenty:palmleaves2"); } + @SideOnly(Side.CLIENT) public Icon getBlockTextureFromSideAndMetadata(int par1, int par2) { return blockIcon[(!isOpaqueCube() ? 0 : 1)]; } + @SideOnly(Side.CLIENT) public int getBlockColor() { double var1 = 0.5D; @@ -63,6 +63,7 @@ public class BlockPalmLeaves extends BlockLeavesBase /** * Returns the color this block should be rendered. Used by leaves. */ + @SideOnly(Side.CLIENT) public int getRenderColor(int par1) { return (par1 & 3) == 1 ? ColorizerFoliage.getFoliageColorPine() : ((par1 & 3) == 2 ? ColorizerFoliage.getFoliageColorBirch() : ColorizerFoliage.getFoliageColorBasic()); @@ -72,6 +73,7 @@ public class BlockPalmLeaves extends BlockLeavesBase * Returns a integer with hex for 0xrrggbb with this color multiplied against the blocks color. Note only called * when first determining what to render. */ + @SideOnly(Side.CLIENT) public int colorMultiplier(IBlockAccess par1IBlockAccess, int par2, int par3, int par4) { int var6 = 0; @@ -238,6 +240,7 @@ public class BlockPalmLeaves extends BlockLeavesBase /** * A randomly called display update to be able to add particles or other items for display */ + @SideOnly(Side.CLIENT) public void randomDisplayTick(World par1World, int par2, int par3, int par4, Random par5Random) { if (par1World.canLightningStrikeAt(par2, par3 + 1, par4) && !par1World.doesBlockHaveSolidTopSurface(par2, par3 - 1, par4) && par5Random.nextInt(15) == 1) @@ -299,15 +302,7 @@ public class BlockPalmLeaves extends BlockLeavesBase */ public void harvestBlock(World par1World, EntityPlayer par2EntityPlayer, int par3, int par4, int par5, int par6) { - if (!par1World.isRemote && par2EntityPlayer.getCurrentEquippedItem() != null && par2EntityPlayer.getCurrentEquippedItem().itemID == Item.shears.itemID) - { - par2EntityPlayer.addStat(StatList.mineBlockStatArray[this.blockID], 1); - this.dropBlockAsItem_do(par1World, par3, par4, par5, new ItemStack(BOPBlocks.palmLeaves.blockID, 1, par6 & 3)); - } - else - { super.harvestBlock(par1World, par2EntityPlayer, par3, par4, par5, par6); - } } /** @@ -322,13 +317,7 @@ public class BlockPalmLeaves extends BlockLeavesBase public boolean isOpaqueCube() { return Block.leaves.isOpaqueCube(); } - - /*@Override - public int getBlockTextureFromSideAndMetadata(int side, int metadata) { - - return blockIndexInTexture + (isOpaqueCube() ? 1 : 0); - }*/ - + public boolean shouldSideBeRendered(IBlockAccess par1IBlockAccess, int par2, int par3, int par4, int par5) { return true; @@ -337,8 +326,23 @@ public class BlockPalmLeaves extends BlockLeavesBase /** * Pass true to draw this block using fancy graphics, or false for fast graphics. */ + @SideOnly(Side.CLIENT) public void setGraphicsLevel(boolean par1) { this.graphicsLevel = par1; } + + @Override + public boolean isShearable(ItemStack item, World world, int x, int y, int z) + { + return true; + } + + @Override + 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) & 3)); + return ret; + } } diff --git a/src/minecraft/tdwp_ftw/biomesop/blocks/BlockPinkLeaves.java b/src/minecraft/tdwp_ftw/biomesop/blocks/BlockPinkLeaves.java index e38895e02..f3d201046 100644 --- a/src/minecraft/tdwp_ftw/biomesop/blocks/BlockPinkLeaves.java +++ b/src/minecraft/tdwp_ftw/biomesop/blocks/BlockPinkLeaves.java @@ -1,27 +1,24 @@ 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 tdwp_ftw.biomesop.declarations.BOPBlocks; - import net.minecraft.block.Block; import net.minecraft.block.BlockLeavesBase; 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.Item; import net.minecraft.item.ItemStack; -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; +import tdwp_ftw.biomesop.mod_BiomesOPlenty; +import tdwp_ftw.biomesop.declarations.BOPBlocks; +import cpw.mods.fml.relauncher.Side; +import cpw.mods.fml.relauncher.SideOnly; -public class BlockPinkLeaves extends BlockLeavesBase +public class BlockPinkLeaves extends BlockLeavesBase implements IShearable { /** * The base index in terrain.png corresponding to the fancy version of the leaf texture. This is stored so we can @@ -41,12 +38,14 @@ public class BlockPinkLeaves extends BlockLeavesBase } @Override + @SideOnly(Side.CLIENT) public void registerIcons(IconRegister par1IconRegister) { this.blockIcon[0] = par1IconRegister.registerIcon("BiomesOPlenty:pinkleaves1"); this.blockIcon[1] = par1IconRegister.registerIcon("BiomesOPlenty:pinkleaves2"); } + @SideOnly(Side.CLIENT) public Icon getBlockTextureFromSideAndMetadata(int par1, int par2) { return blockIcon[(!isOpaqueCube() ? 0 : 1)]; @@ -198,6 +197,7 @@ public class BlockPinkLeaves extends BlockLeavesBase /** * A randomly called display update to be able to add particles or other items for display */ + @SideOnly(Side.CLIENT) public void randomDisplayTick(World par1World, int par2, int par3, int par4, Random par5Random) { if (par1World.canLightningStrikeAt(par2, par3 + 1, par4) && !par1World.doesBlockHaveSolidTopSurface(par2, par3 - 1, par4) && par5Random.nextInt(15) == 1) @@ -259,15 +259,7 @@ public class BlockPinkLeaves extends BlockLeavesBase */ public void harvestBlock(World par1World, EntityPlayer par2EntityPlayer, int par3, int par4, int par5, int par6) { - if (!par1World.isRemote && par2EntityPlayer.getCurrentEquippedItem() != null && par2EntityPlayer.getCurrentEquippedItem().itemID == Item.shears.itemID) - { - par2EntityPlayer.addStat(StatList.mineBlockStatArray[this.blockID], 1); - this.dropBlockAsItem_do(par1World, par3, par4, par5, new ItemStack(BOPBlocks.pinkLeaves.blockID, 1, par6 & 3)); - } - else - { super.harvestBlock(par1World, par2EntityPlayer, par3, par4, par5, par6); - } } /** @@ -282,13 +274,7 @@ public class BlockPinkLeaves extends BlockLeavesBase public boolean isOpaqueCube() { return Block.leaves.isOpaqueCube(); } - - /*@Override - public int getBlockTextureFromSideAndMetadata(int side, int metadata) { - - return blockIndexInTexture + (isOpaqueCube() ? 1 : 0); - }*/ - + public boolean shouldSideBeRendered(IBlockAccess par1IBlockAccess, int par2, int par3, int par4, int par5) { return true; @@ -297,8 +283,23 @@ public class BlockPinkLeaves extends BlockLeavesBase /** * Pass true to draw this block using fancy graphics, or false for fast graphics. */ + @SideOnly(Side.CLIENT) public void setGraphicsLevel(boolean par1) { this.graphicsLevel = par1; } + + @Override + public boolean isShearable(ItemStack item, World world, int x, int y, int z) + { + return true; + } + + @Override + 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) & 3)); + return ret; + } } diff --git a/src/minecraft/tdwp_ftw/biomesop/blocks/BlockRedLeaves.java b/src/minecraft/tdwp_ftw/biomesop/blocks/BlockRedLeaves.java index d5478e169..af5fe4cfe 100644 --- a/src/minecraft/tdwp_ftw/biomesop/blocks/BlockRedLeaves.java +++ b/src/minecraft/tdwp_ftw/biomesop/blocks/BlockRedLeaves.java @@ -1,27 +1,24 @@ 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 tdwp_ftw.biomesop.declarations.BOPBlocks; - import net.minecraft.block.Block; import net.minecraft.block.BlockLeavesBase; 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.Item; import net.minecraft.item.ItemStack; -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; +import tdwp_ftw.biomesop.mod_BiomesOPlenty; +import tdwp_ftw.biomesop.declarations.BOPBlocks; +import cpw.mods.fml.relauncher.Side; +import cpw.mods.fml.relauncher.SideOnly; -public class BlockRedLeaves extends BlockLeavesBase +public class BlockRedLeaves extends BlockLeavesBase implements IShearable { /** * The base index in terrain.png corresponding to the fancy version of the leaf texture. This is stored so we can @@ -41,12 +38,14 @@ public class BlockRedLeaves extends BlockLeavesBase } @Override + @SideOnly(Side.CLIENT) public void registerIcons(IconRegister par1IconRegister) { this.blockIcon[0] = par1IconRegister.registerIcon("BiomesOPlenty:redleaves1"); this.blockIcon[1] = par1IconRegister.registerIcon("BiomesOPlenty:redleaves2"); } + @SideOnly(Side.CLIENT) public Icon getBlockTextureFromSideAndMetadata(int par1, int par2) { return blockIcon[(!isOpaqueCube() ? 0 : 1)]; @@ -198,6 +197,7 @@ public class BlockRedLeaves extends BlockLeavesBase /** * A randomly called display update to be able to add particles or other items for display */ + @SideOnly(Side.CLIENT) public void randomDisplayTick(World par1World, int par2, int par3, int par4, Random par5Random) { if (par1World.canLightningStrikeAt(par2, par3 + 1, par4) && !par1World.doesBlockHaveSolidTopSurface(par2, par3 - 1, par4) && par5Random.nextInt(15) == 1) @@ -259,15 +259,7 @@ public class BlockRedLeaves extends BlockLeavesBase */ public void harvestBlock(World par1World, EntityPlayer par2EntityPlayer, int par3, int par4, int par5, int par6) { - if (!par1World.isRemote && par2EntityPlayer.getCurrentEquippedItem() != null && par2EntityPlayer.getCurrentEquippedItem().itemID == Item.shears.itemID) - { - par2EntityPlayer.addStat(StatList.mineBlockStatArray[this.blockID], 1); - this.dropBlockAsItem_do(par1World, par3, par4, par5, new ItemStack(BOPBlocks.redLeaves.blockID, 1, par6 & 3)); - } - else - { - super.harvestBlock(par1World, par2EntityPlayer, par3, par4, par5, par6); - } + super.harvestBlock(par1World, par2EntityPlayer, par3, par4, par5, par6); } /** @@ -282,13 +274,7 @@ public class BlockRedLeaves extends BlockLeavesBase public boolean isOpaqueCube() { return Block.leaves.isOpaqueCube(); } - - /*@Override - public int getBlockTextureFromSideAndMetadata(int side, int metadata) { - - return blockIndexInTexture + (isOpaqueCube() ? 1 : 0); - }*/ - + public boolean shouldSideBeRendered(IBlockAccess par1IBlockAccess, int par2, int par3, int par4, int par5) { return true; @@ -297,8 +283,23 @@ public class BlockRedLeaves extends BlockLeavesBase /** * Pass true to draw this block using fancy graphics, or false for fast graphics. */ + @SideOnly(Side.CLIENT) public void setGraphicsLevel(boolean par1) { this.graphicsLevel = par1; } + + @Override + public boolean isShearable(ItemStack item, World world, int x, int y, int z) + { + return true; + } + + @Override + 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) & 3)); + return ret; + } } diff --git a/src/minecraft/tdwp_ftw/biomesop/blocks/BlockRedwoodLeaves.java b/src/minecraft/tdwp_ftw/biomesop/blocks/BlockRedwoodLeaves.java index f37e6e8cb..4b70931a8 100644 --- a/src/minecraft/tdwp_ftw/biomesop/blocks/BlockRedwoodLeaves.java +++ b/src/minecraft/tdwp_ftw/biomesop/blocks/BlockRedwoodLeaves.java @@ -1,28 +1,25 @@ 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 tdwp_ftw.biomesop.declarations.BOPBlocks; - import net.minecraft.block.Block; import net.minecraft.block.BlockLeavesBase; 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.Item; import net.minecraft.item.ItemStack; -import net.minecraft.stats.StatList; import net.minecraft.util.Icon; import net.minecraft.world.ColorizerFoliage; import net.minecraft.world.IBlockAccess; import net.minecraft.world.World; +import net.minecraftforge.common.IShearable; +import tdwp_ftw.biomesop.mod_BiomesOPlenty; +import tdwp_ftw.biomesop.declarations.BOPBlocks; +import cpw.mods.fml.relauncher.Side; +import cpw.mods.fml.relauncher.SideOnly; -public class BlockRedwoodLeaves extends BlockLeavesBase +public class BlockRedwoodLeaves extends BlockLeavesBase implements IShearable { /** * The base index in terrain.png corresponding to the fancy version of the leaf texture. This is stored so we can @@ -42,17 +39,20 @@ public class BlockRedwoodLeaves extends BlockLeavesBase } @Override + @SideOnly(Side.CLIENT) public void registerIcons(IconRegister par1IconRegister) { this.blockIcon[0] = par1IconRegister.registerIcon("BiomesOPlenty:redwoodleaves1"); this.blockIcon[1] = par1IconRegister.registerIcon("BiomesOPlenty:redwoodleaves2"); } + @SideOnly(Side.CLIENT) public Icon getBlockTextureFromSideAndMetadata(int par1, int par2) { return blockIcon[(!isOpaqueCube() ? 0 : 1)]; } + @SideOnly(Side.CLIENT) public int getBlockColor() { double var1 = 0.5D; @@ -63,6 +63,7 @@ public class BlockRedwoodLeaves extends BlockLeavesBase /** * Returns the color this block should be rendered. Used by leaves. */ + @SideOnly(Side.CLIENT) public int getRenderColor(int par1) { return (par1 & 3) == 1 ? ColorizerFoliage.getFoliageColorPine() : ((par1 & 3) == 2 ? ColorizerFoliage.getFoliageColorBirch() : ColorizerFoliage.getFoliageColorBasic()); @@ -72,6 +73,7 @@ public class BlockRedwoodLeaves extends BlockLeavesBase * Returns a integer with hex for 0xrrggbb with this color multiplied against the blocks color. Note only called * when first determining what to render. */ + @SideOnly(Side.CLIENT) public int colorMultiplier(IBlockAccess par1IBlockAccess, int par2, int par3, int par4) { int var6 = 0; @@ -238,6 +240,7 @@ public class BlockRedwoodLeaves extends BlockLeavesBase /** * A randomly called display update to be able to add particles or other items for display */ + @SideOnly(Side.CLIENT) public void randomDisplayTick(World par1World, int par2, int par3, int par4, Random par5Random) { if (par1World.canLightningStrikeAt(par2, par3 + 1, par4) && !par1World.doesBlockHaveSolidTopSurface(par2, par3 - 1, par4) && par5Random.nextInt(15) == 1) @@ -299,15 +302,7 @@ public class BlockRedwoodLeaves extends BlockLeavesBase */ public void harvestBlock(World par1World, EntityPlayer par2EntityPlayer, int par3, int par4, int par5, int par6) { - if (!par1World.isRemote && par2EntityPlayer.getCurrentEquippedItem() != null && par2EntityPlayer.getCurrentEquippedItem().itemID == Item.shears.itemID) - { - par2EntityPlayer.addStat(StatList.mineBlockStatArray[this.blockID], 1); - this.dropBlockAsItem_do(par1World, par3, par4, par5, new ItemStack(BOPBlocks.redwoodLeaves.blockID, 1, par6 & 3)); - } - else - { - super.harvestBlock(par1World, par2EntityPlayer, par3, par4, par5, par6); - } + super.harvestBlock(par1World, par2EntityPlayer, par3, par4, par5, par6); } /** @@ -322,13 +317,7 @@ public class BlockRedwoodLeaves extends BlockLeavesBase public boolean isOpaqueCube() { return Block.leaves.isOpaqueCube(); } - - /*@Override - public int getBlockTextureFromSideAndMetadata(int side, int metadata) { - - return blockIndexInTexture + (isOpaqueCube() ? 1 : 0); - }*/ - + public boolean shouldSideBeRendered(IBlockAccess par1IBlockAccess, int par2, int par3, int par4, int par5) { return true; @@ -337,8 +326,23 @@ public class BlockRedwoodLeaves extends BlockLeavesBase /** * Pass true to draw this block using fancy graphics, or false for fast graphics. */ + @SideOnly(Side.CLIENT) public void setGraphicsLevel(boolean par1) { this.graphicsLevel = par1; } + + @Override + public boolean isShearable(ItemStack item, World world, int x, int y, int z) + { + return true; + } + + @Override + 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) & 3)); + return ret; + } } diff --git a/src/minecraft/tdwp_ftw/biomesop/blocks/BlockWhiteLeaves.java b/src/minecraft/tdwp_ftw/biomesop/blocks/BlockWhiteLeaves.java index 2e8eb0bfa..a1417332d 100644 --- a/src/minecraft/tdwp_ftw/biomesop/blocks/BlockWhiteLeaves.java +++ b/src/minecraft/tdwp_ftw/biomesop/blocks/BlockWhiteLeaves.java @@ -1,27 +1,24 @@ 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 tdwp_ftw.biomesop.declarations.BOPBlocks; - import net.minecraft.block.Block; import net.minecraft.block.BlockLeavesBase; 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.Item; import net.minecraft.item.ItemStack; -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; +import tdwp_ftw.biomesop.mod_BiomesOPlenty; +import tdwp_ftw.biomesop.declarations.BOPBlocks; +import cpw.mods.fml.relauncher.Side; +import cpw.mods.fml.relauncher.SideOnly; -public class BlockWhiteLeaves extends BlockLeavesBase +public class BlockWhiteLeaves extends BlockLeavesBase implements IShearable { /** * The base index in terrain.png corresponding to the fancy version of the leaf texture. This is stored so we can @@ -41,12 +38,14 @@ public class BlockWhiteLeaves extends BlockLeavesBase } @Override + @SideOnly(Side.CLIENT) public void registerIcons(IconRegister par1IconRegister) { this.blockIcon[0] = par1IconRegister.registerIcon("BiomesOPlenty:whiteleaves1"); this.blockIcon[1] = par1IconRegister.registerIcon("BiomesOPlenty:whiteleaves2"); } + @SideOnly(Side.CLIENT) public Icon getBlockTextureFromSideAndMetadata(int par1, int par2) { return blockIcon[(!isOpaqueCube() ? 0 : 1)]; @@ -198,6 +197,7 @@ public class BlockWhiteLeaves extends BlockLeavesBase /** * A randomly called display update to be able to add particles or other items for display */ + @SideOnly(Side.CLIENT) public void randomDisplayTick(World par1World, int par2, int par3, int par4, Random par5Random) { if (par1World.canLightningStrikeAt(par2, par3 + 1, par4) && !par1World.doesBlockHaveSolidTopSurface(par2, par3 - 1, par4) && par5Random.nextInt(15) == 1) @@ -259,15 +259,7 @@ public class BlockWhiteLeaves extends BlockLeavesBase */ public void harvestBlock(World par1World, EntityPlayer par2EntityPlayer, int par3, int par4, int par5, int par6) { - if (!par1World.isRemote && par2EntityPlayer.getCurrentEquippedItem() != null && par2EntityPlayer.getCurrentEquippedItem().itemID == Item.shears.itemID) - { - par2EntityPlayer.addStat(StatList.mineBlockStatArray[this.blockID], 1); - this.dropBlockAsItem_do(par1World, par3, par4, par5, new ItemStack(BOPBlocks.whiteLeaves.blockID, 1, par6 & 3)); - } - else - { - super.harvestBlock(par1World, par2EntityPlayer, par3, par4, par5, par6); - } + super.harvestBlock(par1World, par2EntityPlayer, par3, par4, par5, par6); } /** @@ -282,13 +274,7 @@ public class BlockWhiteLeaves extends BlockLeavesBase public boolean isOpaqueCube() { return Block.leaves.isOpaqueCube(); } - - /*@Override - public int getBlockTextureFromSideAndMetadata(int side, int metadata) { - - return blockIndexInTexture + (isOpaqueCube() ? 1 : 0); - }*/ - + public boolean shouldSideBeRendered(IBlockAccess par1IBlockAccess, int par2, int par3, int par4, int par5) { return true; @@ -297,8 +283,23 @@ public class BlockWhiteLeaves extends BlockLeavesBase /** * Pass true to draw this block using fancy graphics, or false for fast graphics. */ + @SideOnly(Side.CLIENT) public void setGraphicsLevel(boolean par1) { this.graphicsLevel = par1; } + + @Override + public boolean isShearable(ItemStack item, World world, int x, int y, int z) + { + return true; + } + + @Override + 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) & 3)); + return ret; + } } diff --git a/src/minecraft/tdwp_ftw/biomesop/blocks/BlockWillowLeaves.java b/src/minecraft/tdwp_ftw/biomesop/blocks/BlockWillowLeaves.java index 7e78bdc93..3bd016ae1 100644 --- a/src/minecraft/tdwp_ftw/biomesop/blocks/BlockWillowLeaves.java +++ b/src/minecraft/tdwp_ftw/biomesop/blocks/BlockWillowLeaves.java @@ -1,28 +1,25 @@ 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 tdwp_ftw.biomesop.declarations.BOPBlocks; - import net.minecraft.block.Block; import net.minecraft.block.BlockLeavesBase; 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.Item; import net.minecraft.item.ItemStack; -import net.minecraft.stats.StatList; import net.minecraft.util.Icon; import net.minecraft.world.ColorizerFoliage; import net.minecraft.world.IBlockAccess; import net.minecraft.world.World; +import net.minecraftforge.common.IShearable; +import tdwp_ftw.biomesop.mod_BiomesOPlenty; +import tdwp_ftw.biomesop.declarations.BOPBlocks; +import cpw.mods.fml.relauncher.Side; +import cpw.mods.fml.relauncher.SideOnly; -public class BlockWillowLeaves extends BlockLeavesBase +public class BlockWillowLeaves extends BlockLeavesBase implements IShearable { /** * The base index in terrain.png corresponding to the fancy version of the leaf texture. This is stored so we can @@ -42,17 +39,20 @@ public class BlockWillowLeaves extends BlockLeavesBase } @Override + @SideOnly(Side.CLIENT) public void registerIcons(IconRegister par1IconRegister) { this.blockIcon[0] = par1IconRegister.registerIcon("BiomesOPlenty:willowleaves3"); this.blockIcon[1] = par1IconRegister.registerIcon("BiomesOPlenty:willowleaves4"); } + @SideOnly(Side.CLIENT) public Icon getBlockTextureFromSideAndMetadata(int par1, int par2) { return blockIcon[(!isOpaqueCube() ? 0 : 1)]; } + @SideOnly(Side.CLIENT) public int getBlockColor() { double var1 = 0.5D; @@ -63,6 +63,7 @@ public class BlockWillowLeaves extends BlockLeavesBase /** * Returns the color this block should be rendered. Used by leaves. */ + @SideOnly(Side.CLIENT) public int getRenderColor(int par1) { return (par1 & 3) == 1 ? ColorizerFoliage.getFoliageColorPine() : ((par1 & 3) == 2 ? ColorizerFoliage.getFoliageColorBirch() : ColorizerFoliage.getFoliageColorBasic()); @@ -72,6 +73,7 @@ public class BlockWillowLeaves extends BlockLeavesBase * Returns a integer with hex for 0xrrggbb with this color multiplied against the blocks color. Note only called * when first determining what to render. */ + @SideOnly(Side.CLIENT) public int colorMultiplier(IBlockAccess par1IBlockAccess, int par2, int par3, int par4) { int var6 = 0; @@ -238,6 +240,7 @@ public class BlockWillowLeaves extends BlockLeavesBase /** * A randomly called display update to be able to add particles or other items for display */ + @SideOnly(Side.CLIENT) public void randomDisplayTick(World par1World, int par2, int par3, int par4, Random par5Random) { if (par1World.canLightningStrikeAt(par2, par3 + 1, par4) && !par1World.doesBlockHaveSolidTopSurface(par2, par3 - 1, par4) && par5Random.nextInt(15) == 1) @@ -299,15 +302,7 @@ public class BlockWillowLeaves extends BlockLeavesBase */ public void harvestBlock(World par1World, EntityPlayer par2EntityPlayer, int par3, int par4, int par5, int par6) { - if (!par1World.isRemote && par2EntityPlayer.getCurrentEquippedItem() != null && par2EntityPlayer.getCurrentEquippedItem().itemID == Item.shears.itemID) - { - par2EntityPlayer.addStat(StatList.mineBlockStatArray[this.blockID], 1); - this.dropBlockAsItem_do(par1World, par3, par4, par5, new ItemStack(BOPBlocks.willowLeaves.blockID, 1, par6 & 3)); - } - else - { - super.harvestBlock(par1World, par2EntityPlayer, par3, par4, par5, par6); - } + super.harvestBlock(par1World, par2EntityPlayer, par3, par4, par5, par6); } /** @@ -322,13 +317,7 @@ public class BlockWillowLeaves extends BlockLeavesBase public boolean isOpaqueCube() { return Block.leaves.isOpaqueCube(); } - - /*@Override - public int getBlockTextureFromSideAndMetadata(int side, int metadata) { - - return blockIndexInTexture + (isOpaqueCube() ? 1 : 0); - }*/ - + public boolean shouldSideBeRendered(IBlockAccess par1IBlockAccess, int par2, int par3, int par4, int par5) { return true; @@ -337,8 +326,22 @@ public class BlockWillowLeaves extends BlockLeavesBase /** * Pass true to draw this block using fancy graphics, or false for fast graphics. */ + @SideOnly(Side.CLIENT) public void setGraphicsLevel(boolean par1) { this.graphicsLevel = par1; } + @Override + public boolean isShearable(ItemStack item, World world, int x, int y, int z) + { + return true; + } + + @Override + 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) & 3)); + return ret; + } }