From 2a55e35124b5b000215dee2e6374403dfbfcec30 Mon Sep 17 00:00:00 2001 From: Jake Potrebic Date: Tue, 22 Feb 2022 18:44:06 -0800 Subject: [PATCH] Option to have default CustomSpawners in custom worlds (#7493) --- ...efault-CustomSpawners-in-custom-worl.patch | 46 +++++++++++++++++++ 1 file changed, 46 insertions(+) create mode 100644 patches/server/0875-Option-to-have-default-CustomSpawners-in-custom-worl.patch diff --git a/patches/server/0875-Option-to-have-default-CustomSpawners-in-custom-worl.patch b/patches/server/0875-Option-to-have-default-CustomSpawners-in-custom-worl.patch new file mode 100644 index 0000000000..6da8332101 --- /dev/null +++ b/patches/server/0875-Option-to-have-default-CustomSpawners-in-custom-worl.patch @@ -0,0 +1,46 @@ +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/com/destroystokyo/paper/PaperConfig.java b/src/main/java/com/destroystokyo/paper/PaperConfig.java +index 153f07bac06093b43a1f5b0f8e1a46ffbe6407e5..a7ebf6d9f79ce50a90c3c903563e00a10607f9f2 100644 +--- a/src/main/java/com/destroystokyo/paper/PaperConfig.java ++++ b/src/main/java/com/destroystokyo/paper/PaperConfig.java +@@ -679,4 +679,9 @@ public class PaperConfig { + } + globalMaxConcurrentChunkLoads = getDouble("settings.chunk-loading.global-max-concurrent-loads", 500.0); + } ++ ++ public static boolean useDimensionTypeForCustomSpawners; ++ private static void useDimensionTypeForCustomSpawners() { ++ useDimensionTypeForCustomSpawners = getBoolean("settings.use-dimension-type-for-custom-spawners", false); ++ } + } +diff --git a/src/main/java/net/minecraft/server/MinecraftServer.java b/src/main/java/net/minecraft/server/MinecraftServer.java +index 053dbe5eef6574cfe98ab7499181bdd83a81f2e1..6d1d83bc17403346cc9d3143666b927ef55fb9df 100644 +--- a/src/main/java/net/minecraft/server/MinecraftServer.java ++++ b/src/main/java/net/minecraft/server/MinecraftServer.java +@@ -689,7 +689,15 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop spawners; ++ if (com.destroystokyo.paper.PaperConfig.useDimensionTypeForCustomSpawners && this.registryHolder.registryOrThrow(Registry.DIMENSION_TYPE_REGISTRY).getResourceKey(dimensionmanager).orElseThrow() == DimensionType.OVERWORLD_LOCATION) { ++ spawners = list; ++ } else { ++ spawners = Collections.emptyList(); ++ } ++ world = new ServerLevel(this, this.executor, worldSession, iworlddataserver, worldKey, dimensionmanager, worldloadlistener, chunkgenerator, flag, j, spawners, true, org.bukkit.World.Environment.getEnvironment(dimension), gen, biomeProvider); ++ // Paper end + } + + worlddata.setModdedInfo(this.getServerModName(), this.getModdedStatus().shouldReportAsModified());