Пример #1
0
  private void initGuiMode() {
    mode = new ChoiceLabel(mc, this).setDesiredHeight(13).setDesiredWidth(80);
    for (EnderMonitorMode m : EnderMonitorMode.values()) {
      mode.addChoices(m.getDescription());
    }

    mode.setChoiceTooltip(
        EnderMonitorMode.MODE_LOSTPEARL.getDescription(),
        "Send a redstone pulse when a",
        "pearl is lost");
    mode.setChoiceTooltip(
        EnderMonitorMode.MODE_PEARLFIRED.getDescription(),
        "Send a redstone pulse when a",
        "pearl is fired");
    mode.setChoiceTooltip(
        EnderMonitorMode.MODE_PEARLARRIVED.getDescription(),
        "Send a redstone pulse when a",
        "pearl arrives");
    mode.setChoice(tileEntity.getMode().getDescription());
    mode.addChoiceEvent(
        new ChoiceEvent() {
          @Override
          public void choiceChanged(Widget parent, String newChoice) {
            changeMode();
          }
        });
  }
Пример #2
0
 private void changeMode() {
   EnderMonitorMode newMode = EnderMonitorMode.getMode(mode.getCurrentChoice());
   tileEntity.setMode(newMode);
   sendServerCommand(
       EnderMonitorTileEntity.CMD_MODE, new Argument("mode", newMode.getDescription()));
 }