Files
CustomNPC-Plus/src/main/java/noppes/npcs/blocks/tiles/TileBook.java
T
2025-02-13 03:12:46 -05:00

22 lines
673 B
Java

package noppes.npcs.blocks.tiles;
import net.minecraft.init.Items;
import net.minecraft.item.ItemStack;
import net.minecraft.nbt.NBTTagCompound;
public class TileBook extends TileVariant {
public ItemStack book = new ItemStack(Items.writable_book);
public void readFromNBT(NBTTagCompound compound){
super.readFromNBT(compound);
book = ItemStack.loadItemStackFromNBT(compound.getCompoundTag("Items"));
if(book == null)
book = new ItemStack(Items.writable_book);
}
public void writeToNBT(NBTTagCompound compound){
super.writeToNBT(compound);
compound.setTag("Items", book.writeToNBT(new NBTTagCompound()));
}
}