Advertisement
Guest User

Untitled

a guest
Jun 16th, 2016
104
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 0.91 KB | None | 0 0
  1. package me.ferdz.placeableitems.tileentity;
  2.  
  3. import net.minecraft.init.Items;
  4. import net.minecraft.item.ItemStack;
  5. import net.minecraft.nbt.NBTTagCompound;
  6. import net.minecraft.tileentity.TileEntity;
  7.  
  8. public class TEArrow extends TileEntity {
  9.    
  10.     private ItemStack arrow;
  11.    
  12.     public TEArrow() {
  13.         arrow = new ItemStack(Items.ARROW);
  14.     }
  15.  
  16.     public ItemStack getType() {
  17.         return this.arrow;
  18.     }
  19.  
  20.     public void setType(ItemStack arrow) {
  21.         this.arrow = arrow;
  22.     }
  23.  
  24.     @Override
  25.     public void readFromNBT(NBTTagCompound nbttagcompound) {
  26.         super.readFromNBT(nbttagcompound);
  27.         arrow.readFromNBT(nbttagcompound.getCompoundTag("arrow"));
  28.     }
  29.  
  30.     @Override
  31.     public NBTTagCompound writeToNBT(NBTTagCompound nbttagcompound) {
  32.         super.writeToNBT(nbttagcompound);
  33.         NBTTagCompound nbt2 = new NBTTagCompound();
  34.         nbt2 = arrow.writeToNBT(nbt2);
  35.         nbttagcompound.setTag("arrow", nbt2);
  36.         return nbttagcompound;
  37.     }
  38. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement