Changed the leaves blocks to use the IShearable interface.

It fixed shears not being damaged when used on leaves.
Still have no idea why they don't drop instantly when using shears.
This commit is contained in:
Amnet 2013-04-06 22:01:43 +02:00
parent 7bea89c24f
commit c3e23b87bc
19 changed files with 522 additions and 472 deletions

View file

@ -1,28 +1,26 @@
package tdwp_ftw.biomesop.blocks; package tdwp_ftw.biomesop.blocks;
import java.util.ArrayList;
import java.util.Random; import java.util.Random;
import cpw.mods.fml.relauncher.Side; import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly; 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.Block;
import net.minecraft.block.BlockLeavesBase; import net.minecraft.block.BlockLeavesBase;
import net.minecraft.block.material.Material; 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.entity.player.EntityPlayer;
import net.minecraft.item.Item;
import net.minecraft.item.ItemStack; import net.minecraft.item.ItemStack;
import net.minecraft.stats.StatList;
import net.minecraft.util.Icon; import net.minecraft.util.Icon;
import net.minecraft.world.ColorizerFoliage; import net.minecraft.world.ColorizerFoliage;
import net.minecraft.world.IBlockAccess; import net.minecraft.world.IBlockAccess;
import net.minecraft.world.World; 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 * The base index in terrain.png corresponding to the fancy version of the leaf texture. This is stored so we can
@ -42,17 +40,20 @@ public class BlockAcaciaLeaves extends BlockLeavesBase
} }
@Override @Override
@SideOnly(Side.CLIENT)
public void registerIcons(IconRegister par1IconRegister) public void registerIcons(IconRegister par1IconRegister)
{ {
this.blockIcon[0] = par1IconRegister.registerIcon("BiomesOPlenty:acacialeaves1"); this.blockIcon[0] = par1IconRegister.registerIcon("BiomesOPlenty:acacialeaves1");
this.blockIcon[1] = par1IconRegister.registerIcon("BiomesOPlenty:acacialeaves2"); this.blockIcon[1] = par1IconRegister.registerIcon("BiomesOPlenty:acacialeaves2");
} }
@SideOnly(Side.CLIENT)
public Icon getBlockTextureFromSideAndMetadata(int par1, int par2) public Icon getBlockTextureFromSideAndMetadata(int par1, int par2)
{ {
return blockIcon[(!isOpaqueCube() ? 0 : 1)]; return blockIcon[(!isOpaqueCube() ? 0 : 1)];
} }
@SideOnly(Side.CLIENT)
public int getBlockColor() public int getBlockColor()
{ {
double var1 = 0.5D; double var1 = 0.5D;
@ -63,6 +64,7 @@ public class BlockAcaciaLeaves extends BlockLeavesBase
/** /**
* Returns the color this block should be rendered. Used by leaves. * Returns the color this block should be rendered. Used by leaves.
*/ */
@SideOnly(Side.CLIENT)
public int getRenderColor(int par1) public int getRenderColor(int par1)
{ {
return (par1 & 3) == 1 ? ColorizerFoliage.getFoliageColorPine() : ((par1 & 3) == 2 ? ColorizerFoliage.getFoliageColorBirch() : ColorizerFoliage.getFoliageColorBasic()); 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 * Returns a integer with hex for 0xrrggbb with this color multiplied against the blocks color. Note only called
* when first determining what to render. * when first determining what to render.
*/ */
@SideOnly(Side.CLIENT)
public int colorMultiplier(IBlockAccess par1IBlockAccess, int par2, int par3, int par4) public int colorMultiplier(IBlockAccess par1IBlockAccess, int par2, int par3, int par4)
{ {
int var6 = 0; 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 * 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) 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) 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) private void removeLeaves(World par1World, int par2, int par3, int par4)
{ {
this.dropBlockAsItem(par1World, par2, par3, par4, par1World.getBlockMetadata(par2, par3, par4), 0); this.dropBlockAsItem(par1World, par2, par3, par4, par1World.getBlockMetadata(par2, par3, par4), 0);
par1World.setBlock(par2, par3, par4, 0); par1World.setBlockToAir(par2, par3, par4);
} }
/** /**
@ -298,17 +302,9 @@ public class BlockAcaciaLeaves extends BlockLeavesBase
* block and l is the block's subtype/damage. * block and l is the block's subtype/damage.
*/ */
public void harvestBlock(World par1World, EntityPlayer par2EntityPlayer, int par3, int par4, int par5, int par6) 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);
} }
}
/** /**
* Determines the damage on the item the block drops. Used in cloth and wood. * Determines the damage on the item the block drops. Used in cloth and wood.
@ -332,8 +328,23 @@ public class BlockAcaciaLeaves extends BlockLeavesBase
/** /**
* Pass true to draw this block using fancy graphics, or false for fast graphics. * Pass true to draw this block using fancy graphics, or false for fast graphics.
*/ */
@SideOnly(Side.CLIENT)
public void setGraphicsLevel(boolean par1) public void setGraphicsLevel(boolean par1)
{ {
this.graphicsLevel = par1; this.graphicsLevel = par1;
} }
@Override
public boolean isShearable(ItemStack item, World world, int x, int y, int z)
{
return true;
}
@Override
public ArrayList<ItemStack> onSheared(ItemStack item, World world, int x, int y, int z, int fortune)
{
ArrayList<ItemStack> ret = new ArrayList<ItemStack>();
ret.add(new ItemStack(this, 1, world.getBlockMetadata(x, y, z) & 3));
return ret;
}
} }

View file

@ -6,14 +6,10 @@ import java.util.Random;
import cpw.mods.fml.relauncher.Side; import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly; 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.Block;
import net.minecraft.block.BlockLeavesBase; import net.minecraft.block.BlockLeavesBase;
import net.minecraft.block.material.Material; 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.entity.player.EntityPlayer;
import net.minecraft.item.Item; import net.minecraft.item.Item;
import net.minecraft.item.ItemStack; import net.minecraft.item.ItemStack;
@ -22,8 +18,10 @@ import net.minecraft.util.Icon;
import net.minecraft.world.IBlockAccess; import net.minecraft.world.IBlockAccess;
import net.minecraft.world.World; import net.minecraft.world.World;
import net.minecraftforge.common.IShearable; 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 * 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 @Override
@SideOnly(Side.CLIENT)
public void registerIcons(IconRegister par1IconRegister) public void registerIcons(IconRegister par1IconRegister)
{ {
this.blockIcon[0] = par1IconRegister.registerIcon("BiomesOPlenty:appleleaves1"); this.blockIcon[0] = par1IconRegister.registerIcon("BiomesOPlenty:appleleaves1");
this.blockIcon[1] = par1IconRegister.registerIcon("BiomesOPlenty:appleleaves2"); this.blockIcon[1] = par1IconRegister.registerIcon("BiomesOPlenty:appleleaves2");
} }
@SideOnly(Side.CLIENT)
public Icon getBlockTextureFromSideAndMetadata(int par1, int par2) public Icon getBlockTextureFromSideAndMetadata(int par1, int par2)
{ {
return blockIcon[(!isOpaqueCube() ? 0 : 1)]; 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 * 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) 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) if (par1World.canLightningStrikeAt(par2, par3 + 1, par4) && !par1World.doesBlockHaveSolidTopSurface(par2, par3 - 1, par4) && par5Random.nextInt(15) == 1)
@ -265,17 +266,9 @@ public class BlockAppleLeaves extends BlockLeavesBase
* block and l is the block's subtype/damage. * block and l is the block's subtype/damage.
*/ */
public void harvestBlock(World par1World, EntityPlayer par2EntityPlayer, int par3, int par4, int par5, int par6) 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);
} }
}
/** /**
* Determines the damage on the item the block drops. Used in cloth and wood. * Determines the damage on the item the block drops. Used in cloth and wood.
@ -298,8 +291,23 @@ public class BlockAppleLeaves extends BlockLeavesBase
/** /**
* Pass true to draw this block using fancy graphics, or false for fast graphics. * Pass true to draw this block using fancy graphics, or false for fast graphics.
*/ */
@SideOnly(Side.CLIENT)
public void setGraphicsLevel(boolean par1) public void setGraphicsLevel(boolean par1)
{ {
this.graphicsLevel = par1; this.graphicsLevel = par1;
} }
@Override
public boolean isShearable(ItemStack item, World world, int x, int y, int z)
{
return true;
}
@Override
public ArrayList<ItemStack> onSheared(ItemStack item, World world, int x, int y, int z, int fortune)
{
ArrayList<ItemStack> ret = new ArrayList<ItemStack>();
ret.add(new ItemStack(this, 1, world.getBlockMetadata(x, y, z) & 3));
return ret;
}
} }

View file

@ -1,27 +1,25 @@
package tdwp_ftw.biomesop.blocks; package tdwp_ftw.biomesop.blocks;
import java.util.ArrayList;
import java.util.Random; 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.Block;
import net.minecraft.block.BlockLeavesBase; import net.minecraft.block.BlockLeavesBase;
import net.minecraft.block.material.Material; import net.minecraft.block.material.Material;
import net.minecraft.client.renderer.texture.IconRegister; import net.minecraft.client.renderer.texture.IconRegister;
import net.minecraft.creativetab.CreativeTabs;
import net.minecraft.entity.player.EntityPlayer; import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.item.Item; import net.minecraft.item.Item;
import net.minecraft.item.ItemStack; import net.minecraft.item.ItemStack;
import net.minecraft.stats.StatList;
import net.minecraft.util.Icon; import net.minecraft.util.Icon;
import net.minecraft.world.IBlockAccess; import net.minecraft.world.IBlockAccess;
import net.minecraft.world.World; 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 * 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 @Override
@SideOnly(Side.CLIENT)
public void registerIcons(IconRegister par1IconRegister) public void registerIcons(IconRegister par1IconRegister)
{ {
this.blockIcon[0] = par1IconRegister.registerIcon("BiomesOPlenty:appleleaves3"); this.blockIcon[0] = par1IconRegister.registerIcon("BiomesOPlenty:appleleaves3");
this.blockIcon[1] = par1IconRegister.registerIcon("BiomesOPlenty:appleleaves4"); this.blockIcon[1] = par1IconRegister.registerIcon("BiomesOPlenty:appleleaves4");
} }
@SideOnly(Side.CLIENT)
public Icon getBlockTextureFromSideAndMetadata(int par1, int par2) public Icon getBlockTextureFromSideAndMetadata(int par1, int par2)
{ {
return blockIcon[(!isOpaqueCube() ? 0 : 1)]; 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 * 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) 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) if (par1World.canLightningStrikeAt(par2, par3 + 1, par4) && !par1World.doesBlockHaveSolidTopSurface(par2, par3 - 1, par4) && par5Random.nextInt(15) == 1)
@ -263,17 +264,9 @@ public class BlockAppleLeavesFruitless extends BlockLeavesBase
* block and l is the block's subtype/damage. * block and l is the block's subtype/damage.
*/ */
public void harvestBlock(World par1World, EntityPlayer par2EntityPlayer, int par3, int par4, int par5, int par6) 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);
} }
}
/** /**
* Determines the damage on the item the block drops. Used in cloth and wood. * Determines the damage on the item the block drops. Used in cloth and wood.
@ -296,8 +289,23 @@ public class BlockAppleLeavesFruitless extends BlockLeavesBase
/** /**
* Pass true to draw this block using fancy graphics, or false for fast graphics. * Pass true to draw this block using fancy graphics, or false for fast graphics.
*/ */
@SideOnly(Side.CLIENT)
public void setGraphicsLevel(boolean par1) public void setGraphicsLevel(boolean par1)
{ {
this.graphicsLevel = par1; this.graphicsLevel = par1;
} }
@Override
public boolean isShearable(ItemStack item, World world, int x, int y, int z)
{
return true;
}
@Override
public ArrayList<ItemStack> onSheared(ItemStack item, World world, int x, int y, int z, int fortune)
{
ArrayList<ItemStack> ret = new ArrayList<ItemStack>();
ret.add(new ItemStack(this, 1, world.getBlockMetadata(x, y, z) & 3));
return ret;
}
} }

View file

@ -1,29 +1,24 @@
package tdwp_ftw.biomesop.blocks; package tdwp_ftw.biomesop.blocks;
import java.util.ArrayList;
import java.util.Random; 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.Block;
import net.minecraft.block.BlockLeavesBase; import net.minecraft.block.BlockLeavesBase;
import net.minecraft.block.material.Material; 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.entity.player.EntityPlayer;
import net.minecraft.item.Item;
import net.minecraft.item.ItemStack; import net.minecraft.item.ItemStack;
import net.minecraft.stats.StatList;
import net.minecraft.util.Icon; import net.minecraft.util.Icon;
import net.minecraft.world.ColorizerFoliage;
import net.minecraft.world.IBlockAccess; import net.minecraft.world.IBlockAccess;
import net.minecraft.world.World; 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 implements IShearable
public class BlockAutumnLeaves extends BlockLeavesBase
{ {
/** /**
* The base index in terrain.png corresponding to the fancy version of the leaf texture. This is stored so we can * 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 @Override
@SideOnly(Side.CLIENT)
public void registerIcons(IconRegister par1IconRegister) public void registerIcons(IconRegister par1IconRegister)
{ {
this.blockIcon[0] = par1IconRegister.registerIcon("BiomesOPlenty:autumnleaves1"); this.blockIcon[0] = par1IconRegister.registerIcon("BiomesOPlenty:autumnleaves1");
this.blockIcon[1] = par1IconRegister.registerIcon("BiomesOPlenty:autumnleaves2"); this.blockIcon[1] = par1IconRegister.registerIcon("BiomesOPlenty:autumnleaves2");
} }
@SideOnly(Side.CLIENT)
public Icon getBlockTextureFromSideAndMetadata(int par1, int par2) public Icon getBlockTextureFromSideAndMetadata(int par1, int par2)
{ {
return blockIcon[(!isOpaqueCube() ? 0 : 1)]; 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 * 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) 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) if (par1World.canLightningStrikeAt(par2, par3 + 1, par4) && !par1World.doesBlockHaveSolidTopSurface(par2, par3 - 1, par4) && par5Random.nextInt(15) == 1)
@ -260,17 +258,9 @@ public class BlockAutumnLeaves extends BlockLeavesBase
* block and l is the block's subtype/damage. * block and l is the block's subtype/damage.
*/ */
public void harvestBlock(World par1World, EntityPlayer par2EntityPlayer, int par3, int par4, int par5, int par6) 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);
} }
}
/** /**
* Determines the damage on the item the block drops. Used in cloth and wood. * Determines the damage on the item the block drops. Used in cloth and wood.
@ -285,12 +275,6 @@ public class BlockAutumnLeaves extends BlockLeavesBase
return Block.leaves.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) public boolean shouldSideBeRendered(IBlockAccess par1IBlockAccess, int par2, int par3, int par4, int par5)
{ {
return true; 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. * Pass true to draw this block using fancy graphics, or false for fast graphics.
*/ */
@SideOnly(Side.CLIENT)
public void setGraphicsLevel(boolean par1) public void setGraphicsLevel(boolean par1)
{ {
this.graphicsLevel = par1; this.graphicsLevel = par1;
} }
@Override
public boolean isShearable(ItemStack item, World world, int x, int y, int z)
{
return true;
}
@Override
public ArrayList<ItemStack> onSheared(ItemStack item, World world, int x, int y, int z, int fortune)
{
ArrayList<ItemStack> ret = new ArrayList<ItemStack>();
ret.add(new ItemStack(this, 1, world.getBlockMetadata(x, y, z) & 3));
return ret;
}
} }

View file

@ -1,29 +1,24 @@
package tdwp_ftw.biomesop.blocks; package tdwp_ftw.biomesop.blocks;
import java.util.ArrayList;
import java.util.Random; 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.Block;
import net.minecraft.block.BlockLeavesBase; import net.minecraft.block.BlockLeavesBase;
import net.minecraft.block.material.Material; import net.minecraft.block.material.Material;
import net.minecraft.client.renderer.texture.IconRegister; import net.minecraft.client.renderer.texture.IconRegister;
import net.minecraft.creativetab.CreativeTabs;
import net.minecraft.entity.player.EntityPlayer; import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.item.Item;
import net.minecraft.item.ItemStack; import net.minecraft.item.ItemStack;
import net.minecraft.stats.StatList;
import net.minecraft.util.Icon; import net.minecraft.util.Icon;
import net.minecraft.world.ColorizerFoliage;
import net.minecraft.world.IBlockAccess; import net.minecraft.world.IBlockAccess;
import net.minecraft.world.World; 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 implements IShearable
public class BlockBambooLeaves extends BlockLeavesBase
{ {
/** /**
* The base index in terrain.png corresponding to the fancy version of the leaf texture. This is stored so we can * 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 @Override
@SideOnly(Side.CLIENT)
public void registerIcons(IconRegister par1IconRegister) public void registerIcons(IconRegister par1IconRegister)
{ {
this.blockIcon[0] = par1IconRegister.registerIcon("BiomesOPlenty:bambooleaves1"); this.blockIcon[0] = par1IconRegister.registerIcon("BiomesOPlenty:bambooleaves1");
this.blockIcon[1] = par1IconRegister.registerIcon("BiomesOPlenty:bambooleaves2"); this.blockIcon[1] = par1IconRegister.registerIcon("BiomesOPlenty:bambooleaves2");
} }
@SideOnly(Side.CLIENT)
public Icon getBlockTextureFromSideAndMetadata(int par1, int par2) public Icon getBlockTextureFromSideAndMetadata(int par1, int par2)
{ {
return blockIcon[(!isOpaqueCube() ? 0 : 1)]; 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 * 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) 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) if (par1World.canLightningStrikeAt(par2, par3 + 1, par4) && !par1World.doesBlockHaveSolidTopSurface(par2, par3 - 1, par4) && par5Random.nextInt(15) == 1)
@ -260,17 +258,9 @@ public class BlockBambooLeaves extends BlockLeavesBase
* block and l is the block's subtype/damage. * block and l is the block's subtype/damage.
*/ */
public void harvestBlock(World par1World, EntityPlayer par2EntityPlayer, int par3, int par4, int par5, int par6) 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);
} }
}
/** /**
* Determines the damage on the item the block drops. Used in cloth and wood. * Determines the damage on the item the block drops. Used in cloth and wood.
@ -285,12 +275,6 @@ public class BlockBambooLeaves extends BlockLeavesBase
return Block.leaves.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) public boolean shouldSideBeRendered(IBlockAccess par1IBlockAccess, int par2, int par3, int par4, int par5)
{ {
return true; 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. * Pass true to draw this block using fancy graphics, or false for fast graphics.
*/ */
@SideOnly(Side.CLIENT)
public void setGraphicsLevel(boolean par1) public void setGraphicsLevel(boolean par1)
{ {
this.graphicsLevel = par1; this.graphicsLevel = par1;
} }
@Override
public boolean isShearable(ItemStack item, World world, int x, int y, int z)
{
return true;
}
@Override
public ArrayList<ItemStack> onSheared(ItemStack item, World world, int x, int y, int z, int fortune)
{
ArrayList<ItemStack> ret = new ArrayList<ItemStack>();
ret.add(new ItemStack(this, 1, world.getBlockMetadata(x, y, z) & 3));
return ret;
}
} }

View file

@ -1,28 +1,24 @@
package tdwp_ftw.biomesop.blocks; package tdwp_ftw.biomesop.blocks;
import java.util.ArrayList;
import java.util.Random; 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.Block;
import net.minecraft.block.BlockLeavesBase; import net.minecraft.block.BlockLeavesBase;
import net.minecraft.block.material.Material; 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.entity.player.EntityPlayer;
import net.minecraft.item.Item;
import net.minecraft.item.ItemStack; import net.minecraft.item.ItemStack;
import net.minecraft.stats.StatList;
import net.minecraft.util.Icon; import net.minecraft.util.Icon;
import net.minecraft.world.ColorizerFoliage;
import net.minecraft.world.IBlockAccess; import net.minecraft.world.IBlockAccess;
import net.minecraft.world.World; 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 * 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 @Override
@SideOnly(Side.CLIENT)
public void registerIcons(IconRegister par1IconRegister) public void registerIcons(IconRegister par1IconRegister)
{ {
this.blockIcon[0] = par1IconRegister.registerIcon("BiomesOPlenty:blueleaves1"); this.blockIcon[0] = par1IconRegister.registerIcon("BiomesOPlenty:blueleaves1");
this.blockIcon[1] = par1IconRegister.registerIcon("BiomesOPlenty:blueleaves2"); this.blockIcon[1] = par1IconRegister.registerIcon("BiomesOPlenty:blueleaves2");
} }
@SideOnly(Side.CLIENT)
public Icon getBlockTextureFromSideAndMetadata(int par1, int par2) public Icon getBlockTextureFromSideAndMetadata(int par1, int par2)
{ {
return blockIcon[(!isOpaqueCube() ? 0 : 1)]; 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 * 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) 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) if (par1World.canLightningStrikeAt(par2, par3 + 1, par4) && !par1World.doesBlockHaveSolidTopSurface(par2, par3 - 1, par4) && par5Random.nextInt(15) == 1)
@ -259,17 +258,9 @@ public class BlockBlueLeaves extends BlockLeavesBase
* block and l is the block's subtype/damage. * block and l is the block's subtype/damage.
*/ */
public void harvestBlock(World par1World, EntityPlayer par2EntityPlayer, int par3, int par4, int par5, int par6) 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);
} }
}
/** /**
* Determines the damage on the item the block drops. Used in cloth and wood. * Determines the damage on the item the block drops. Used in cloth and wood.
@ -284,12 +275,6 @@ public class BlockBlueLeaves extends BlockLeavesBase
return Block.leaves.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) public boolean shouldSideBeRendered(IBlockAccess par1IBlockAccess, int par2, int par3, int par4, int par5)
{ {
return true; 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. * Pass true to draw this block using fancy graphics, or false for fast graphics.
*/ */
@SideOnly(Side.CLIENT)
public void setGraphicsLevel(boolean par1) public void setGraphicsLevel(boolean par1)
{ {
this.graphicsLevel = par1; this.graphicsLevel = par1;
} }
@Override
public boolean isShearable(ItemStack item, World world, int x, int y, int z)
{
return true;
}
@Override
public ArrayList<ItemStack> onSheared(ItemStack item, World world, int x, int y, int z, int fortune)
{
ArrayList<ItemStack> ret = new ArrayList<ItemStack>();
ret.add(new ItemStack(this, 1, world.getBlockMetadata(x, y, z) & 3));
return ret;
}
} }

View file

@ -1,28 +1,24 @@
package tdwp_ftw.biomesop.blocks; package tdwp_ftw.biomesop.blocks;
import java.util.ArrayList;
import java.util.Random; 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.Block;
import net.minecraft.block.BlockLeavesBase; import net.minecraft.block.BlockLeavesBase;
import net.minecraft.block.material.Material; 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.entity.player.EntityPlayer;
import net.minecraft.item.Item;
import net.minecraft.item.ItemStack; import net.minecraft.item.ItemStack;
import net.minecraft.stats.StatList;
import net.minecraft.util.Icon; import net.minecraft.util.Icon;
import net.minecraft.world.ColorizerFoliage;
import net.minecraft.world.IBlockAccess; import net.minecraft.world.IBlockAccess;
import net.minecraft.world.World; 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 * 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 @Override
@SideOnly(Side.CLIENT)
public void registerIcons(IconRegister par1IconRegister) public void registerIcons(IconRegister par1IconRegister)
{ {
this.blockIcon[0] = par1IconRegister.registerIcon("BiomesOPlenty:darkleaves1"); this.blockIcon[0] = par1IconRegister.registerIcon("BiomesOPlenty:darkleaves1");
this.blockIcon[1] = par1IconRegister.registerIcon("BiomesOPlenty:darkleaves2"); this.blockIcon[1] = par1IconRegister.registerIcon("BiomesOPlenty:darkleaves2");
} }
@SideOnly(Side.CLIENT)
public Icon getBlockTextureFromSideAndMetadata(int par1, int par2) public Icon getBlockTextureFromSideAndMetadata(int par1, int par2)
{ {
return blockIcon[(!isOpaqueCube() ? 0 : 1)]; 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 * 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) 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) if (par1World.canLightningStrikeAt(par2, par3 + 1, par4) && !par1World.doesBlockHaveSolidTopSurface(par2, par3 - 1, par4) && par5Random.nextInt(15) == 1)
@ -259,17 +258,9 @@ public class BlockDarkLeaves extends BlockLeavesBase
* block and l is the block's subtype/damage. * block and l is the block's subtype/damage.
*/ */
public void harvestBlock(World par1World, EntityPlayer par2EntityPlayer, int par3, int par4, int par5, int par6) 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);
} }
}
/** /**
* Determines the damage on the item the block drops. Used in cloth and wood. * Determines the damage on the item the block drops. Used in cloth and wood.
@ -284,12 +275,6 @@ public class BlockDarkLeaves extends BlockLeavesBase
return Block.leaves.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) public boolean shouldSideBeRendered(IBlockAccess par1IBlockAccess, int par2, int par3, int par4, int par5)
{ {
return true; 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. * Pass true to draw this block using fancy graphics, or false for fast graphics.
*/ */
@SideOnly(Side.CLIENT)
public void setGraphicsLevel(boolean par1) public void setGraphicsLevel(boolean par1)
{ {
this.graphicsLevel = par1; this.graphicsLevel = par1;
} }
@Override
public boolean isShearable(ItemStack item, World world, int x, int y, int z)
{
return true;
}
@Override
public ArrayList<ItemStack> onSheared(ItemStack item, World world, int x, int y, int z, int fortune)
{
ArrayList<ItemStack> ret = new ArrayList<ItemStack>();
ret.add(new ItemStack(this, 1, world.getBlockMetadata(x, y, z) & 3));
return ret;
}
} }

View file

@ -1,28 +1,24 @@
package tdwp_ftw.biomesop.blocks; package tdwp_ftw.biomesop.blocks;
import java.util.ArrayList;
import java.util.Random; 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.Block;
import net.minecraft.block.BlockLeavesBase; import net.minecraft.block.BlockLeavesBase;
import net.minecraft.block.material.Material; 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.entity.player.EntityPlayer;
import net.minecraft.item.Item;
import net.minecraft.item.ItemStack; import net.minecraft.item.ItemStack;
import net.minecraft.stats.StatList;
import net.minecraft.util.Icon; import net.minecraft.util.Icon;
import net.minecraft.world.ColorizerFoliage;
import net.minecraft.world.IBlockAccess; import net.minecraft.world.IBlockAccess;
import net.minecraft.world.World; 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 * 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 @Override
@SideOnly(Side.CLIENT)
public void registerIcons(IconRegister par1IconRegister) public void registerIcons(IconRegister par1IconRegister)
{ {
this.blockIcon[0] = par1IconRegister.registerIcon("BiomesOPlenty:deadleaves1"); this.blockIcon[0] = par1IconRegister.registerIcon("BiomesOPlenty:deadleaves1");
this.blockIcon[1] = par1IconRegister.registerIcon("BiomesOPlenty:deadleaves2"); this.blockIcon[1] = par1IconRegister.registerIcon("BiomesOPlenty:deadleaves2");
} }
@SideOnly(Side.CLIENT)
public Icon getBlockTextureFromSideAndMetadata(int par1, int par2) public Icon getBlockTextureFromSideAndMetadata(int par1, int par2)
{ {
return blockIcon[(!isOpaqueCube() ? 0 : 1)]; 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 * 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) 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) if (par1World.canLightningStrikeAt(par2, par3 + 1, par4) && !par1World.doesBlockHaveSolidTopSurface(par2, par3 - 1, par4) && par5Random.nextInt(15) == 1)
@ -259,17 +258,9 @@ public class BlockDeadLeaves extends BlockLeavesBase
* block and l is the block's subtype/damage. * block and l is the block's subtype/damage.
*/ */
public void harvestBlock(World par1World, EntityPlayer par2EntityPlayer, int par3, int par4, int par5, int par6) 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);
} }
}
/** /**
* Determines the damage on the item the block drops. Used in cloth and wood. * Determines the damage on the item the block drops. Used in cloth and wood.
@ -284,12 +275,6 @@ public class BlockDeadLeaves extends BlockLeavesBase
return Block.leaves.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) public boolean shouldSideBeRendered(IBlockAccess par1IBlockAccess, int par2, int par3, int par4, int par5)
{ {
return true; 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. * Pass true to draw this block using fancy graphics, or false for fast graphics.
*/ */
@SideOnly(Side.CLIENT)
public void setGraphicsLevel(boolean par1) public void setGraphicsLevel(boolean par1)
{ {
this.graphicsLevel = par1; this.graphicsLevel = par1;
} }
@Override
public boolean isShearable(ItemStack item, World world, int x, int y, int z)
{
return true;
}
@Override
public ArrayList<ItemStack> onSheared(ItemStack item, World world, int x, int y, int z, int fortune)
{
ArrayList<ItemStack> ret = new ArrayList<ItemStack>();
ret.add(new ItemStack(this, 1, world.getBlockMetadata(x, y, z) & 3));
return ret;
}
} }

View file

@ -1,27 +1,24 @@
package tdwp_ftw.biomesop.blocks; package tdwp_ftw.biomesop.blocks;
import java.util.ArrayList;
import java.util.Random; 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.Block;
import net.minecraft.block.BlockLeavesBase; import net.minecraft.block.BlockLeavesBase;
import net.minecraft.block.material.Material; import net.minecraft.block.material.Material;
import net.minecraft.client.renderer.texture.IconRegister; import net.minecraft.client.renderer.texture.IconRegister;
import net.minecraft.creativetab.CreativeTabs;
import net.minecraft.entity.player.EntityPlayer; import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.item.Item;
import net.minecraft.item.ItemStack; import net.minecraft.item.ItemStack;
import net.minecraft.stats.StatList;
import net.minecraft.util.Icon; import net.minecraft.util.Icon;
import net.minecraft.world.IBlockAccess; import net.minecraft.world.IBlockAccess;
import net.minecraft.world.World; 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 * 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 @Override
@SideOnly(Side.CLIENT)
public void registerIcons(IconRegister par1IconRegister) public void registerIcons(IconRegister par1IconRegister)
{ {
this.blockIcon[0] = par1IconRegister.registerIcon("BiomesOPlenty:firleaves1"); this.blockIcon[0] = par1IconRegister.registerIcon("BiomesOPlenty:firleaves1");
this.blockIcon[1] = par1IconRegister.registerIcon("BiomesOPlenty:firleaves2"); this.blockIcon[1] = par1IconRegister.registerIcon("BiomesOPlenty:firleaves2");
} }
@SideOnly(Side.CLIENT)
public Icon getBlockTextureFromSideAndMetadata(int par1, int par2) public Icon getBlockTextureFromSideAndMetadata(int par1, int par2)
{ {
return blockIcon[(!isOpaqueCube() ? 0 : 1)]; 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 * 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) 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) if (par1World.canLightningStrikeAt(par2, par3 + 1, par4) && !par1World.doesBlockHaveSolidTopSurface(par2, par3 - 1, par4) && par5Random.nextInt(15) == 1)
@ -258,17 +258,9 @@ public class BlockFirLeaves extends BlockLeavesBase
* block and l is the block's subtype/damage. * block and l is the block's subtype/damage.
*/ */
public void harvestBlock(World par1World, EntityPlayer par2EntityPlayer, int par3, int par4, int par5, int par6) 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);
} }
}
/** /**
* Determines the damage on the item the block drops. Used in cloth and wood. * Determines the damage on the item the block drops. Used in cloth and wood.
@ -283,12 +275,6 @@ public class BlockFirLeaves extends BlockLeavesBase
return Block.leaves.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) public boolean shouldSideBeRendered(IBlockAccess par1IBlockAccess, int par2, int par3, int par4, int par5)
{ {
return true; 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. * Pass true to draw this block using fancy graphics, or false for fast graphics.
*/ */
@SideOnly(Side.CLIENT)
public void setGraphicsLevel(boolean par1) public void setGraphicsLevel(boolean par1)
{ {
this.graphicsLevel = par1; this.graphicsLevel = par1;
} }
@Override
public boolean isShearable(ItemStack item, World world, int x, int y, int z)
{
return true;
}
@Override
public ArrayList<ItemStack> onSheared(ItemStack item, World world, int x, int y, int z, int fortune)
{
ArrayList<ItemStack> ret = new ArrayList<ItemStack>();
ret.add(new ItemStack(this, 1, world.getBlockMetadata(x, y, z) & 3));
return ret;
}
} }

View file

@ -1,28 +1,24 @@
package tdwp_ftw.biomesop.blocks; package tdwp_ftw.biomesop.blocks;
import java.util.ArrayList;
import java.util.Random; 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.Block;
import net.minecraft.block.BlockLeavesBase; import net.minecraft.block.BlockLeavesBase;
import net.minecraft.block.material.Material; import net.minecraft.block.material.Material;
import net.minecraft.client.renderer.texture.IconRegister; import net.minecraft.client.renderer.texture.IconRegister;
import net.minecraft.creativetab.CreativeTabs;
import net.minecraft.entity.player.EntityPlayer; import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.item.Item;
import net.minecraft.item.ItemStack; import net.minecraft.item.ItemStack;
import net.minecraft.stats.StatList;
import net.minecraft.util.Icon; import net.minecraft.util.Icon;
import net.minecraft.world.ColorizerFoliage;
import net.minecraft.world.IBlockAccess; import net.minecraft.world.IBlockAccess;
import net.minecraft.world.World; 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 * 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 @Override
@SideOnly(Side.CLIENT)
public void registerIcons(IconRegister par1IconRegister) public void registerIcons(IconRegister par1IconRegister)
{ {
this.blockIcon[0] = par1IconRegister.registerIcon("BiomesOPlenty:holyleaves1"); this.blockIcon[0] = par1IconRegister.registerIcon("BiomesOPlenty:holyleaves1");
this.blockIcon[1] = par1IconRegister.registerIcon("BiomesOPlenty:holyleaves2"); this.blockIcon[1] = par1IconRegister.registerIcon("BiomesOPlenty:holyleaves2");
} }
@SideOnly(Side.CLIENT)
public Icon getBlockTextureFromSideAndMetadata(int par1, int par2) public Icon getBlockTextureFromSideAndMetadata(int par1, int par2)
{ {
return blockIcon[(!isOpaqueCube() ? 0 : 1)]; 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 * 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) 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) if (par1World.canLightningStrikeAt(par2, par3 + 1, par4) && !par1World.doesBlockHaveSolidTopSurface(par2, par3 - 1, par4) && par5Random.nextInt(15) == 1)
@ -258,17 +257,9 @@ public class BlockHolyLeaves extends BlockLeavesBase
* block and l is the block's subtype/damage. * block and l is the block's subtype/damage.
*/ */
public void harvestBlock(World par1World, EntityPlayer par2EntityPlayer, int par3, int par4, int par5, int par6) 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);
} }
}
/** /**
* Determines the damage on the item the block drops. Used in cloth and wood. * Determines the damage on the item the block drops. Used in cloth and wood.
@ -283,12 +274,6 @@ public class BlockHolyLeaves extends BlockLeavesBase
return Block.leaves.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) public boolean shouldSideBeRendered(IBlockAccess par1IBlockAccess, int par2, int par3, int par4, int par5)
{ {
return true; 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. * Pass true to draw this block using fancy graphics, or false for fast graphics.
*/ */
@SideOnly(Side.CLIENT)
public void setGraphicsLevel(boolean par1) public void setGraphicsLevel(boolean par1)
{ {
this.graphicsLevel = par1; this.graphicsLevel = par1;
} }
@Override
public boolean isShearable(ItemStack item, World world, int x, int y, int z)
{
return true;
}
@Override
public ArrayList<ItemStack> onSheared(ItemStack item, World world, int x, int y, int z, int fortune)
{
ArrayList<ItemStack> ret = new ArrayList<ItemStack>();
ret.add(new ItemStack(this, 1, world.getBlockMetadata(x, y, z) & 3));
return ret;
}
} }

View file

@ -1,28 +1,25 @@
package tdwp_ftw.biomesop.blocks; package tdwp_ftw.biomesop.blocks;
import java.util.ArrayList;
import java.util.Random; 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.Block;
import net.minecraft.block.BlockLeavesBase; import net.minecraft.block.BlockLeavesBase;
import net.minecraft.block.material.Material; import net.minecraft.block.material.Material;
import net.minecraft.client.renderer.texture.IconRegister; import net.minecraft.client.renderer.texture.IconRegister;
import net.minecraft.creativetab.CreativeTabs;
import net.minecraft.entity.player.EntityPlayer; import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.item.Item;
import net.minecraft.item.ItemStack; import net.minecraft.item.ItemStack;
import net.minecraft.stats.StatList;
import net.minecraft.util.Icon; import net.minecraft.util.Icon;
import net.minecraft.world.ColorizerFoliage; import net.minecraft.world.ColorizerFoliage;
import net.minecraft.world.IBlockAccess; import net.minecraft.world.IBlockAccess;
import net.minecraft.world.World; 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 * 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 @Override
@SideOnly(Side.CLIENT)
public void registerIcons(IconRegister par1IconRegister) public void registerIcons(IconRegister par1IconRegister)
{ {
this.blockIcon[0] = par1IconRegister.registerIcon("BiomesOPlenty:mangroveleaves1"); this.blockIcon[0] = par1IconRegister.registerIcon("BiomesOPlenty:mangroveleaves1");
this.blockIcon[1] = par1IconRegister.registerIcon("BiomesOPlenty:mangroveleaves2"); this.blockIcon[1] = par1IconRegister.registerIcon("BiomesOPlenty:mangroveleaves2");
} }
@SideOnly(Side.CLIENT)
public Icon getBlockTextureFromSideAndMetadata(int par1, int par2) public Icon getBlockTextureFromSideAndMetadata(int par1, int par2)
{ {
return blockIcon[(!isOpaqueCube() ? 0 : 1)]; return blockIcon[(!isOpaqueCube() ? 0 : 1)];
} }
@SideOnly(Side.CLIENT)
public int getBlockColor() public int getBlockColor()
{ {
double var1 = 0.5D; double var1 = 0.5D;
@ -63,6 +63,7 @@ public class BlockMangroveLeaves extends BlockLeavesBase
/** /**
* Returns the color this block should be rendered. Used by leaves. * Returns the color this block should be rendered. Used by leaves.
*/ */
@SideOnly(Side.CLIENT)
public int getRenderColor(int par1) public int getRenderColor(int par1)
{ {
return (par1 & 3) == 1 ? ColorizerFoliage.getFoliageColorPine() : ((par1 & 3) == 2 ? ColorizerFoliage.getFoliageColorBirch() : ColorizerFoliage.getFoliageColorBasic()); 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 * Returns a integer with hex for 0xrrggbb with this color multiplied against the blocks color. Note only called
* when first determining what to render. * when first determining what to render.
*/ */
@SideOnly(Side.CLIENT)
public int colorMultiplier(IBlockAccess par1IBlockAccess, int par2, int par3, int par4) public int colorMultiplier(IBlockAccess par1IBlockAccess, int par2, int par3, int par4)
{ {
int var6 = 0; 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 * 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) 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) if (par1World.canLightningStrikeAt(par2, par3 + 1, par4) && !par1World.doesBlockHaveSolidTopSurface(par2, par3 - 1, par4) && par5Random.nextInt(15) == 1)
@ -298,17 +301,9 @@ public class BlockMangroveLeaves extends BlockLeavesBase
* block and l is the block's subtype/damage. * block and l is the block's subtype/damage.
*/ */
public void harvestBlock(World par1World, EntityPlayer par2EntityPlayer, int par3, int par4, int par5, int par6) 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); super.harvestBlock(par1World, par2EntityPlayer, par3, par4, par5, par6);
} }
}
/** /**
* Determines the damage on the item the block drops. Used in cloth and wood. * Determines the damage on the item the block drops. Used in cloth and wood.
@ -323,12 +318,6 @@ public class BlockMangroveLeaves extends BlockLeavesBase
return Block.leaves.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) public boolean shouldSideBeRendered(IBlockAccess par1IBlockAccess, int par2, int par3, int par4, int par5)
{ {
return true; 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. * Pass true to draw this block using fancy graphics, or false for fast graphics.
*/ */
@SideOnly(Side.CLIENT)
public void setGraphicsLevel(boolean par1) public void setGraphicsLevel(boolean par1)
{ {
this.graphicsLevel = par1; this.graphicsLevel = par1;
} }
@Override
public boolean isShearable(ItemStack item, World world, int x, int y, int z)
{
return true;
}
@Override
public ArrayList<ItemStack> onSheared(ItemStack item, World world, int x, int y, int z, int fortune)
{
ArrayList<ItemStack> ret = new ArrayList<ItemStack>();
ret.add(new ItemStack(this, 1, world.getBlockMetadata(x, y, z) & 3));
return ret;
}
} }

View file

@ -1,27 +1,25 @@
package tdwp_ftw.biomesop.blocks; package tdwp_ftw.biomesop.blocks;
import java.util.ArrayList;
import java.util.Random; 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.Block;
import net.minecraft.block.BlockLeavesBase; import net.minecraft.block.BlockLeavesBase;
import net.minecraft.block.material.Material; import net.minecraft.block.material.Material;
import net.minecraft.client.renderer.texture.IconRegister; import net.minecraft.client.renderer.texture.IconRegister;
import net.minecraft.creativetab.CreativeTabs;
import net.minecraft.entity.player.EntityPlayer; import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.item.Item; import net.minecraft.item.Item;
import net.minecraft.item.ItemStack; import net.minecraft.item.ItemStack;
import net.minecraft.stats.StatList;
import net.minecraft.util.Icon; import net.minecraft.util.Icon;
import net.minecraft.world.IBlockAccess; import net.minecraft.world.IBlockAccess;
import net.minecraft.world.World; 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 * 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 @Override
@SideOnly(Side.CLIENT)
public void registerIcons(IconRegister par1IconRegister) public void registerIcons(IconRegister par1IconRegister)
{ {
this.blockIcon[0] = par1IconRegister.registerIcon("BiomesOPlenty:orangeleaves1"); this.blockIcon[0] = par1IconRegister.registerIcon("BiomesOPlenty:orangeleaves1");
this.blockIcon[1] = par1IconRegister.registerIcon("BiomesOPlenty:orangeleaves2"); this.blockIcon[1] = par1IconRegister.registerIcon("BiomesOPlenty:orangeleaves2");
} }
@SideOnly(Side.CLIENT)
public Icon getBlockTextureFromSideAndMetadata(int par1, int par2) public Icon getBlockTextureFromSideAndMetadata(int par1, int par2)
{ {
return blockIcon[(!isOpaqueCube() ? 0 : 1)]; 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 * 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) 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) if (par1World.canLightningStrikeAt(par2, par3 + 1, par4) && !par1World.doesBlockHaveSolidTopSurface(par2, par3 - 1, par4) && par5Random.nextInt(15) == 1)
@ -263,17 +264,9 @@ public class BlockOrangeLeaves extends BlockLeavesBase
* block and l is the block's subtype/damage. * block and l is the block's subtype/damage.
*/ */
public void harvestBlock(World par1World, EntityPlayer par2EntityPlayer, int par3, int par4, int par5, int par6) 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);
} }
}
/** /**
* Determines the damage on the item the block drops. Used in cloth and wood. * Determines the damage on the item the block drops. Used in cloth and wood.
@ -288,12 +281,6 @@ public class BlockOrangeLeaves extends BlockLeavesBase
return Block.leaves.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) public boolean shouldSideBeRendered(IBlockAccess par1IBlockAccess, int par2, int par3, int par4, int par5)
{ {
return true; 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. * Pass true to draw this block using fancy graphics, or false for fast graphics.
*/ */
@SideOnly(Side.CLIENT)
public void setGraphicsLevel(boolean par1) public void setGraphicsLevel(boolean par1)
{ {
this.graphicsLevel = par1; this.graphicsLevel = par1;
} }
@Override
public boolean isShearable(ItemStack item, World world, int x, int y, int z)
{
return true;
}
@Override
public ArrayList<ItemStack> onSheared(ItemStack item, World world, int x, int y, int z, int fortune)
{
ArrayList<ItemStack> ret = new ArrayList<ItemStack>();
ret.add(new ItemStack(this, 1, world.getBlockMetadata(x, y, z) & 3));
return ret;
}
} }

View file

@ -1,24 +1,24 @@
package tdwp_ftw.biomesop.blocks; package tdwp_ftw.biomesop.blocks;
import java.util.ArrayList;
import java.util.Random; 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.Block;
import net.minecraft.block.BlockLeavesBase; import net.minecraft.block.BlockLeavesBase;
import net.minecraft.block.material.Material; import net.minecraft.block.material.Material;
import net.minecraft.client.renderer.texture.IconRegister; import net.minecraft.client.renderer.texture.IconRegister;
import net.minecraft.creativetab.CreativeTabs;
import net.minecraft.entity.player.EntityPlayer; import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.item.Item;
import net.minecraft.item.ItemStack; import net.minecraft.item.ItemStack;
import net.minecraft.stats.StatList;
import net.minecraft.util.Icon; import net.minecraft.util.Icon;
import net.minecraft.world.IBlockAccess; import net.minecraft.world.IBlockAccess;
import net.minecraft.world.World; 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 * 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 @Override
@SideOnly(Side.CLIENT)
public void registerIcons(IconRegister par1IconRegister) public void registerIcons(IconRegister par1IconRegister)
{ {
this.blockIcon[0] = par1IconRegister.registerIcon("BiomesOPlenty:originleaves1"); this.blockIcon[0] = par1IconRegister.registerIcon("BiomesOPlenty:originleaves1");
this.blockIcon[1] = par1IconRegister.registerIcon("BiomesOPlenty:originleaves2"); this.blockIcon[1] = par1IconRegister.registerIcon("BiomesOPlenty:originleaves2");
} }
@SideOnly(Side.CLIENT)
public Icon getBlockTextureFromSideAndMetadata(int par1, int par2) public Icon getBlockTextureFromSideAndMetadata(int par1, int par2)
{ {
return blockIcon[(!isOpaqueCube() ? 0 : 1)]; 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 * 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) 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) if (par1World.canLightningStrikeAt(par2, par3 + 1, par4) && !par1World.doesBlockHaveSolidTopSurface(par2, par3 - 1, par4) && par5Random.nextInt(15) == 1)
@ -255,17 +258,9 @@ public class BlockOriginLeaves extends BlockLeavesBase
* block and l is the block's subtype/damage. * block and l is the block's subtype/damage.
*/ */
public void harvestBlock(World par1World, EntityPlayer par2EntityPlayer, int par3, int par4, int par5, int par6) 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); super.harvestBlock(par1World, par2EntityPlayer, par3, par4, par5, par6);
} }
}
/** /**
* Determines the damage on the item the block drops. Used in cloth and wood. * Determines the damage on the item the block drops. Used in cloth and wood.
@ -280,12 +275,6 @@ public class BlockOriginLeaves extends BlockLeavesBase
return Block.leaves.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) public boolean shouldSideBeRendered(IBlockAccess par1IBlockAccess, int par2, int par3, int par4, int par5)
{ {
return true; 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. * Pass true to draw this block using fancy graphics, or false for fast graphics.
*/ */
@SideOnly(Side.CLIENT)
public void setGraphicsLevel(boolean par1) public void setGraphicsLevel(boolean par1)
{ {
this.graphicsLevel = par1; this.graphicsLevel = par1;
} }
@Override
public boolean isShearable(ItemStack item, World world, int x, int y, int z)
{
return true;
}
@Override
public ArrayList<ItemStack> onSheared(ItemStack item, World world, int x, int y, int z, int fortune)
{
ArrayList<ItemStack> ret = new ArrayList<ItemStack>();
ret.add(new ItemStack(this, 1, world.getBlockMetadata(x, y, z) & 3));
return ret;
}
} }

View file

@ -1,28 +1,25 @@
package tdwp_ftw.biomesop.blocks; package tdwp_ftw.biomesop.blocks;
import java.util.ArrayList;
import java.util.Random; 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.Block;
import net.minecraft.block.BlockLeavesBase; import net.minecraft.block.BlockLeavesBase;
import net.minecraft.block.material.Material; import net.minecraft.block.material.Material;
import net.minecraft.client.renderer.texture.IconRegister; import net.minecraft.client.renderer.texture.IconRegister;
import net.minecraft.creativetab.CreativeTabs;
import net.minecraft.entity.player.EntityPlayer; import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.item.Item;
import net.minecraft.item.ItemStack; import net.minecraft.item.ItemStack;
import net.minecraft.stats.StatList;
import net.minecraft.util.Icon; import net.minecraft.util.Icon;
import net.minecraft.world.ColorizerFoliage; import net.minecraft.world.ColorizerFoliage;
import net.minecraft.world.IBlockAccess; import net.minecraft.world.IBlockAccess;
import net.minecraft.world.World; 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 * 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 @Override
@SideOnly(Side.CLIENT)
public void registerIcons(IconRegister par1IconRegister) public void registerIcons(IconRegister par1IconRegister)
{ {
this.blockIcon[0] = par1IconRegister.registerIcon("BiomesOPlenty:palmleaves1"); this.blockIcon[0] = par1IconRegister.registerIcon("BiomesOPlenty:palmleaves1");
this.blockIcon[1] = par1IconRegister.registerIcon("BiomesOPlenty:palmleaves2"); this.blockIcon[1] = par1IconRegister.registerIcon("BiomesOPlenty:palmleaves2");
} }
@SideOnly(Side.CLIENT)
public Icon getBlockTextureFromSideAndMetadata(int par1, int par2) public Icon getBlockTextureFromSideAndMetadata(int par1, int par2)
{ {
return blockIcon[(!isOpaqueCube() ? 0 : 1)]; return blockIcon[(!isOpaqueCube() ? 0 : 1)];
} }
@SideOnly(Side.CLIENT)
public int getBlockColor() public int getBlockColor()
{ {
double var1 = 0.5D; double var1 = 0.5D;
@ -63,6 +63,7 @@ public class BlockPalmLeaves extends BlockLeavesBase
/** /**
* Returns the color this block should be rendered. Used by leaves. * Returns the color this block should be rendered. Used by leaves.
*/ */
@SideOnly(Side.CLIENT)
public int getRenderColor(int par1) public int getRenderColor(int par1)
{ {
return (par1 & 3) == 1 ? ColorizerFoliage.getFoliageColorPine() : ((par1 & 3) == 2 ? ColorizerFoliage.getFoliageColorBirch() : ColorizerFoliage.getFoliageColorBasic()); 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 * Returns a integer with hex for 0xrrggbb with this color multiplied against the blocks color. Note only called
* when first determining what to render. * when first determining what to render.
*/ */
@SideOnly(Side.CLIENT)
public int colorMultiplier(IBlockAccess par1IBlockAccess, int par2, int par3, int par4) public int colorMultiplier(IBlockAccess par1IBlockAccess, int par2, int par3, int par4)
{ {
int var6 = 0; 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 * 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) 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) if (par1World.canLightningStrikeAt(par2, par3 + 1, par4) && !par1World.doesBlockHaveSolidTopSurface(par2, par3 - 1, par4) && par5Random.nextInt(15) == 1)
@ -298,17 +301,9 @@ public class BlockPalmLeaves extends BlockLeavesBase
* block and l is the block's subtype/damage. * block and l is the block's subtype/damage.
*/ */
public void harvestBlock(World par1World, EntityPlayer par2EntityPlayer, int par3, int par4, int par5, int par6) 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); super.harvestBlock(par1World, par2EntityPlayer, par3, par4, par5, par6);
} }
}
/** /**
* Determines the damage on the item the block drops. Used in cloth and wood. * Determines the damage on the item the block drops. Used in cloth and wood.
@ -323,12 +318,6 @@ public class BlockPalmLeaves extends BlockLeavesBase
return Block.leaves.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) public boolean shouldSideBeRendered(IBlockAccess par1IBlockAccess, int par2, int par3, int par4, int par5)
{ {
return true; 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. * Pass true to draw this block using fancy graphics, or false for fast graphics.
*/ */
@SideOnly(Side.CLIENT)
public void setGraphicsLevel(boolean par1) public void setGraphicsLevel(boolean par1)
{ {
this.graphicsLevel = par1; this.graphicsLevel = par1;
} }
@Override
public boolean isShearable(ItemStack item, World world, int x, int y, int z)
{
return true;
}
@Override
public ArrayList<ItemStack> onSheared(ItemStack item, World world, int x, int y, int z, int fortune)
{
ArrayList<ItemStack> ret = new ArrayList<ItemStack>();
ret.add(new ItemStack(this, 1, world.getBlockMetadata(x, y, z) & 3));
return ret;
}
} }

View file

@ -1,27 +1,24 @@
package tdwp_ftw.biomesop.blocks; package tdwp_ftw.biomesop.blocks;
import java.util.ArrayList;
import java.util.Random; 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.Block;
import net.minecraft.block.BlockLeavesBase; import net.minecraft.block.BlockLeavesBase;
import net.minecraft.block.material.Material; import net.minecraft.block.material.Material;
import net.minecraft.client.renderer.texture.IconRegister; import net.minecraft.client.renderer.texture.IconRegister;
import net.minecraft.creativetab.CreativeTabs;
import net.minecraft.entity.player.EntityPlayer; import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.item.Item;
import net.minecraft.item.ItemStack; import net.minecraft.item.ItemStack;
import net.minecraft.stats.StatList;
import net.minecraft.util.Icon; import net.minecraft.util.Icon;
import net.minecraft.world.IBlockAccess; import net.minecraft.world.IBlockAccess;
import net.minecraft.world.World; 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 * 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 @Override
@SideOnly(Side.CLIENT)
public void registerIcons(IconRegister par1IconRegister) public void registerIcons(IconRegister par1IconRegister)
{ {
this.blockIcon[0] = par1IconRegister.registerIcon("BiomesOPlenty:pinkleaves1"); this.blockIcon[0] = par1IconRegister.registerIcon("BiomesOPlenty:pinkleaves1");
this.blockIcon[1] = par1IconRegister.registerIcon("BiomesOPlenty:pinkleaves2"); this.blockIcon[1] = par1IconRegister.registerIcon("BiomesOPlenty:pinkleaves2");
} }
@SideOnly(Side.CLIENT)
public Icon getBlockTextureFromSideAndMetadata(int par1, int par2) public Icon getBlockTextureFromSideAndMetadata(int par1, int par2)
{ {
return blockIcon[(!isOpaqueCube() ? 0 : 1)]; 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 * 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) 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) if (par1World.canLightningStrikeAt(par2, par3 + 1, par4) && !par1World.doesBlockHaveSolidTopSurface(par2, par3 - 1, par4) && par5Random.nextInt(15) == 1)
@ -258,17 +258,9 @@ public class BlockPinkLeaves extends BlockLeavesBase
* block and l is the block's subtype/damage. * block and l is the block's subtype/damage.
*/ */
public void harvestBlock(World par1World, EntityPlayer par2EntityPlayer, int par3, int par4, int par5, int par6) 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); super.harvestBlock(par1World, par2EntityPlayer, par3, par4, par5, par6);
} }
}
/** /**
* Determines the damage on the item the block drops. Used in cloth and wood. * Determines the damage on the item the block drops. Used in cloth and wood.
@ -283,12 +275,6 @@ public class BlockPinkLeaves extends BlockLeavesBase
return Block.leaves.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) public boolean shouldSideBeRendered(IBlockAccess par1IBlockAccess, int par2, int par3, int par4, int par5)
{ {
return true; 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. * Pass true to draw this block using fancy graphics, or false for fast graphics.
*/ */
@SideOnly(Side.CLIENT)
public void setGraphicsLevel(boolean par1) public void setGraphicsLevel(boolean par1)
{ {
this.graphicsLevel = par1; this.graphicsLevel = par1;
} }
@Override
public boolean isShearable(ItemStack item, World world, int x, int y, int z)
{
return true;
}
@Override
public ArrayList<ItemStack> onSheared(ItemStack item, World world, int x, int y, int z, int fortune)
{
ArrayList<ItemStack> ret = new ArrayList<ItemStack>();
ret.add(new ItemStack(this, 1, world.getBlockMetadata(x, y, z) & 3));
return ret;
}
} }

View file

@ -1,27 +1,24 @@
package tdwp_ftw.biomesop.blocks; package tdwp_ftw.biomesop.blocks;
import java.util.ArrayList;
import java.util.Random; 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.Block;
import net.minecraft.block.BlockLeavesBase; import net.minecraft.block.BlockLeavesBase;
import net.minecraft.block.material.Material; import net.minecraft.block.material.Material;
import net.minecraft.client.renderer.texture.IconRegister; import net.minecraft.client.renderer.texture.IconRegister;
import net.minecraft.creativetab.CreativeTabs;
import net.minecraft.entity.player.EntityPlayer; import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.item.Item;
import net.minecraft.item.ItemStack; import net.minecraft.item.ItemStack;
import net.minecraft.stats.StatList;
import net.minecraft.util.Icon; import net.minecraft.util.Icon;
import net.minecraft.world.IBlockAccess; import net.minecraft.world.IBlockAccess;
import net.minecraft.world.World; 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 * 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 @Override
@SideOnly(Side.CLIENT)
public void registerIcons(IconRegister par1IconRegister) public void registerIcons(IconRegister par1IconRegister)
{ {
this.blockIcon[0] = par1IconRegister.registerIcon("BiomesOPlenty:redleaves1"); this.blockIcon[0] = par1IconRegister.registerIcon("BiomesOPlenty:redleaves1");
this.blockIcon[1] = par1IconRegister.registerIcon("BiomesOPlenty:redleaves2"); this.blockIcon[1] = par1IconRegister.registerIcon("BiomesOPlenty:redleaves2");
} }
@SideOnly(Side.CLIENT)
public Icon getBlockTextureFromSideAndMetadata(int par1, int par2) public Icon getBlockTextureFromSideAndMetadata(int par1, int par2)
{ {
return blockIcon[(!isOpaqueCube() ? 0 : 1)]; 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 * 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) 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) if (par1World.canLightningStrikeAt(par2, par3 + 1, par4) && !par1World.doesBlockHaveSolidTopSurface(par2, par3 - 1, par4) && par5Random.nextInt(15) == 1)
@ -258,17 +258,9 @@ public class BlockRedLeaves extends BlockLeavesBase
* block and l is the block's subtype/damage. * block and l is the block's subtype/damage.
*/ */
public void harvestBlock(World par1World, EntityPlayer par2EntityPlayer, int par3, int par4, int par5, int par6) 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);
} }
}
/** /**
* Determines the damage on the item the block drops. Used in cloth and wood. * Determines the damage on the item the block drops. Used in cloth and wood.
@ -283,12 +275,6 @@ public class BlockRedLeaves extends BlockLeavesBase
return Block.leaves.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) public boolean shouldSideBeRendered(IBlockAccess par1IBlockAccess, int par2, int par3, int par4, int par5)
{ {
return true; 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. * Pass true to draw this block using fancy graphics, or false for fast graphics.
*/ */
@SideOnly(Side.CLIENT)
public void setGraphicsLevel(boolean par1) public void setGraphicsLevel(boolean par1)
{ {
this.graphicsLevel = par1; this.graphicsLevel = par1;
} }
@Override
public boolean isShearable(ItemStack item, World world, int x, int y, int z)
{
return true;
}
@Override
public ArrayList<ItemStack> onSheared(ItemStack item, World world, int x, int y, int z, int fortune)
{
ArrayList<ItemStack> ret = new ArrayList<ItemStack>();
ret.add(new ItemStack(this, 1, world.getBlockMetadata(x, y, z) & 3));
return ret;
}
} }

View file

@ -1,28 +1,25 @@
package tdwp_ftw.biomesop.blocks; package tdwp_ftw.biomesop.blocks;
import java.util.ArrayList;
import java.util.Random; 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.Block;
import net.minecraft.block.BlockLeavesBase; import net.minecraft.block.BlockLeavesBase;
import net.minecraft.block.material.Material; import net.minecraft.block.material.Material;
import net.minecraft.client.renderer.texture.IconRegister; import net.minecraft.client.renderer.texture.IconRegister;
import net.minecraft.creativetab.CreativeTabs;
import net.minecraft.entity.player.EntityPlayer; import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.item.Item;
import net.minecraft.item.ItemStack; import net.minecraft.item.ItemStack;
import net.minecraft.stats.StatList;
import net.minecraft.util.Icon; import net.minecraft.util.Icon;
import net.minecraft.world.ColorizerFoliage; import net.minecraft.world.ColorizerFoliage;
import net.minecraft.world.IBlockAccess; import net.minecraft.world.IBlockAccess;
import net.minecraft.world.World; 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 * 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 @Override
@SideOnly(Side.CLIENT)
public void registerIcons(IconRegister par1IconRegister) public void registerIcons(IconRegister par1IconRegister)
{ {
this.blockIcon[0] = par1IconRegister.registerIcon("BiomesOPlenty:redwoodleaves1"); this.blockIcon[0] = par1IconRegister.registerIcon("BiomesOPlenty:redwoodleaves1");
this.blockIcon[1] = par1IconRegister.registerIcon("BiomesOPlenty:redwoodleaves2"); this.blockIcon[1] = par1IconRegister.registerIcon("BiomesOPlenty:redwoodleaves2");
} }
@SideOnly(Side.CLIENT)
public Icon getBlockTextureFromSideAndMetadata(int par1, int par2) public Icon getBlockTextureFromSideAndMetadata(int par1, int par2)
{ {
return blockIcon[(!isOpaqueCube() ? 0 : 1)]; return blockIcon[(!isOpaqueCube() ? 0 : 1)];
} }
@SideOnly(Side.CLIENT)
public int getBlockColor() public int getBlockColor()
{ {
double var1 = 0.5D; double var1 = 0.5D;
@ -63,6 +63,7 @@ public class BlockRedwoodLeaves extends BlockLeavesBase
/** /**
* Returns the color this block should be rendered. Used by leaves. * Returns the color this block should be rendered. Used by leaves.
*/ */
@SideOnly(Side.CLIENT)
public int getRenderColor(int par1) public int getRenderColor(int par1)
{ {
return (par1 & 3) == 1 ? ColorizerFoliage.getFoliageColorPine() : ((par1 & 3) == 2 ? ColorizerFoliage.getFoliageColorBirch() : ColorizerFoliage.getFoliageColorBasic()); 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 * Returns a integer with hex for 0xrrggbb with this color multiplied against the blocks color. Note only called
* when first determining what to render. * when first determining what to render.
*/ */
@SideOnly(Side.CLIENT)
public int colorMultiplier(IBlockAccess par1IBlockAccess, int par2, int par3, int par4) public int colorMultiplier(IBlockAccess par1IBlockAccess, int par2, int par3, int par4)
{ {
int var6 = 0; 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 * 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) 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) if (par1World.canLightningStrikeAt(par2, par3 + 1, par4) && !par1World.doesBlockHaveSolidTopSurface(par2, par3 - 1, par4) && par5Random.nextInt(15) == 1)
@ -298,17 +301,9 @@ public class BlockRedwoodLeaves extends BlockLeavesBase
* block and l is the block's subtype/damage. * block and l is the block's subtype/damage.
*/ */
public void harvestBlock(World par1World, EntityPlayer par2EntityPlayer, int par3, int par4, int par5, int par6) 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);
} }
}
/** /**
* Determines the damage on the item the block drops. Used in cloth and wood. * Determines the damage on the item the block drops. Used in cloth and wood.
@ -323,12 +318,6 @@ public class BlockRedwoodLeaves extends BlockLeavesBase
return Block.leaves.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) public boolean shouldSideBeRendered(IBlockAccess par1IBlockAccess, int par2, int par3, int par4, int par5)
{ {
return true; 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. * Pass true to draw this block using fancy graphics, or false for fast graphics.
*/ */
@SideOnly(Side.CLIENT)
public void setGraphicsLevel(boolean par1) public void setGraphicsLevel(boolean par1)
{ {
this.graphicsLevel = par1; this.graphicsLevel = par1;
} }
@Override
public boolean isShearable(ItemStack item, World world, int x, int y, int z)
{
return true;
}
@Override
public ArrayList<ItemStack> onSheared(ItemStack item, World world, int x, int y, int z, int fortune)
{
ArrayList<ItemStack> ret = new ArrayList<ItemStack>();
ret.add(new ItemStack(this, 1, world.getBlockMetadata(x, y, z) & 3));
return ret;
}
} }

View file

@ -1,27 +1,24 @@
package tdwp_ftw.biomesop.blocks; package tdwp_ftw.biomesop.blocks;
import java.util.ArrayList;
import java.util.Random; 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.Block;
import net.minecraft.block.BlockLeavesBase; import net.minecraft.block.BlockLeavesBase;
import net.minecraft.block.material.Material; import net.minecraft.block.material.Material;
import net.minecraft.client.renderer.texture.IconRegister; import net.minecraft.client.renderer.texture.IconRegister;
import net.minecraft.creativetab.CreativeTabs;
import net.minecraft.entity.player.EntityPlayer; import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.item.Item;
import net.minecraft.item.ItemStack; import net.minecraft.item.ItemStack;
import net.minecraft.stats.StatList;
import net.minecraft.util.Icon; import net.minecraft.util.Icon;
import net.minecraft.world.IBlockAccess; import net.minecraft.world.IBlockAccess;
import net.minecraft.world.World; 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 * 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 @Override
@SideOnly(Side.CLIENT)
public void registerIcons(IconRegister par1IconRegister) public void registerIcons(IconRegister par1IconRegister)
{ {
this.blockIcon[0] = par1IconRegister.registerIcon("BiomesOPlenty:whiteleaves1"); this.blockIcon[0] = par1IconRegister.registerIcon("BiomesOPlenty:whiteleaves1");
this.blockIcon[1] = par1IconRegister.registerIcon("BiomesOPlenty:whiteleaves2"); this.blockIcon[1] = par1IconRegister.registerIcon("BiomesOPlenty:whiteleaves2");
} }
@SideOnly(Side.CLIENT)
public Icon getBlockTextureFromSideAndMetadata(int par1, int par2) public Icon getBlockTextureFromSideAndMetadata(int par1, int par2)
{ {
return blockIcon[(!isOpaqueCube() ? 0 : 1)]; 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 * 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) 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) if (par1World.canLightningStrikeAt(par2, par3 + 1, par4) && !par1World.doesBlockHaveSolidTopSurface(par2, par3 - 1, par4) && par5Random.nextInt(15) == 1)
@ -258,17 +258,9 @@ public class BlockWhiteLeaves extends BlockLeavesBase
* block and l is the block's subtype/damage. * block and l is the block's subtype/damage.
*/ */
public void harvestBlock(World par1World, EntityPlayer par2EntityPlayer, int par3, int par4, int par5, int par6) 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);
} }
}
/** /**
* Determines the damage on the item the block drops. Used in cloth and wood. * Determines the damage on the item the block drops. Used in cloth and wood.
@ -283,12 +275,6 @@ public class BlockWhiteLeaves extends BlockLeavesBase
return Block.leaves.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) public boolean shouldSideBeRendered(IBlockAccess par1IBlockAccess, int par2, int par3, int par4, int par5)
{ {
return true; 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. * Pass true to draw this block using fancy graphics, or false for fast graphics.
*/ */
@SideOnly(Side.CLIENT)
public void setGraphicsLevel(boolean par1) public void setGraphicsLevel(boolean par1)
{ {
this.graphicsLevel = par1; this.graphicsLevel = par1;
} }
@Override
public boolean isShearable(ItemStack item, World world, int x, int y, int z)
{
return true;
}
@Override
public ArrayList<ItemStack> onSheared(ItemStack item, World world, int x, int y, int z, int fortune)
{
ArrayList<ItemStack> ret = new ArrayList<ItemStack>();
ret.add(new ItemStack(this, 1, world.getBlockMetadata(x, y, z) & 3));
return ret;
}
} }

View file

@ -1,28 +1,25 @@
package tdwp_ftw.biomesop.blocks; package tdwp_ftw.biomesop.blocks;
import java.util.ArrayList;
import java.util.Random; 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.Block;
import net.minecraft.block.BlockLeavesBase; import net.minecraft.block.BlockLeavesBase;
import net.minecraft.block.material.Material; import net.minecraft.block.material.Material;
import net.minecraft.client.renderer.texture.IconRegister; import net.minecraft.client.renderer.texture.IconRegister;
import net.minecraft.creativetab.CreativeTabs;
import net.minecraft.entity.player.EntityPlayer; import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.item.Item;
import net.minecraft.item.ItemStack; import net.minecraft.item.ItemStack;
import net.minecraft.stats.StatList;
import net.minecraft.util.Icon; import net.minecraft.util.Icon;
import net.minecraft.world.ColorizerFoliage; import net.minecraft.world.ColorizerFoliage;
import net.minecraft.world.IBlockAccess; import net.minecraft.world.IBlockAccess;
import net.minecraft.world.World; 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 * 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 @Override
@SideOnly(Side.CLIENT)
public void registerIcons(IconRegister par1IconRegister) public void registerIcons(IconRegister par1IconRegister)
{ {
this.blockIcon[0] = par1IconRegister.registerIcon("BiomesOPlenty:willowleaves3"); this.blockIcon[0] = par1IconRegister.registerIcon("BiomesOPlenty:willowleaves3");
this.blockIcon[1] = par1IconRegister.registerIcon("BiomesOPlenty:willowleaves4"); this.blockIcon[1] = par1IconRegister.registerIcon("BiomesOPlenty:willowleaves4");
} }
@SideOnly(Side.CLIENT)
public Icon getBlockTextureFromSideAndMetadata(int par1, int par2) public Icon getBlockTextureFromSideAndMetadata(int par1, int par2)
{ {
return blockIcon[(!isOpaqueCube() ? 0 : 1)]; return blockIcon[(!isOpaqueCube() ? 0 : 1)];
} }
@SideOnly(Side.CLIENT)
public int getBlockColor() public int getBlockColor()
{ {
double var1 = 0.5D; double var1 = 0.5D;
@ -63,6 +63,7 @@ public class BlockWillowLeaves extends BlockLeavesBase
/** /**
* Returns the color this block should be rendered. Used by leaves. * Returns the color this block should be rendered. Used by leaves.
*/ */
@SideOnly(Side.CLIENT)
public int getRenderColor(int par1) public int getRenderColor(int par1)
{ {
return (par1 & 3) == 1 ? ColorizerFoliage.getFoliageColorPine() : ((par1 & 3) == 2 ? ColorizerFoliage.getFoliageColorBirch() : ColorizerFoliage.getFoliageColorBasic()); 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 * Returns a integer with hex for 0xrrggbb with this color multiplied against the blocks color. Note only called
* when first determining what to render. * when first determining what to render.
*/ */
@SideOnly(Side.CLIENT)
public int colorMultiplier(IBlockAccess par1IBlockAccess, int par2, int par3, int par4) public int colorMultiplier(IBlockAccess par1IBlockAccess, int par2, int par3, int par4)
{ {
int var6 = 0; 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 * 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) 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) if (par1World.canLightningStrikeAt(par2, par3 + 1, par4) && !par1World.doesBlockHaveSolidTopSurface(par2, par3 - 1, par4) && par5Random.nextInt(15) == 1)
@ -298,17 +301,9 @@ public class BlockWillowLeaves extends BlockLeavesBase
* block and l is the block's subtype/damage. * block and l is the block's subtype/damage.
*/ */
public void harvestBlock(World par1World, EntityPlayer par2EntityPlayer, int par3, int par4, int par5, int par6) 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);
} }
}
/** /**
* Determines the damage on the item the block drops. Used in cloth and wood. * Determines the damage on the item the block drops. Used in cloth and wood.
@ -323,12 +318,6 @@ public class BlockWillowLeaves extends BlockLeavesBase
return Block.leaves.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) public boolean shouldSideBeRendered(IBlockAccess par1IBlockAccess, int par2, int par3, int par4, int par5)
{ {
return true; 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. * Pass true to draw this block using fancy graphics, or false for fast graphics.
*/ */
@SideOnly(Side.CLIENT)
public void setGraphicsLevel(boolean par1) public void setGraphicsLevel(boolean par1)
{ {
this.graphicsLevel = par1; this.graphicsLevel = par1;
} }
@Override
public boolean isShearable(ItemStack item, World world, int x, int y, int z)
{
return true;
}
@Override
public ArrayList<ItemStack> onSheared(ItemStack item, World world, int x, int y, int z, int fortune)
{
ArrayList<ItemStack> ret = new ArrayList<ItemStack>();
ret.add(new ItemStack(this, 1, world.getBlockMetadata(x, y, z) & 3));
return ret;
}
} }