@Override protected void actionPerformed(GuiButton button) { if (!button.enabled) return; switch (button.id) { case 0: if (buttonRegenMode.enabled) preset = regenMode; break; case 3: // If going to the more options screen, hide the button. // If going back to the main screen, show the button again. boolean inMoreOptions = ReflectionHelper.getPrivateValue(GuiCreateWorld.class, this, "field_146344_y"); buttonRegenMode.visible = inMoreOptions; break; case 9: regenMode = EnumPreset.values()[(regenMode.ordinal() + 1) % EnumPreset.values().length]; buttonRegenMode.displayString = getRegenButtonString(); break; } super.actionPerformed(button); }
@SideOnly(Side.CLIENT) public static void addOptionsButtonToGui(GuiCreateWorld gui, List<GuiButton> buttonList) { if (gui == null) { _optionsGuiButton = null; } else { if (_optionsGuiButton == null) { WorldConfig.loadedOptionOverrides[0] = null; GuiCustomOreGenSettings button = new GuiCustomOreGenSettings(gui); _optionsGuiButton = new GuiOpenMenuButton(gui, 99, 0, 0, 150, 20, "Custom Ore Generation...", button); } GuiOpenMenuButton button1 = _optionsGuiButton; if (!buttonList.contains(button1)) { button1.xPosition = (gui.width - button1.getWidth()) / 2; button1.yPosition = 165; buttonList.add(button1); } } }
@Override public void onCustomizeButton(Minecraft mc, GuiCreateWorld guiCreateWorld) { // testing time ExampleMod.logger.info("wheee"); /*BiomeSettings testsettings = new DefaultBiomeSettings(); BiomeSettings testammendment = new BiomeSettings(); BiomeSettings.BiomeReplacement testreplace = new BiomeSettings.BiomeReplacement(); testreplace.replace = Biomes.MUSHROOM_ISLAND.getRegistryName(); testreplace.name = Biomes.MESA.getRegistryName(); testammendment.replacements.put(testreplace.getMapKey(), testreplace); testsettings.apply(testammendment); String json = testsettings.writeToJson(); ATG.logger.info("Json 1: "+json); BiomeSettings test2 = new BiomeSettings().readFromJson(json); String json2 = test2.writeToJson(); ATG.logger.info("Json 2: "+json2);*/ //GeneralUtil.printBiomeInformation(); DefaultWorldSettings testsettings = new DefaultWorldSettings(); testsettings.applyDefaultModuleStack(); ExampleMod.logger.info(testsettings.writeToJson()); }
@SideOnly(Side.CLIENT) @SubscribeEvent public void guiEvent(GuiScreenEvent.InitGuiEvent.Post event) { if(!(event.gui instanceof GuiCreateWorld)) return; GuiButton gmodebtn = (GuiButton) event.buttonList.get(2); GuiButton apocSelt = new GuiButton(11, event.gui.width / 2 + 5, 110, 150, 20, StatCollector.translateToLocal("internal.genuineea.ApocButton")); gmodebtn.xPosition -= 80; gmodebtn.yPosition -= 5; apocSelectBTN = apocSelt; event.buttonList.add(apocSelt); }
@SideOnly(Side.CLIENT) @SubscribeEvent public void actionEvent(ActionPerformedEvent.Post event) { if(!(event.gui instanceof GuiCreateWorld)) return; if(event.button.id == 11) { event.gui.mc.displayGuiScreen(new GuiApocSelect(event.gui)); } else if(event.button.id == 3) { apocSelectBTN.visible = !apocSelectBTN.visible; } }
@SubscribeEvent public void onGuiOpen(GuiOpenEvent event) { EnumControl regenControl = AdvHealthOptions.config.<EnumControl>get(AHOGlobalConfig.generalControl); if ((regenControl == EnumControl.HIDDEN) || !(event.gui instanceof GuiCreateWorld) || (event.gui instanceof AHOGuiCreateWorld)) return; // Replace default create world GUI with custom one. This might be // bad if other mods do the same, or try to modify the default one. Minecraft mc = Minecraft.getMinecraft(); mc.displayGuiScreen(new AHOGuiCreateWorld(mc.currentScreen)); event.setCanceled(true); }
@Override public void drawScreen(int par1, int par2, float par3) { boolean inMoreOptions = ReflectionHelper.getPrivateValue(GuiCreateWorld.class, this, "field_146344_y"); if (!inMoreOptions) { GuiTextField textField = ReflectionHelper.getPrivateValue(GuiCreateWorld.class, this, "field_146333_g"); String resultFolder = ReflectionHelper.getPrivateValue(GuiCreateWorld.class, this, "field_146336_i"); String gameModeLine1 = ReflectionHelper.getPrivateValue(GuiCreateWorld.class, this, "field_146323_G"); String gameModeLine2 = ReflectionHelper.getPrivateValue(GuiCreateWorld.class, this, "field_146328_H"); drawDefaultBackground(); drawCenteredString(fontRendererObj, LocalizationUtils.translate("selectWorld.create"), width / 2, 20, -1); drawString(fontRendererObj, LocalizationUtils.translate("selectWorld.enterName"), width / 2 - 100, 47, 0xFFA0A0A0); drawString(fontRendererObj, LocalizationUtils.translate("selectWorld.resultFolder") + " " + resultFolder, width / 2 - 100, 85, 0xFFA0A0A0); textField.drawTextBox(); drawString(fontRendererObj, gameModeLine1, width / 2 - 100, 122, 0xFFA0A0A0); drawString(fontRendererObj, gameModeLine2, width / 2 - 100, 134, 0xFFA0A0A0); String regenModeDesc = ((regenMode == EnumPreset.CUSTOM) ? AdvHealthOptions.config.<String>get(AHOGlobalConfig.generalDescription) : (AHOLocalization.REGEN_MODE + "." + regenMode.toString().toLowerCase() + ".desc")); regenModeDesc = LocalizationUtils.translate(regenModeDesc); drawString(fontRendererObj, regenModeDesc, width / 2 - 100, 172, 0xFFA0A0A0); for (int i = 0; i < buttonList.size(); ++i) ((GuiButton)buttonList.get(i)).drawButton(mc, par1, par2); for (int i = 0; i < labelList.size(); ++i) ((GuiLabel)labelList.get(i)).func_146159_a(mc, par1, par2); } else super.drawScreen(par1, par2, par3); }
/** * Called when the 'Customize' button is pressed on world creation GUI * @param instance The minecraft instance * @param guiCreateWorld the createworld GUI */ @SideOnly(Side.CLIENT) public void onCustomizeButton(Minecraft instance, GuiCreateWorld guiCreateWorld) { if (this == FLAT) { instance.displayGuiScreen(new GuiCreateFlatWorld(guiCreateWorld, guiCreateWorld.field_146334_a)); } }
@SubscribeEvent @SideOnly(Side.CLIENT) //Modders should never do this, im just lazy, and I KNOW what im doing. public void onOpenGui(GuiOpenEvent e) { //If we're opening the new world screen from the world selection, default to void world. if (e.getGui() instanceof GuiCreateWorld && Minecraft.getMinecraft().currentScreen instanceof GuiWorldSelection) { //Auto-select void world. GuiCreateWorld cw = (GuiCreateWorld)e.getGui(); ReflectionHelper.setPrivateValue(GuiCreateWorld.class, cw, worldType.getId(), "field_146331_K", "selectedIndex"); } }
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_); } } }
/** * Called when the 'Customize' button is pressed on world creation GUI * @param instance The minecraft instance * @param guiCreateWorld the createworld GUI */ @SideOnly(Side.CLIENT) public void onCustomizeButton(Minecraft instance, GuiCreateWorld guiCreateWorld) { if (this == FLAT) { instance.displayGuiScreen(new GuiCreateFlatWorld(guiCreateWorld, guiCreateWorld.generatorOptionsToUse)); } }
@SubscribeEvent @SideOnly(Side.CLIENT) public void onInitGui(GuiScreenEvent.InitGuiEvent.Post event) { if (event.getGui() instanceof GuiCreateWorld) { ServerState.addOptionsButtonToGui((GuiCreateWorld)event.getGui(), event.getButtonList()); } }
@SubscribeEvent @SideOnly(Side.CLIENT) public void onActionPerformed(GuiScreenEvent.ActionPerformedEvent.Post event) { if (event.getGui() instanceof GuiCreateWorld) { ServerState.updateOptionsButtonVisibility((GuiCreateWorld)event.getGui()); } }
@SideOnly(Side.CLIENT) @ForgeSubscribe public void handleGuiOpen(GuiOpenEvent event) { if (event.gui == null) { return; } if (event.gui.getClass().equals(GuiCreateWorld.class)) { GuiScreen parent = ObfuscationReflectionHelper.getPrivateValue(GuiCreateWorld.class, (GuiCreateWorld) event.gui, 0); event.gui = new HackedCreateWorld(parent); } else if (event.gui.getClass().equals(GuiSelectWorld.class)) { for (Field f : GuiSelectWorld.class.getDeclaredFields()) { if (f.getType().isArray()) { try { f.setAccessible(true); String[] strings = Arrays.copyOf((String[]) f.get(event.gui), 4); strings[3] = I18n.getString("gamemode." + Constants.GAMEMODE); f.set(event.gui, strings); return; } catch (Exception e) { e.printStackTrace(); } } } } }
@SubscribeEvent public static void onOpenGui(GuiScreenEvent.InitGuiEvent event) { if (event.getGui() instanceof GuiContainer) { if (!SettingsFlags.instance.enableCustomInventory) { return; } GuiContainer gc = (GuiContainer) event.getGui(); if ((gc instanceof GuiInventory || gc instanceof GuiContainerCreative) && Minecraft.getMinecraft().player.capabilities.isCreativeMode) { return; } Container c = gc.inventorySlots; for (int i = 0; i < c.inventorySlots.size(); ++i) { Slot s = c.inventorySlots.get(i); if (s.getClass().equals(Slot.class) && s.inventory instanceof InventoryPlayer && !(s instanceof ManagedSlot) && s.getSlotIndex() >= 9 && s.getSlotIndex() < 36) { ManagedSlot wrapper = new ManagedSlot(s); c.inventorySlots.remove(i); c.inventorySlots.add(i, wrapper); } } } if (event.getGui() instanceof GuiCreateWorld) { if (!SettingsFlags.instance.enableInvasiveChanges) { return; } try { Field f = null; Field[] allFlds = GuiCreateWorld.class.getDeclaredFields(); for (int i = allFlds.length - 1; i >= 0; --i) { if (allFlds[i].getType() == Integer.TYPE) { f = allFlds[i]; break; } } f.setAccessible(true); f.set(event.getGui(), ExPMisc.worldTypeExP.getId()); } catch (Exception ex) { ExPMisc.modLogger.log(LogLevel.Debug, "Could not reflect GuiCreateWorld!", ex); } } }
public CustomizedPlanetTypeGUI(GuiCreateWorld guiCreateWorld) { this.createWorldGui = guiCreateWorld; }
@Override public void onCustomizeButton(Minecraft mc, GuiCreateWorld guiCreateWorld) { mc.displayGuiScreen(new CustomizedPlanetTypeGUI(guiCreateWorld)); }
@Override @SideOnly(Side.CLIENT) public void onCustomizeButton(Minecraft mc, GuiCreateWorld guiCreateWorld) { mc.displayGuiScreen(new GuiCreatePlanetoidWorld(guiCreateWorld, guiCreateWorld.chunkProviderSettingsJson)); // GuiCreateFlatWorld }
public GuiCreatePlanetoidWorld(GuiCreateWorld guiCreateWorld, String str) { this.createWorldGui = guiCreateWorld; this.generatorInfo = PlanetoidGeneratorInfo.createGeneratorFromString(str); }
@Override public void onCustomizeButton(Minecraft mc, GuiCreateWorld guiCreateWorld) { // TODO Auto-generated method stub super.onCustomizeButton(mc, guiCreateWorld); }
@SideOnly(Side.CLIENT) public void onCustomizeButton(Minecraft mc, GuiCreateWorld guiCreateWorld) { mc.displayGuiScreen(new GuiCustomizeWorld(guiCreateWorld)); }
public GuiCustomizeWorld(GuiCreateWorld createGUI) { this.createGUI = createGUI; }
public GuiCreateFlatWorld(GuiCreateWorld p_i1029_1_, String p_i1029_2_) { this.field_82277_b = p_i1029_1_; this.func_82273_a(p_i1029_2_); }
@SideOnly(Side.CLIENT) public static void updateOptionsButtonVisibility(GuiCreateWorld gui) { _optionsGuiButton.visible = !(Boolean)ObfuscationReflectionHelper.getPrivateValue(GuiCreateWorld.class, gui, 12); }
@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; } }