From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 From: Jake Potrebic Date: Sat, 19 Feb 2022 20:15:41 -0800 Subject: [PATCH] Option to have default CustomSpawners in custom worlds By default, only LevelStem's that specifically match the ResourceKey for OVERWORLD will have the 5 (currently) impls of CustomSpawner (for phantoms, wandering traders, etc.). This adds an option to instead of just looking at the LevelStem key, look at the DimensionType key which is one level below that. Defaults to off to keep vanilla behavior. diff --git a/src/main/java/net/minecraft/server/MinecraftServer.java b/src/main/java/net/minecraft/server/MinecraftServer.java index 9c215a77ca24ab2c75709c867c1d92ad7c97f1ea..38e41238cb8629fb511f7d4ba35665c1c41c3c5d 100644 --- a/src/main/java/net/minecraft/server/MinecraftServer.java +++ b/src/main/java/net/minecraft/server/MinecraftServer.java @@ -586,7 +586,15 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop spawners; + if (io.papermc.paper.configuration.GlobalConfiguration.get().misc.useDimensionTypeForCustomSpawners && this.registryHolder.registryOrThrow(Registry.DIMENSION_TYPE_REGISTRY).getResourceKey(worlddimension.typeHolder().value()).orElseThrow() == net.minecraft.world.level.dimension.BuiltinDimensionTypes.OVERWORLD) { + spawners = list; + } else { + spawners = Collections.emptyList(); + } + world = new ServerLevel(this, this.executor, worldSession, iworlddataserver, worldKey, worlddimension, worldloadlistener, flag, j, spawners, true, org.bukkit.World.Environment.getEnvironment(dimension), gen, biomeProvider); + // Paper end } worlddata.setModdedInfo(this.getServerModName(), this.getModdedStatus().shouldReportAsModified());