Paper/patches/server/0770-Option-to-have-default-CustomSpawners-in-custom-worl.patch
Jake Potrebic 90fe0d58a5
Updated Upstream (Bukkit/CraftBukkit/Spigot) (#9825)
Upstream has released updates that appear to apply and compile correctly.
This update has not been tested by PaperMC and as with ANY update, please do your own testing

Bukkit Changes:
897a0a23 SPIGOT-5753: Back PotionType by a minecraft registry
255b2aa1 SPIGOT-7080: Add World#locateNearestBiome
ff984826 Remove javadoc.io doc links

CraftBukkit Changes:
71b0135cc SPIGOT-5753: Back PotionType by a minecraft registry
a6bcb8489 SPIGOT-7080: Add World#locateNearestBiome
ad0e57434 SPIGOT-7502: CraftMetaItem - cannot deserialize BlockStateTag
b3efca57a SPIGOT-6400: Use Mockito instead of InvocationHandler
38c599f9d PR-1272: Only allow one entity in CraftItem instead of two
f065271ac SPIGOT-7498: ChunkSnapshot.getBlockEmittedLight() gets 64 blocks upper in Overworld

Spigot Changes:
e0e223fe Remove javadoc.io doc links
2023-10-22 20:12:00 +01:00

33 lines
2.6 KiB
Diff

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
index 5e90384ae64af46acff9d1b58c7d401e5590859c..7d944606f7e136aa60a0ea376ef325887bd4e6a8 100644
--- a/src/main/java/net/minecraft/server/MinecraftServer.java
+++ b/src/main/java/net/minecraft/server/MinecraftServer.java
@@ -577,7 +577,15 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa
this.commandStorage = new CommandStorage(worldpersistentdata);
} else {
ChunkProgressListener worldloadlistener = this.progressListenerFactory.create(11);
- 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);
+ // 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;
+ 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) {
+ spawners = list;
+ } else {
+ spawners = Collections.emptyList();
+ }
+ 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);
+ // Paper end
}
worlddata.setModdedInfo(this.getServerModName(), this.getModdedStatus().shouldReportAsModified());