From 098cc8e66d979e928867c0f3585ae2de75b7430d Mon Sep 17 00:00:00 2001 From: target-san Date: Tue, 21 May 2013 07:46:54 +0300 Subject: [PATCH] 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 --- common/buildcraft/transport/Pipe.java | 19 +++++++++---------- 1 file changed, 9 insertions(+), 10 deletions(-) diff --git a/common/buildcraft/transport/Pipe.java b/common/buildcraft/transport/Pipe.java index 21945636..4a4026db 100644 --- a/common/buildcraft/transport/Pipe.java +++ b/common/buildcraft/transport/Pipe.java @@ -206,14 +206,13 @@ public abstract class Pipe implements IPipe, IDropControlInventory { NBTTagCompound nbttagcompoundC = new NBTTagCompound(); gate.writeToNBT(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("wireState[" + i + "]", broadcastSignal[i]); - } - - nbttagcompound.setBoolean("redstoneState", broadcastRedstone); 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; } } + // 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 + "]"); - broadcastSignal[i] = nbttagcompound.getBoolean("wireState[" + i + "]"); - } - - broadcastRedstone = nbttagcompound.getBoolean("redstoneState"); for (int i = 0; i < 8; ++i) { activatedActions[i] = ActionManager.actions[nbttagcompound.getInteger("action[" + i + "]")];