package net.minecraft.client.gui.screens.worldselection;

import org.apache.logging.log4j.LogManager;
import it.unimi.dsi.fastutil.booleans.BooleanConsumer;
import java.io.BufferedReader;
import java.util.concurrent.CompletableFuture;
import net.minecraft.client.gui.screens.Screen;
import net.minecraft.client.gui.screens.ConfirmScreen;
import com.mojang.serialization.Lifecycle;
import java.util.function.Consumer;
import com.google.gson.JsonSyntaxException;
import com.google.gson.JsonIOException;
import java.io.IOException;
import com.mojang.serialization.DataResult;
import java.io.Reader;
import java.nio.file.Files;
import java.nio.file.Paths;
import com.google.gson.JsonParser;
import com.mojang.serialization.DynamicOps;
import com.google.gson.JsonElement;
import net.minecraft.resources.RegistryReadOps;
import com.mojang.serialization.JsonOps;
import java.util.concurrent.ExecutionException;
import net.minecraft.client.gui.components.toasts.Toast;
import net.minecraft.client.gui.components.toasts.SystemToast;
import net.minecraft.network.chat.TextComponent;
import java.util.concurrent.Executor;
import net.minecraft.server.ServerResources;
import net.minecraft.Util;
import net.minecraft.commands.Commands;
import net.minecraft.server.MinecraftServer;
import net.minecraft.server.packs.repository.PackRepository;
import net.minecraft.server.packs.repository.FolderRepositorySource;
import net.minecraft.server.packs.repository.PackSource;
import net.minecraft.server.packs.repository.ServerPacksSource;
import net.minecraft.server.packs.repository.RepositorySource;
import net.minecraft.server.packs.repository.Pack;
import org.lwjgl.PointerBuffer;
import org.lwjgl.util.tinyfd.TinyFileDialogs;
import net.minecraft.network.chat.TranslatableComponent;
import org.apache.commons.lang3.StringUtils;
import java.util.OptionalLong;
import net.minecraft.network.chat.FormattedText;
import net.minecraft.client.resources.language.I18n;
import com.mojang.blaze3d.vertex.PoseStack;
import net.minecraft.client.Minecraft;
import java.util.Optional;
import net.minecraft.world.level.levelgen.WorldGenSettings;
import net.minecraft.core.RegistryAccess;
import net.minecraft.client.gui.components.Button;
import net.minecraft.client.gui.components.EditBox;
import net.minecraft.client.gui.Font;
import net.minecraft.network.chat.Component;
import org.apache.logging.log4j.Logger;
import net.minecraft.client.gui.components.Widget;
import net.minecraft.client.gui.components.TickableWidget;

public class WorldGenSettingsComponent implements TickableWidget, Widget {
    private static final Logger LOGGER;
    private static final Component CUSTOM_WORLD_DESCRIPTION;
    private static final Component AMPLIFIED_HELP_TEXT;
    private Font font;
    private int width;
    private EditBox seedEdit;
    private Button featuresButton;
    public Button bonusItemsButton;
    private Button typeButton;
    private Button customizeTypeButton;
    private Button importSettingsButton;
    private RegistryAccess.RegistryHolder registryHolder;
    private WorldGenSettings settings;
    private Optional<WorldPreset> preset;
    private String initSeed;
    
    public WorldGenSettingsComponent() {
        this.registryHolder = RegistryAccess.builtin();
        this.settings = WorldGenSettings.makeDefault();
        this.preset = Optional.<WorldPreset>of(WorldPreset.NORMAL);
        this.initSeed = "";
    }
    
    public WorldGenSettingsComponent(final RegistryAccess.RegistryHolder a, final WorldGenSettings cix) {
        this.registryHolder = a;
        this.settings = cix;
        this.preset = WorldPreset.of(cix);
        this.initSeed = Long.toString(cix.seed());
    }
    
    public void init(final CreateWorldScreen dty, final Minecraft dlx, final Font dmt) {
        // 
        // This method could not be decompiled.
        // 
        // Original Bytecode:
        // 
        //     1: aload_3         /* dmt */
        //     2: putfield        net/minecraft/client/gui/screens/worldselection/WorldGenSettingsComponent.font:Lnet/minecraft/client/gui/Font;
        //     5: aload_0         /* this */
        //     6: aload_1         /* dty */
        //     7: getfield        net/minecraft/client/gui/screens/worldselection/CreateWorldScreen.width:I
        //    10: putfield        net/minecraft/client/gui/screens/worldselection/WorldGenSettingsComponent.width:I
        //    13: aload_0         /* this */
        //    14: new             Lnet/minecraft/client/gui/components/EditBox;
        //    17: dup            
        //    18: aload_0         /* this */
        //    19: getfield        net/minecraft/client/gui/screens/worldselection/WorldGenSettingsComponent.font:Lnet/minecraft/client/gui/Font;
        //    22: aload_0         /* this */
        //    23: getfield        net/minecraft/client/gui/screens/worldselection/WorldGenSettingsComponent.width:I
        //    26: iconst_2       
        //    27: idiv           
        //    28: bipush          100
        //    30: isub           
        //    31: bipush          60
        //    33: sipush          200
        //    36: bipush          20
        //    38: new             Lnet/minecraft/network/chat/TranslatableComponent;
        //    41: dup            
        //    42: ldc             "selectWorld.enterSeed"
        //    44: invokespecial   net/minecraft/network/chat/TranslatableComponent.<init>:(Ljava/lang/String;)V
        //    47: invokespecial   net/minecraft/client/gui/components/EditBox.<init>:(Lnet/minecraft/client/gui/Font;IIIILnet/minecraft/network/chat/Component;)V
        //    50: putfield        net/minecraft/client/gui/screens/worldselection/WorldGenSettingsComponent.seedEdit:Lnet/minecraft/client/gui/components/EditBox;
        //    53: aload_0         /* this */
        //    54: getfield        net/minecraft/client/gui/screens/worldselection/WorldGenSettingsComponent.seedEdit:Lnet/minecraft/client/gui/components/EditBox;
        //    57: aload_0         /* this */
        //    58: getfield        net/minecraft/client/gui/screens/worldselection/WorldGenSettingsComponent.initSeed:Ljava/lang/String;
        //    61: invokevirtual   net/minecraft/client/gui/components/EditBox.setValue:(Ljava/lang/String;)V
        //    64: aload_0         /* this */
        //    65: getfield        net/minecraft/client/gui/screens/worldselection/WorldGenSettingsComponent.seedEdit:Lnet/minecraft/client/gui/components/EditBox;
        //    68: aload_0         /* this */
        //    69: invokedynamic   BootstrapMethod #0, accept:(Lnet/minecraft/client/gui/screens/worldselection/WorldGenSettingsComponent;)Ljava/util/function/Consumer;
        //    74: invokevirtual   net/minecraft/client/gui/components/EditBox.setResponder:(Ljava/util/function/Consumer;)V
        //    77: aload_1         /* dty */
        //    78: aload_0         /* this */
        //    79: getfield        net/minecraft/client/gui/screens/worldselection/WorldGenSettingsComponent.seedEdit:Lnet/minecraft/client/gui/components/EditBox;
        //    82: invokevirtual   net/minecraft/client/gui/screens/worldselection/CreateWorldScreen.addWidget:(Lnet/minecraft/client/gui/components/events/GuiEventListener;)Lnet/minecraft/client/gui/components/events/GuiEventListener;
        //    85: pop            
        //    86: aload_0         /* this */
        //    87: getfield        net/minecraft/client/gui/screens/worldselection/WorldGenSettingsComponent.width:I
        //    90: iconst_2       
        //    91: idiv           
        //    92: sipush          155
        //    95: isub           
        //    96: istore          integer5
        //    98: aload_0         /* this */
        //    99: getfield        net/minecraft/client/gui/screens/worldselection/WorldGenSettingsComponent.width:I
        //   102: iconst_2       
        //   103: idiv           
        //   104: iconst_5       
        //   105: iadd           
        //   106: istore          integer6
        //   108: aload_0         /* this */
        //   109: aload_1         /* dty */
        //   110: new             Lnet/minecraft/client/gui/screens/worldselection/WorldGenSettingsComponent$1;
        //   113: dup            
        //   114: aload_0         /* this */
        //   115: iload           integer5
        //   117: bipush          100
        //   119: sipush          150
        //   122: bipush          20
        //   124: new             Lnet/minecraft/network/chat/TranslatableComponent;
        //   127: dup            
        //   128: ldc             "selectWorld.mapFeatures"
        //   130: invokespecial   net/minecraft/network/chat/TranslatableComponent.<init>:(Ljava/lang/String;)V
        //   133: aload_0         /* this */
        //   134: invokedynamic   BootstrapMethod #1, onPress:(Lnet/minecraft/client/gui/screens/worldselection/WorldGenSettingsComponent;)Lnet/minecraft/client/gui/components/Button$OnPress;
        //   139: invokespecial   net/minecraft/client/gui/screens/worldselection/WorldGenSettingsComponent$1.<init>:(Lnet/minecraft/client/gui/screens/worldselection/WorldGenSettingsComponent;IIIILnet/minecraft/network/chat/Component;Lnet/minecraft/client/gui/components/Button$OnPress;)V
        //   142: invokevirtual   net/minecraft/client/gui/screens/worldselection/CreateWorldScreen.addButton:(Lnet/minecraft/client/gui/components/AbstractWidget;)Lnet/minecraft/client/gui/components/AbstractWidget;
        //   145: checkcast       Lnet/minecraft/client/gui/components/Button;
        //   148: putfield        net/minecraft/client/gui/screens/worldselection/WorldGenSettingsComponent.featuresButton:Lnet/minecraft/client/gui/components/Button;
        //   151: aload_0         /* this */
        //   152: getfield        net/minecraft/client/gui/screens/worldselection/WorldGenSettingsComponent.featuresButton:Lnet/minecraft/client/gui/components/Button;
        //   155: iconst_0       
        //   156: putfield        net/minecraft/client/gui/components/Button.visible:Z
        //   159: aload_0         /* this */
        //   160: aload_1         /* dty */
        //   161: new             Lnet/minecraft/client/gui/screens/worldselection/WorldGenSettingsComponent$2;
        //   164: dup            
        //   165: aload_0         /* this */
        //   166: iload           integer6
        //   168: bipush          100
        //   170: sipush          150
        //   173: bipush          20
        //   175: new             Lnet/minecraft/network/chat/TranslatableComponent;
        //   178: dup            
        //   179: ldc             "selectWorld.mapType"
        //   181: invokespecial   net/minecraft/network/chat/TranslatableComponent.<init>:(Ljava/lang/String;)V
        //   184: aload_0         /* this */
        //   185: aload_1         /* dty */
        //   186: invokedynamic   BootstrapMethod #2, onPress:(Lnet/minecraft/client/gui/screens/worldselection/WorldGenSettingsComponent;Lnet/minecraft/client/gui/screens/worldselection/CreateWorldScreen;)Lnet/minecraft/client/gui/components/Button$OnPress;
        //   191: invokespecial   net/minecraft/client/gui/screens/worldselection/WorldGenSettingsComponent$2.<init>:(Lnet/minecraft/client/gui/screens/worldselection/WorldGenSettingsComponent;IIIILnet/minecraft/network/chat/Component;Lnet/minecraft/client/gui/components/Button$OnPress;)V
        //   194: invokevirtual   net/minecraft/client/gui/screens/worldselection/CreateWorldScreen.addButton:(Lnet/minecraft/client/gui/components/AbstractWidget;)Lnet/minecraft/client/gui/components/AbstractWidget;
        //   197: checkcast       Lnet/minecraft/client/gui/components/Button;
        //   200: putfield        net/minecraft/client/gui/screens/worldselection/WorldGenSettingsComponent.typeButton:Lnet/minecraft/client/gui/components/Button;
        //   203: aload_0         /* this */
        //   204: getfield        net/minecraft/client/gui/screens/worldselection/WorldGenSettingsComponent.typeButton:Lnet/minecraft/client/gui/components/Button;
        //   207: iconst_0       
        //   208: putfield        net/minecraft/client/gui/components/Button.visible:Z
        //   211: aload_0         /* this */
        //   212: getfield        net/minecraft/client/gui/screens/worldselection/WorldGenSettingsComponent.typeButton:Lnet/minecraft/client/gui/components/Button;
        //   215: aload_0         /* this */
        //   216: getfield        net/minecraft/client/gui/screens/worldselection/WorldGenSettingsComponent.preset:Ljava/util/Optional;
        //   219: invokevirtual   java/util/Optional.isPresent:()Z
        //   222: putfield        net/minecraft/client/gui/components/Button.active:Z
        //   225: aload_0         /* this */
        //   226: aload_1         /* dty */
        //   227: new             Lnet/minecraft/client/gui/components/Button;
        //   230: dup            
        //   231: iload           integer6
        //   233: bipush          120
        //   235: sipush          150
        //   238: bipush          20
        //   240: new             Lnet/minecraft/network/chat/TranslatableComponent;
        //   243: dup            
        //   244: ldc             "selectWorld.customizeType"
        //   246: invokespecial   net/minecraft/network/chat/TranslatableComponent.<init>:(Ljava/lang/String;)V
        //   249: aload_0         /* this */
        //   250: aload_2         /* dlx */
        //   251: aload_1         /* dty */
        //   252: invokedynamic   BootstrapMethod #3, onPress:(Lnet/minecraft/client/gui/screens/worldselection/WorldGenSettingsComponent;Lnet/minecraft/client/Minecraft;Lnet/minecraft/client/gui/screens/worldselection/CreateWorldScreen;)Lnet/minecraft/client/gui/components/Button$OnPress;
        //   257: invokespecial   net/minecraft/client/gui/components/Button.<init>:(IIIILnet/minecraft/network/chat/Component;Lnet/minecraft/client/gui/components/Button$OnPress;)V
        //   260: invokevirtual   net/minecraft/client/gui/screens/worldselection/CreateWorldScreen.addButton:(Lnet/minecraft/client/gui/components/AbstractWidget;)Lnet/minecraft/client/gui/components/AbstractWidget;
        //   263: checkcast       Lnet/minecraft/client/gui/components/Button;
        //   266: putfield        net/minecraft/client/gui/screens/worldselection/WorldGenSettingsComponent.customizeTypeButton:Lnet/minecraft/client/gui/components/Button;
        //   269: aload_0         /* this */
        //   270: getfield        net/minecraft/client/gui/screens/worldselection/WorldGenSettingsComponent.customizeTypeButton:Lnet/minecraft/client/gui/components/Button;
        //   273: iconst_0       
        //   274: putfield        net/minecraft/client/gui/components/Button.visible:Z
        //   277: aload_0         /* this */
        //   278: aload_1         /* dty */
        //   279: new             Lnet/minecraft/client/gui/screens/worldselection/WorldGenSettingsComponent$3;
        //   282: dup            
        //   283: aload_0         /* this */
        //   284: iload           integer5
        //   286: sipush          151
        //   289: sipush          150
        //   292: bipush          20
        //   294: new             Lnet/minecraft/network/chat/TranslatableComponent;
        //   297: dup            
        //   298: ldc             "selectWorld.bonusItems"
        //   300: invokespecial   net/minecraft/network/chat/TranslatableComponent.<init>:(Ljava/lang/String;)V
        //   303: aload_0         /* this */
        //   304: invokedynamic   BootstrapMethod #4, onPress:(Lnet/minecraft/client/gui/screens/worldselection/WorldGenSettingsComponent;)Lnet/minecraft/client/gui/components/Button$OnPress;
        //   309: aload_1         /* dty */
        //   310: invokespecial   net/minecraft/client/gui/screens/worldselection/WorldGenSettingsComponent$3.<init>:(Lnet/minecraft/client/gui/screens/worldselection/WorldGenSettingsComponent;IIIILnet/minecraft/network/chat/Component;Lnet/minecraft/client/gui/components/Button$OnPress;Lnet/minecraft/client/gui/screens/worldselection/CreateWorldScreen;)V
        //   313: invokevirtual   net/minecraft/client/gui/screens/worldselection/CreateWorldScreen.addButton:(Lnet/minecraft/client/gui/components/AbstractWidget;)Lnet/minecraft/client/gui/components/AbstractWidget;
        //   316: checkcast       Lnet/minecraft/client/gui/components/Button;
        //   319: putfield        net/minecraft/client/gui/screens/worldselection/WorldGenSettingsComponent.bonusItemsButton:Lnet/minecraft/client/gui/components/Button;
        //   322: aload_0         /* this */
        //   323: getfield        net/minecraft/client/gui/screens/worldselection/WorldGenSettingsComponent.bonusItemsButton:Lnet/minecraft/client/gui/components/Button;
        //   326: iconst_0       
        //   327: putfield        net/minecraft/client/gui/components/Button.visible:Z
        //   330: aload_0         /* this */
        //   331: aload_1         /* dty */
        //   332: new             Lnet/minecraft/client/gui/components/Button;
        //   335: dup            
        //   336: iload           integer5
        //   338: sipush          185
        //   341: sipush          150
        //   344: bipush          20
        //   346: new             Lnet/minecraft/network/chat/TranslatableComponent;
        //   349: dup            
        //   350: ldc_w           "selectWorld.import_worldgen_settings"
        //   353: invokespecial   net/minecraft/network/chat/TranslatableComponent.<init>:(Ljava/lang/String;)V
        //   356: aload_0         /* this */
        //   357: aload_1         /* dty */
        //   358: aload_2         /* dlx */
        //   359: invokedynamic   BootstrapMethod #5, onPress:(Lnet/minecraft/client/gui/screens/worldselection/WorldGenSettingsComponent;Lnet/minecraft/client/gui/screens/worldselection/CreateWorldScreen;Lnet/minecraft/client/Minecraft;)Lnet/minecraft/client/gui/components/Button$OnPress;
        //   364: invokespecial   net/minecraft/client/gui/components/Button.<init>:(IIIILnet/minecraft/network/chat/Component;Lnet/minecraft/client/gui/components/Button$OnPress;)V
        //   367: invokevirtual   net/minecraft/client/gui/screens/worldselection/CreateWorldScreen.addButton:(Lnet/minecraft/client/gui/components/AbstractWidget;)Lnet/minecraft/client/gui/components/AbstractWidget;
        //   370: checkcast       Lnet/minecraft/client/gui/components/Button;
        //   373: putfield        net/minecraft/client/gui/screens/worldselection/WorldGenSettingsComponent.importSettingsButton:Lnet/minecraft/client/gui/components/Button;
        //   376: aload_0         /* this */
        //   377: getfield        net/minecraft/client/gui/screens/worldselection/WorldGenSettingsComponent.importSettingsButton:Lnet/minecraft/client/gui/components/Button;
        //   380: iconst_0       
        //   381: putfield        net/minecraft/client/gui/components/Button.visible:Z
        //   384: return         
        //    MethodParameters:
        //  Name  Flags  
        //  ----  -----
        //  dty   
        //  dlx   
        //  dmt   
        // 
        // The error that occurred was:
        // 
        // java.lang.IllegalStateException: Unsupported node type: com.strobel.decompiler.ast.Lambda
        //     at com.strobel.decompiler.ast.Error.unsupportedNode(Error.java:32)
        //     at com.strobel.decompiler.ast.GotoRemoval.exit(GotoRemoval.java:612)
        //     at com.strobel.decompiler.ast.GotoRemoval.exit(GotoRemoval.java:586)
        //     at com.strobel.decompiler.ast.GotoRemoval.transformLeaveStatements(GotoRemoval.java:625)
        //     at com.strobel.decompiler.ast.GotoRemoval.removeGotosCore(GotoRemoval.java:57)
        //     at com.strobel.decompiler.ast.GotoRemoval.removeGotos(GotoRemoval.java:53)
        //     at com.strobel.decompiler.ast.AstOptimizer.optimize(AstOptimizer.java:276)
        //     at com.strobel.decompiler.ast.AstOptimizer.optimize(AstOptimizer.java:42)
        //     at com.strobel.decompiler.languages.java.ast.AstMethodBodyBuilder.createMethodBody(AstMethodBodyBuilder.java:214)
        //     at com.strobel.decompiler.languages.java.ast.AstMethodBodyBuilder.createMethodBody(AstMethodBodyBuilder.java:99)
        //     at com.strobel.decompiler.languages.java.ast.AstBuilder.createMethodBody(AstBuilder.java:782)
        //     at com.strobel.decompiler.languages.java.ast.AstBuilder.createMethod(AstBuilder.java:675)
        //     at com.strobel.decompiler.languages.java.ast.AstBuilder.addTypeMembers(AstBuilder.java:552)
        //     at com.strobel.decompiler.languages.java.ast.AstBuilder.createTypeCore(AstBuilder.java:519)
        //     at com.strobel.decompiler.languages.java.ast.AstBuilder.createTypeNoCache(AstBuilder.java:161)
        //     at com.strobel.decompiler.languages.java.ast.AstBuilder.createType(AstBuilder.java:150)
        //     at com.strobel.decompiler.languages.java.ast.AstBuilder.addType(AstBuilder.java:125)
        //     at cuchaz.enigma.SourceProvider.getSources(SourceProvider.java:85)
        //     at cuchaz.enigma.EnigmaProject$JarExport.decompileClass(EnigmaProject.java:241)
        //     at cuchaz.enigma.EnigmaProject$JarExport.lambda$decompile$1(EnigmaProject.java:230)
        //     at java.base/java.util.stream.ReferencePipeline$3$1.accept(ReferencePipeline.java:195)
        //     at java.base/java.util.ArrayList$ArrayListSpliterator.forEachRemaining(ArrayList.java:1654)
        //     at java.base/java.util.stream.AbstractPipeline.copyInto(AbstractPipeline.java:484)
        //     at java.base/java.util.stream.AbstractPipeline.wrapAndCopyInto(AbstractPipeline.java:474)
        //     at java.base/java.util.stream.ReduceOps$ReduceTask.doLeaf(ReduceOps.java:952)
        //     at java.base/java.util.stream.ReduceOps$ReduceTask.doLeaf(ReduceOps.java:926)
        //     at java.base/java.util.stream.AbstractTask.compute(AbstractTask.java:327)
        //     at java.base/java.util.concurrent.CountedCompleter.exec(CountedCompleter.java:746)
        //     at java.base/java.util.concurrent.ForkJoinTask.doExec(ForkJoinTask.java:290)
        //     at java.base/java.util.concurrent.ForkJoinPool$WorkQueue.helpCC(ForkJoinPool.java:1115)
        //     at java.base/java.util.concurrent.ForkJoinPool.externalHelpComplete(ForkJoinPool.java:1957)
        //     at java.base/java.util.concurrent.ForkJoinTask.tryExternalHelp(ForkJoinTask.java:378)
        //     at java.base/java.util.concurrent.ForkJoinTask.externalAwaitDone(ForkJoinTask.java:323)
        //     at java.base/java.util.concurrent.ForkJoinTask.doInvoke(ForkJoinTask.java:412)
        //     at java.base/java.util.concurrent.ForkJoinTask.invoke(ForkJoinTask.java:736)
        //     at java.base/java.util.stream.ReduceOps$ReduceOp.evaluateParallel(ReduceOps.java:919)
        //     at java.base/java.util.stream.AbstractPipeline.evaluate(AbstractPipeline.java:233)
        //     at java.base/java.util.stream.ReferencePipeline.collect(ReferencePipeline.java:578)
        //     at cuchaz.enigma.EnigmaProject$JarExport.decompile(EnigmaProject.java:233)
        //     at cuchaz.enigma.command.DecompileCommand.run(DecompileCommand.java:35)
        //     at cuchaz.enigma.CommandMain.main(CommandMain.java:43)
        // 
        throw new IllegalStateException("An error occurred while decompiling this method.");
    }
    
    private void importSettings(final RegistryAccess.RegistryHolder a, final WorldGenSettings cix) {
        this.registryHolder = a;
        this.settings = cix;
        this.preset = WorldPreset.of(cix);
        this.initSeed = Long.toString(cix.seed());
        this.seedEdit.setValue(this.initSeed);
        this.typeButton.active = this.preset.isPresent();
    }
    
    @Override
    public void tick() {
        this.seedEdit.tick();
    }
    
    @Override
    public void render(final PoseStack dhl, final int integer2, final int integer3, final float float4) {
        if (this.featuresButton.visible) {
            this.font.drawShadow(dhl, I18n.get("selectWorld.mapFeatures.info"), (float)(this.width / 2 - 150), 122.0f, -6250336);
        }
        this.seedEdit.render(dhl, integer2, integer3, float4);
        if (this.preset.equals(Optional.<WorldPreset>of(WorldPreset.AMPLIFIED))) {
            this.font.drawWordWrap(WorldGenSettingsComponent.AMPLIFIED_HELP_TEXT, this.typeButton.x + 2, this.typeButton.y + 22, this.typeButton.getWidth(), 10526880);
        }
    }
    
    protected void updateSettings(final WorldGenSettings cix) {
        this.settings = cix;
    }
    
    private static OptionalLong parseLong(final String string) {
        try {
            return OptionalLong.of(Long.parseLong(string));
        }
        catch (NumberFormatException ex) {
            return OptionalLong.empty();
        }
    }
    
    public WorldGenSettings makeSettings(final boolean boolean1) {
        final String string3 = this.seedEdit.getValue();
        OptionalLong optionalLong4;
        if (StringUtils.isEmpty((CharSequence)string3)) {
            optionalLong4 = OptionalLong.empty();
        }
        else {
            final OptionalLong optionalLong5 = parseLong(string3);
            if (optionalLong5.isPresent() && optionalLong5.getAsLong() != 0L) {
                optionalLong4 = optionalLong5;
            }
            else {
                optionalLong4 = OptionalLong.of(string3.hashCode());
            }
        }
        return this.settings.withSeed(boolean1, optionalLong4);
    }
    
    public boolean isDebug() {
        return this.settings.isDebug();
    }
    
    public void setDisplayOptions(final boolean boolean1) {
        this.typeButton.visible = boolean1;
        if (this.settings.isDebug()) {
            this.featuresButton.visible = false;
            this.bonusItemsButton.visible = false;
            this.customizeTypeButton.visible = false;
            this.importSettingsButton.visible = false;
        }
        else {
            this.featuresButton.visible = boolean1;
            this.bonusItemsButton.visible = boolean1;
            this.customizeTypeButton.visible = (boolean1 && WorldPreset.EDITORS.containsKey(this.preset));
            this.importSettingsButton.visible = boolean1;
        }
        this.seedEdit.setVisible(boolean1);
    }
    
    public RegistryAccess.RegistryHolder registryHolder() {
        return this.registryHolder;
    }
    
    static {
        LOGGER = LogManager.getLogger();
        CUSTOM_WORLD_DESCRIPTION = new TranslatableComponent("generator.custom");
        AMPLIFIED_HELP_TEXT = new TranslatableComponent("generator.amplified.info");
    }
}
