diff --git a/paper-server/nms-patches/net/minecraft/world/level/levelgen/GeneratorSettings.patch b/paper-server/nms-patches/net/minecraft/world/level/levelgen/GeneratorSettings.patch new file mode 100644 index 0000000000..133f30c49a --- /dev/null +++ b/paper-server/nms-patches/net/minecraft/world/level/levelgen/GeneratorSettings.patch @@ -0,0 +1,62 @@ +--- a/net/minecraft/world/level/levelgen/GeneratorSettings.java ++++ b/net/minecraft/world/level/levelgen/GeneratorSettings.java +@@ -22,6 +22,7 @@ + import net.minecraft.core.IRegistryWritable; + import net.minecraft.core.RegistryCodecs; + import net.minecraft.core.RegistryMaterials; ++import net.minecraft.resources.RegistryOps; + import net.minecraft.resources.ResourceKey; + import net.minecraft.server.dedicated.DedicatedServerProperties; + import net.minecraft.world.level.World; +@@ -38,7 +39,7 @@ + + public class GeneratorSettings { + +- public static final Codec CODEC = RecordCodecBuilder.create((instance) -> { ++ public static final Codec CODEC = RecordCodecBuilder.create((instance) -> { // CraftBukkit - decompile error + return instance.group(Codec.LONG.fieldOf("seed").stable().forGetter(GeneratorSettings::seed), Codec.BOOL.fieldOf("generate_features").orElse(true).stable().forGetter(GeneratorSettings::generateFeatures), Codec.BOOL.fieldOf("bonus_chest").orElse(false).stable().forGetter(GeneratorSettings::generateBonusChest), RegistryCodecs.dataPackAwareCodec(IRegistry.LEVEL_STEM_REGISTRY, Lifecycle.stable(), WorldDimension.CODEC).xmap(WorldDimension::sortMap, Function.identity()).fieldOf("dimensions").forGetter(GeneratorSettings::dimensions), Codec.STRING.optionalFieldOf("legacy_custom_options").stable().forGetter((generatorsettings) -> { + return generatorsettings.legacyCustomOptions; + })).apply(instance, instance.stable(GeneratorSettings::new)); +@@ -132,7 +133,7 @@ + public static IRegistry withOverworld(IRegistry iregistry, Holder holder, ChunkGenerator chunkgenerator) { + IRegistryWritable iregistrywritable = new RegistryMaterials<>(IRegistry.LEVEL_STEM_REGISTRY, Lifecycle.experimental(), (Function) null); + +- iregistrywritable.register(WorldDimension.OVERWORLD, (Object) (new WorldDimension(holder, chunkgenerator)), Lifecycle.stable()); ++ iregistrywritable.register(WorldDimension.OVERWORLD, new WorldDimension(holder, chunkgenerator), Lifecycle.stable()); // CraftBukkit - decompile error + Iterator iterator = iregistry.entrySet().iterator(); + + while (iterator.hasNext()) { +@@ -140,7 +141,7 @@ + ResourceKey resourcekey = (ResourceKey) entry.getKey(); + + if (resourcekey != WorldDimension.OVERWORLD) { +- iregistrywritable.register(resourcekey, (Object) ((WorldDimension) entry.getValue()), iregistry.lifecycle((WorldDimension) entry.getValue())); ++ iregistrywritable.register(resourcekey, entry.getValue(), iregistry.lifecycle(entry.getValue())); // CraftBukkit - decompile error + } + } + +@@ -230,13 +231,13 @@ + + switch (b0) { + case 0: +- Dynamic dynamic = new Dynamic(JsonOps.INSTANCE, dedicatedserverproperties_a.generatorSettings()); ++ Dynamic dynamic = new Dynamic(RegistryOps.create(JsonOps.INSTANCE, iregistrycustom), dedicatedserverproperties_a.generatorSettings()); // CraftBukkit - Incorrect Ops + boolean flag = dedicatedserverproperties_a.generateStructures(); + DataResult dataresult = GeneratorSettingsFlat.CODEC.parse(dynamic); + Logger logger = GeneratorSettings.LOGGER; + + Objects.requireNonNull(logger); +- return new GeneratorSettings(i, flag, false, withOverworld(iregistry, iregistry3, new ChunkProviderFlat(iregistry2, (GeneratorSettingsFlat) dataresult.resultOrPartial(logger::error).orElseGet(() -> { ++ return new GeneratorSettings(i, flag, false, withOverworld(iregistry, iregistry3, new ChunkProviderFlat(iregistry2, (GeneratorSettingsFlat) dataresult.resultOrPartial(s1 -> logger.error(String.valueOf(s1))).orElseGet(() -> { // CraftBukkit - decompile error + return GeneratorSettingsFlat.getDefault(iregistry1, iregistry2); + })))); + case 1: +@@ -263,7 +264,7 @@ + Entry, WorldDimension> entry = (Entry) iterator.next(); + ResourceKey resourcekey = (ResourceKey) entry.getKey(); + +- iregistrywritable.register(resourcekey, (Object) (new WorldDimension(((WorldDimension) entry.getValue()).typeHolder(), ((WorldDimension) entry.getValue()).generator().withSeed(j))), this.dimensions.lifecycle((WorldDimension) entry.getValue())); ++ iregistrywritable.register(resourcekey, new WorldDimension(entry.getValue().typeHolder(), entry.getValue().generator().withSeed(j)), this.dimensions.lifecycle(entry.getValue())); // CraftBukkit - decompile error + } + + object = iregistrywritable;