Modified pipe persistence. Only pipe gates can actually broadcast wire signal. And redstone broadcast is generated from only from triggers and only on gates - so no sense to store it

This commit is contained in:
target-san 2013-05-21 07:46:54 +03:00
parent 104885f934
commit 098cc8e66d

View file

@ -206,14 +206,13 @@ public abstract class Pipe implements IPipe, IDropControlInventory {
NBTTagCompound nbttagcompoundC = new NBTTagCompound();
gate.writeToNBT(nbttagcompoundC);
nbttagcompound.setTag("Gate", nbttagcompoundC);
}
for (int i = 0; i < 4; ++i) {
nbttagcompound.setBoolean("wireSet[" + i + "]", wireSet[i]);
// Wire states are stored for pipes with gates only
for (int i = 0; i < 4; ++i)
nbttagcompound.setBoolean("wireState[" + i + "]", broadcastSignal[i]);
}
nbttagcompound.setBoolean("redstoneState", broadcastRedstone);
for (int i = 0; i < 4; ++i)
nbttagcompound.setBoolean("wireSet[" + i + "]", wireSet[i]);
for (int i = 0; i < 8; ++i) {
nbttagcompound.setInteger("action[" + i + "]", activatedActions[i] != null ? activatedActions[i].getId() : 0);
@ -245,13 +244,13 @@ public abstract class Pipe implements IPipe, IDropControlInventory {
gate.kind = kind;
}
}
for (int i = 0; i < 4; ++i) {
wireSet[i] = nbttagcompound.getBoolean("wireSet[" + i + "]");
// Wire states are restored for pipes with gates
if (gate != null)
for (int i = 0; i < 4; ++i)
broadcastSignal[i] = nbttagcompound.getBoolean("wireState[" + i + "]");
}
broadcastRedstone = nbttagcompound.getBoolean("redstoneState");
for (int i = 0; i < 4; ++i)
wireSet[i] = nbttagcompound.getBoolean("wireSet[" + i + "]");
for (int i = 0; i < 8; ++i) {
activatedActions[i] = ActionManager.actions[nbttagcompound.getInteger("action[" + i + "]")];