use of mcjty.lib.network.Argument in project RFTools by McJty.
the class GuiSensor method setGroup.
private void setGroup() {
GroupType groupType = NamedEnum.getEnumByName(groupLabel.getCurrentChoice(), GroupType.values());
tileEntity.setGroupType(groupType);
sendServerCommand(RFToolsMessages.INSTANCE, SensorTileEntity.CMD_SETGROUP, new Argument("type", groupType.ordinal()));
}
use of mcjty.lib.network.Argument in project RFTools by McJty.
the class GuiSequencer method changeBit.
private void changeBit(int bit, String choice) {
boolean newChoice = "1".equals(choice);
tileEntity.setCycleBit(bit, newChoice);
sendServerCommand(RFToolsMessages.INSTANCE, SequencerTileEntity.CMD_SETBIT, new Argument("bit", bit), new Argument("choice", newChoice));
}
use of mcjty.lib.network.Argument in project RFTools by McJty.
the class GuiSequencer method setEndState.
private void setEndState(String choice) {
boolean newChoice = "1".equals(choice);
tileEntity.setEndState(newChoice);
sendServerCommand(RFToolsMessages.INSTANCE, SequencerTileEntity.CMD_SETENDSTATE, new Argument("endState", newChoice));
}
use of mcjty.lib.network.Argument in project RFTools by McJty.
the class ScreenTileEntity method hitScreenClient.
public void hitScreenClient(double hitX, double hitY, double hitZ, EnumFacing side, EnumFacing horizontalFacing) {
ModuleRaytraceResult result = getHitModule(hitX, hitY, hitZ, side, horizontalFacing);
if (result == null) {
return;
}
List<IClientScreenModule> modules = getClientScreenModules();
int module = result.getModuleIndex();
if (isActivated(module)) {
// We are getting a hit twice. Module is already activated. Do nothing
return;
}
modules.get(module).mouseClick(getWorld(), result.getX(), result.getY() - result.getCurrenty(), true);
clickedModules.add(new ActivatedModule(module, 3, result.getX(), result.getY()));
RFToolsMessages.INSTANCE.sendToServer(new PacketServerCommand(getPos(), CMD_CLICK, new Argument("x", result.getX()), new Argument("y", result.getY() - result.getCurrenty()), new Argument("module", module)));
}
use of mcjty.lib.network.Argument in project RFTools by McJty.
the class GuiScreen method initGui.
@Override
public void initGui() {
super.initGui();
toplevel = new Panel(mc, this).setBackground(iconLocation).setLayout(new PositionalLayout());
for (int i = 0; i < ScreenContainer.SCREEN_MODULES; i++) {
buttons[i] = new ToggleButton(mc, this).setLayoutHint(new PositionalLayout.PositionalHint(30, 7 + i * 18 + 1, 40, 16)).setEnabled(false).setTooltips("Open the gui for this", "module");
final int finalI = i;
buttons[i].addButtonEvent(parent -> selectPanel(finalI));
toplevel.addChild(buttons[i]);
modulePanels[i] = null;
clientScreenModules[i] = null;
}
bright = new ToggleButton(mc, this).setText("Bright").setCheckMarker(true).setTooltips("Toggle full brightness").setLayoutHint(new PositionalLayout.PositionalHint(85, 123, 55, 14));
// .setLayoutHint(new PositionalLayout.PositionalHint(7, 208, 63, 14));
bright.setPressed(tileEntity.isBright());
bright.addButtonEvent(parent -> sendServerCommand(RFToolsMessages.INSTANCE, ScreenTileEntity.CMD_SETBRIGHT, new Argument("b", bright.isPressed())));
toplevel.addChild(bright);
toplevel.addChild(new Label(mc, this).setText("Font:").setHorizontalAlignment(HorizontalAlignment.ALIGN_RIGHT).setLayoutHint(new PositionalLayout.PositionalHint(85 + 50 + 9, 123, 30, 14)));
trueType = new ChoiceLabel(mc, this).addChoices("Default", "Truetype", "Vanilla").setTooltips("Set truetype font mode", "for the screen").setLayoutHint(new PositionalLayout.PositionalHint(85 + 50 + 14 + 30, 123, 68, 14));
int trueTypeMode = tileEntity.getTrueTypeMode();
trueType.setChoice(trueTypeMode == 0 ? "Default" : (trueTypeMode == -1 ? "Vanilla" : "Truetype"));
trueType.addChoiceEvent((a, b) -> sendServerCommand(RFToolsMessages.INSTANCE, ScreenTileEntity.CMD_SETTRUETYPE, new Argument("b", getCurrentTruetypeChoice())));
toplevel.addChild(trueType);
toplevel.setBounds(new Rectangle(guiLeft, guiTop, xSize, ySize));
window = new Window(this, toplevel);
Keyboard.enableRepeatEvents(true);
selected = -1;
}
Aggregations