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