use of pneumaticCraft.common.network.PacketGuiButton in project PneumaticCraft by MineMaarten.
the class GuiProgrammer method keyTyped.
@Override
protected void keyTyped(char key, int keyCode) {
super.keyTyped(key, keyCode);
if (Keyboard.KEY_I == keyCode && Loader.isModLoaded(ModIds.IGWMOD)) {
onIGWAction();
}
if (Keyboard.KEY_R == keyCode) {
if (exportButton.getBounds().contains(lastMouseX, lastMouseY)) {
NetworkHandler.sendToServer(new PacketGuiButton(0));
}
}
if (Keyboard.KEY_SPACE == keyCode) {
toggleShowWidgets();
}
if (Keyboard.KEY_DELETE == keyCode) {
IProgWidget widget = programmerUnit.getHoveredWidget(lastMouseX, lastMouseY);
if (widget != null) {
te.progWidgets.remove(widget);
NetworkHandler.sendToServer(new PacketProgrammerUpdate(te));
}
}
if (Keyboard.KEY_Z == keyCode) {
NetworkHandler.sendToServer(new PacketGuiButton(undoButton.id));
}
if (Keyboard.KEY_Y == keyCode) {
NetworkHandler.sendToServer(new PacketGuiButton(redoButton.id));
}
}
use of pneumaticCraft.common.network.PacketGuiButton in project PneumaticCraft by MineMaarten.
the class GuiProgrammer method actionPerformed.
/**
* Fired when a control is clicked. This is the equivalent of
* ActionListener.actionPerformed(ActionEvent e).
*/
@Override
protected void actionPerformed(GuiButton button) {
switch(button.id) {
case // redstone button
0:
// redstoneBehaviourStat.closeWindow();
break;
case 3:
if (--widgetPage < 0)
widgetPage = maxPage;
updateVisibleProgWidgets();
return;
case 4:
if (++widgetPage > maxPage)
widgetPage = 0;
updateVisibleProgWidgets();
return;
case 5:
for (IProgWidget widget : te.progWidgets) {
if (widget instanceof ProgWidgetStart) {
programmerUnit.gotoPiece(widget);
break;
}
}
return;
case 6:
if (te.progWidgets.size() > 0) {
programmerUnit.gotoPiece(te.progWidgets.get(te.progWidgets.size() - 1));
}
return;
case 7:
NBTTagCompound mainTag = new NBTTagCompound();
te.writeProgWidgetsToNBT(mainTag);
FMLClientHandler.instance().showGuiScreen(pastebinGui = new GuiPastebin(this, mainTag));
break;
case 11:
te.progWidgets.clear();
NetworkHandler.sendToServer(new PacketProgrammerUpdate(te));
break;
case 12:
for (IProgWidget widget : te.progWidgets) {
if (widget instanceof ProgWidgetStart) {
generateRelativeOperators((ProgWidgetCoordinateOperator) widget.getOutputWidget(), null, false);
break;
}
}
break;
}
NetworkHandler.sendToServer(new PacketGuiButton(button.id));
}
Aggregations