Java 类net.minecraft.client.gui.GuiYesNo 实例源码

项目:Wurst-MC-1.12    文件:GuiMessage.java   
@Override
protected void actionPerformed(GuiButton button) throws IOException
{
    if(button.id == buttons.entrySet().size())
    {
        if(cancel.equals("allowed"))
            mc.displayGuiScreen(new GuiWurstMainMenu());
        else if(cancel.equals("prompt"))
            mc.displayGuiScreen(new GuiYesNo(this,
                "Are you sure you want to cancel?", "", 0));
    }else
    {
        MiscUtils.openLink(buttons.get(button.displayString).getAsString());
        WurstClient.INSTANCE.analytics.trackEvent("message", "click",
            "v" + WurstClient.VERSION, button.id);
    }
}
项目:BaseClient    文件:GuiOtherSettingsOF.java   
/**
 * Called by the controls from the buttonList when activated. (Mouse pressed for buttons)
 */
protected void actionPerformed(GuiButton button)
{
    if (button.enabled)
    {
        if (button.id < 200 && button instanceof GuiOptionButton)
        {
            this.settings.setOptionValue(((GuiOptionButton)button).returnEnumOptions(), 1);
            button.displayString = this.settings.getKeyBinding(GameSettings.Options.getEnumOptions(button.id));
        }

        if (button.id == 200)
        {
            this.mc.gameSettings.saveOptions();
            this.mc.displayGuiScreen(this.prevScreen);
        }

        if (button.id == 210)
        {
            this.mc.gameSettings.saveOptions();
            GuiYesNo guiyesno = new GuiYesNo(this, I18n.format("of.message.other.reset", new Object[0]), "", 9999);
            this.mc.displayGuiScreen(guiyesno);
        }
    }
}
项目:Backmemed    文件:GuiOtherSettingsOF.java   
/**
 * Called by the controls from the buttonList when activated. (Mouse pressed for buttons)
 */
protected void actionPerformed(GuiButton button)
{
    if (button.enabled)
    {
        if (button.id < 200 && button instanceof GuiOptionButton)
        {
            this.settings.setOptionValue(((GuiOptionButton)button).returnEnumOptions(), 1);
            button.displayString = this.settings.getKeyBinding(GameSettings.Options.getEnumOptions(button.id));
        }

        if (button.id == 200)
        {
            this.mc.gameSettings.saveOptions();
            this.mc.displayGuiScreen(this.prevScreen);
        }

        if (button.id == 210)
        {
            this.mc.gameSettings.saveOptions();
            GuiYesNo guiyesno = new GuiYesNo(this, I18n.format("of.message.other.reset", new Object[0]), "", 9999);
            this.mc.displayGuiScreen(guiyesno);
        }
    }
}
项目:WurstSDK    文件:GuiWurstMainMenu.java   
private void enablePermissions(JavaPlugin pl) {
    Iterator<Permission> permissions = pl.getPermissions().iterator();
    AtomicBoolean done = new AtomicBoolean(false);
    for (; permissions.hasNext(); ) {
        done.set(false);
        Permission permission = permissions.next();
        currentPerm = permission;
        mc.displayGuiScreen(new GuiYesNo((b, i) -> {
            ((WurstSDK) SDK.getClient()).getConfig().change(currentPl, currentPerm, b, token);
            permissions.remove();
            mc.displayGuiScreen(this);
            done.set(true);
        },
                "'" + pl.getName() + "' Would Like to " + permission.getDescription(), "",
                "OK", "Don't Allow", 99));
        while (!done.get()) {
            try {
                Thread.sleep(100);
            } catch (InterruptedException e) {
                e.printStackTrace();
            }
        }
    }
}
项目:EvenWurse    文件:GuiAlts.java   
@SuppressWarnings("unchecked")
@Override
public void initGui() {
    altList = new GuiAltList(mc, this);
    altList.registerScrollButtons(7, 8);
    altList.elementClicked(-1, false, 0, 0);
    if (GuiAltList.alts.isEmpty() && shouldAsk) {
        mc.displayGuiScreen(
                new GuiYesNo(this, "Your alt list is empty.", "Would you like some random alts to get started?",
                        0));
    }
    buttonList.clear();
    buttonList.add(new GuiButton(0, width / 2 - 154, height - 52, 100, 20, "Use"));
    buttonList.add(new GuiButton(1, width / 2 - 50, height - 52, 100, 20, "Direct Login"));
    buttonList.add(new GuiButton(2, width / 2 + 54, height - 52, 100, 20, "Add"));
    buttonList.add(new GuiButton(3, width / 2 - 154, height - 28, 75, 20, "Star"));
    buttonList.add(new GuiButton(4, width / 2 - 76, height - 28, 74, 20, "Edit"));
    buttonList.add(new GuiButton(5, width / 2 + 2, height - 28, 74, 20, "Delete"));
    buttonList.add(new GuiButton(6, width / 2 + 80, height - 28, 75, 20, "Cancel"));
    buttonList.add(new GuiButton(8, width - 108, 8, 100, 20, "Session Stealer"));

    buttonList.add(new GuiButton(7, 8, 8, 100, 20, "Import Alts"));
    WurstClient.INSTANCE.analytics.trackPageView("/alt-manager/", "Alt Manager");
}
项目:GimmeTime    文件:GuiScreenAlarmConfig.java   
@Override
protected void actionPerformed(GuiButton button) {
    IGuiListEntry entry = alarmList.getListEntry(alarmList.getSelected());
    if (button.enabled) {
        switch (button.id) {
            case 0:
                if (entry == null)
                    break;
            case 1:
                mc.displayGuiScreen(new GuiScreenEditAlarm(this, ((button.id == 0 && entry instanceof GuiAlarmEntry) ? (((GuiAlarmEntry) entry).getAlarm()) : null), button.id == 1));
                break;
            case 2:
                if (entry instanceof GuiAlarmEntry)
                    mc.displayGuiScreen(new GuiYesNo(
                            this,
                            StatCollector.translateToLocal("gui.alarmConfig.delete.question"),
                            StatCollector.translateToLocalFormatted(((GuiAlarmEntry) entry).getAlarm().getTitle()),
                            alarmList.getSelected()));
                break;
            default:
                mc.displayGuiScreen(parent);
        }
    }
}
项目:Wurst-MC-1.12    文件:GuiWurstMainMenu.java   
@Override
public void updateScreen()
{
    super.updateScreen();

    // updater
    if(startupMessageDisabled)
        return;
    if(WurstClient.INSTANCE.updater.isOutdated())
    {
        WurstClient.INSTANCE.analytics.trackEvent("updater",
            "update to v" + WurstClient.INSTANCE.updater.getLatestVersion(),
            "from " + WurstClient.VERSION);
        WurstClient.INSTANCE.updater.update();
        startupMessageDisabled = true;
    }

    // emergency message
    if(startupMessageDisabled)
        return;
    try
    {
        HttpsURLConnection connection = (HttpsURLConnection)new URL(
            "https://www.wurstclient.net/api/v1/messages.json")
                .openConnection();
        connection.connect();

        JsonObject json = JsonUtils.jsonParser
            .parse(
                new InputStreamReader(connection.getInputStream(), "UTF-8"))
            .getAsJsonObject();

        if(json.get(WurstClient.VERSION) != null)
        {
            System.out.println("Emergency message found!");
            mc.displayGuiScreen(new GuiMessage(
                json.get(WurstClient.VERSION).getAsJsonObject()));
            startupMessageDisabled = true;
        }
    }catch(Exception e)
    {
        e.printStackTrace();
    }

    // changelog
    if(startupMessageDisabled)
        return;
    if(!WurstClient.VERSION
        .equals(WurstClient.INSTANCE.options.lastLaunchedVersion))
    {
        mc.displayGuiScreen(new GuiYesNo(this,
            "Successfully updated to Wurst v" + WurstClient.VERSION, "",
            "Go Play", "View Changelog", 64));
        WurstClient.INSTANCE.options.lastLaunchedVersion =
            WurstClient.VERSION;
        ConfigFiles.OPTIONS.save();
    }

    startupMessageDisabled = true;
}
项目:Wurst-MC-1.12    文件:AltManagerScreen.java   
@Override
public void initGui()
{
    altList = new GuiAltList(mc, this);
    altList.registerScrollButtons(7, 8);
    altList.elementClicked(-1, false, 0, 0);

    if(GuiAltList.alts.isEmpty() && shouldAsk)
        mc.displayGuiScreen(new GuiYesNo(this, "Your alt list is empty.",
            "Would you like some random alts to get started?", 0));

    buttonList.clear();
    buttonList.add(
        new GuiButton(0, width / 2 - 154, height - 52, 100, 20, "Use"));
    buttonList.add(new GuiButton(1, width / 2 - 50, height - 52, 100, 20,
        "Direct Login"));
    buttonList
        .add(new GuiButton(2, width / 2 + 54, height - 52, 100, 20, "Add"));
    buttonList.add(
        new GuiButton(3, width / 2 - 154, height - 28, 75, 20, "Star"));
    buttonList
        .add(new GuiButton(4, width / 2 - 76, height - 28, 74, 20, "Edit"));
    buttonList.add(
        new GuiButton(5, width / 2 + 2, height - 28, 74, 20, "Delete"));
    buttonList.add(
        new GuiButton(6, width / 2 + 80, height - 28, 75, 20, "Cancel"));
    buttonList.add(new GuiButton(7, 8, 8, 100, 20, "Import Alts"));
}
项目:BaseClient    文件:GuiOtherSettingsOF.java   
/**
 * Called by the controls from the buttonList when activated. (Mouse pressed for buttons)
 */
protected void actionPerformed(GuiButton button)
{
    if (button.enabled)
    {
        if (button.id < 200 && button instanceof GuiOptionButton)
        {
            this.settings.setOptionValue(((GuiOptionButton)button).returnEnumOptions(), 1);
            button.displayString = this.settings.getKeyBinding(GameSettings.Options.getEnumOptions(button.id));
        }

        if (button.id == 200)
        {
            this.mc.gameSettings.saveOptions();
            this.mc.displayGuiScreen(this.prevScreen);
        }

        if (button.id == 210)
        {
            this.mc.gameSettings.saveOptions();
            GuiYesNo guiyesno = new GuiYesNo(this, "Reset all video settings to their default values?", "", 9999);
            this.mc.displayGuiScreen(guiyesno);
        }

        if (button.id != GameSettings.Options.CLOUD_HEIGHT.ordinal())
        {
            ScaledResolution scaledresolution = new ScaledResolution(this.mc);
            int i = scaledresolution.getScaledWidth();
            int j = scaledresolution.getScaledHeight();
            this.setWorldAndResolution(this.mc, i, j);
        }
    }
}
项目:Mods    文件:ClientProxy.java   
public static void displayScreenJoinTeam() {
    final GuiScreen prevScreen = Minecraft.getMinecraft().currentScreen;
    Minecraft.getMinecraft().displayGuiScreen(new GuiYesNo(new GuiYesNoCallback() {

        @Override
        public void confirmClicked(boolean result, int id) {
            if (result)
                TF2weapons.network.sendToServer(new TF2Message.ActionMessage(16));
            else
                TF2weapons.network.sendToServer(new TF2Message.ActionMessage(17));
            Minecraft.getMinecraft().displayGuiScreen(prevScreen);
        }

    }, "Choose your team", "Before using the store, you need to join a team", "RED", "BLU", 0));
}
项目:DiscordCE    文件:GuiServerList.java   
protected void actionPerformed(GuiButton button)
{
    GuiListButton b = (GuiListButton) button;
    // Muting server
    if (b.id == 0)
    {
        if (!Preferences.i.mutedGuilds.contains(guild.getId()))
            Preferences.i.mutedGuilds.add(guild.getId());
        else
            Preferences.i.mutedGuilds.remove(guild.getId());

        b.displayString = Preferences.i.mutedGuilds.contains(guild.getId())
                ? TextFormatting.RED + "Unmute"
                : "Mute";
    }

    // Leaving server
    else if (b.id == 1)
    {
        GuiYesNo yn = new GuiYesNo((result, id) ->
        {
            // leaving guild
            if (result)
                guild.getManager().leave();

            mc.displayGuiScreen(guiServers);
        }
        , "Are you sure you want to leave " + guild.getName() + "?"
        , "You'll have to get an invite link to join again."
        , 0);
        mc.displayGuiScreen(yn);
    }

    // Showing channels for guild
    if (b.id == 2)
    {
        mc.displayGuiScreen(new GuiChannels(guiServers, guild));
    }
}
项目:EvenWurse    文件:GuiMessage.java   
@Override
protected void actionPerformed(GuiButton button) throws IOException {
    if (button.id == buttons.entrySet().size()) {
        if (cancel.equals("allowed")) {
            mc.displayGuiScreen(new GuiWurstMainMenu());
        } else if (cancel.equals("prompt")) {
            mc.displayGuiScreen(new GuiYesNo(this, "Are you sure you want to cancel?", "", 0));
        }
    } else {
        MiscUtils.openLink(buttons.get(button.displayString).getAsString());
        WurstClient.INSTANCE.analytics.trackEvent("message", "click", "v" + WurstClient.VERSION, button.id);
    }
}
项目:Resilience-Client-Source    文件:GuiOtherSettingsOF.java   
protected void actionPerformed(GuiButton guibutton)
{
    if (guibutton.enabled)
    {
        if (guibutton.id < 200 && guibutton instanceof GuiOptionButton)
        {
            this.settings.setOptionValue(((GuiOptionButton)guibutton).func_146136_c(), 1);
            guibutton.displayString = this.settings.getKeyBinding(GameSettings.Options.getEnumOptions(guibutton.id));
        }

        if (guibutton.id == 200)
        {
            this.mc.gameSettings.saveOptions();
            this.mc.displayGuiScreen(this.prevScreen);
        }

        if (guibutton.id == 210)
        {
            this.mc.gameSettings.saveOptions();
            GuiYesNo scaledresolution = new GuiYesNo(this, "Reset all video settings to their default values?", "", 9999);
            this.mc.displayGuiScreen(scaledresolution);
        }

        if (guibutton.id != GameSettings.Options.CLOUD_HEIGHT.ordinal())
        {
            ScaledResolution scaledresolution1 = new ScaledResolution(this.mc.gameSettings, this.mc.displayWidth, this.mc.displayHeight);
            int i = scaledresolution1.getScaledWidth();
            int j = scaledresolution1.getScaledHeight();
            this.setWorldAndResolution(this.mc, i, j);
        }
    }
}
项目:MyMod    文件:GuiScreenAlarmConfig.java   
@Override
protected void actionPerformed(GuiButton button) {

    if (button.enabled) {
        switch (button.id) {
            case 0:
            case 1:
                GuiAlarm guiAlarm = (GuiAlarm) alarmList.getListEntry(alarmList
                        .getSelected());
                mc.displayGuiScreen(new GuiScreenEditAlarm(this, alarmList
                        .getSelected(), ((guiAlarm != null) ? (guiAlarm
                        .getAlarm()) : null), button.id == 1));
                break;
            case 2:
                mc.displayGuiScreen(new GuiYesNo(
                        this,
                        StatCollector
                                .translateToLocal("gui.alarmConfig.delete.question"),
                        StatCollector.translateToLocalFormatted(
                                "gui.alarmConfig.delete.warning",
                                ((GuiAlarm) alarmList.getListEntry(alarmList
                                        .getSelected())).getAlarm().getTitle()),
                        alarmList.getSelected()));
                break;
            default:
                mc.displayGuiScreen(parent);
        }
    }

}
项目:RuneCraftery    文件:GuiSelectWorld.java   
protected void func_73875_a(GuiButton p_73875_1_) {
   if(p_73875_1_.field_73742_g) {
      if(p_73875_1_.field_73741_f == 2) {
         String var2 = this.func_74063_d(this.field_74080_m);
         if(var2 != null) {
            this.field_74084_s = true;
            GuiYesNo var3 = func_74061_a(this, var2, this.field_74080_m);
            this.field_73882_e.func_71373_a(var3);
         }
      } else if(p_73875_1_.field_73741_f == 1) {
         this.func_74064_e(this.field_74080_m);
      } else if(p_73875_1_.field_73741_f == 3) {
         this.field_73882_e.func_71373_a(new GuiCreateWorld(this));
      } else if(p_73875_1_.field_73741_f == 6) {
         this.field_73882_e.func_71373_a(new GuiRenameWorld(this, this.func_74069_a(this.field_74080_m)));
      } else if(p_73875_1_.field_73741_f == 0) {
         this.field_73882_e.func_71373_a(this.field_74077_a);
      } else if(p_73875_1_.field_73741_f == 7) {
         GuiCreateWorld var5 = new GuiCreateWorld(this);
         ISaveHandler var6 = this.field_73882_e.func_71359_d().func_75804_a(this.func_74069_a(this.field_74080_m), false);
         WorldInfo var4 = var6.func_75757_d();
         var6.func_75759_a();
         var5.func_82286_a(var4);
         this.field_73882_e.func_71373_a(var5);
      } else {
         this.field_74079_o.func_77219_a(p_73875_1_);
      }

   }
}
项目:RuneCraftery    文件:GuiSelectWorld.java   
public static GuiYesNo func_74061_a(GuiScreen p_74061_0_, String p_74061_1_, int p_74061_2_) {
   String var3 = I18n.func_135053_a("selectWorld.deleteQuestion");
   String var4 = "\'" + p_74061_1_ + "\' " + I18n.func_135053_a("selectWorld.deleteWarning");
   String var5 = I18n.func_135053_a("selectWorld.deleteButton");
   String var6 = I18n.func_135053_a("gui.cancel");
   GuiYesNo var7 = new GuiYesNo(p_74061_0_, var3, var4, var5, var6, p_74061_2_);
   return var7;
}
项目:RuneCraftery    文件:GuiMultiplayer.java   
protected void func_73875_a(GuiButton p_73875_1_) {
   if(p_73875_1_.field_73742_g) {
      if(p_73875_1_.field_73741_f == 2) {
         String var2 = this.field_74030_m.func_78850_a(this.field_74028_n).field_78847_a;
         if(var2 != null) {
            this.field_74036_r = true;
            String var3 = I18n.func_135053_a("selectServer.deleteQuestion");
            String var4 = "\'" + var2 + "\' " + I18n.func_135053_a("selectServer.deleteWarning");
            String var5 = I18n.func_135053_a("selectServer.deleteButton");
            String var6 = I18n.func_135053_a("gui.cancel");
            GuiYesNo var7 = new GuiYesNo(this, var3, var4, var5, var6, this.field_74028_n);
            this.field_73882_e.func_71373_a(var7);
         }
      } else if(p_73875_1_.field_73741_f == 1) {
         this.func_74004_a(this.field_74028_n);
      } else if(p_73875_1_.field_73741_f == 4) {
         this.field_74033_u = true;
         this.field_73882_e.func_71373_a(new GuiScreenServerList(this, this.field_74031_w = new ServerData(I18n.func_135053_a("selectServer.defaultName"), "")));
      } else if(p_73875_1_.field_73741_f == 3) {
         this.field_74035_s = true;
         this.field_73882_e.func_71373_a(new GuiScreenAddServer(this, this.field_74031_w = new ServerData(I18n.func_135053_a("selectServer.defaultName"), "")));
      } else if(p_73875_1_.field_73741_f == 7) {
         this.field_74034_t = true;
         ServerData var8 = this.field_74030_m.func_78850_a(this.field_74028_n);
         this.field_74031_w = new ServerData(var8.field_78847_a, var8.field_78845_b);
         this.field_74031_w.func_82819_b(var8.func_82820_d());
         this.field_73882_e.func_71373_a(new GuiScreenAddServer(this, this.field_74031_w));
      } else if(p_73875_1_.field_73741_f == 0) {
         this.field_73882_e.func_71373_a(this.field_74025_c);
      } else if(p_73875_1_.field_73741_f == 8) {
         this.field_73882_e.func_71373_a(new GuiMultiplayer(this.field_74025_c));
      } else {
         this.field_74022_d.func_77219_a(p_73875_1_);
      }

   }
}
项目:RuneCraftery    文件:GuiScreenConfigureWorld.java   
private void func_96272_i() {
   if(this.field_96284_p >= 0 && this.field_96284_p < this.field_96280_b.field_96402_f.size()) {
      this.field_96283_q = (String)this.field_96280_b.field_96402_f.get(this.field_96284_p);
      GuiYesNo var1 = new GuiYesNo(this, "Warning!", I18n.func_135053_a("mco.configure.world.uninvite.question") + " \'" + this.field_96283_q + "\'", 3);
      this.field_73882_e.func_71373_a(var1);
   }

}
项目:RuneCraftery    文件:GuiMainMenu.java   
protected void func_73875_a(GuiButton p_73875_1_) {
   if(p_73875_1_.field_73741_f == 0) {
      this.field_73882_e.func_71373_a(new GuiOptions(this, this.field_73882_e.field_71474_y));
   }

   if(p_73875_1_.field_73741_f == 5) {
      this.field_73882_e.func_71373_a(new GuiLanguage(this, this.field_73882_e.field_71474_y, this.field_73882_e.func_135016_M()));
   }

   if(p_73875_1_.field_73741_f == 1) {
      this.field_73882_e.func_71373_a(new GuiSelectWorld(this));
   }

   if(p_73875_1_.field_73741_f == 2) {
      this.field_73882_e.func_71373_a(new GuiMultiplayer(this));
   }

   if(p_73875_1_.field_73741_f == 14 && this.field_130023_H.field_73748_h) {
      this.func_140005_i();
   }

   if(p_73875_1_.field_73741_f == 4) {
      this.field_73882_e.func_71400_g();
   }

   if(p_73875_1_.field_73741_f == 11) {
      this.field_73882_e.func_71371_a("Demo_World", "Demo_World", DemoWorldServer.field_73071_a);
   }

   if(p_73875_1_.field_73741_f == 12) {
      ISaveFormat var2 = this.field_73882_e.func_71359_d();
      WorldInfo var3 = var2.func_75803_c("Demo_World");
      if(var3 != null) {
         GuiYesNo var4 = GuiSelectWorld.func_74061_a(this, var3.func_76065_j(), 12);
         this.field_73882_e.func_71373_a(var4);
      }
   }

}
项目:DecompiledMinecraft    文件:ResourcePackListEntry.java   
/**
 * Returns true if the mouse has been pressed on this control.
 */
public boolean mousePressed(int slotIndex, int p_148278_2_, int p_148278_3_, int p_148278_4_, int p_148278_5_, int p_148278_6_)
{
    if (this.func_148310_d() && p_148278_5_ <= 32)
    {
        if (this.func_148309_e())
        {
            this.resourcePacksGUI.markChanged();
            int j = this.func_183019_a();

            if (j != 1)
            {
                String s1 = I18n.format("resourcePack.incompatible.confirm.title", new Object[0]);
                String s = I18n.format("resourcePack.incompatible.confirm." + (j > 1 ? "new" : "old"), new Object[0]);
                this.mc.displayGuiScreen(new GuiYesNo(new GuiYesNoCallback()
                {
                    public void confirmClicked(boolean result, int id)
                    {
                        List<ResourcePackListEntry> list2 = ResourcePackListEntry.this.resourcePacksGUI.getListContaining(ResourcePackListEntry.this);
                        ResourcePackListEntry.this.mc.displayGuiScreen(ResourcePackListEntry.this.resourcePacksGUI);

                        if (result)
                        {
                            list2.remove(ResourcePackListEntry.this);
                            ResourcePackListEntry.this.resourcePacksGUI.getSelectedResourcePacks().add(0, ResourcePackListEntry.this);
                        }
                    }
                }, s1, s, 0));
            }
            else
            {
                this.resourcePacksGUI.getListContaining(this).remove(this);
                this.resourcePacksGUI.getSelectedResourcePacks().add(0, this);
            }

            return true;
        }

        if (p_148278_5_ < 16 && this.func_148308_f())
        {
            this.resourcePacksGUI.getListContaining(this).remove(this);
            this.resourcePacksGUI.getAvailableResourcePacks().add(0, this);
            this.resourcePacksGUI.markChanged();
            return true;
        }

        if (p_148278_5_ > 16 && p_148278_6_ < 16 && this.func_148314_g())
        {
            List<ResourcePackListEntry> list1 = this.resourcePacksGUI.getListContaining(this);
            int k = list1.indexOf(this);
            list1.remove(this);
            list1.add(k - 1, this);
            this.resourcePacksGUI.markChanged();
            return true;
        }

        if (p_148278_5_ > 16 && p_148278_6_ > 16 && this.func_148307_h())
        {
            List<ResourcePackListEntry> list = this.resourcePacksGUI.getListContaining(this);
            int i = list.indexOf(this);
            list.remove(this);
            list.add(i + 1, this);
            this.resourcePacksGUI.markChanged();
            return true;
        }
    }

    return false;
}
项目:Wurst-MC-1.12    文件:KeybindManagerScreen.java   
@Override
protected void actionPerformed(GuiButton button) throws IOException
{
    if(!button.enabled)
        return;

    switch(button.id)
    {
        case 0:
        // Add
        mc.displayGuiScreen(new KeybindEditorScreen(this));
        break;

        case 1:
        // Edit
        Keybind keybind =
            WurstClient.INSTANCE.getKeybinds().get(listGui.selectedSlot);
        mc.displayGuiScreen(new KeybindEditorScreen(this, keybind.getKey(),
            keybind.getCommands()));
        break;

        case 2:
        // Remove
        Keybind keybind1 =
            WurstClient.INSTANCE.getKeybinds().get(listGui.selectedSlot);
        WurstClient.INSTANCE.getKeybinds().remove(keybind1.getKey());
        break;

        case 3:
        // Back
        mc.displayGuiScreen(prevScreen);
        break;

        case 4:
        // Reset Keybinds
        mc.displayGuiScreen(new GuiYesNo(this,
            "Are you sure you want to reset your keybinds?",
            "This cannot be undone!", 0));
        break;
    }
}
项目:BaseClient    文件:ResourcePackListEntry.java   
/**
 * Returns true if the mouse has been pressed on this control.
 */
public boolean mousePressed(int slotIndex, int p_148278_2_, int p_148278_3_, int p_148278_4_, int p_148278_5_, int p_148278_6_)
{
    if (this.func_148310_d() && p_148278_5_ <= 32)
    {
        if (this.func_148309_e())
        {
            this.resourcePacksGUI.markChanged();
            int j = this.func_183019_a();

            if (j != 1)
            {
                String s1 = I18n.format("resourcePack.incompatible.confirm.title", new Object[0]);
                String s = I18n.format("resourcePack.incompatible.confirm." + (j > 1 ? "new" : "old"), new Object[0]);
                this.mc.displayGuiScreen(new GuiYesNo(new GuiYesNoCallback()
                {
                    public void confirmClicked(boolean result, int id)
                    {
                        List<ResourcePackListEntry> list2 = ResourcePackListEntry.this.resourcePacksGUI.getListContaining(ResourcePackListEntry.this);
                        ResourcePackListEntry.this.mc.displayGuiScreen(ResourcePackListEntry.this.resourcePacksGUI);

                        if (result)
                        {
                            list2.remove(ResourcePackListEntry.this);
                            ResourcePackListEntry.this.resourcePacksGUI.getSelectedResourcePacks().add(0, ResourcePackListEntry.this);
                        }
                    }
                }, s1, s, 0));
            }
            else
            {
                this.resourcePacksGUI.getListContaining(this).remove(this);
                this.resourcePacksGUI.getSelectedResourcePacks().add(0, this);
            }

            return true;
        }

        if (p_148278_5_ < 16 && this.func_148308_f())
        {
            this.resourcePacksGUI.getListContaining(this).remove(this);
            this.resourcePacksGUI.getAvailableResourcePacks().add(0, this);
            this.resourcePacksGUI.markChanged();
            return true;
        }

        if (p_148278_5_ > 16 && p_148278_6_ < 16 && this.func_148314_g())
        {
            List<ResourcePackListEntry> list1 = this.resourcePacksGUI.getListContaining(this);
            int k = list1.indexOf(this);
            list1.remove(this);
            list1.add(k - 1, this);
            this.resourcePacksGUI.markChanged();
            return true;
        }

        if (p_148278_5_ > 16 && p_148278_6_ > 16 && this.func_148307_h())
        {
            List<ResourcePackListEntry> list = this.resourcePacksGUI.getListContaining(this);
            int i = list.indexOf(this);
            list.remove(this);
            list.add(i + 1, this);
            this.resourcePacksGUI.markChanged();
            return true;
        }
    }

    return false;
}
项目:BaseClient    文件:ResourcePackListEntry.java   
/**
 * Returns true if the mouse has been pressed on this control.
 */
public boolean mousePressed(int slotIndex, int p_148278_2_, int p_148278_3_, int p_148278_4_, int p_148278_5_, int p_148278_6_)
{
    if (this.func_148310_d() && p_148278_5_ <= 32)
    {
        if (this.func_148309_e())
        {
            this.resourcePacksGUI.markChanged();
            int j = this.func_183019_a();

            if (j != 1)
            {
                String s1 = I18n.format("resourcePack.incompatible.confirm.title", new Object[0]);
                String s = I18n.format("resourcePack.incompatible.confirm." + (j > 1 ? "new" : "old"), new Object[0]);
                this.mc.displayGuiScreen(new GuiYesNo(new GuiYesNoCallback()
                {
                    public void confirmClicked(boolean result, int id)
                    {
                        List<ResourcePackListEntry> list2 = ResourcePackListEntry.this.resourcePacksGUI.getListContaining(ResourcePackListEntry.this);
                        ResourcePackListEntry.this.mc.displayGuiScreen(ResourcePackListEntry.this.resourcePacksGUI);

                        if (result)
                        {
                            list2.remove(ResourcePackListEntry.this);
                            ResourcePackListEntry.this.resourcePacksGUI.getSelectedResourcePacks().add(0, ResourcePackListEntry.this);
                        }
                    }
                }, s1, s, 0));
            }
            else
            {
                this.resourcePacksGUI.getListContaining(this).remove(this);
                this.resourcePacksGUI.getSelectedResourcePacks().add(0, this);
            }

            return true;
        }

        if (p_148278_5_ < 16 && this.func_148308_f())
        {
            this.resourcePacksGUI.getListContaining(this).remove(this);
            this.resourcePacksGUI.getAvailableResourcePacks().add(0, this);
            this.resourcePacksGUI.markChanged();
            return true;
        }

        if (p_148278_5_ > 16 && p_148278_6_ < 16 && this.func_148314_g())
        {
            List<ResourcePackListEntry> list1 = this.resourcePacksGUI.getListContaining(this);
            int k = list1.indexOf(this);
            list1.remove(this);
            list1.add(k - 1, this);
            this.resourcePacksGUI.markChanged();
            return true;
        }

        if (p_148278_5_ > 16 && p_148278_6_ > 16 && this.func_148307_h())
        {
            List<ResourcePackListEntry> list = this.resourcePacksGUI.getListContaining(this);
            int i = list.indexOf(this);
            list.remove(this);
            list.add(i + 1, this);
            this.resourcePacksGUI.markChanged();
            return true;
        }
    }

    return false;
}
项目:BaseClient    文件:Minecraft.java   
public void dispatchKeypresses() {
    int i = Keyboard.getEventKey() == 0 ? Keyboard.getEventCharacter() : Keyboard.getEventKey();

    if (i != 0 && !Keyboard.isRepeatEvent()) {
        if (!(this.currentScreen instanceof GuiControls)
                || ((GuiControls) this.currentScreen).time <= getSystemTime() - 20L) {
            if (Keyboard.getEventKeyState()) {
                if (i == this.gameSettings.keyBindStreamStartStop.getKeyCode()) {
                    if (this.getTwitchStream().isBroadcasting()) {
                        this.getTwitchStream().stopBroadcasting();
                    } else if (this.getTwitchStream().isReadyToBroadcast()) {
                        this.displayGuiScreen(new GuiYesNo(new GuiYesNoCallback() {
                            public void confirmClicked(boolean result, int id) {
                                if (result) {
                                    Minecraft.this.getTwitchStream().func_152930_t();
                                }

                                Minecraft.this.displayGuiScreen((GuiScreen) null);
                            }
                        }, I18n.format("stream.confirm_start", new Object[0]), "", 0));
                    } else if (this.getTwitchStream().func_152928_D() && this.getTwitchStream().func_152936_l()) {
                        if (this.theWorld != null) {
                            this.ingameGUI.getChatGUI()
                                    .printChatMessage(new ChatComponentText("Not ready to start streaming yet!"));
                        }
                    } else {
                        GuiStreamUnavailable.func_152321_a(this.currentScreen);
                    }
                } else if (i == this.gameSettings.keyBindStreamPauseUnpause.getKeyCode()) {
                    if (this.getTwitchStream().isBroadcasting()) {
                        if (this.getTwitchStream().isPaused()) {
                            this.getTwitchStream().unpause();
                        } else {
                            this.getTwitchStream().pause();
                        }
                    }
                } else if (i == this.gameSettings.keyBindStreamCommercials.getKeyCode()) {
                    if (this.getTwitchStream().isBroadcasting()) {
                        this.getTwitchStream().requestCommercial();
                    }
                } else if (i == this.gameSettings.keyBindStreamToggleMic.getKeyCode()) {
                    this.stream.muteMicrophone(true);
                } else if (i == this.gameSettings.keyBindFullscreen.getKeyCode()) {
                    this.toggleFullscreen();
                } else if (i == this.gameSettings.keyBindScreenshot.getKeyCode()) {
                    this.ingameGUI.getChatGUI().printChatMessage(ScreenShotHelper.saveScreenshot(this.mcDataDir,
                            this.displayWidth, this.displayHeight, this.framebufferMc));
                }
            } else if (i == this.gameSettings.keyBindStreamToggleMic.getKeyCode()) {
                this.stream.muteMicrophone(false);
            }
        }
    }
}
项目:Backmemed    文件:ResourcePackListEntry.java   
/**
 * Called when the mouse is clicked within this entry. Returning true means that something within this entry was
 * clicked and the list should not be dragged.
 */
public boolean mousePressed(int slotIndex, int mouseX, int mouseY, int mouseEvent, int relativeX, int relativeY)
{
    if (this.showHoverOverlay() && relativeX <= 32)
    {
        if (this.canMoveRight())
        {
            this.resourcePacksGUI.markChanged();
            final int j = ((ResourcePackListEntry)this.resourcePacksGUI.getSelectedResourcePacks().get(0)).isServerPack() ? 1 : 0;
            int l = this.getResourcePackFormat();

            if (l == 3)
            {
                this.resourcePacksGUI.getListContaining(this).remove(this);
                this.resourcePacksGUI.getSelectedResourcePacks().add(j, this);
            }
            else
            {
                String s = I18n.format("resourcePack.incompatible.confirm.title", new Object[0]);
                String s1 = I18n.format("resourcePack.incompatible.confirm." + (l > 3 ? "new" : "old"), new Object[0]);
                this.mc.displayGuiScreen(new GuiYesNo(new GuiYesNoCallback()
                {
                    public void confirmClicked(boolean result, int id)
                    {
                        List<ResourcePackListEntry> list2 = ResourcePackListEntry.this.resourcePacksGUI.getListContaining(ResourcePackListEntry.this);
                        ResourcePackListEntry.this.mc.displayGuiScreen(ResourcePackListEntry.this.resourcePacksGUI);

                        if (result)
                        {
                            list2.remove(ResourcePackListEntry.this);
                            ResourcePackListEntry.this.resourcePacksGUI.getSelectedResourcePacks().add(j, ResourcePackListEntry.this);
                        }
                    }
                }, s, s1, 0));
            }

            return true;
        }

        if (relativeX < 16 && this.canMoveLeft())
        {
            this.resourcePacksGUI.getListContaining(this).remove(this);
            this.resourcePacksGUI.getAvailableResourcePacks().add(0, this);
            this.resourcePacksGUI.markChanged();
            return true;
        }

        if (relativeX > 16 && relativeY < 16 && this.canMoveUp())
        {
            List<ResourcePackListEntry> list1 = this.resourcePacksGUI.getListContaining(this);
            int k = list1.indexOf(this);
            list1.remove(this);
            list1.add(k - 1, this);
            this.resourcePacksGUI.markChanged();
            return true;
        }

        if (relativeX > 16 && relativeY > 16 && this.canMoveDown())
        {
            List<ResourcePackListEntry> list = this.resourcePacksGUI.getListContaining(this);
            int i = list.indexOf(this);
            list.remove(this);
            list.add(i + 1, this);
            this.resourcePacksGUI.markChanged();
            return true;
        }
    }

    return false;
}
项目:CustomWorldGen    文件:NetHandlerPlayClient.java   
public void handleResourcePack(SPacketResourcePackSend packetIn)
{
    final String s = packetIn.getURL();
    final String s1 = packetIn.getHash();

    if (this.validateResourcePackUrl(s))
    {
        if (s.startsWith("level://"))
        {
            String s2 = s.substring("level://".length());
            File file1 = new File(this.gameController.mcDataDir, "saves");
            File file2 = new File(file1, s2);

            if (file2.isFile())
            {
                this.netManager.sendPacket(new CPacketResourcePackStatus(CPacketResourcePackStatus.Action.ACCEPTED));
                Futures.addCallback(this.gameController.getResourcePackRepository().setResourcePackInstance(file2), this.createDownloadCallback());
            }
            else
            {
                this.netManager.sendPacket(new CPacketResourcePackStatus(CPacketResourcePackStatus.Action.FAILED_DOWNLOAD));
            }
        }
        else
        {
            ServerData serverdata = this.gameController.getCurrentServerData();

            if (serverdata != null && serverdata.getResourceMode() == ServerData.ServerResourceMode.ENABLED)
            {
                this.netManager.sendPacket(new CPacketResourcePackStatus(CPacketResourcePackStatus.Action.ACCEPTED));
                Futures.addCallback(this.gameController.getResourcePackRepository().downloadResourcePack(s, s1), this.createDownloadCallback());
            }
            else if (serverdata != null && serverdata.getResourceMode() != ServerData.ServerResourceMode.PROMPT)
            {
                this.netManager.sendPacket(new CPacketResourcePackStatus(CPacketResourcePackStatus.Action.DECLINED));
            }
            else
            {
                this.gameController.addScheduledTask(new Runnable()
                {
                    public void run()
                    {
                        NetHandlerPlayClient.this.gameController.displayGuiScreen(new GuiYesNo(new GuiYesNoCallback()
                        {
                            public void confirmClicked(boolean result, int id)
                            {
                                NetHandlerPlayClient.this.gameController = Minecraft.getMinecraft();
                                ServerData serverdata1 = NetHandlerPlayClient.this.gameController.getCurrentServerData();

                                if (result)
                                {
                                    if (serverdata1 != null)
                                    {
                                        serverdata1.setResourceMode(ServerData.ServerResourceMode.ENABLED);
                                    }

                                    NetHandlerPlayClient.this.netManager.sendPacket(new CPacketResourcePackStatus(CPacketResourcePackStatus.Action.ACCEPTED));
                                    Futures.addCallback(NetHandlerPlayClient.this.gameController.getResourcePackRepository().downloadResourcePack(s, s1), NetHandlerPlayClient.this.createDownloadCallback());
                                }
                                else
                                {
                                    if (serverdata1 != null)
                                    {
                                        serverdata1.setResourceMode(ServerData.ServerResourceMode.DISABLED);
                                    }

                                    NetHandlerPlayClient.this.netManager.sendPacket(new CPacketResourcePackStatus(CPacketResourcePackStatus.Action.DECLINED));
                                }

                                ServerList.saveSingleServer(serverdata1);
                                NetHandlerPlayClient.this.gameController.displayGuiScreen((GuiScreen)null);
                            }
                        }, I18n.format("multiplayer.texturePrompt.line1", new Object[0]), I18n.format("multiplayer.texturePrompt.line2", new Object[0]), 0));
                    }
                });
            }
        }
    }
}
项目:CustomWorldGen    文件:ResourcePackListEntry.java   
/**
 * Called when the mouse is clicked within this entry. Returning true means that something within this entry was
 * clicked and the list should not be dragged.
 */
public boolean mousePressed(int slotIndex, int mouseX, int mouseY, int mouseEvent, int relativeX, int relativeY)
{
    if (this.showHoverOverlay() && relativeX <= 32)
    {
        if (this.canMoveRight())
        {
            this.resourcePacksGUI.markChanged();
            final int j = ((ResourcePackListEntry)this.resourcePacksGUI.getSelectedResourcePacks().get(0)).isServerPack() ? 1 : 0;
            int l = this.getResourcePackFormat();

            if (l == 2)
            {
                this.resourcePacksGUI.getListContaining(this).remove(this);
                this.resourcePacksGUI.getSelectedResourcePacks().add(j, this);
            }
            else
            {
                String s = I18n.format("resourcePack.incompatible.confirm.title", new Object[0]);
                String s1 = I18n.format("resourcePack.incompatible.confirm." + (l > 2 ? "new" : "old"), new Object[0]);
                this.mc.displayGuiScreen(new GuiYesNo(new GuiYesNoCallback()
                {
                    public void confirmClicked(boolean result, int id)
                    {
                        List<ResourcePackListEntry> list2 = ResourcePackListEntry.this.resourcePacksGUI.getListContaining(ResourcePackListEntry.this);
                        ResourcePackListEntry.this.mc.displayGuiScreen(ResourcePackListEntry.this.resourcePacksGUI);

                        if (result)
                        {
                            list2.remove(ResourcePackListEntry.this);
                            ResourcePackListEntry.this.resourcePacksGUI.getSelectedResourcePacks().add(j, ResourcePackListEntry.this);
                        }
                    }
                }, s, s1, 0));
            }

            return true;
        }

        if (relativeX < 16 && this.canMoveLeft())
        {
            this.resourcePacksGUI.getListContaining(this).remove(this);
            this.resourcePacksGUI.getAvailableResourcePacks().add(0, this);
            this.resourcePacksGUI.markChanged();
            return true;
        }

        if (relativeX > 16 && relativeY < 16 && this.canMoveUp())
        {
            List<ResourcePackListEntry> list1 = this.resourcePacksGUI.getListContaining(this);
            int k = list1.indexOf(this);
            list1.remove(this);
            list1.add(k - 1, this);
            this.resourcePacksGUI.markChanged();
            return true;
        }

        if (relativeX > 16 && relativeY > 16 && this.canMoveDown())
        {
            List<ResourcePackListEntry> list = this.resourcePacksGUI.getListContaining(this);
            int i = list.indexOf(this);
            list.remove(this);
            list.add(i + 1, this);
            this.resourcePacksGUI.markChanged();
            return true;
        }
    }

    return false;
}
项目:CheataClientSrc    文件:CheataMainMenu.java   
/**
  * Called by the controls from the buttonList when activated. (Mouse pressed for buttons)
  */
 protected void actionPerformed(GuiButton button) throws IOException
 {
     if (button.id == 0)
     {
         this.mc.displayGuiScreen(new GuiOptions(this, this.mc.gameSettings));
     }

     if (button.id == 5)
     {
         this.mc.displayGuiScreen(new GuiLanguage(this, this.mc.gameSettings, this.mc.getLanguageManager()));
     }

     if (button.id == 1)
     {
         this.mc.displayGuiScreen(new GuiWorldSelection(this));
     }

     if (button.id == 2)
     {
         this.mc.displayGuiScreen(new GuiMultiplayer(this));
     }

     if (button.id == 4)
     {
         this.mc.shutdown();
     }

     if (button.id == 11)
     {
         this.mc.launchIntegratedServer("Demo_World", "Demo_World", DemoWorldServer.demoWorldSettings);
     }

     if (button.id == 12)
     {
         ISaveFormat isaveformat = this.mc.getSaveLoader();
         WorldInfo worldinfo = isaveformat.getWorldInfo("Demo_World");
         if (worldinfo != null)
         {
             this.mc.displayGuiScreen(new GuiYesNo(this, I18n.format("selectWorld.deleteQuestion", new Object[0]), "\'" + worldinfo.getWorldName() + "\' " + I18n.format("selectWorld.deleteWarning", new Object[0]), I18n.format("selectWorld.deleteButton", new Object[0]), I18n.format("gui.cancel", new Object[0]), 12));
         }
     }

     if (button.id == 21)
     {
        this.mc.displayGuiScreen(new CheataGui(this));
     }

     if (button.id == 24)
     {
try {
            final URL url = new URL("https://github.com/CheataClient/CheataClient");
    URI uri = url.toURI();                                                                                                                                              
             Desktop.getDesktop().browse(uri);
} catch (URISyntaxException e) {
    e.printStackTrace();
}
     }
 }
项目:PopularMMOS-EpicProportions-Mod    文件:GuiMainMenu.java   
protected void actionPerformed(GuiButton p_146284_1_)
{
    if (p_146284_1_.id == 0)
    {
        this.mc.displayGuiScreen(new GuiOptions(this, this.mc.gameSettings));
    }

    if (p_146284_1_.id == 5)
    {
        this.mc.displayGuiScreen(new GuiLanguage(this, this.mc.gameSettings, this.mc.getLanguageManager()));
    }

    if (p_146284_1_.id == 1)
    {
        this.mc.displayGuiScreen(new GuiSelectWorld(this));
    }

    if (p_146284_1_.id == 2)
    {
        this.mc.displayGuiScreen(new GuiMultiplayer(this));
    }

    if (p_146284_1_.id == 14)
    {
        this.func_140005_i();
    }

    if (p_146284_1_.id == 4)
    {
        this.mc.shutdown();
    }

    if (p_146284_1_.id == 6)
    {
        this.mc.displayGuiScreen(new GuiModList(this));
    }

    if (p_146284_1_.id == 11)
    {
        this.mc.launchIntegratedServer("Demo_World", "Demo_World", DemoWorldServer.demoWorldSettings);
    }

    if (p_146284_1_.id == 12)
    {
        ISaveFormat isaveformat = this.mc.getSaveLoader();
        WorldInfo worldinfo = isaveformat.getWorldInfo("Demo_World");

        if (worldinfo != null)
        {
            GuiYesNo guiyesno = GuiSelectWorld.func_152129_a(this, worldinfo.getWorldName(), 12);
            this.mc.displayGuiScreen(guiyesno);
        }
    }
}
项目:ARKCraft-Code    文件:GuiMainMenuOverride.java   
protected void actionPerformed(GuiButton button) throws IOException
{
    if (button.id == 0)
    {
        this.mc.displayGuiScreen(new GuiOptions(this, this.mc.gameSettings));
    }

    if (button.id == 5)
    {
        this.mc.displayGuiScreen(new GuiLanguage(this, this.mc.gameSettings, this.mc
                .getLanguageManager()));
    }

    if (button.id == 1)
    {
        this.mc.displayGuiScreen(new GuiSelectWorld(this));
    }

    if (button.id == 2)
    {
        this.mc.displayGuiScreen(new GuiMultiplayer(this));
    }

    if (button.id == 14 && this.realmsButton.visible)
    {
        this.switchToRealms();
    }

    if (button.id == 4)
    {
        this.mc.shutdown();
    }

    if (button.id == 6)
    {
        this.mc.displayGuiScreen(new net.minecraftforge.fml.client.GuiModList(this));
    }

    if (button.id == 11)
    {
        this.mc.launchIntegratedServer("Demo_World", "Demo_World",
                DemoWorldServer.demoWorldSettings);
    }

    if (button.id == 12)
    {
        ISaveFormat isaveformat = this.mc.getSaveLoader();
        WorldInfo worldinfo = isaveformat.getWorldInfo("Demo_World");

        if (worldinfo != null)
        {
            GuiYesNo guiyesno = GuiSelectWorld
                    .func_152129_a(this, worldinfo.getWorldName(), 12);
            this.mc.displayGuiScreen(guiyesno);
        }
    }
}
项目:Resilience-Client-Source    文件:NetHandlerPlayClient.java   
/**
 * Handles packets that have room for a channel specification. Vanilla implemented channels are "MC|TrList" to
 * acquire a MerchantRecipeList trades for a villager merchant, "MC|Brand" which sets the server brand? on the
 * player instance and finally "MC|RPack" which the server uses to communicate the identifier of the default server
 * resourcepack for the client to load.
 */
public void handleCustomPayload(S3FPacketCustomPayload p_147240_1_)
{
    if ("MC|TrList".equals(p_147240_1_.func_149169_c()))
    {
        ByteBuf var2 = Unpooled.wrappedBuffer(p_147240_1_.func_149168_d());

        try
        {
            int var3 = var2.readInt();
            GuiScreen var4 = this.gameController.currentScreen;

            if (var4 != null && var4 instanceof GuiMerchant && var3 == this.gameController.thePlayer.openContainer.windowId)
            {
                IMerchant var5 = ((GuiMerchant)var4).func_147035_g();
                MerchantRecipeList var6 = MerchantRecipeList.func_151390_b(new PacketBuffer(var2));
                var5.setRecipes(var6);
            }
        }
        catch (IOException var7)
        {
            logger.error("Couldn\'t load trade info", var7);
        }
    }
    else if ("MC|Brand".equals(p_147240_1_.func_149169_c()))
    {
        this.gameController.thePlayer.func_142020_c(new String(p_147240_1_.func_149168_d(), Charsets.UTF_8));
    }
    else if ("MC|RPack".equals(p_147240_1_.func_149169_c()))
    {
        final String var8 = new String(p_147240_1_.func_149168_d(), Charsets.UTF_8);

        if (this.gameController.gameSettings.serverTextures)
        {
            if (this.gameController.func_147104_D() != null && this.gameController.func_147104_D().func_147408_b())
            {
                this.gameController.getResourcePackRepository().func_148526_a(var8);
            }
            else if (this.gameController.func_147104_D() == null || this.gameController.func_147104_D().func_147410_c())
            {
                this.gameController.displayGuiScreen(new GuiYesNo(new GuiScreen()
                {
                    private static final String __OBFID = "CL_00000879";
                    public void confirmClicked(boolean par1, int par2)
                    {
                        this.mc = Minecraft.getMinecraft();

                        if (this.mc.func_147104_D() != null)
                        {
                            this.mc.func_147104_D().setAcceptsTextures(par1);
                            ServerList.func_147414_b(this.mc.func_147104_D());
                        }

                        if (par1)
                        {
                            this.mc.getResourcePackRepository().func_148526_a(var8);
                        }

                        this.mc.displayGuiScreen((GuiScreen)null);
                    }
                }, I18n.format("multiplayer.texturePrompt.line1", new Object[0]), I18n.format("multiplayer.texturePrompt.line2", new Object[0]), 0));
            }
        }
    }
}
项目:Easy-Editors    文件:GuiCommandEditor.java   
@Override
public void commandSyntaxError() {
    Minecraft.getMinecraft()
            .displayGuiScreen(new GuiYesNo(this, Translate.GUI_COMMANDEDITOR_INVALIDCOMMAND_LINE1,
                    Translate.GUI_COMMANDEDITOR_INVALIDCOMMAND_LINE2, 0));
}
项目:ExpandedRailsMod    文件:NetHandlerPlayClient.java   
public void handleResourcePack(SPacketResourcePackSend packetIn)
{
    final String s = packetIn.getURL();
    final String s1 = packetIn.getHash();

    if (this.func_189688_b(s))
    {
        if (s.startsWith("level://"))
        {
            String s2 = s.substring("level://".length());
            File file1 = new File(this.gameController.mcDataDir, "saves");
            File file2 = new File(file1, s2);

            if (file2.isFile())
            {
                this.netManager.sendPacket(new CPacketResourcePackStatus(CPacketResourcePackStatus.Action.ACCEPTED));
                Futures.addCallback(this.gameController.getResourcePackRepository().setResourcePackInstance(file2), this.func_189686_f());
            }
            else
            {
                this.netManager.sendPacket(new CPacketResourcePackStatus(CPacketResourcePackStatus.Action.FAILED_DOWNLOAD));
            }
        }
        else
        {
            ServerData serverdata = this.gameController.getCurrentServerData();

            if (serverdata != null && serverdata.getResourceMode() == ServerData.ServerResourceMode.ENABLED)
            {
                this.netManager.sendPacket(new CPacketResourcePackStatus(CPacketResourcePackStatus.Action.ACCEPTED));
                Futures.addCallback(this.gameController.getResourcePackRepository().downloadResourcePack(s, s1), this.func_189686_f());
            }
            else if (serverdata != null && serverdata.getResourceMode() != ServerData.ServerResourceMode.PROMPT)
            {
                this.netManager.sendPacket(new CPacketResourcePackStatus(CPacketResourcePackStatus.Action.DECLINED));
            }
            else
            {
                this.gameController.addScheduledTask(new Runnable()
                {
                    public void run()
                    {
                        NetHandlerPlayClient.this.gameController.displayGuiScreen(new GuiYesNo(new GuiYesNoCallback()
                        {
                            public void confirmClicked(boolean result, int id)
                            {
                                NetHandlerPlayClient.this.gameController = Minecraft.getMinecraft();
                                ServerData serverdata1 = NetHandlerPlayClient.this.gameController.getCurrentServerData();

                                if (result)
                                {
                                    if (serverdata1 != null)
                                    {
                                        serverdata1.setResourceMode(ServerData.ServerResourceMode.ENABLED);
                                    }

                                    NetHandlerPlayClient.this.netManager.sendPacket(new CPacketResourcePackStatus(CPacketResourcePackStatus.Action.ACCEPTED));
                                    Futures.addCallback(NetHandlerPlayClient.this.gameController.getResourcePackRepository().downloadResourcePack(s, s1), NetHandlerPlayClient.this.func_189686_f());
                                }
                                else
                                {
                                    if (serverdata1 != null)
                                    {
                                        serverdata1.setResourceMode(ServerData.ServerResourceMode.DISABLED);
                                    }

                                    NetHandlerPlayClient.this.netManager.sendPacket(new CPacketResourcePackStatus(CPacketResourcePackStatus.Action.DECLINED));
                                }

                                ServerList.saveSingleServer(serverdata1);
                                NetHandlerPlayClient.this.gameController.displayGuiScreen((GuiScreen)null);
                            }
                        }, I18n.format("multiplayer.texturePrompt.line1", new Object[0]), I18n.format("multiplayer.texturePrompt.line2", new Object[0]), 0));
                    }
                });
            }
        }
    }
}
项目:ExpandedRailsMod    文件:ResourcePackListEntry.java   
/**
 * Called when the mouse is clicked within this entry. Returning true means that something within this entry was
 * clicked and the list should not be dragged.
 */
public boolean mousePressed(int slotIndex, int mouseX, int mouseY, int mouseEvent, int relativeX, int relativeY)
{
    if (this.showHoverOverlay() && relativeX <= 32)
    {
        if (this.canMoveRight())
        {
            this.resourcePacksGUI.markChanged();
            final int j = ((ResourcePackListEntry)this.resourcePacksGUI.getSelectedResourcePacks().get(0)).isServerPack() ? 1 : 0;
            int l = this.getResourcePackFormat();

            if (l == 2)
            {
                this.resourcePacksGUI.getListContaining(this).remove(this);
                this.resourcePacksGUI.getSelectedResourcePacks().add(j, this);
            }
            else
            {
                String s = I18n.format("resourcePack.incompatible.confirm.title", new Object[0]);
                String s1 = I18n.format("resourcePack.incompatible.confirm." + (l > 2 ? "new" : "old"), new Object[0]);
                this.mc.displayGuiScreen(new GuiYesNo(new GuiYesNoCallback()
                {
                    public void confirmClicked(boolean result, int id)
                    {
                        List<ResourcePackListEntry> list2 = ResourcePackListEntry.this.resourcePacksGUI.getListContaining(ResourcePackListEntry.this);
                        ResourcePackListEntry.this.mc.displayGuiScreen(ResourcePackListEntry.this.resourcePacksGUI);

                        if (result)
                        {
                            list2.remove(ResourcePackListEntry.this);
                            ResourcePackListEntry.this.resourcePacksGUI.getSelectedResourcePacks().add(j, ResourcePackListEntry.this);
                        }
                    }
                }, s, s1, 0));
            }

            return true;
        }

        if (relativeX < 16 && this.canMoveLeft())
        {
            this.resourcePacksGUI.getListContaining(this).remove(this);
            this.resourcePacksGUI.getAvailableResourcePacks().add(0, this);
            this.resourcePacksGUI.markChanged();
            return true;
        }

        if (relativeX > 16 && relativeY < 16 && this.canMoveUp())
        {
            List<ResourcePackListEntry> list1 = this.resourcePacksGUI.getListContaining(this);
            int k = list1.indexOf(this);
            list1.remove(this);
            list1.add(k - 1, this);
            this.resourcePacksGUI.markChanged();
            return true;
        }

        if (relativeX > 16 && relativeY > 16 && this.canMoveDown())
        {
            List<ResourcePackListEntry> list = this.resourcePacksGUI.getListContaining(this);
            int i = list.indexOf(this);
            list.remove(this);
            list.add(i + 1, this);
            this.resourcePacksGUI.markChanged();
            return true;
        }
    }

    return false;
}
项目:Cauldron    文件:NetHandlerPlayClient.java   
public void handleCustomPayload(S3FPacketCustomPayload p_147240_1_)
{
    if ("MC|TrList".equals(p_147240_1_.func_149169_c()))
    {
        ByteBuf bytebuf = Unpooled.wrappedBuffer(p_147240_1_.func_149168_d());

        try
        {
            int i = bytebuf.readInt();
            GuiScreen guiscreen = this.gameController.currentScreen;

            if (guiscreen != null && guiscreen instanceof GuiMerchant && i == this.gameController.thePlayer.openContainer.windowId)
            {
                IMerchant imerchant = ((GuiMerchant)guiscreen).func_147035_g();
                MerchantRecipeList merchantrecipelist = MerchantRecipeList.func_151390_b(new PacketBuffer(bytebuf));
                imerchant.setRecipes(merchantrecipelist);
            }
        }
        catch (IOException ioexception)
        {
            logger.error("Couldn\'t load trade info", ioexception);
        }
        finally
        {
            bytebuf.release();
        }
    }
    else if ("MC|Brand".equals(p_147240_1_.func_149169_c()))
    {
        this.gameController.thePlayer.func_142020_c(new String(p_147240_1_.func_149168_d(), Charsets.UTF_8));
    }
    else if ("MC|RPack".equals(p_147240_1_.func_149169_c()))
    {
        final String s = new String(p_147240_1_.func_149168_d(), Charsets.UTF_8);

        if (this.gameController.func_147104_D() != null && this.gameController.func_147104_D().func_152586_b() == ServerData.ServerResourceMode.ENABLED)
        {
            this.gameController.getResourcePackRepository().func_148526_a(s);
        }
        else if (this.gameController.func_147104_D() == null || this.gameController.func_147104_D().func_152586_b() == ServerData.ServerResourceMode.PROMPT)
        {
            this.gameController.displayGuiScreen(new GuiYesNo(new GuiYesNoCallback()
            {
                private static final String __OBFID = "CL_00000879";
                public void confirmClicked(boolean p_73878_1_, int p_73878_2_)
                {
                    NetHandlerPlayClient.this.gameController = Minecraft.getMinecraft();

                    if (NetHandlerPlayClient.this.gameController.func_147104_D() != null)
                    {
                        NetHandlerPlayClient.this.gameController.func_147104_D().func_152584_a(ServerData.ServerResourceMode.ENABLED);
                        ServerList.func_147414_b(NetHandlerPlayClient.this.gameController.func_147104_D());
                    }

                    if (p_73878_1_)
                    {
                        NetHandlerPlayClient.this.gameController.getResourcePackRepository().func_148526_a(s);
                    }

                    NetHandlerPlayClient.this.gameController.displayGuiScreen((GuiScreen)null);
                }
            }, I18n.format("multiplayer.texturePrompt.line1", new Object[0]), I18n.format("multiplayer.texturePrompt.line2", new Object[0]), 0));
        }
    }
}
项目:Cauldron    文件:NetHandlerPlayClient.java   
public void handleCustomPayload(S3FPacketCustomPayload p_147240_1_)
{
    if ("MC|TrList".equals(p_147240_1_.func_149169_c()))
    {
        ByteBuf bytebuf = Unpooled.wrappedBuffer(p_147240_1_.func_149168_d());

        try
        {
            int i = bytebuf.readInt();
            GuiScreen guiscreen = this.gameController.currentScreen;

            if (guiscreen != null && guiscreen instanceof GuiMerchant && i == this.gameController.thePlayer.openContainer.windowId)
            {
                IMerchant imerchant = ((GuiMerchant)guiscreen).func_147035_g();
                MerchantRecipeList merchantrecipelist = MerchantRecipeList.func_151390_b(new PacketBuffer(bytebuf));
                imerchant.setRecipes(merchantrecipelist);
            }
        }
        catch (IOException ioexception)
        {
            logger.error("Couldn\'t load trade info", ioexception);
        }
        finally
        {
            bytebuf.release();
        }
    }
    else if ("MC|Brand".equals(p_147240_1_.func_149169_c()))
    {
        this.gameController.thePlayer.func_142020_c(new String(p_147240_1_.func_149168_d(), Charsets.UTF_8));
    }
    else if ("MC|RPack".equals(p_147240_1_.func_149169_c()))
    {
        final String s = new String(p_147240_1_.func_149168_d(), Charsets.UTF_8);

        if (this.gameController.func_147104_D() != null && this.gameController.func_147104_D().func_152586_b() == ServerData.ServerResourceMode.ENABLED)
        {
            this.gameController.getResourcePackRepository().func_148526_a(s);
        }
        else if (this.gameController.func_147104_D() == null || this.gameController.func_147104_D().func_152586_b() == ServerData.ServerResourceMode.PROMPT)
        {
            this.gameController.displayGuiScreen(new GuiYesNo(new GuiYesNoCallback()
            {
                private static final String __OBFID = "CL_00000879";
                public void confirmClicked(boolean p_73878_1_, int p_73878_2_)
                {
                    NetHandlerPlayClient.this.gameController = Minecraft.getMinecraft();

                    if (NetHandlerPlayClient.this.gameController.func_147104_D() != null)
                    {
                        NetHandlerPlayClient.this.gameController.func_147104_D().func_152584_a(ServerData.ServerResourceMode.ENABLED);
                        ServerList.func_147414_b(NetHandlerPlayClient.this.gameController.func_147104_D());
                    }

                    if (p_73878_1_)
                    {
                        NetHandlerPlayClient.this.gameController.getResourcePackRepository().func_148526_a(s);
                    }

                    NetHandlerPlayClient.this.gameController.displayGuiScreen((GuiScreen)null);
                }
            }, I18n.format("multiplayer.texturePrompt.line1", new Object[0]), I18n.format("multiplayer.texturePrompt.line2", new Object[0]), 0));
        }
    }
}
项目:SimpleMenu    文件:GuiOverride.java   
@Override
public void tickStart(EnumSet<TickType> type, Object... tickData) {
    Minecraft mc = Minecraft.getMinecraft();
    if (mc.currentScreen instanceof GuiMainMenu && flag == false) {
        SimpleMenu.gui.loadMostRecentWorld();
        if (SimpleMenu.gui.renderWorld) {
            world = mc.getIntegratedServer().hashCode();
        } else {
            mc.displayGuiScreen(SimpleMenu.gui);
        }
        flag = true;
    }

    if (mc.getIntegratedServer() != null && mc.getIntegratedServer().hashCode() == world) {
        if (mc.thePlayer != null && (mc.currentScreen == null || mc.currentScreen instanceof GuiIngameMenu)) {
            mc.displayGuiScreen(SimpleMenu.gui);
        }
    } else {
        flag = false;
    }

    if (mc.currentScreen instanceof GuiNewMainMenu) {
        SimpleMenu.gui.closeTicks++;
        if (shouldUnloadWorld) {
            mc.loadWorld(null);
            shouldUnloadWorld = false;
        }
        if (shouldTryToEnableRenderWorld) {
            flag = false;
            SimpleMenu.gui.renderWorld = true;
            shouldTryToEnableRenderWorld = false;
        }
    }

    if (mc.currentScreen instanceof GuiYesNo && SimpleMenu.gui.renderWorld) {
        shouldUnloadWorld = true;
        SimpleMenu.gui.renderWorld = false;
    }

    if (mc.currentScreen instanceof GuiCreateWorld) {
        shouldTryToEnableRenderWorld = true;
    }
}