예제 #1
0
 @SuppressWarnings("unchecked")
 private void refreshButtons() {
   for (GuiButton button : (List<GuiButton>) buttonList) {
     WeatherTask[] tasks = WeatherTask.values();
     if (button.id >= 0 && button.id < tasks.length) {
       WeatherTask task = WeatherTask.values()[button.id];
       if (WeatherTask.worldIsState(task, getTileEntity().getWorldObj().getWorldInfo())) {
         button.enabled = false;
       } else {
         button.enabled = true;
       }
     }
   }
 }
예제 #2
0
 @Override
 protected void actionPerformed(GuiButton b) {
   super.actionPerformed(b);
   if (b.id >= 0 && b.id <= 2) {
     getTileEntity().startTask(b.id);
     PacketHandler.INSTANCE.sendToServer(
         new PacketActivateWeather(getTileEntity(), WeatherTask.values()[b.id]));
   }
 }
예제 #3
0
 private void addButton(IconButton button, WeatherTask task) {
   String tt1 =
       EnumChatFormatting.WHITE
           + EnderIO.lang.localize("gui.weather.task." + task.name().toLowerCase(Locale.ENGLISH));
   String tt2 =
       EnumChatFormatting.AQUA
           + String.format(
               EnderIO.lang.localize("gui.weather.requireditem"),
               EnumChatFormatting.WHITE + task.requiredItem().getDisplayName());
   String tt3 =
       String.format(
           "%s%s %s%s",
           EnumChatFormatting.GREEN,
           fmt.format(task.power),
           EnumChatFormatting.WHITE,
           EnderIO.lang.localize("power.rf"));
   button.setToolTip(tt1, tt2, tt3);
   button.onGuiInit();
 }