BloodMagic/BM_src/WayofTime/alchemicalWizardry/common/items/sigil/DivinationSigil.java
Fenn e3644f2d2b Massive rework of configs, items and blocks.
I redone where the items/blocsks are stored and how the configs are
handled to clean up it and give space. You can change the config line to
AWWayofTime if you want to keep the compatibility with old configs. Now
you reference the blocks from the ModBlocks and Items from the ModItems.
2014-01-17 21:05:38 +00:00

93 lines
2.8 KiB
Java

package WayofTime.alchemicalWizardry.common.items.sigil;
import WayofTime.alchemicalWizardry.common.AlchemicalWizardry;
import WayofTime.alchemicalWizardry.common.ArmourUpgrade;
import WayofTime.alchemicalWizardry.common.PacketHandler;
import WayofTime.alchemicalWizardry.common.items.EnergyItems;
import cpw.mods.fml.common.network.PacketDispatcher;
import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;
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.nbt.NBTTagCompound;
import net.minecraft.potion.Potion;
import net.minecraft.potion.PotionEffect;
import net.minecraft.world.World;
import java.util.List;
public class DivinationSigil extends Item implements ArmourUpgrade {
public DivinationSigil(int par1)
{
super(par1);
this.maxStackSize = 1;
//setMaxDamage(1000);
setCreativeTab(AlchemicalWizardry.tabBloodMagic);
}
@Override
@SideOnly(Side.CLIENT)
public void registerIcons(IconRegister iconRegister)
{
this.itemIcon = iconRegister.registerIcon("AlchemicalWizardry:DivinationSigil");
}
@Override
public void addInformation(ItemStack par1ItemStack, EntityPlayer par2EntityPlayer, List par3List, boolean par4)
{
par3List.add("Peer into the soul to");
par3List.add("get the current essence");
if (!(par1ItemStack.stackTagCompound == null))
{
par3List.add("Current owner: " + par1ItemStack.stackTagCompound.getString("ownerName"));
}
}
@Override
public ItemStack onItemRightClick(ItemStack par1ItemStack, World par2World, EntityPlayer par3EntityPlayer)
{
EnergyItems.checkAndSetItemOwner(par1ItemStack, par3EntityPlayer);
if (!par3EntityPlayer.worldObj.isRemote)
{
return par1ItemStack;
}
NBTTagCompound itemTag = par1ItemStack.stackTagCompound;
if (itemTag == null || itemTag.getString("ownerName").equals(""))
{
return par1ItemStack;
}
String ownerName = itemTag.getString("ownerName");
PacketDispatcher.sendPacketToServer(PacketHandler.getPacket(ownerName));
return par1ItemStack;
}
@Override
public void onArmourUpdate(World world, EntityPlayer player,
ItemStack thisItemStack)
{
// TODO Auto-generated method stub
player.addPotionEffect(new PotionEffect(Potion.nightVision.id, 400, 9));
}
@Override
public boolean isUpgrade()
{
// TODO Auto-generated method stub
return true;
}
@Override
public int getEnergyForTenSeconds()
{
// TODO Auto-generated method stub
return 25;
}
}