initialize mandatory parameters properly, fix bug with not removing certain unusable gate types when minParameters() is above 1
This commit is contained in:
parent
b997871f9a
commit
02bb70ec53
2 changed files with 20 additions and 16 deletions
|
@ -100,27 +100,23 @@ public class ContainerGateInterface extends BuildCraftContainer {
|
|||
potentialTriggers.addAll(gate.getAllValidTriggers());
|
||||
potentialActions.addAll(gate.getAllValidActions());
|
||||
|
||||
if (gate.material.numTriggerParameters == 0) {
|
||||
Iterator<IStatement> it = potentialTriggers.iterator();
|
||||
Iterator<IStatement> it = potentialTriggers.iterator();
|
||||
|
||||
while (it.hasNext()) {
|
||||
IStatement trigger = it.next();
|
||||
while (it.hasNext()) {
|
||||
IStatement trigger = it.next();
|
||||
|
||||
if (trigger.minParameters() > 0) {
|
||||
it.remove();
|
||||
}
|
||||
if (trigger.minParameters() > gate.material.numTriggerParameters) {
|
||||
it.remove();
|
||||
}
|
||||
}
|
||||
|
||||
if (gate.material.numActionParameters == 0) {
|
||||
Iterator<IStatement> it = potentialActions.iterator();
|
||||
it = potentialActions.iterator();
|
||||
|
||||
while (it.hasNext()) {
|
||||
IStatement action = it.next();
|
||||
while (it.hasNext()) {
|
||||
IStatement action = it.next();
|
||||
|
||||
if (action.minParameters() > 0) {
|
||||
it.remove();
|
||||
}
|
||||
if (action.minParameters() > gate.material.numActionParameters) {
|
||||
it.remove();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -412,7 +412,11 @@ public class GuiGateInterface extends GuiAdvancedInterface {
|
|||
}
|
||||
|
||||
for (StatementParameterSlot p : triggerSlot.parameters) {
|
||||
container.setTriggerParameter(triggerSlot.slot, p.slot, null, true);
|
||||
IStatementParameter parameter = null;
|
||||
if (changed != null && p.slot < changed.minParameters()) {
|
||||
parameter = changed.createParameter(p.slot);
|
||||
}
|
||||
container.setTriggerParameter(triggerSlot.slot, p.slot, parameter, true);
|
||||
}
|
||||
} else if (slot instanceof ActionSlot) {
|
||||
ActionSlot actionSlot = (ActionSlot) slot;
|
||||
|
@ -451,7 +455,11 @@ public class GuiGateInterface extends GuiAdvancedInterface {
|
|||
}
|
||||
|
||||
for (StatementParameterSlot p : actionSlot.parameters) {
|
||||
container.setActionParameter(actionSlot.slot, p.slot, null, true);
|
||||
IStatementParameter parameter = null;
|
||||
if (changed != null && p.slot < changed.minParameters()) {
|
||||
parameter = changed.createParameter(p.slot);
|
||||
}
|
||||
container.setActionParameter(actionSlot.slot, p.slot, parameter, true);
|
||||
}
|
||||
} else if (slot instanceof StatementParameterSlot) {
|
||||
StatementParameterSlot paramSlot = (StatementParameterSlot) slot;
|
||||
|
|
Loading…
Reference in a new issue