NaturesAura/src/main/java/de/ellpeck/naturesaura/blocks/tiles/TileEntityOfferingTable.java

33 lines
984 B
Java
Raw Normal View History

2018-11-19 20:18:22 +01:00
package de.ellpeck.naturesaura.blocks.tiles;
import net.minecraft.nbt.NBTTagCompound;
import net.minecraft.util.EnumFacing;
import net.minecraftforge.items.IItemHandlerModifiable;
import net.minecraftforge.items.ItemStackHandler;
public class TileEntityOfferingTable extends TileEntityImpl {
public final ItemStackHandler items = new ItemStackHandlerNA(1, this, true);
@Override
public void writeNBT(NBTTagCompound compound, SaveType type) {
super.writeNBT(compound, type);
if (type != SaveType.BLOCK) {
2018-11-20 11:48:45 +01:00
compound.setTag("items", this.items.serializeNBT());
2018-11-19 20:18:22 +01:00
}
}
@Override
public void readNBT(NBTTagCompound compound, SaveType type) {
super.readNBT(compound, type);
if (type != SaveType.BLOCK) {
2018-11-20 11:48:45 +01:00
this.items.deserializeNBT(compound.getCompoundTag("items"));
2018-11-19 20:18:22 +01:00
}
}
@Override
public IItemHandlerModifiable getItemHandler(EnumFacing facing) {
return this.items;
}
}