@Override public void writeToNBT(NBTTagCompound nbt, MappingRegistry registry) { nbt.setByte("mode", (byte) mode.ordinal()); nbt.setInteger("x", x); nbt.setInteger("y", y); nbt.setInteger("z", z); if (schematic != null) { NBTTagCompound schematicNBT = new NBTTagCompound(); SchematicFactory.getFactory(schematic.getClass()) .saveSchematicToWorldNBT(schematicNBT, schematic, registry); nbt.setTag("schematic", schematicNBT); } NBTTagList nbtStacks = new NBTTagList(); if (stackConsumed != null) { for (ItemStack stack : stackConsumed) { NBTTagCompound nbtStack = new NBTTagCompound(); stack.writeToNBT(nbtStack); nbtStacks.appendTag(nbtStack); } } nbt.setTag("stackConsumed", nbtStacks); }
@Override public int buildTime() { if (schematic == null) { return 1; } else { return schematic.buildTime(); } }
@Override public int getEnergyRequirement() { return schematic.getEnergyRequirement(stackConsumed); }
@Override public boolean isAlreadyBuilt(IBuilderContext context) { return schematic.isAlreadyBuilt(context, x, y, z); }