BiomesOPlenty/common/biomesoplenty/blocks/BlockBeetroot.java

88 lines
1.9 KiB
Java
Raw Normal View History

package biomesoplenty.blocks;
import java.util.Random;
import biomesoplenty.BiomesOPlenty;
import biomesoplenty.api.Items;
import net.minecraft.block.BlockCrops;
import net.minecraft.client.renderer.texture.IconRegister;
import net.minecraft.item.Item;
import net.minecraft.util.Icon;
import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;
public class BlockBeetroot extends BlockCrops
{
@SideOnly(Side.CLIENT)
private Icon[] iconArray;
public BlockBeetroot(int par1)
{
super(par1);
}
@SideOnly(Side.CLIENT)
/**
* From the specified side and block metadata retrieves the blocks texture. Args: side, metadata
*/
@Override
public Icon getIcon(int par1, int par2)
{
if (par2 < 7)
{
if (par2 == 6)
{
par2 = 5;
}
return this.iconArray[par2 >> 1];
}
else
{
return this.iconArray[3];
}
}
/**
* Generate a seed ItemStack for this crop.
*/
@Override
protected int getSeedItem()
{
return Items.beetrootseeds.get().itemID;
}
/**
* Generate a crop produce ItemStack for this crop.
*/
@Override
protected int getCropItem()
{
return Items.food.get().itemID;
}
@Override
public int damageDropped(int meta)
{
return meta == 7 ? 11 : 0;
}
@SideOnly(Side.CLIENT)
/**
* When this method is called, your block should register all the icons it needs with the given IconRegister. This
* is the only chance you get to register icons.
*/
@Override
public void registerIcons(IconRegister par1IconRegister)
{
this.iconArray = new Icon[4];
for (int i = 0; i < this.iconArray.length; ++i)
{
this.iconArray[i] = par1IconRegister.registerIcon("biomesoplenty:" + this.getTextureName() + "_stage_" + i);
}
}
}