Gates are now specifically providing actions specific to their side,
for #1895.
This commit is contained in:
parent
8801cdedc9
commit
a670949a9c
3 changed files with 17 additions and 15 deletions
|
@ -149,7 +149,7 @@ public final class Gate implements IGate {
|
||||||
}
|
}
|
||||||
data.setTag("expansions", exList);
|
data.setTag("expansions", exList);
|
||||||
|
|
||||||
for (int i = 0; i < 8; ++i) {
|
for (int i = 0; i < MAX_STATEMENTS; ++i) {
|
||||||
if (triggers[i] != null) {
|
if (triggers[i] != null) {
|
||||||
data.setString("trigger[" + i + "]", triggers[i].getUniqueTag());
|
data.setString("trigger[" + i + "]", triggers[i].getUniqueTag());
|
||||||
}
|
}
|
||||||
|
@ -158,7 +158,7 @@ public final class Gate implements IGate {
|
||||||
data.setString("action[" + i + "]", actions[i].getUniqueTag());
|
data.setString("action[" + i + "]", actions[i].getUniqueTag());
|
||||||
}
|
}
|
||||||
|
|
||||||
for (int j = 0; j < 3; ++j) {
|
for (int j = 0; j < MAX_PARAMETERS; ++j) {
|
||||||
if (triggerParameters[i][j] != null) {
|
if (triggerParameters[i][j] != null) {
|
||||||
NBTTagCompound cpt = new NBTTagCompound();
|
NBTTagCompound cpt = new NBTTagCompound();
|
||||||
cpt.setString("kind", StatementManager.getParameterKind(triggerParameters[i][j]));
|
cpt.setString("kind", StatementManager.getParameterKind(triggerParameters[i][j]));
|
||||||
|
@ -167,7 +167,7 @@ public final class Gate implements IGate {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
for (int j = 0; j < 3; ++j) {
|
for (int j = 0; j < MAX_PARAMETERS; ++j) {
|
||||||
if (actionParameters[i][j] != null) {
|
if (actionParameters[i][j] != null) {
|
||||||
NBTTagCompound cpt = new NBTTagCompound();
|
NBTTagCompound cpt = new NBTTagCompound();
|
||||||
cpt.setString("kind", StatementManager.getParameterKind(actionParameters[i][j]));
|
cpt.setString("kind", StatementManager.getParameterKind(actionParameters[i][j]));
|
||||||
|
@ -185,7 +185,7 @@ public final class Gate implements IGate {
|
||||||
}
|
}
|
||||||
|
|
||||||
public void readFromNBT(NBTTagCompound data) {
|
public void readFromNBT(NBTTagCompound data) {
|
||||||
for (int i = 0; i < 8; ++i) {
|
for (int i = 0; i < MAX_STATEMENTS; ++i) {
|
||||||
if (data.hasKey("trigger[" + i + "]")) {
|
if (data.hasKey("trigger[" + i + "]")) {
|
||||||
triggers[i] = (ITrigger) StatementManager.statements.get(data.getString("trigger[" + i + "]"));
|
triggers[i] = (ITrigger) StatementManager.statements.get(data.getString("trigger[" + i + "]"));
|
||||||
}
|
}
|
||||||
|
@ -200,7 +200,7 @@ public final class Gate implements IGate {
|
||||||
triggerParameters[i][0].readFromNBT(data.getCompoundTag("triggerParameters[" + i + "]"));
|
triggerParameters[i][0].readFromNBT(data.getCompoundTag("triggerParameters[" + i + "]"));
|
||||||
}
|
}
|
||||||
|
|
||||||
for (int j = 0; j < 3; ++j) {
|
for (int j = 0; j < MAX_PARAMETERS; ++j) {
|
||||||
if (data.hasKey("triggerParameters[" + i + "][" + j + "]")) {
|
if (data.hasKey("triggerParameters[" + i + "][" + j + "]")) {
|
||||||
NBTTagCompound cpt = data.getCompoundTag("triggerParameters[" + i + "][" + j + "]");
|
NBTTagCompound cpt = data.getCompoundTag("triggerParameters[" + i + "][" + j + "]");
|
||||||
triggerParameters[i][j] = (ITriggerParameter) StatementManager.createParameter(cpt
|
triggerParameters[i][j] = (ITriggerParameter) StatementManager.createParameter(cpt
|
||||||
|
@ -209,7 +209,7 @@ public final class Gate implements IGate {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
for (int j = 0; j < 3; ++j) {
|
for (int j = 0; j < MAX_PARAMETERS; ++j) {
|
||||||
if (data.hasKey("actionParameters[" + i + "][" + j + "]")) {
|
if (data.hasKey("actionParameters[" + i + "][" + j + "]")) {
|
||||||
NBTTagCompound cpt = data.getCompoundTag("actionParameters[" + i + "][" + j + "]");
|
NBTTagCompound cpt = data.getCompoundTag("actionParameters[" + i + "][" + j + "]");
|
||||||
actionParameters[i][j] = (IActionParameter) StatementManager.createParameter(cpt.getString("kind"));
|
actionParameters[i][j] = (IActionParameter) StatementManager.createParameter(cpt.getString("kind"));
|
||||||
|
@ -221,6 +221,7 @@ public final class Gate implements IGate {
|
||||||
for (PipeWire wire : PipeWire.VALUES) {
|
for (PipeWire wire : PipeWire.VALUES) {
|
||||||
broadcastSignal.set(wire.ordinal(), data.getBoolean("wireState[" + wire.ordinal() + "]"));
|
broadcastSignal.set(wire.ordinal(), data.getBoolean("wireState[" + wire.ordinal() + "]"));
|
||||||
}
|
}
|
||||||
|
|
||||||
redstoneOutput = data.getByte("redstoneOutput");
|
redstoneOutput = data.getByte("redstoneOutput");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -465,6 +466,14 @@ public final class Gate implements IGate {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public LinkedList<IAction> getActions() {
|
||||||
|
LinkedList<IAction> result = new LinkedList<IAction>();
|
||||||
|
|
||||||
|
addActions(result);
|
||||||
|
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void setPulsing(boolean pulsing) {
|
public void setPulsing(boolean pulsing) {
|
||||||
if (pulsing != isPulsing) {
|
if (pulsing != isPulsing) {
|
||||||
|
|
|
@ -525,15 +525,7 @@ public abstract class Pipe<T extends PipeTransport> implements IDropControlInven
|
||||||
}
|
}
|
||||||
|
|
||||||
public LinkedList<IAction> getActions() {
|
public LinkedList<IAction> getActions() {
|
||||||
LinkedList<IAction> result = new LinkedList<IAction>();
|
return new LinkedList<IAction>();
|
||||||
|
|
||||||
for (Gate gate : gates) {
|
|
||||||
if (gate != null) {
|
|
||||||
gate.addActions(result);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
return result;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public void resetGates() {
|
public void resetGates() {
|
||||||
|
|
|
@ -105,6 +105,7 @@ public class ContainerGateInterface extends BuildCraftContainer {
|
||||||
// Do not attempt to create a list of potential actions and triggers on
|
// Do not attempt to create a list of potential actions and triggers on
|
||||||
// the client.
|
// the client.
|
||||||
if (!pipe.container.getWorldObj().isRemote) {
|
if (!pipe.container.getWorldObj().isRemote) {
|
||||||
|
potentialActions.addAll(gate.getActions());
|
||||||
potentialActions.addAll(pipe.getActions());
|
potentialActions.addAll(pipe.getActions());
|
||||||
potentialTriggers.addAll(StatementManager.getPipeTriggers(pipe.container));
|
potentialTriggers.addAll(StatementManager.getPipeTriggers(pipe.container));
|
||||||
potentialActions.addAll(StatementManager.getPipeActions(pipe.container));
|
potentialActions.addAll(StatementManager.getPipeActions(pipe.container));
|
||||||
|
|
Loading…
Reference in a new issue