package net.minecraft.world.level.storage;

import java.util.AbstractList;
import net.minecraft.CrashReportCategory;
import net.minecraft.core.BlockPos;
import net.minecraft.nbt.NbtUtils;
import net.minecraft.util.datafix.DataFixTypes;
import com.google.common.hash.Hashing;
import net.minecraft.Util;
import net.minecraft.nbt.Tag;
import java.util.function.Consumer;
import java.util.function.Function;
import net.minecraft.nbt.StringTag;
import com.mojang.datafixers.types.DynamicOps;
import com.mojang.datafixers.Dynamic;
import net.minecraft.nbt.NbtOps;
import com.mojang.datafixers.types.JsonOps;
import net.minecraft.world.level.LevelSettings;
import java.util.Iterator;
import net.minecraft.nbt.ListTag;
import net.minecraft.SharedConstants;
import net.minecraft.world.level.timers.TimerCallbacks;
import com.google.common.collect.Maps;
import com.google.common.collect.Sets;
import net.minecraft.server.MinecraftServer;
import net.minecraft.world.level.timers.TimerQueue;
import net.minecraft.world.level.GameRules;
import java.util.UUID;
import net.minecraft.world.level.dimension.DimensionType;
import java.util.Map;
import java.util.Set;
import net.minecraft.world.level.GameType;
import com.mojang.datafixers.DataFixer;
import javax.annotation.Nullable;
import net.minecraft.nbt.CompoundTag;
import net.minecraft.world.level.LevelType;
import net.minecraft.world.Difficulty;

public class LevelData {
    private String minecraftVersionName;
    private int minecraftVersion;
    private boolean snapshot;
    public static final Difficulty DEFAULT_DIFFICULTY;
    private long seed;
    private LevelType generator;
    private CompoundTag generatorOptions;
    @Nullable
    private String legacyCustomOptions;
    private int xSpawn;
    private int ySpawn;
    private int zSpawn;
    private long gameTime;
    private long dayTime;
    private long lastPlayed;
    private long sizeOnDisk;
    @Nullable
    private final DataFixer fixerUpper;
    private final int playerDataVersion;
    private boolean upgradedPlayerTag;
    private CompoundTag loadedPlayerTag;
    private String levelName;
    private int version;
    private int clearWeatherTime;
    private boolean raining;
    private int rainTime;
    private boolean thundering;
    private int thunderTime;
    private GameType gameType;
    private boolean generateMapFeatures;
    private boolean hardcore;
    private boolean allowCommands;
    private boolean initialized;
    private Difficulty difficulty;
    private boolean difficultyLocked;
    private double borderX;
    private double borderZ;
    private double borderSize;
    private long borderSizeLerpTime;
    private double borderSizeLerpTarget;
    private double borderSafeZone;
    private double borderDamagePerBlock;
    private int borderWarningBlocks;
    private int borderWarningTime;
    private final Set<String> disabledDataPacks;
    private final Set<String> enabledDataPacks;
    private final Map<DimensionType, CompoundTag> dimensionData;
    private CompoundTag customBossEvents;
    private int wanderingTraderSpawnDelay;
    private int wanderingTraderSpawnChance;
    private UUID wanderingTraderId;
    private Set<String> knownServerBrands;
    private boolean wasModded;
    private final GameRules gameRules;
    private final TimerQueue<MinecraftServer> scheduledEvents;
    
    protected LevelData() {
        this.generator = LevelType.NORMAL;
        this.generatorOptions = new CompoundTag();
        this.borderSize = 6.0E7;
        this.borderSafeZone = 5.0;
        this.borderDamagePerBlock = 0.2;
        this.borderWarningBlocks = 5;
        this.borderWarningTime = 15;
        this.disabledDataPacks = Sets.newHashSet();
        this.enabledDataPacks = Sets.newLinkedHashSet();
        this.dimensionData = Maps.newIdentityHashMap();
        this.knownServerBrands = Sets.newLinkedHashSet();
        this.gameRules = new GameRules();
        this.scheduledEvents = new TimerQueue<MinecraftServer>(TimerCallbacks.SERVER_CALLBACKS);
        this.fixerUpper = null;
        this.playerDataVersion = SharedConstants.getCurrentVersion().getWorldVersion();
        this.setGeneratorOptions(new CompoundTag());
    }
    
    public LevelData(final CompoundTag jt1, final DataFixer dataFixer, final int integer, @Nullable final CompoundTag jt4) {
        this.generator = LevelType.NORMAL;
        this.generatorOptions = new CompoundTag();
        this.borderSize = 6.0E7;
        this.borderSafeZone = 5.0;
        this.borderDamagePerBlock = 0.2;
        this.borderWarningBlocks = 5;
        this.borderWarningTime = 15;
        this.disabledDataPacks = Sets.newHashSet();
        this.enabledDataPacks = Sets.newLinkedHashSet();
        this.dimensionData = Maps.newIdentityHashMap();
        this.knownServerBrands = Sets.newLinkedHashSet();
        this.gameRules = new GameRules();
        this.scheduledEvents = new TimerQueue<MinecraftServer>(TimerCallbacks.SERVER_CALLBACKS);
        this.fixerUpper = dataFixer;
        final ListTag jz6 = jt1.getList("ServerBrands", 8);
        for (int integer2 = 0; integer2 < jz6.size(); ++integer2) {
            this.knownServerBrands.add(jz6.getString(integer2));
        }
        this.wasModded = jt1.getBoolean("WasModded");
        if (jt1.contains("Version", 10)) {
            final CompoundTag jt5 = jt1.getCompound("Version");
            this.minecraftVersionName = jt5.getString("Name");
            this.minecraftVersion = jt5.getInt("Id");
            this.snapshot = jt5.getBoolean("Snapshot");
        }
        this.seed = jt1.getLong("RandomSeed");
        if (jt1.contains("generatorName", 8)) {
            final String string7 = jt1.getString("generatorName");
            this.generator = LevelType.getLevelType(string7);
            if (this.generator == null) {
                this.generator = LevelType.NORMAL;
            }
            else if (this.generator == LevelType.CUSTOMIZED) {
                this.legacyCustomOptions = jt1.getString("generatorOptions");
            }
            else if (this.generator.hasReplacement()) {
                int integer3 = 0;
                if (jt1.contains("generatorVersion", 99)) {
                    integer3 = jt1.getInt("generatorVersion");
                }
                this.generator = this.generator.getReplacementForVersion(integer3);
            }
            this.setGeneratorOptions(jt1.getCompound("generatorOptions"));
        }
        this.gameType = GameType.byId(jt1.getInt("GameType"));
        if (jt1.contains("legacy_custom_options", 8)) {
            this.legacyCustomOptions = jt1.getString("legacy_custom_options");
        }
        if (jt1.contains("MapFeatures", 99)) {
            this.generateMapFeatures = jt1.getBoolean("MapFeatures");
        }
        else {
            this.generateMapFeatures = true;
        }
        this.xSpawn = jt1.getInt("SpawnX");
        this.ySpawn = jt1.getInt("SpawnY");
        this.zSpawn = jt1.getInt("SpawnZ");
        this.gameTime = jt1.getLong("Time");
        if (jt1.contains("DayTime", 99)) {
            this.dayTime = jt1.getLong("DayTime");
        }
        else {
            this.dayTime = this.gameTime;
        }
        this.lastPlayed = jt1.getLong("LastPlayed");
        this.sizeOnDisk = jt1.getLong("SizeOnDisk");
        this.levelName = jt1.getString("LevelName");
        this.version = jt1.getInt("version");
        this.clearWeatherTime = jt1.getInt("clearWeatherTime");
        this.rainTime = jt1.getInt("rainTime");
        this.raining = jt1.getBoolean("raining");
        this.thunderTime = jt1.getInt("thunderTime");
        this.thundering = jt1.getBoolean("thundering");
        this.hardcore = jt1.getBoolean("hardcore");
        if (jt1.contains("initialized", 99)) {
            this.initialized = jt1.getBoolean("initialized");
        }
        else {
            this.initialized = true;
        }
        if (jt1.contains("allowCommands", 99)) {
            this.allowCommands = jt1.getBoolean("allowCommands");
        }
        else {
            this.allowCommands = (this.gameType == GameType.CREATIVE);
        }
        this.playerDataVersion = integer;
        if (jt4 != null) {
            this.loadedPlayerTag = jt4;
        }
        if (jt1.contains("GameRules", 10)) {
            this.gameRules.loadFromTag(jt1.getCompound("GameRules"));
        }
        if (jt1.contains("Difficulty", 99)) {
            this.difficulty = Difficulty.byId(jt1.getByte("Difficulty"));
        }
        if (jt1.contains("DifficultyLocked", 1)) {
            this.difficultyLocked = jt1.getBoolean("DifficultyLocked");
        }
        if (jt1.contains("BorderCenterX", 99)) {
            this.borderX = jt1.getDouble("BorderCenterX");
        }
        if (jt1.contains("BorderCenterZ", 99)) {
            this.borderZ = jt1.getDouble("BorderCenterZ");
        }
        if (jt1.contains("BorderSize", 99)) {
            this.borderSize = jt1.getDouble("BorderSize");
        }
        if (jt1.contains("BorderSizeLerpTime", 99)) {
            this.borderSizeLerpTime = jt1.getLong("BorderSizeLerpTime");
        }
        if (jt1.contains("BorderSizeLerpTarget", 99)) {
            this.borderSizeLerpTarget = jt1.getDouble("BorderSizeLerpTarget");
        }
        if (jt1.contains("BorderSafeZone", 99)) {
            this.borderSafeZone = jt1.getDouble("BorderSafeZone");
        }
        if (jt1.contains("BorderDamagePerBlock", 99)) {
            this.borderDamagePerBlock = jt1.getDouble("BorderDamagePerBlock");
        }
        if (jt1.contains("BorderWarningBlocks", 99)) {
            this.borderWarningBlocks = jt1.getInt("BorderWarningBlocks");
        }
        if (jt1.contains("BorderWarningTime", 99)) {
            this.borderWarningTime = jt1.getInt("BorderWarningTime");
        }
        if (jt1.contains("DimensionData", 10)) {
            final CompoundTag jt5 = jt1.getCompound("DimensionData");
            for (final String string8 : jt5.getAllKeys()) {
                this.dimensionData.put(DimensionType.getById(Integer.parseInt(string8)), jt5.getCompound(string8));
            }
        }
        if (jt1.contains("DataPacks", 10)) {
            final CompoundTag jt5 = jt1.getCompound("DataPacks");
            final ListTag jz7 = jt5.getList("Disabled", 8);
            for (int integer4 = 0; integer4 < jz7.size(); ++integer4) {
                this.disabledDataPacks.add(jz7.getString(integer4));
            }
            final ListTag jz8 = jt5.getList("Enabled", 8);
            for (int integer5 = 0; integer5 < jz8.size(); ++integer5) {
                this.enabledDataPacks.add(jz8.getString(integer5));
            }
        }
        if (jt1.contains("CustomBossEvents", 10)) {
            this.customBossEvents = jt1.getCompound("CustomBossEvents");
        }
        if (jt1.contains("ScheduledEvents", 9)) {
            this.scheduledEvents.load(jt1.getList("ScheduledEvents", 10));
        }
        if (jt1.contains("WanderingTraderSpawnDelay", 99)) {
            this.wanderingTraderSpawnDelay = jt1.getInt("WanderingTraderSpawnDelay");
        }
        if (jt1.contains("WanderingTraderSpawnChance", 99)) {
            this.wanderingTraderSpawnChance = jt1.getInt("WanderingTraderSpawnChance");
        }
        if (jt1.contains("WanderingTraderId", 8)) {
            this.wanderingTraderId = UUID.fromString(jt1.getString("WanderingTraderId"));
        }
    }
    
    public LevelData(final LevelSettings bka, final String string) {
        this.generator = LevelType.NORMAL;
        this.generatorOptions = new CompoundTag();
        this.borderSize = 6.0E7;
        this.borderSafeZone = 5.0;
        this.borderDamagePerBlock = 0.2;
        this.borderWarningBlocks = 5;
        this.borderWarningTime = 15;
        this.disabledDataPacks = Sets.newHashSet();
        this.enabledDataPacks = Sets.newLinkedHashSet();
        this.dimensionData = Maps.newIdentityHashMap();
        this.knownServerBrands = Sets.newLinkedHashSet();
        this.gameRules = new GameRules();
        this.scheduledEvents = new TimerQueue<MinecraftServer>(TimerCallbacks.SERVER_CALLBACKS);
        this.fixerUpper = null;
        this.playerDataVersion = SharedConstants.getCurrentVersion().getWorldVersion();
        this.setLevelSettings(bka);
        this.levelName = string;
        this.difficulty = LevelData.DEFAULT_DIFFICULTY;
        this.initialized = false;
    }
    
    public void setLevelSettings(final LevelSettings bka) {
        this.seed = bka.getSeed();
        this.gameType = bka.getGameType();
        this.generateMapFeatures = bka.isGenerateMapFeatures();
        this.hardcore = bka.isHardcore();
        this.generator = bka.getLevelType();
        this.setGeneratorOptions((CompoundTag)Dynamic.convert((DynamicOps)JsonOps.INSTANCE, (DynamicOps)NbtOps.INSTANCE, bka.getLevelTypeOptions()));
        this.allowCommands = bka.getAllowCommands();
    }
    
    public CompoundTag createTag(@Nullable CompoundTag jt) {
        this.updatePlayerTag();
        if (jt == null) {
            jt = this.loadedPlayerTag;
        }
        final CompoundTag jt2 = new CompoundTag();
        this.setTagData(jt2, jt);
        return jt2;
    }
    
    private void setTagData(final CompoundTag jt1, final CompoundTag jt2) {
        final ListTag jz4 = new ListTag();
        this.knownServerBrands.stream().map(StringTag::valueOf).forEach(jz4::add);
        jt1.put("ServerBrands", jz4);
        jt1.putBoolean("WasModded", this.wasModded);
        final CompoundTag jt3 = new CompoundTag();
        jt3.putString("Name", SharedConstants.getCurrentVersion().getName());
        jt3.putInt("Id", SharedConstants.getCurrentVersion().getWorldVersion());
        jt3.putBoolean("Snapshot", !SharedConstants.getCurrentVersion().isStable());
        jt1.put("Version", jt3);
        jt1.putInt("DataVersion", SharedConstants.getCurrentVersion().getWorldVersion());
        jt1.putLong("RandomSeed", this.seed);
        jt1.putString("generatorName", this.generator.getSerialization());
        jt1.putInt("generatorVersion", this.generator.getVersion());
        if (!this.generatorOptions.isEmpty()) {
            jt1.put("generatorOptions", this.generatorOptions);
        }
        if (this.legacyCustomOptions != null) {
            jt1.putString("legacy_custom_options", this.legacyCustomOptions);
        }
        jt1.putInt("GameType", this.gameType.getId());
        jt1.putBoolean("MapFeatures", this.generateMapFeatures);
        jt1.putInt("SpawnX", this.xSpawn);
        jt1.putInt("SpawnY", this.ySpawn);
        jt1.putInt("SpawnZ", this.zSpawn);
        jt1.putLong("Time", this.gameTime);
        jt1.putLong("DayTime", this.dayTime);
        jt1.putLong("SizeOnDisk", this.sizeOnDisk);
        jt1.putLong("LastPlayed", Util.getEpochMillis());
        jt1.putString("LevelName", this.levelName);
        jt1.putInt("version", this.version);
        jt1.putInt("clearWeatherTime", this.clearWeatherTime);
        jt1.putInt("rainTime", this.rainTime);
        jt1.putBoolean("raining", this.raining);
        jt1.putInt("thunderTime", this.thunderTime);
        jt1.putBoolean("thundering", this.thundering);
        jt1.putBoolean("hardcore", this.hardcore);
        jt1.putBoolean("allowCommands", this.allowCommands);
        jt1.putBoolean("initialized", this.initialized);
        jt1.putDouble("BorderCenterX", this.borderX);
        jt1.putDouble("BorderCenterZ", this.borderZ);
        jt1.putDouble("BorderSize", this.borderSize);
        jt1.putLong("BorderSizeLerpTime", this.borderSizeLerpTime);
        jt1.putDouble("BorderSafeZone", this.borderSafeZone);
        jt1.putDouble("BorderDamagePerBlock", this.borderDamagePerBlock);
        jt1.putDouble("BorderSizeLerpTarget", this.borderSizeLerpTarget);
        jt1.putDouble("BorderWarningBlocks", this.borderWarningBlocks);
        jt1.putDouble("BorderWarningTime", this.borderWarningTime);
        if (this.difficulty != null) {
            jt1.putByte("Difficulty", (byte)this.difficulty.getId());
        }
        jt1.putBoolean("DifficultyLocked", this.difficultyLocked);
        jt1.put("GameRules", this.gameRules.createTag());
        final CompoundTag jt4 = new CompoundTag();
        for (final Map.Entry<DimensionType, CompoundTag> entry8 : this.dimensionData.entrySet()) {
            jt4.put(String.valueOf(entry8.getKey().getId()), entry8.getValue());
        }
        jt1.put("DimensionData", jt4);
        if (jt2 != null) {
            jt1.put("Player", jt2);
        }
        final CompoundTag jt5 = new CompoundTag();
        final ListTag jz5 = new ListTag();
        for (final String string10 : this.enabledDataPacks) {
            ((AbstractList<StringTag>)jz5).add(StringTag.valueOf(string10));
        }
        jt5.put("Enabled", jz5);
        final ListTag jz6 = new ListTag();
        for (final String string11 : this.disabledDataPacks) {
            ((AbstractList<StringTag>)jz6).add(StringTag.valueOf(string11));
        }
        jt5.put("Disabled", jz6);
        jt1.put("DataPacks", jt5);
        if (this.customBossEvents != null) {
            jt1.put("CustomBossEvents", this.customBossEvents);
        }
        jt1.put("ScheduledEvents", this.scheduledEvents.store());
        jt1.putInt("WanderingTraderSpawnDelay", this.wanderingTraderSpawnDelay);
        jt1.putInt("WanderingTraderSpawnChance", this.wanderingTraderSpawnChance);
        if (this.wanderingTraderId != null) {
            jt1.putString("WanderingTraderId", this.wanderingTraderId.toString());
        }
    }
    
    public long getSeed() {
        return this.seed;
    }
    
    public static long obfuscateSeed(final long long1) {
        return Hashing.sha256().hashLong(long1).asLong();
    }
    
    public int getXSpawn() {
        return this.xSpawn;
    }
    
    public int getYSpawn() {
        return this.ySpawn;
    }
    
    public int getZSpawn() {
        return this.zSpawn;
    }
    
    public long getGameTime() {
        return this.gameTime;
    }
    
    public long getDayTime() {
        return this.dayTime;
    }
    
    private void updatePlayerTag() {
        if (this.upgradedPlayerTag || this.loadedPlayerTag == null) {
            return;
        }
        if (this.playerDataVersion < SharedConstants.getCurrentVersion().getWorldVersion()) {
            if (this.fixerUpper == null) {
                throw Util.<NullPointerException>pauseInIde(new NullPointerException("Fixer Upper not set inside LevelData, and the player tag is not upgraded."));
            }
            this.loadedPlayerTag = NbtUtils.update(this.fixerUpper, DataFixTypes.PLAYER, this.loadedPlayerTag, this.playerDataVersion);
        }
        this.upgradedPlayerTag = true;
    }
    
    public CompoundTag getLoadedPlayerTag() {
        this.updatePlayerTag();
        return this.loadedPlayerTag;
    }
    
    public void setXSpawn(final int integer) {
        this.xSpawn = integer;
    }
    
    public void setYSpawn(final int integer) {
        this.ySpawn = integer;
    }
    
    public void setZSpawn(final int integer) {
        this.zSpawn = integer;
    }
    
    public void setGameTime(final long long1) {
        this.gameTime = long1;
    }
    
    public void setDayTime(final long long1) {
        this.dayTime = long1;
    }
    
    public void setSpawn(final BlockPos fk) {
        this.xSpawn = fk.getX();
        this.ySpawn = fk.getY();
        this.zSpawn = fk.getZ();
    }
    
    public String getLevelName() {
        return this.levelName;
    }
    
    public void setLevelName(final String string) {
        this.levelName = string;
    }
    
    public int getVersion() {
        return this.version;
    }
    
    public void setVersion(final int integer) {
        this.version = integer;
    }
    
    public long getLastPlayed() {
        return this.lastPlayed;
    }
    
    public int getClearWeatherTime() {
        return this.clearWeatherTime;
    }
    
    public void setClearWeatherTime(final int integer) {
        this.clearWeatherTime = integer;
    }
    
    public boolean isThundering() {
        return this.thundering;
    }
    
    public void setThundering(final boolean boolean1) {
        this.thundering = boolean1;
    }
    
    public int getThunderTime() {
        return this.thunderTime;
    }
    
    public void setThunderTime(final int integer) {
        this.thunderTime = integer;
    }
    
    public boolean isRaining() {
        return this.raining;
    }
    
    public void setRaining(final boolean boolean1) {
        this.raining = boolean1;
    }
    
    public int getRainTime() {
        return this.rainTime;
    }
    
    public void setRainTime(final int integer) {
        this.rainTime = integer;
    }
    
    public GameType getGameType() {
        return this.gameType;
    }
    
    public boolean isGenerateMapFeatures() {
        return this.generateMapFeatures;
    }
    
    public void setGenerateMapFeatures(final boolean boolean1) {
        this.generateMapFeatures = boolean1;
    }
    
    public void setGameType(final GameType bjt) {
        this.gameType = bjt;
    }
    
    public boolean isHardcore() {
        return this.hardcore;
    }
    
    public void setHardcore(final boolean boolean1) {
        this.hardcore = boolean1;
    }
    
    public LevelType getGeneratorType() {
        return this.generator;
    }
    
    public void setGenerator(final LevelType bkd) {
        this.generator = bkd;
    }
    
    public CompoundTag getGeneratorOptions() {
        return this.generatorOptions;
    }
    
    public void setGeneratorOptions(final CompoundTag jt) {
        this.generatorOptions = jt;
    }
    
    public boolean getAllowCommands() {
        return this.allowCommands;
    }
    
    public void setAllowCommands(final boolean boolean1) {
        this.allowCommands = boolean1;
    }
    
    public boolean isInitialized() {
        return this.initialized;
    }
    
    public void setInitialized(final boolean boolean1) {
        this.initialized = boolean1;
    }
    
    public GameRules getGameRules() {
        return this.gameRules;
    }
    
    public double getBorderX() {
        return this.borderX;
    }
    
    public double getBorderZ() {
        return this.borderZ;
    }
    
    public double getBorderSize() {
        return this.borderSize;
    }
    
    public void setBorderSize(final double double1) {
        this.borderSize = double1;
    }
    
    public long getBorderSizeLerpTime() {
        return this.borderSizeLerpTime;
    }
    
    public void setBorderSizeLerpTime(final long long1) {
        this.borderSizeLerpTime = long1;
    }
    
    public double getBorderSizeLerpTarget() {
        return this.borderSizeLerpTarget;
    }
    
    public void setBorderSizeLerpTarget(final double double1) {
        this.borderSizeLerpTarget = double1;
    }
    
    public void setBorderZ(final double double1) {
        this.borderZ = double1;
    }
    
    public void setBorderX(final double double1) {
        this.borderX = double1;
    }
    
    public double getBorderSafeZone() {
        return this.borderSafeZone;
    }
    
    public void setBorderSafeZone(final double double1) {
        this.borderSafeZone = double1;
    }
    
    public double getBorderDamagePerBlock() {
        return this.borderDamagePerBlock;
    }
    
    public void setBorderDamagePerBlock(final double double1) {
        this.borderDamagePerBlock = double1;
    }
    
    public int getBorderWarningBlocks() {
        return this.borderWarningBlocks;
    }
    
    public int getBorderWarningTime() {
        return this.borderWarningTime;
    }
    
    public void setBorderWarningBlocks(final int integer) {
        this.borderWarningBlocks = integer;
    }
    
    public void setBorderWarningTime(final int integer) {
        this.borderWarningTime = integer;
    }
    
    public Difficulty getDifficulty() {
        return this.difficulty;
    }
    
    public void setDifficulty(final Difficulty aji) {
        this.difficulty = aji;
    }
    
    public boolean isDifficultyLocked() {
        return this.difficultyLocked;
    }
    
    public void setDifficultyLocked(final boolean boolean1) {
        this.difficultyLocked = boolean1;
    }
    
    public TimerQueue<MinecraftServer> getScheduledEvents() {
        return this.scheduledEvents;
    }
    
    public void fillCrashReportCategory(final CrashReportCategory i) {
        i.setDetail("Level name", () -> this.levelName);
        i.setDetail("Level seed", () -> String.valueOf(this.seed));
        i.setDetail("Level generator", () -> String.format("ID %02d - %s, ver %d. Features enabled: %b", this.generator.getId(), this.generator.getName(), this.generator.getVersion(), this.generateMapFeatures));
        i.setDetail("Level generator options", () -> this.generatorOptions.toString());
        i.setDetail("Level spawn location", () -> CrashReportCategory.formatLocation(this.xSpawn, this.ySpawn, this.zSpawn));
        i.setDetail("Level time", () -> String.format("%d game time, %d day time", this.gameTime, this.dayTime));
        i.setDetail("Known server brands", () -> String.join(", ", this.knownServerBrands));
        i.setDetail("Level was modded", () -> Boolean.toString(this.wasModded));
        String string2;
        i.setDetail("Level storage version", () -> {
            string2 = "Unknown?";
            try {
                switch (this.version) {
                    case 19133: {
                        string2 = "Anvil";
                        break;
                    }
                    case 19132: {
                        string2 = "McRegion";
                        break;
                    }
                }
            }
            catch (Throwable t) {}
            return String.format("0x%05X - %s", this.version, string2);
        });
        i.setDetail("Level weather", () -> String.format("Rain time: %d (now: %b), thunder time: %d (now: %b)", this.rainTime, this.raining, this.thunderTime, this.thundering));
        i.setDetail("Level game mode", () -> String.format("Game mode: %s (ID %d). Hardcore: %b. Cheats: %b", this.gameType.getName(), this.gameType.getId(), this.hardcore, this.allowCommands));
    }
    
    public CompoundTag getDimensionData(final DimensionType cbi) {
        final CompoundTag jt3 = this.dimensionData.get(cbi);
        if (jt3 == null) {
            return new CompoundTag();
        }
        return jt3;
    }
    
    public void setDimensionData(final DimensionType cbi, final CompoundTag jt) {
        this.dimensionData.put(cbi, jt);
    }
    
    public int getMinecraftVersion() {
        return this.minecraftVersion;
    }
    
    public boolean isSnapshot() {
        return this.snapshot;
    }
    
    public String getMinecraftVersionName() {
        return this.minecraftVersionName;
    }
    
    public Set<String> getDisabledDataPacks() {
        return this.disabledDataPacks;
    }
    
    public Set<String> getEnabledDataPacks() {
        return this.enabledDataPacks;
    }
    
    @Nullable
    public CompoundTag getCustomBossEvents() {
        return this.customBossEvents;
    }
    
    public void setCustomBossEvents(@Nullable final CompoundTag jt) {
        this.customBossEvents = jt;
    }
    
    public int getWanderingTraderSpawnDelay() {
        return this.wanderingTraderSpawnDelay;
    }
    
    public void setWanderingTraderSpawnDelay(final int integer) {
        this.wanderingTraderSpawnDelay = integer;
    }
    
    public int getWanderingTraderSpawnChance() {
        return this.wanderingTraderSpawnChance;
    }
    
    public void setWanderingTraderSpawnChance(final int integer) {
        this.wanderingTraderSpawnChance = integer;
    }
    
    public void setWanderingTraderId(final UUID uUID) {
        this.wanderingTraderId = uUID;
    }
    
    public void setModdedInfo(final String string, final boolean boolean2) {
        this.knownServerBrands.add(string);
        this.wasModded |= boolean2;
    }
    
    static {
        DEFAULT_DIFFICULTY = Difficulty.NORMAL;
    }
}
