2021-10-17 19:10:03 +02:00
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: Jason Penilla <11360596+jpenilla@users.noreply.github.com>
Date: Sat, 16 Oct 2021 17:38:35 -0700
Subject: [PATCH] Use correct LevelStem registry when loading default
end/nether
2022-03-17 01:54:52 +01:00
Co-authored-by: Jake Potrebic <jake.m.potrebic@gmail.com>
2021-10-17 19:10:03 +02:00
2022-03-17 01:54:52 +01:00
diff --git a/src/main/java/net/minecraft/resources/RegistryLoader.java b/src/main/java/net/minecraft/resources/RegistryLoader.java
2022-05-05 00:29:15 +02:00
index 0d28a3a7f52174e70e044957b37361043b153e42..cdd2556e0401be0411563b89c6b7456a4778376a 100644
2022-03-17 01:54:52 +01:00
--- a/src/main/java/net/minecraft/resources/RegistryLoader.java
+++ b/src/main/java/net/minecraft/resources/RegistryLoader.java
@@ -42,6 +42,12 @@ public class RegistryLoader {
RegistryLoader.ReadCache<E> readCache = this.readCache(registryRef);
DataResult<Holder<E>> dataResult = readCache.values.get(entryKey);
if (dataResult != null) {
+ // Paper start - register in registry due to craftbukkit running this 3 times instead of once
+ if (registryRef == (ResourceKey) Registry.LEVEL_STEM_REGISTRY && dataResult.result().isPresent()) {
+ // OptionalInt.empty() because the LevelStem registry is only loaded from the resource manager, not the InMemory resource access
+ registry.registerOrOverride(java.util.OptionalInt.empty(), entryKey, dataResult.result().get().value(), dataResult.lifecycle());
+ }
+ // Paper end
return dataResult;
} else {
Holder<E> holder = registry.getOrCreateHolder(entryKey);
2021-10-17 19:10:03 +02:00
diff --git a/src/main/java/net/minecraft/server/MinecraftServer.java b/src/main/java/net/minecraft/server/MinecraftServer.java
2022-03-17 01:54:52 +01:00
index fddb279d161b30d6944495f0de9f6b7e21761a80..df955666723a8cb1e612311f0b8e77fb577d6be5 100644
2021-10-17 19:10:03 +02:00
--- a/src/main/java/net/minecraft/server/MinecraftServer.java
+++ b/src/main/java/net/minecraft/server/MinecraftServer.java
2022-03-13 08:47:54 +01:00
@@ -563,7 +563,14 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa
2021-10-17 19:10:03 +02:00
long i = generatorsettings.seed();
long j = BiomeManager.obfuscateSeed(i);
List<CustomSpawner> list = ImmutableList.of(new PhantomSpawner(), new PatrolSpawner(), new CatSpawner(), new VillageSiege(), new WanderingTraderSpawner(iworlddataserver));
2022-03-01 06:43:03 +01:00
- LevelStem worlddimension = (LevelStem) iregistry.get(dimensionKey);
2021-10-17 19:10:03 +02:00
+ // Paper start - Use correct LevelStem registry
2021-11-12 23:27:26 +01:00
+ final LevelStem worlddimension;
+ if (dimensionKey == LevelStem.END || dimensionKey == LevelStem.NETHER) {
+ worlddimension = generatorsettings.dimensions().get(dimensionKey);
+ } else {
2022-03-01 06:43:03 +01:00
+ worlddimension = iregistry.get(dimensionKey);
2021-10-17 19:10:03 +02:00
+ }
+ // Paper end
2022-03-01 06:43:03 +01:00
Holder<DimensionType> holder;
2021-10-17 19:10:03 +02:00
ChunkGenerator chunkgenerator;