allow shift-click to clear trigger/action slots

This commit is contained in:
asiekierka 2015-04-28 18:46:31 +02:00
parent 58c230f248
commit ae51723c82

View file

@ -9,6 +9,7 @@
package buildcraft.transport.gui;
import java.util.Iterator;
import org.lwjgl.input.Keyboard;
import org.lwjgl.input.Mouse;
import org.lwjgl.opengl.GL11;
import net.minecraft.inventory.IInventory;
@ -271,18 +272,19 @@ public class GuiGateInterface extends GuiAdvancedInterface {
IStatement changed = null;
if (isShiftKeyDown()) {
changed = null;
} else {
if (triggerSlot.getStatement() == null) {
if (k == 0) {
changed = container.getFirstTrigger();
} else {
changed = container.getLastTrigger();
}
} else {
Iterator<IStatement> it = container.getTriggerIterator(k != 0);
for (; it.hasNext();) {
for (; it.hasNext(); ) {
IStatement trigger = it.next();
if (!it.hasNext()) {
@ -296,6 +298,7 @@ public class GuiGateInterface extends GuiAdvancedInterface {
}
}
}
}
if (changed == null) {
container.setTrigger(triggerSlot.slot, null, true);
@ -314,8 +317,11 @@ public class GuiGateInterface extends GuiAdvancedInterface {
ActionSlot actionSlot = (ActionSlot) slot;
IStatement changed = null;
if (actionSlot.getStatement() == null) {
if (isShiftKeyDown()) {
changed = null;
} else {
if (actionSlot.getStatement() == null) {
if (k == 0) {
changed = container.getFirstAction();
} else {
@ -325,7 +331,7 @@ public class GuiGateInterface extends GuiAdvancedInterface {
} else {
Iterator<IStatement> it = container.getActionIterator(k != 0);
for (; it.hasNext();) {
for (; it.hasNext(); ) {
IStatement action = it.next();
if (!it.hasNext()) {
@ -339,6 +345,7 @@ public class GuiGateInterface extends GuiAdvancedInterface {
}
}
}
}
if (changed == null) {
container.setAction(actionSlot.slot, null, true);