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:
parent
104885f934
commit
098cc8e66d
1 changed files with 9 additions and 10 deletions
|
@ -206,14 +206,13 @@ public abstract class Pipe implements IPipe, IDropControlInventory {
|
||||||
NBTTagCompound nbttagcompoundC = new NBTTagCompound();
|
NBTTagCompound nbttagcompoundC = new NBTTagCompound();
|
||||||
gate.writeToNBT(nbttagcompoundC);
|
gate.writeToNBT(nbttagcompoundC);
|
||||||
nbttagcompound.setTag("Gate", nbttagcompoundC);
|
nbttagcompound.setTag("Gate", nbttagcompoundC);
|
||||||
|
// Wire states are stored for pipes with gates only
|
||||||
|
for (int i = 0; i < 4; ++i)
|
||||||
|
nbttagcompound.setBoolean("wireState[" + i + "]", broadcastSignal[i]);
|
||||||
}
|
}
|
||||||
|
|
||||||
for (int i = 0; i < 4; ++i) {
|
for (int i = 0; i < 4; ++i)
|
||||||
nbttagcompound.setBoolean("wireSet[" + i + "]", wireSet[i]);
|
nbttagcompound.setBoolean("wireSet[" + i + "]", wireSet[i]);
|
||||||
nbttagcompound.setBoolean("wireState[" + i + "]", broadcastSignal[i]);
|
|
||||||
}
|
|
||||||
|
|
||||||
nbttagcompound.setBoolean("redstoneState", broadcastRedstone);
|
|
||||||
|
|
||||||
for (int i = 0; i < 8; ++i) {
|
for (int i = 0; i < 8; ++i) {
|
||||||
nbttagcompound.setInteger("action[" + i + "]", activatedActions[i] != null ? activatedActions[i].getId() : 0);
|
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;
|
gate.kind = kind;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
// Wire states are restored for pipes with gates
|
||||||
|
if (gate != null)
|
||||||
|
for (int i = 0; i < 4; ++i)
|
||||||
|
broadcastSignal[i] = nbttagcompound.getBoolean("wireState[" + i + "]");
|
||||||
|
|
||||||
for (int i = 0; i < 4; ++i) {
|
for (int i = 0; i < 4; ++i)
|
||||||
wireSet[i] = nbttagcompound.getBoolean("wireSet[" + i + "]");
|
wireSet[i] = nbttagcompound.getBoolean("wireSet[" + i + "]");
|
||||||
broadcastSignal[i] = nbttagcompound.getBoolean("wireState[" + i + "]");
|
|
||||||
}
|
|
||||||
|
|
||||||
broadcastRedstone = nbttagcompound.getBoolean("redstoneState");
|
|
||||||
|
|
||||||
for (int i = 0; i < 8; ++i) {
|
for (int i = 0; i < 8; ++i) {
|
||||||
activatedActions[i] = ActionManager.actions[nbttagcompound.getInteger("action[" + i + "]")];
|
activatedActions[i] = ActionManager.actions[nbttagcompound.getInteger("action[" + i + "]")];
|
||||||
|
|
Loading…
Reference in a new issue