}
@Override
protected void actionPerformed(GuiButton clickedButton) {
if(clickedButton.id == 0) {
CircuitType newCircuitType = getUserSelectedCircuitType();
int actualOutputLevel = this.outputLevel;
if(newCircuitType == CircuitType.inputSetControlRod && this.greaterThan && this.retract) { actualOutputLevel *= -1; }
CommonPacketHandler.INSTANCE.sendToServer(new ReactorRedstonePortChangeMessage(port, newCircuitType.ordinal(), actualOutputLevel, this.greaterThan, this.activeOnPulse));
}
else if(clickedButton.id == 1) {
for(Entry<CircuitType, GuiSelectableButton> pair : btnMap.entrySet()) {
pair.getValue().setSelected(pair.getKey() == port.getCircuitType());
}
setSubSettingsToDefaults(port.getCircuitType());
}
else if(clickedButton.id == 2) {
CircuitType selectedCircuitType = this.getUserSelectedCircuitType();
if(TileEntityReactorRedNetPort.isInput(selectedCircuitType))
this.activeOnPulse = !this.activeOnPulse;
else
this.greaterThan = !this.greaterThan;
}
else if(clickedButton.id == 3) {
if(this.greaterThan && !this.retract) {
// Insert -> Retract
this.greaterThan = true;
this.retract = true;
}
else if(this.greaterThan && this.retract) {
// Retract -> Set
this.greaterThan = false;
this.retract = false;
}
else {
// Set -> Insert
this.greaterThan = true;
this.retract = false; // Doesn't actually matter, but hey, keeping it tidy.
}
}
else if(clickedButton.id >= MINIMUM_SETTING_SELECTOR_ID && clickedButton.id < MINIMUM_SETTING_SELECTOR_ID + btnMap.size()) {
CircuitType ct = CircuitType.DISABLED;
for(Entry<CircuitType, GuiSelectableButton> pair : btnMap.entrySet()) {
GuiSelectableButton btn = pair.getValue();
btn.setSelected(btn.id == clickedButton.id);
if(btn.isSelected()) {