NaturesAura/src/main/java/de/ellpeck/naturesaura/blocks/tiles/TileEntityOfferingTable.java
2018-11-20 11:48:45 +01:00

33 lines
984 B
Java

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) {
compound.setTag("items", this.items.serializeNBT());
}
}
@Override
public void readNBT(NBTTagCompound compound, SaveType type) {
super.readNBT(compound, type);
if (type != SaveType.BLOCK) {
this.items.deserializeNBT(compound.getCompoundTag("items"));
}
}
@Override
public IItemHandlerModifiable getItemHandler(EnumFacing facing) {
return this.items;
}
}