2022-02-23 03:44:06 +01:00
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: Jake Potrebic <jake.m.potrebic@gmail.com>
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
2024-04-24 20:03:59 +02:00
index 6036939ff03516a16aecf67ec9cf2260531ad83b..644f178438863295754c2b72339ce7f9066674b9 100644
2022-02-23 03:44:06 +01:00
--- a/src/main/java/net/minecraft/server/MinecraftServer.java
+++ b/src/main/java/net/minecraft/server/MinecraftServer.java
2024-04-24 20:03:59 +02:00
@@ -628,7 +628,15 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa
2022-02-23 03:44:06 +01:00
this.commandStorage = new CommandStorage(worldpersistentdata);
} else {
2024-04-24 20:03:59 +02:00
ChunkProgressListener worldloadlistener = this.progressListenerFactory.create(this.worldData.getGameRules().getInt(GameRules.RULE_SPAWN_CHUNK_RADIUS));
2023-06-08 10:08:08 +02:00
- world = new ServerLevel(this, this.executor, worldSession, iworlddataserver, worldKey, worlddimension, worldloadlistener, flag, j, ImmutableList.of(), true, this.overworld().getRandomSequences(), org.bukkit.World.Environment.getEnvironment(dimension), gen, biomeProvider);
2022-02-23 03:44:06 +01:00
+ // Paper start - option to use the dimension_type to check if spawners should be added. I imagine mojang will add some datapack-y way of managing this in the future.
+ final List<CustomSpawner> spawners;
2022-12-08 00:49:41 +01:00
+ if (io.papermc.paper.configuration.GlobalConfiguration.get().misc.useDimensionTypeForCustomSpawners && this.registryAccess().registryOrThrow(Registries.DIMENSION_TYPE).getResourceKey(worlddimension.type().value()).orElseThrow() == net.minecraft.world.level.dimension.BuiltinDimensionTypes.OVERWORLD) {
2022-02-23 03:44:06 +01:00
+ spawners = list;
+ } else {
+ spawners = Collections.emptyList();
+ }
2023-06-08 10:08:08 +02:00
+ world = new ServerLevel(this, this.executor, worldSession, iworlddataserver, worldKey, worlddimension, worldloadlistener, flag, j, spawners, true, this.overworld().getRandomSequences(), org.bukkit.World.Environment.getEnvironment(dimension), gen, biomeProvider);
2024-01-18 18:52:00 +01:00
+ // Paper end - option to use the dimension_type to check if spawners should be added
2022-02-23 03:44:06 +01:00
}
worlddata.setModdedInfo(this.getServerModName(), this.getModdedStatus().shouldReportAsModified());