Fixed world type resetting to Biomes O' Plenty after customizing a Vanilla worldtype

This commit is contained in:
Adubbz 2020-07-14 20:18:48 +10:00
parent 9f601850fc
commit 99eb540906
1 changed files with 3 additions and 10 deletions

View File

@ -39,12 +39,11 @@ public class GuiEventHandler
{ {
Screen gui = event.getGui(); Screen gui = event.getGui();
Minecraft mc = Minecraft.getInstance(); Minecraft mc = Minecraft.getInstance();
Screen prevScreen = mc.screen;
// Retain the last level that was selected // Retain the last level that was selected
if (isDataReadScreen(gui)) if (isDataReadScreen(gui))
{ {
Screen prevScreen = mc.screen;
if (prevScreen instanceof WorldSelectionScreen) if (prevScreen instanceof WorldSelectionScreen)
{ {
WorldSelectionScreen worldSelectionScreen = (WorldSelectionScreen)prevScreen; WorldSelectionScreen worldSelectionScreen = (WorldSelectionScreen)prevScreen;
@ -71,15 +70,9 @@ public class GuiEventHandler
{ {
cleanupGuiTracking(); cleanupGuiTracking();
} }
}
@OnlyIn(Dist.CLIENT) // Default to the bop worldtype
@SubscribeEvent if (ModConfig.ClientConfig.useWorldType.get() && gui instanceof CreateWorldScreen && prevScreen instanceof WorldSelectionScreen)
public static void onGuiPostInit(GuiScreenEvent.InitGuiEvent.Post event)
{
Screen gui = event.getGui();
if (ModConfig.ClientConfig.useWorldType.get() && gui instanceof CreateWorldScreen)
{ {
WorldOptionsScreen optionsScreen = ((CreateWorldScreen)gui).worldGenSettingsComponent; WorldOptionsScreen optionsScreen = ((CreateWorldScreen)gui).worldGenSettingsComponent;
optionsScreen.preset = Optional.of(ModBiomes.biomeGeneratorTypeScreenBOP); optionsScreen.preset = Optional.of(ModBiomes.biomeGeneratorTypeScreenBOP);