use of crazypants.enderio.base.machine.modes.PacketIoMode in project EnderIO by SleepyTrousers.
the class IoConfigRenderer method handleMouseInput.
public void handleMouseInput() {
if (Mouse.getEventButton() == 0) {
dragging = Mouse.getEventButtonState();
}
if (dragging) {
double dx = (Mouse.getEventDX() / (double) mc.displayWidth);
double dy = (Mouse.getEventDY() / (double) mc.displayHeight);
if (Keyboard.isKeyDown(Keyboard.KEY_LCONTROL) || Keyboard.isKeyDown(Keyboard.KEY_LSHIFT)) {
distance -= dy * 15;
} else {
yaw -= 4 * dx * 180;
pitch += 2 * dy * 180;
pitch = (float) VecmathUtil.clamp(pitch, -80, 80);
}
}
distance -= Mouse.getEventDWheel() * 0.01;
distance = VecmathUtil.clamp(distance, 0.01, 200);
long elapsed = System.currentTimeMillis() - initTime;
// Mouse Over
int x = Mouse.getEventX();
int y = Mouse.getEventY();
Vector3d start = new Vector3d();
Vector3d end = new Vector3d();
if (camera.getRayForPixel(x, y, start, end)) {
end.scale(distance * 2);
end.add(start);
updateSelection(start, end);
}
// Mouse pressed on configurable side
if (!Mouse.getEventButtonState() && camera.isValid() && elapsed > 500) {
if (Mouse.getEventButton() == 1) {
if (selection != null) {
selection.config.toggleIoModeForFace(selection.face);
PacketHandler.INSTANCE.sendToServer(new PacketIoMode(selection.config, selection.face));
}
} else if (Mouse.getEventButton() == 0 && inNeigButBounds) {
renderNeighbours = !renderNeighbours;
}
}
}
use of crazypants.enderio.base.machine.modes.PacketIoMode in project EnderIO by SleepyTrousers.
the class GuiButtonIoConfig method toggleSelected.
@Override
protected boolean toggleSelected() {
if (Keyboard.isKeyDown(Keyboard.KEY_LSHIFT) || Keyboard.isKeyDown(Keyboard.KEY_RSHIFT)) {
if (!configOverlay.isVisible()) {
return false;
}
config.clearAllIoModes();
PacketHandler.INSTANCE.sendToServer(new PacketIoMode(config));
} else {
boolean vis = !configOverlay.isVisible();
configOverlay.setIsVisible(vis);
}
return true;
}
Aggregations