
Allows event to cancel the binding (rather than set key to "" which had the same effect but was messy) Prevents binding by Fake Players
82 lines
2.4 KiB
Java
82 lines
2.4 KiB
Java
package WayofTime.alchemicalWizardry.common.items.sigil;
|
|
|
|
import WayofTime.alchemicalWizardry.AlchemicalWizardry;
|
|
import WayofTime.alchemicalWizardry.api.items.interfaces.ArmourUpgrade;
|
|
import WayofTime.alchemicalWizardry.api.items.interfaces.IHolding;
|
|
import WayofTime.alchemicalWizardry.common.items.EnergyItems;
|
|
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.Item;
|
|
import net.minecraft.item.ItemStack;
|
|
import net.minecraft.nbt.NBTTagCompound;
|
|
import net.minecraft.util.StatCollector;
|
|
import net.minecraft.world.World;
|
|
|
|
import java.util.List;
|
|
|
|
public class ItemSeerSigil extends Item implements IHolding, ArmourUpgrade
|
|
{
|
|
public ItemSeerSigil()
|
|
{
|
|
super();
|
|
this.maxStackSize = 1;
|
|
setCreativeTab(AlchemicalWizardry.tabBloodMagic);
|
|
}
|
|
|
|
@Override
|
|
@SideOnly(Side.CLIENT)
|
|
public void registerIcons(IIconRegister iconRegister)
|
|
{
|
|
this.itemIcon = iconRegister.registerIcon("AlchemicalWizardry:SeerSigil");
|
|
}
|
|
|
|
@Override
|
|
public void addInformation(ItemStack par1ItemStack, EntityPlayer par2EntityPlayer, List par3List, boolean par4)
|
|
{
|
|
par3List.add(StatCollector.translateToLocal("tooltip.seersigil.desc"));
|
|
|
|
if (!(par1ItemStack.getTagCompound() == null))
|
|
{
|
|
par3List.add(StatCollector.translateToLocal("tooltip.owner.currentowner") + " " + par1ItemStack.getTagCompound().getString("ownerName"));
|
|
}
|
|
}
|
|
|
|
@Override
|
|
public ItemStack onItemRightClick(ItemStack par1ItemStack, World par2World, EntityPlayer par3EntityPlayer)
|
|
{
|
|
if (!EnergyItems.checkAndSetItemOwner(par1ItemStack, par3EntityPlayer) || par3EntityPlayer.worldObj.isRemote)
|
|
{
|
|
return par1ItemStack;
|
|
}
|
|
|
|
NBTTagCompound itemTag = par1ItemStack.getTagCompound();
|
|
|
|
if (itemTag == null || itemTag.getString("ownerName").equals(""))
|
|
{
|
|
return par1ItemStack;
|
|
}
|
|
|
|
String ownerName = itemTag.getString("ownerName");
|
|
|
|
return par1ItemStack;
|
|
}
|
|
|
|
@Override
|
|
public void onArmourUpdate(World world, EntityPlayer player, ItemStack thisItemStack)
|
|
{
|
|
}
|
|
|
|
@Override
|
|
public boolean isUpgrade()
|
|
{
|
|
return false;
|
|
}
|
|
|
|
@Override
|
|
public int getEnergyForTenSeconds()
|
|
{
|
|
return 0;
|
|
}
|
|
}
|