From 94eccc606a677c1912d67c3e8618971696774b2c Mon Sep 17 00:00:00 2001 From: Calclavia Date: Mon, 10 Mar 2014 07:29:21 +0800 Subject: [PATCH] Fixed Quantum Gates not saving their internal data --- .../quantum/gate/PartQuantumGlyph.java | 25 ++++++++++++++++++- 1 file changed, 24 insertions(+), 1 deletion(-) diff --git a/electrical/src/main/java/resonantinduction/quantum/gate/PartQuantumGlyph.java b/electrical/src/main/java/resonantinduction/quantum/gate/PartQuantumGlyph.java index 78f5144c..4afed8d2 100644 --- a/electrical/src/main/java/resonantinduction/quantum/gate/PartQuantumGlyph.java +++ b/electrical/src/main/java/resonantinduction/quantum/gate/PartQuantumGlyph.java @@ -249,6 +249,22 @@ public class PartQuantumGlyph extends JCuboidPart implements TSlottedPart, JNorm { slot = nbt.getByte("side"); number = nbt.getByte("number"); + + if (nbt.hasKey("frequency")) + { + int frequency = nbt.getInteger("frequency"); + + if (frequency != -1) + { + ExternalInventory savedInventory = new ExternalInventory(null, this, 1); + savedInventory.load(nbt); + quantumInventories.put(frequency, savedInventory); + + FluidTank tank = new FluidTank(FluidContainerRegistry.BUCKET_VOLUME); + tank.readFromNBT(nbt); + quantumTanks.put(frequency, tank); + } + } } @Override @@ -256,6 +272,14 @@ public class PartQuantumGlyph extends JCuboidPart implements TSlottedPart, JNorm { nbt.setByte("side", slot); nbt.setByte("number", number); + int frequency = ((IQuantumGate) tile()).getFrequency(); + nbt.setInteger("frequency", frequency); + + if (frequency != -1) + { + getInventory().save(nbt); + getQuantumTank().writeToNBT(nbt); + } } @Override @@ -476,5 +500,4 @@ public class PartQuantumGlyph extends JCuboidPart implements TSlottedPart, JNorm { } - }