mirror of
https://github.com/GTNewHorizons/EnderIO.git
synced 2026-11-20 12:19:55 +00:00
Right mouse button now goes 'back' on the color and redstone mode buttons.
This commit is contained in:
1 parent
b74904c6be
commit
decdd3a87b
3 files changed
+60
-4
No files matched your search
@@ -1,5 +1,9 @@
|
||||
package crazypants.enderio.gui;
|
||||
|
||||
import java.awt.Rectangle;
|
||||
|
||||
import org.lwjgl.input.Mouse;
|
||||
|
||||
import net.minecraft.client.Minecraft;
|
||||
import crazypants.enderio.machine.IRedstoneModeControlable;
|
||||
import crazypants.enderio.machine.PacketRedstoneMode;
|
||||
@@ -14,12 +18,14 @@ public class RedstoneModeButton extends IconButtonEIO {
|
||||
private static IconEIO[] ICONS = new IconEIO[] { IconEIO.REDSTONE_MODE_ALWAYS, IconEIO.REDSTONE_MODE_WITH_SIGNAL, IconEIO.REDSTONE_MODE_WITHOUT_SIGNAL,
|
||||
IconEIO.REDSTONE_MODE_NEVER };
|
||||
|
||||
IRedstoneModeControlable model;
|
||||
RedstoneControlMode curMode;
|
||||
private IRedstoneModeControlable model;
|
||||
private RedstoneControlMode curMode;
|
||||
|
||||
private boolean rightMouseDown = false;
|
||||
|
||||
BlockCoord bc;
|
||||
private BlockCoord bc;
|
||||
|
||||
String tooltipKey = "enderio.gui.tooltip.redstoneControlMode";
|
||||
private String tooltipKey = "enderio.gui.tooltip.redstoneControlMode";
|
||||
|
||||
public RedstoneModeButton(IGuiScreen gui, int id, int x, int y, IRedstoneModeControlable model) {
|
||||
this(gui, id, x, y, model, null);
|
||||
@@ -58,6 +64,13 @@ public class RedstoneModeButton extends IconButtonEIO {
|
||||
}
|
||||
setMode(curMode.next());
|
||||
}
|
||||
|
||||
private void prevMode() {
|
||||
if(curMode == null) {
|
||||
curMode = RedstoneControlMode.ON;
|
||||
}
|
||||
setMode(curMode.previous());
|
||||
}
|
||||
|
||||
public void setMode(RedstoneControlMode mode) {
|
||||
if(mode == curMode) {
|
||||
@@ -75,6 +88,16 @@ public class RedstoneModeButton extends IconButtonEIO {
|
||||
@Override
|
||||
public void drawButton(Minecraft mc, int mouseX, int mouseY) {
|
||||
super.drawButton(mc, mouseX, mouseY);
|
||||
|
||||
Rectangle r = new Rectangle(xPosition, yPosition, width, height);
|
||||
if(r.contains(mouseX, mouseY)) {
|
||||
if(rightMouseDown && Mouse.getEventButton() == 1 && !Mouse.getEventButtonState()) {
|
||||
prevMode();
|
||||
}
|
||||
rightMouseDown = Mouse.getEventButton() == 1 && Mouse.getEventButtonState();
|
||||
} else {
|
||||
rightMouseDown = false;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
Reference in new issue
Block a user