package net.tropicraft.item;
import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;
import net.minecraft.client.renderer.texture.IIconRegister;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.item.ItemStack;
import net.minecraft.world.World;
import net.tropicraft.entity.projectile.EntityTropicraftLeafballNew;
import net.tropicraft.info.TCInfo;
import CoroUtil.entity.ItemTropicraftLeafball;
/* extends to allow inner logic fixes to still happen */
public class ItemTropicraftLeafballNew extends ItemTropicraftLeafball
{
public ItemTropicraftLeafballNew()
{
super();
maxStackSize = 16;
}
public ItemStack onItemRightClick(ItemStack itemstack, World world, EntityPlayer entityplayer)
{
if (!entityplayer.capabilities.isCreativeMode)
{
itemstack.stackSize--;
}
world.playSoundAtEntity(entityplayer, "random.bow", 0.5F, 0.4F / (itemRand.nextFloat() * 0.4F + 0.8F));
if (!world.isRemote)
{
world.spawnEntityInWorld(new EntityTropicraftLeafballNew(world, entityplayer));
}
return itemstack;
}
@Override
public String getUnlocalizedName() {
return String.format("item.%s%s", TCInfo.ICON_LOCATION, getActualName(super.getUnlocalizedName()));
}
/**
* @param itemStack ItemStack instance of this item
* @return The unlocalized item name
*/
@Override
public String getUnlocalizedName(ItemStack itemStack) {
return String.format("item.%s%s", TCInfo.ICON_LOCATION, getActualName(super.getUnlocalizedName()));
}
/**
* Get the actual name of the block
* @param unlocalizedName Unlocalized name of the block
* @return Actual name of the block, without the "tile." prefix
*/
protected String getActualName(String unlocalizedName) {
return unlocalizedName.substring(unlocalizedName.indexOf(".") + 1);
}
/**
* Register all icons here
* @param iconRegister Icon registry
*/
@Override
@SideOnly(Side.CLIENT)
public void registerIcons(IIconRegister iconRegister) {
itemIcon = iconRegister.registerIcon(this.getUnlocalizedName().substring(this.getUnlocalizedName().indexOf(".") + 1));
}
}