use of net.minecraftforge.fml.client.config.GuiConfig in project DynamicSurroundings by OreCruncher.
the class GuiConfigBase method actionPerformed.
/**
* Called by the controls from the buttonList when activated. (Mouse pressed for
* buttons)
*/
@Override
protected void actionPerformed(GuiButton button) {
if (button.id == 2000) {
boolean flag = true;
try {
if ((this.configID != null || this.parentScreen == null || !(this.parentScreen instanceof GuiConfig)) && (this.entryList.hasChangedEntry(true))) {
final boolean requiresMcRestart = this.entryList.saveConfigElements();
// My hook for massaging the results
doFixups();
if (Loader.isModLoaded(this.modID)) {
final ConfigChangedEvent event = new OnConfigChangedEvent(this.modID, this.configID, this.isWorldRunning, requiresMcRestart);
MinecraftForge.EVENT_BUS.post(event);
if (!event.getResult().equals(Result.DENY))
MinecraftForge.EVENT_BUS.post(new PostConfigChangedEvent(this.modID, this.configID, this.isWorldRunning, requiresMcRestart));
if (requiresMcRestart) {
flag = false;
this.mc.displayGuiScreen(new GuiMessageDialog(this.parentScreen, "fml.configgui.gameRestartTitle", new TextComponentString(I18n.format("fml.configgui.gameRestartRequired")), "fml.configgui.confirmRestartMessage"));
}
if (this.parentScreen instanceof GuiConfig)
((GuiConfig) this.parentScreen).needsRefresh = true;
}
}
} catch (final Throwable e) {
FMLLog.log.error("Error performing GuiConfig action:", e);
}
if (flag)
this.mc.displayGuiScreen(this.parentScreen);
} else if (button.id == 2001) {
this.entryList.setAllToDefault(this.chkApplyGlobally.isChecked());
} else if (button.id == 2002) {
this.entryList.undoAllChanges(this.chkApplyGlobally.isChecked());
}
}
use of net.minecraftforge.fml.client.config.GuiConfig in project DynamicSurroundings by OreCruncher.
the class PresetsConfigGui method onGuiClosed.
@Override
public void onGuiClosed() {
super.onGuiClosed();
if (this.parentScreen instanceof GuiConfig) {
final GuiConfig parentGuiConfig = (GuiConfig) this.parentScreen;
parentGuiConfig.needsRefresh = true;
parentGuiConfig.initGui();
}
}
Aggregations