use of mcjty.lib.network.Argument in project RFTools by McJty.
the class GuiEnvironmentalController method addPlayer.
private void addPlayer() {
sendServerCommand(RFToolsMessages.INSTANCE, EnvironmentalControllerTileEntity.CMD_ADDPLAYER, new Argument("player", nameField.getText()));
listDirty = 0;
}
use of mcjty.lib.network.Argument in project RFTools by McJty.
the class GuiLocator method update.
private void update() {
List<Argument> arguments = new ArrayList<>();
arguments.add(new Argument("hostile", COLOR_TO_TYPE.get(hostile.getCurrentColor()).getCode()));
arguments.add(new Argument("passive", COLOR_TO_TYPE.get(passive.getCurrentColor()).getCode()));
arguments.add(new Argument("player", COLOR_TO_TYPE.get(player.getCurrentColor()).getCode()));
arguments.add(new Argument("energy", COLOR_TO_TYPE.get(energy.getCurrentColor()).getCode()));
arguments.add(new Argument("hostileBeacon", hostileBeacon.isPressed()));
arguments.add(new Argument("passiveBeacon", passiveBeacon.isPressed()));
arguments.add(new Argument("playerBeacon", playerBeacon.isPressed()));
arguments.add(new Argument("energyBeacon", energyBeacon.isPressed()));
arguments.add(new Argument("filter", filter.getText()));
if (!minEnergy.getText().trim().isEmpty()) {
try {
arguments.add(new Argument("minEnergy", Integer.parseInt(minEnergy.getText())));
} catch (NumberFormatException e) {
}
}
if (!maxEnergy.getText().trim().isEmpty()) {
try {
arguments.add(new Argument("maxEnergy", Integer.parseInt(maxEnergy.getText())));
} catch (NumberFormatException e) {
}
}
sendServerCommand(RFToolsMessages.INSTANCE, LocatorTileEntity.CMD_SETTINGS, arguments.toArray(new Argument[arguments.size()]));
}
use of mcjty.lib.network.Argument in project RFTools by McJty.
the class GuiLocator method changeRedstoneMode.
private void changeRedstoneMode() {
tileEntity.setRSMode(RedstoneMode.values()[redstoneMode.getCurrentChoiceIndex()]);
sendServerCommand(RFToolsMessages.INSTANCE, LocatorTileEntity.CMD_MODE, new Argument("rs", RedstoneMode.values()[redstoneMode.getCurrentChoiceIndex()].getDescription()));
}
use of mcjty.lib.network.Argument in project RFTools by McJty.
the class GuiProjector method updateRs.
private void updateRs() {
List<Argument> argumentList = new ArrayList<>();
for (int i = 0; i < 4; i++) {
argumentList.add(new Argument("opOn" + i, rsLabelOn[i].getCurrentChoice()));
argumentList.add(new Argument("opOff" + i, rsLabelOff[i].getCurrentChoice()));
String text = valOn[i].getText();
if (!text.trim().isEmpty()) {
try {
argumentList.add(new Argument("valOn" + i, Double.parseDouble(text)));
} catch (NumberFormatException e) {
// Ignore
}
}
text = valOff[i].getText();
if (!text.trim().isEmpty()) {
try {
argumentList.add(new Argument("valOff" + i, Double.parseDouble(text)));
} catch (NumberFormatException e) {
// Ignore
}
}
}
sendServerCommand(RFToolsMessages.INSTANCE, ProjectorTileEntity.CMD_RSSETTINGS, argumentList.toArray(new Argument[argumentList.size()]));
}
use of mcjty.lib.network.Argument in project RFTools by McJty.
the class GuiShield method initGui.
@Override
public void initGui() {
super.initGui();
int maxEnergyStored = tileEntity.getMaxEnergyStored();
energyBar = new EnergyBar(mc, this).setVertical().setMaxValue(maxEnergyStored).setLayoutHint(new PositionalLayout.PositionalHint(12, 141, 10, 76)).setShowText(false);
energyBar.setValue(GenericEnergyStorageTileEntity.getCurrentRF());
initVisibilityMode();
initActionOptions();
initTypeOptions();
initRedstoneMode();
initDamageType();
filterList = new WidgetList(mc, this).setDesiredHeight(120).addSelectionEvent(new DefaultSelectionEvent() {
@Override
public void select(Widget parent, int index) {
selectFilter();
}
});
Slider filterSlider = new Slider(mc, this).setVertical().setScrollable(filterList).setDesiredWidth(11).setDesiredHeight(120);
Panel filterPanel = new Panel(mc, this).setLayout(new HorizontalLayout().setSpacing(1).setHorizontalMargin(3)).setLayoutHint(new PositionalLayout.PositionalHint(12, 10, 154, 124)).addChild(filterList).addChild(filterSlider).setFilledBackground(0xff9e9e9e);
Button applyCamo = new Button(mc, this).setText("Set").setTooltips("Set the camouflage block").setLayoutHint(new PositionalLayout.PositionalHint(51, 142, 28, 16)).addButtonEvent(parent -> applyCamoToShield());
// applyCamo.setEnabled(false);
// applyCamo.setTooltips("Not implemented yet"); // @todo
colorSelector = new ColorChoiceLabel(mc, this).setTooltips("Color for the shield").setLayoutHint(new PositionalLayout.PositionalHint(31, 177, 48, 16));
colorSelector.addColors(0x96ffc8);
for (EnumDyeColor color : EnumDyeColor.values()) {
colorSelector.addColors(color.getColorValue());
}
colorSelector.setCurrentColor(tileEntity.getShieldColor());
colorSelector.addChoiceEvent((parent, newColor) -> sendServerCommand(RFToolsMessages.INSTANCE, ShieldTEBase.CMD_SETCOLOR, new Argument("color", newColor)));
player = new TextField(mc, this).setTooltips("Optional player name").setLayoutHint(new PositionalLayout.PositionalHint(170, 44, 80, 14));
addFilter = new Button(mc, this).setText("Add").setTooltips("Add selected filter").setLayoutHint(new PositionalLayout.PositionalHint(4, 6, 36, 14)).addButtonEvent(parent -> addNewFilter());
delFilter = new Button(mc, this).setText("Del").setTooltips("Delete selected filter").setLayoutHint(new PositionalLayout.PositionalHint(39, 6, 36, 14)).addButtonEvent(parent -> removeSelectedFilter());
upFilter = new Button(mc, this).setText("Up").setTooltips("Move filter up").setLayoutHint(new PositionalLayout.PositionalHint(4, 22, 36, 14)).addButtonEvent(parent -> moveFilterUp());
downFilter = new Button(mc, this).setText("Down").setTooltips("Move filter down").setLayoutHint(new PositionalLayout.PositionalHint(39, 22, 36, 14)).addButtonEvent(parent -> moveFilterDown());
Panel controlPanel = new Panel(mc, this).setLayout(new PositionalLayout()).setLayoutHint(new PositionalLayout.PositionalHint(170, 58, 80, 43)).addChild(addFilter).addChild(delFilter).addChild(upFilter).addChild(downFilter).setFilledRectThickness(-2).setFilledBackground(StyleConfig.colorListBackground);
Label lootingBonus = new Label(mc, this).setHorizontalAlignment(HorizontalAlignment.ALIGN_RIGHT).setText("Looting:");
lootingBonus.setTooltips("Insert dimensional shards", "for looting bonus").setLayoutHint(new PositionalLayout.PositionalHint(160, 118, 60, 18));
Panel toplevel = new Panel(mc, this).setBackground(iconLocation).setLayout(new PositionalLayout()).addChild(energyBar).addChild(visibilityOptions).addChild(applyCamo).addChild(redstoneMode).addChild(filterPanel).addChild(actionOptions).addChild(typeOptions).addChild(player).addChild(controlPanel).addChild(damageType).addChild(colorSelector).addChild(lootingBonus);
toplevel.setBounds(new Rectangle(guiLeft, guiTop, xSize, ySize));
window = new Window(this, toplevel);
listDirty = 0;
requestFilters();
tileEntity.requestRfFromServer(RFTools.MODID);
}
Aggregations