Make Thermodynamic Conductors read/write
@@ -7,6 +7,7 @@ import java.util.Optional;
import java.util.UUID;
import javax.annotation.Nonnull;
import javax.annotation.Nullable;
+import mekanism.api.DataHandlerUtils;
import mekanism.api.NBTConstants;
import mekanism.api.heat.IHeatCapacitor;
import mekanism.api.heat.IHeatHandler;
@@ -35,6 +36,7 @@ import net.minecraft.nbt.CompoundNBT;
import net.minecraft.tileentity.TileEntity;
import net.minecraft.util.Direction;
import net.minecraftforge.common.capabilities.Capability;
+import net.minecraftforge.common.util.Constants.NBT;
import net.minecraftforge.common.util.LazyOptional;
public class TileEntityThermodynamicConductor extends TileEntityTransmitter<IHeatHandler, HeatNetwork, Void> implements ITileHeatHandler {
@@ -102,6 +104,21 @@ public class TileEntityThermodynamicConductor extends TileEntityTransmitter<IHea
return MekanismUtils.toOptional(CapabilityUtils.getCapability(getCachedTile(side), Capabilities.HEAT_HANDLER_CAPABILITY, side.getOpposite())).orElse(null);
}
+ @Nonnull
+ @Override
+ public CompoundNBT write(CompoundNBT tag) {
+ super.write(tag);
+ buffer.serializeNBT();
+ tag.put(NBTConstants.HEAT_CAPACITORS, DataHandlerUtils.writeContainers(getHeatCapacitors(null)));
+ return tag;
+ }
+
+ @Override
+ public void read(CompoundNBT tag) {
+ super.read(tag);
+ DataHandlerUtils.readContainers(getHeatCapacitors(null), tag.getList(NBTConstants.HEAT_CAPACITORS, NBT.TAG_COMPOUND));
+ }
+
@Nonnull
@Override
public CompoundNBT getReducedUpdateTag() {
