Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- package Ghost.TestMod;
- import java.util.List;
- 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.BlockPos;
- import net.minecraft.util.EnumChatFormatting;
- import net.minecraft.util.EnumFacing;
- import net.minecraft.world.World;
- import net.minecraftforge.fml.relauncher.Side;
- import net.minecraftforge.fml.relauncher.SideOnly;
- public class ItemProperties extends Item{
- @Override
- public boolean onItemUse(ItemStack stack, EntityPlayer playerIn, World worldIn, BlockPos pos, EnumFacing side, float hitX, float hitY, float hitZ)
- {
- if(!playerIn.isSneaking())
- {
- if(stack.getTagCompound() == null)
- {
- stack.setTagCompound(new NBTTagCompound());
- }
- NBTTagCompound nbt = new NBTTagCompound();
- nbt.getClass();
- stack.getTagCompound().setTag("Captured", nbt);
- stack.setStackDisplayName(EnumChatFormatting.AQUA + "PokeBall");
- }
- return false;
- }
- @Override
- public ItemStack onItemRightClick(ItemStack stack, World worldIn, EntityPlayer playerIn)
- {
- if(playerIn.isSneaking())
- {
- if(stack.getTagCompound() != null )
- {
- stack.getTagCompound().removeTag("Captured");
- stack.clearCustomName();
- }
- }
- return stack;
- }
- @Override
- @SideOnly(Side.CLIENT)
- public void addInformation(ItemStack stack, EntityPlayer playerIn, List tooltip, boolean advanced)
- {
- if(stack.getTagCompound() != null)
- {
- if(stack.getTagCompound().hasKey("Captured"))
- {
- NBTTagCompound nbt = (NBTTagCompound) stack.getTagCompound().getTag("Captured");
- Class<? extends NBTTagCompound> Captured = nbt.getClass();
- tooltip.add("Captured");
- }
- }
- }
- @Override
- @SideOnly(Side.CLIENT)
- public boolean hasEffect(ItemStack stack)
- {
- if(stack.getTagCompound() != null)
- {
- return stack.getTagCompound().hasKey("Captured");
- }
- return false;
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment