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:44:07 +01:00
|
|
|
compound.setTag("ingredients", 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:44:07 +01:00
|
|
|
this.items.deserializeNBT(compound.getCompoundTag("ingredients"));
|
2018-11-19 20:18:22 +01:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
@Override
|
|
|
|
public IItemHandlerModifiable getItemHandler(EnumFacing facing) {
|
|
|
|
return this.items;
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|