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