aboutsummaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
-rw-r--r--patches/api/0243-Add-RegistryAccess-for-managing-registries.patch34
-rw-r--r--patches/api/0244-Add-StructuresLocateEvent.patch4
-rw-r--r--patches/api/0338-More-PotionEffectType-API.patch4
-rw-r--r--patches/server/0019-Paper-Plugins.patch13
-rw-r--r--patches/server/0485-Add-RegistryAccess-for-managing-Registries.patch92
-rw-r--r--patches/server/0486-Add-StructuresLocateEvent.patch8
-rw-r--r--patches/server/0989-Flat-bedrock-generator-settings.patch6
7 files changed, 97 insertions, 64 deletions
diff --git a/patches/api/0243-Add-RegistryAccess-for-managing-registries.patch b/patches/api/0243-Add-RegistryAccess-for-managing-registries.patch
index 42c6e0c151..adf73a5e96 100644
--- a/patches/api/0243-Add-RegistryAccess-for-managing-registries.patch
+++ b/patches/api/0243-Add-RegistryAccess-for-managing-registries.patch
@@ -163,6 +163,28 @@ index 0000000000000000000000000000000000000000..b89e19c070f97c9662f1e16309446494
+ private RegistryAccessHolder() {
+ }
+}
+diff --git a/src/main/java/io/papermc/paper/registry/RegistryKeyImpl.java b/src/main/java/io/papermc/paper/registry/RegistryKeyImpl.java
+index 791813220b2504214b1adecc69093cd600fb0f8c..47fe5b0d5d031110c27210a0a256c260b35d9ba1 100644
+--- a/src/main/java/io/papermc/paper/registry/RegistryKeyImpl.java
++++ b/src/main/java/io/papermc/paper/registry/RegistryKeyImpl.java
+@@ -10,6 +10,17 @@ record RegistryKeyImpl<T>(@NotNull Key key) implements RegistryKey<T> {
+
+ static final Set<RegistryKey<?>> REGISTRY_KEYS = Sets.newIdentityHashSet();
+
++ // override equals and hashCode to this can be used to simulate an "identity" hashmap
++ @Override
++ public boolean equals(final Object obj) {
++ return obj == this;
++ }
++
++ @Override
++ public int hashCode() {
++ return System.identityHashCode(this);
++ }
++
+ static <T> RegistryKey<T> create(@Subst("some_key") final String key) {
+ final RegistryKey<T> registryKey = createInternal(key);
+ REGISTRY_KEYS.add(registryKey);
diff --git a/src/main/java/org/bukkit/Bukkit.java b/src/main/java/org/bukkit/Bukkit.java
index 732ed3724e784ad659cb4411dbd73b42a8330a2c..7be6710d28dea19bd0f9054c1c2e32dacd355c45 100644
--- a/src/main/java/org/bukkit/Bukkit.java
@@ -180,7 +202,7 @@ index 732ed3724e784ad659cb4411dbd73b42a8330a2c..7be6710d28dea19bd0f9054c1c2e32da
return server.getRegistry(tClass);
}
diff --git a/src/main/java/org/bukkit/Registry.java b/src/main/java/org/bukkit/Registry.java
-index a04d279561676e825905f5512c399d14a3d8f828..7aee2cee892492c523ae06902c6582b0ab827ffa 100644
+index a04d279561676e825905f5512c399d14a3d8f828..91117cad12eee0bdaac8e0398a0f7f288ba27a40 100644
--- a/src/main/java/org/bukkit/Registry.java
+++ b/src/main/java/org/bukkit/Registry.java
@@ -129,7 +129,7 @@ public interface Registry<T extends Keyed> extends Iterable<T> {
@@ -218,7 +240,7 @@ index a04d279561676e825905f5512c399d14a3d8f828..7aee2cee892492c523ae06902c6582b0
*/
- Registry<Structure> STRUCTURE = Bukkit.getRegistry(Structure.class);
+ @Deprecated(since = "1.20.6") // Paper
-+ Registry<Structure> STRUCTURE = io.papermc.paper.registry.RegistryAccess.registryAccess().getRegistry(Structure.class); // Paper
++ Registry<Structure> STRUCTURE = Objects.requireNonNull(io.papermc.paper.registry.RegistryAccess.registryAccess().getRegistry(Structure.class), "No registry present for Structure. This is a bug."); // Paper
/**
* Server structure types.
*
@@ -237,7 +259,7 @@ index a04d279561676e825905f5512c399d14a3d8f828..7aee2cee892492c523ae06902c6582b0
*/
- Registry<TrimMaterial> TRIM_MATERIAL = Bukkit.getRegistry(TrimMaterial.class);
+ @Deprecated(since = "1.20.6") // Paper
-+ Registry<TrimMaterial> TRIM_MATERIAL = io.papermc.paper.registry.RegistryAccess.registryAccess().getRegistry(TrimMaterial.class); // Paper
++ Registry<TrimMaterial> TRIM_MATERIAL = Objects.requireNonNull(io.papermc.paper.registry.RegistryAccess.registryAccess().getRegistry(TrimMaterial.class), "No registry present for TrimMaterial. This is a bug."); // Paper
/**
* Trim patterns.
*
@@ -246,7 +268,7 @@ index a04d279561676e825905f5512c399d14a3d8f828..7aee2cee892492c523ae06902c6582b0
*/
- Registry<TrimPattern> TRIM_PATTERN = Bukkit.getRegistry(TrimPattern.class);
+ @Deprecated(since = "1.20.6")
-+ Registry<TrimPattern> TRIM_PATTERN = io.papermc.paper.registry.RegistryAccess.registryAccess().getRegistry(TrimPattern.class); // Paper
++ Registry<TrimPattern> TRIM_PATTERN = Objects.requireNonNull(io.papermc.paper.registry.RegistryAccess.registryAccess().getRegistry(TrimPattern.class), "No registry present for TrimPattern. This is a bug."); // Paper
/**
* Damage types.
*
@@ -256,7 +278,7 @@ index a04d279561676e825905f5512c399d14a3d8f828..7aee2cee892492c523ae06902c6582b0
- @ApiStatus.Experimental
- Registry<DamageType> DAMAGE_TYPE = Objects.requireNonNull(Bukkit.getRegistry(DamageType.class), "No registry present for DamageType. This is a bug.");
+ @Deprecated(since = "1.20.6")
-+ Registry<DamageType> DAMAGE_TYPE = io.papermc.paper.registry.RegistryAccess.registryAccess().getRegistry(DamageType.class); // Paper
++ Registry<DamageType> DAMAGE_TYPE = Objects.requireNonNull(io.papermc.paper.registry.RegistryAccess.registryAccess().getRegistry(DamageType.class), "No registry present for DamageType. This is a bug."); // Paper
/**
* Villager profession.
*
@@ -268,7 +290,7 @@ index a04d279561676e825905f5512c399d14a3d8f828..7aee2cee892492c523ae06902c6582b0
*/
- Registry<Wolf.Variant> WOLF_VARIANT = Objects.requireNonNull(Bukkit.getRegistry(Wolf.Variant.class), "No registry present for Wolf Variant. This is a bug.");
+ @Deprecated(since = "1.20.6")
-+ Registry<Wolf.Variant> WOLF_VARIANT = io.papermc.paper.registry.RegistryAccess.registryAccess().getRegistry(Wolf.Variant.class); // Paper
++ Registry<Wolf.Variant> WOLF_VARIANT = Objects.requireNonNull(io.papermc.paper.registry.RegistryAccess.registryAccess().getRegistry(Wolf.Variant.class), "No registry present for Wolf$Variant. This is a bug."); // Paper
/**
* Map cursor types.
*
diff --git a/patches/api/0244-Add-StructuresLocateEvent.patch b/patches/api/0244-Add-StructuresLocateEvent.patch
index 517815d777..10ef586cce 100644
--- a/patches/api/0244-Add-StructuresLocateEvent.patch
+++ b/patches/api/0244-Add-StructuresLocateEvent.patch
@@ -513,7 +513,7 @@ index 0000000000000000000000000000000000000000..1e7b53f9bc13dcd5a0a4a40004591e4f
+ }
+}
diff --git a/src/main/java/org/bukkit/Registry.java b/src/main/java/org/bukkit/Registry.java
-index 7aee2cee892492c523ae06902c6582b0ab827ffa..3adc243fa7e1aecf8a271b38a25c7fa3ef6fcc03 100644
+index 91117cad12eee0bdaac8e0398a0f7f288ba27a40..43f410326d6d68242113e2fefe31af256889ed9c 100644
--- a/src/main/java/org/bukkit/Registry.java
+++ b/src/main/java/org/bukkit/Registry.java
@@ -292,6 +292,15 @@ public interface Registry<T extends Keyed> extends Iterable<T> {
@@ -527,7 +527,7 @@ index 7aee2cee892492c523ae06902c6582b0ab827ffa..3adc243fa7e1aecf8a271b38a25c7fa3
+ * @deprecated use {@link io.papermc.paper.registry.RegistryAccess#getRegistry(io.papermc.paper.registry.RegistryKey)} with {@link io.papermc.paper.registry.RegistryKey#STRUCTURE}
+ */
+ @Deprecated(forRemoval = true)
-+ Registry<io.papermc.paper.world.structure.ConfiguredStructure> CONFIGURED_STRUCTURE = io.papermc.paper.registry.RegistryAccess.registryAccess().getRegistry(io.papermc.paper.world.structure.ConfiguredStructure.class);
++ Registry<io.papermc.paper.world.structure.ConfiguredStructure> CONFIGURED_STRUCTURE = Objects.requireNonNull(io.papermc.paper.registry.RegistryAccess.registryAccess().getRegistry(io.papermc.paper.world.structure.ConfiguredStructure.class), "No registry present for ConfiguredStructure. This is a bug.");
+ // Paper end
/**
* Get the object by its key.
diff --git a/patches/api/0338-More-PotionEffectType-API.patch b/patches/api/0338-More-PotionEffectType-API.patch
index 197d1f3222..cad46c8765 100644
--- a/patches/api/0338-More-PotionEffectType-API.patch
+++ b/patches/api/0338-More-PotionEffectType-API.patch
@@ -5,13 +5,13 @@ Subject: [PATCH] More PotionEffectType API
diff --git a/src/main/java/org/bukkit/Registry.java b/src/main/java/org/bukkit/Registry.java
-index 3adc243fa7e1aecf8a271b38a25c7fa3ef6fcc03..9a8be5c730802e5750de1fc31e65f254f5894e63 100644
+index 43f410326d6d68242113e2fefe31af256889ed9c..90ab3bef4c5b6b6e215e9c759c886ed6d0f3302b 100644
--- a/src/main/java/org/bukkit/Registry.java
+++ b/src/main/java/org/bukkit/Registry.java
@@ -300,6 +300,31 @@ public interface Registry<T extends Keyed> extends Iterable<T> {
*/
@Deprecated(forRemoval = true)
- Registry<io.papermc.paper.world.structure.ConfiguredStructure> CONFIGURED_STRUCTURE = io.papermc.paper.registry.RegistryAccess.registryAccess().getRegistry(io.papermc.paper.world.structure.ConfiguredStructure.class);
+ Registry<io.papermc.paper.world.structure.ConfiguredStructure> CONFIGURED_STRUCTURE = Objects.requireNonNull(io.papermc.paper.registry.RegistryAccess.registryAccess().getRegistry(io.papermc.paper.world.structure.ConfiguredStructure.class), "No registry present for ConfiguredStructure. This is a bug.");
+
+ /**
+ * Potion effect types.
diff --git a/patches/server/0019-Paper-Plugins.patch b/patches/server/0019-Paper-Plugins.patch
index 7a19309b99..b3ef03dd63 100644
--- a/patches/server/0019-Paper-Plugins.patch
+++ b/patches/server/0019-Paper-Plugins.patch
@@ -7208,17 +7208,24 @@ index bc91370654f5da33cbfe7d42431568915c1159d6..b43af53960978ac04bccde08544a5628
validate(REGISTRY);
}
diff --git a/src/main/java/net/minecraft/server/Bootstrap.java b/src/main/java/net/minecraft/server/Bootstrap.java
-index 15ee2f2a83bfef2f6891d9bfb2d3a8c14b24ffb1..d0d95d729853fc296c4931a2f73a3fc5f94302c9 100644
+index 15ee2f2a83bfef2f6891d9bfb2d3a8c14b24ffb1..26892378d27dadce25c178333188ba093dc1617b 100644
--- a/src/main/java/net/minecraft/server/Bootstrap.java
+++ b/src/main/java/net/minecraft/server/Bootstrap.java
-@@ -74,7 +74,11 @@ public class Bootstrap {
+@@ -63,6 +63,7 @@ public class Bootstrap {
+ Bootstrap.isBootstrapped = true;
+ Instant instant = Instant.now();
+
++ io.papermc.paper.plugin.entrypoint.LaunchEntryPointHandler.enterBootstrappers(); // Paper - Entrypoint for bootstrapping
+ if (BuiltInRegistries.REGISTRY.keySet().isEmpty()) {
+ throw new IllegalStateException("Unable to load registries");
+ } else {
+@@ -74,7 +75,10 @@ public class Bootstrap {
EntitySelectorOptions.bootStrap();
DispenseItemBehavior.bootStrap();
CauldronInteraction.bootStrap();
- BuiltInRegistries.bootStrap();
+ // Paper start
+ BuiltInRegistries.bootStrap(() -> {
-+ io.papermc.paper.plugin.entrypoint.LaunchEntryPointHandler.enterBootstrappers(); // Paper - Entrypoint for bootstrapping
+ });
+ // Paper end
CreativeModeTabs.validate();
diff --git a/patches/server/0485-Add-RegistryAccess-for-managing-Registries.patch b/patches/server/0485-Add-RegistryAccess-for-managing-Registries.patch
index 989e6099ae..aed4ca95bb 100644
--- a/patches/server/0485-Add-RegistryAccess-for-managing-Registries.patch
+++ b/patches/server/0485-Add-RegistryAccess-for-managing-Registries.patch
@@ -100,10 +100,10 @@ index 0000000000000000000000000000000000000000..5fc4c41ec2089d4f69861c5da17e0bef
+}
diff --git a/src/main/java/io/papermc/paper/registry/PaperRegistryAccess.java b/src/main/java/io/papermc/paper/registry/PaperRegistryAccess.java
new file mode 100644
-index 0000000000000000000000000000000000000000..9480dafb2de09ac883e997c41e8a16b77f5f7082
+index 0000000000000000000000000000000000000000..00a49ae2f0c89b129301e226794fc9c29d4c0ddd
--- /dev/null
+++ b/src/main/java/io/papermc/paper/registry/PaperRegistryAccess.java
-@@ -0,0 +1,119 @@
+@@ -0,0 +1,123 @@
+package io.papermc.paper.registry;
+
+import io.papermc.paper.registry.entry.RegistryEntry;
@@ -111,9 +111,10 @@ index 0000000000000000000000000000000000000000..9480dafb2de09ac883e997c41e8a16b7
+import io.papermc.paper.registry.legacy.DelayedRegistryEntry;
+import io.papermc.paper.registry.legacy.LegacyRegistryIdentifiers;
+import java.util.Collections;
-+import java.util.IdentityHashMap;
+import java.util.Map;
++import java.util.NoSuchElementException;
+import java.util.Set;
++import java.util.concurrent.ConcurrentHashMap;
+import net.minecraft.resources.ResourceKey;
+import org.bukkit.Keyed;
+import org.bukkit.Registry;
@@ -132,7 +133,7 @@ index 0000000000000000000000000000000000000000..9480dafb2de09ac883e997c41e8a16b7
+ // We want to do registration there, so we have access to the nms.Registry instance in order to wrap it in a CraftRegistry instance.
+ // The memoized Supplier is needed because we *can't* instantiate any CraftRegistry class until **all** the BuiltInRegistries have been added
+ // to this map because that would class-load org.bukkit.Registry which would query this map.
-+ private final Map<RegistryKey<?>, RegistryHolder<?, ?>> registries = Collections.synchronizedMap(new IdentityHashMap<>());
++ private final Map<RegistryKey<?>, RegistryHolder<?>> registries = new ConcurrentHashMap<>(); // is "identity" because RegistryKey overrides equals and hashCode
+
+ public static PaperRegistryAccess instance() {
+ return (PaperRegistryAccess) RegistryAccessHolder.INSTANCE.orElseThrow(() -> new IllegalStateException("No RegistryAccess implementation found"));
@@ -151,7 +152,7 @@ index 0000000000000000000000000000000000000000..9480dafb2de09ac883e997c41e8a16b7
+ final @Nullable RegistryEntry<?, T, ?> entry;
+ registryKey = requireNonNull(byType(type), () -> type + " is not a valid registry type");
+ entry = PaperRegistries.getEntry(registryKey);
-+ final @Nullable RegistryHolder<T, ?> registry = (RegistryHolder<T, ?>) this.registries.get(registryKey);
++ final @Nullable RegistryHolder<T> registry = (RegistryHolder<T>) this.registries.get(registryKey);
+ if (registry != null) {
+ // if the registry exists, return right away. Since this is the "legacy" method, we return DelayedRegistry
+ // for the non-builtin Registry instances stored as fields in Registry.
@@ -160,7 +161,7 @@ index 0000000000000000000000000000000000000000..9480dafb2de09ac883e997c41e8a16b7
+ // if the registry doesn't exist and the entry is marked as "delayed", we create a registry holder that is empty
+ // which will later be filled with the actual registry. This is so the fields on org.bukkit.Registry can be populated with
+ // registries that don't exist at the time org.bukkit.Registry is statically initialized.
-+ final RegistryHolder<T, ?> delayedHolder = new RegistryHolder.Delayed<>();
++ final RegistryHolder<T> delayedHolder = new RegistryHolder.Delayed<>();
+ this.registries.put(registryKey, delayedHolder);
+ return delayedHolder.get();
+ } else {
@@ -172,9 +173,12 @@ index 0000000000000000000000000000000000000000..9480dafb2de09ac883e997c41e8a16b7
+ @SuppressWarnings("unchecked")
+ @Override
+ public <T extends Keyed> Registry<T> getRegistry(final RegistryKey<T> key) {
-+ final @Nullable RegistryHolder<T, ?> registryHolder = (RegistryHolder<T, ?>) this.registries.get(key);
++ if (PaperRegistries.getEntry(key) == null) {
++ throw new NoSuchElementException(key + " is not a valid registry key");
++ }
++ final @Nullable RegistryHolder<T> registryHolder = (RegistryHolder<T>) this.registries.get(key);
+ if (registryHolder == null) {
-+ throw new IllegalArgumentException(key + " is not a valid registry key or that registry is not available yet");
++ throw new IllegalArgumentException(key + " points to a registry that is not available yet");
+ }
+ // since this is the getRegistry method that uses the modern RegistryKey, we unwrap any DelayedRegistry instances
+ // that might be returned here. I don't think reference equality is required when doing getRegistry(RegistryKey.WOLF_VARIANT) == Registry.WOLF_VARIANT
@@ -202,14 +206,14 @@ index 0000000000000000000000000000000000000000..9480dafb2de09ac883e997c41e8a16b7
+ if (entry == null) { // skip registries that don't have API entries
+ return;
+ }
-+ final @Nullable RegistryHolder<B, R> registryHolder = (RegistryHolder<B, R>) this.registries.get(entry.apiKey());
++ final @Nullable RegistryHolder<B> registryHolder = (RegistryHolder<B>) this.registries.get(entry.apiKey());
+ if (registryHolder == null || replace) {
+ // if the holder doesn't exist yet, or is marked as "replaceable", put it in the map.
+ this.registries.put(entry.apiKey(), entry.createRegistryHolder(registry));
+ } else {
-+ if (registryHolder instanceof final RegistryHolder.Delayed<B, R> delayedHolder && entry instanceof final DelayedRegistryEntry<M, B, R> delayedEntry) {
++ if (registryHolder instanceof RegistryHolder.Delayed<?, ?> && entry instanceof final DelayedRegistryEntry<M, B, R> delayedEntry) {
+ // if the registry holder is delayed, and the entry is marked as "delayed", then load the holder with the CraftRegistry instance that wraps the actual nms Registry.
-+ delayedHolder.loadFrom(delayedEntry, registry);
++ ((RegistryHolder.Delayed<B, R>) registryHolder).loadFrom(delayedEntry, registry);
+ } else {
+ throw new IllegalArgumentException(resourceKey + " has already been created");
+ }
@@ -225,13 +229,12 @@ index 0000000000000000000000000000000000000000..9480dafb2de09ac883e997c41e8a16b7
+}
diff --git a/src/main/java/io/papermc/paper/registry/RegistryHolder.java b/src/main/java/io/papermc/paper/registry/RegistryHolder.java
new file mode 100644
-index 0000000000000000000000000000000000000000..f750325fa980d4c49b92573ac4650f2b53c26e7b
+index 0000000000000000000000000000000000000000..02402ef647c3e78ed56fd6b2687bf7c67448f891
--- /dev/null
+++ b/src/main/java/io/papermc/paper/registry/RegistryHolder.java
@@ -0,0 +1,47 @@
+package io.papermc.paper.registry;
+
-+import com.google.common.base.Preconditions;
+import com.google.common.base.Suppliers;
+import io.papermc.paper.registry.legacy.DelayedRegistry;
+import io.papermc.paper.registry.legacy.DelayedRegistryEntry;
@@ -239,46 +242,47 @@ index 0000000000000000000000000000000000000000..f750325fa980d4c49b92573ac4650f2b
+import org.bukkit.Keyed;
+import org.bukkit.Registry;
+import org.checkerframework.checker.nullness.qual.NonNull;
-+import org.checkerframework.checker.nullness.qual.Nullable;
+import org.checkerframework.framework.qual.DefaultQualifier;
+
+@DefaultQualifier(NonNull.class)
-+public class RegistryHolder<B extends Keyed, R extends Registry<B>> {
++public interface RegistryHolder<B extends Keyed> {
+
-+ private final @Nullable Supplier<R> memoizedSupplier;
++ Registry<B> get();
+
-+ public RegistryHolder(final Supplier<? extends R> supplier) {
-+ this.memoizedSupplier = Suppliers.memoize(supplier::get);
-+ }
++ final class Memoized<B extends Keyed, R extends Registry<B>> implements RegistryHolder<B> {
+
-+ protected RegistryHolder() {
-+ this.memoizedSupplier = null;
-+ }
++ private final Supplier<R> memoizedSupplier;
+
-+ public Registry<B> get() {
-+ Preconditions.checkState(this.memoizedSupplier != null, "Must provide a supplier or override this method!");
-+ return this.memoizedSupplier.get();
++ public Memoized(final Supplier<? extends R> supplier) {
++ this.memoizedSupplier = Suppliers.memoize(supplier::get);
++ }
++
++ public Registry<B> get() {
++ return this.memoizedSupplier.get();
++ }
+ }
+
-+ public static final class Delayed<B extends Keyed, R extends Registry<B>> extends RegistryHolder<B, R> {
++ final class Delayed<B extends Keyed, R extends Registry<B>> implements RegistryHolder<B> {
+
+ private final DelayedRegistry<B, R> delayedRegistry = new DelayedRegistry<>();
+
+ @Override
-+ public Registry<B> get() {
++ public DelayedRegistry<B, R> get() {
+ return this.delayedRegistry;
+ }
+
+ <M> void loadFrom(final DelayedRegistryEntry<M, B, R> delayedEntry, final net.minecraft.core.Registry<M> registry) {
-+ final RegistryHolder<B, R> delegateHolder = delayedEntry.delegate().createRegistryHolder(registry);
-+ Preconditions.checkState(delegateHolder.memoizedSupplier != null, "delegateHolder must have a memoized supplier!");
-+ this.delayedRegistry.load(delegateHolder.memoizedSupplier);
++ final RegistryHolder<B> delegateHolder = delayedEntry.delegate().createRegistryHolder(registry);
++ if (!(delegateHolder instanceof RegistryHolder.Memoized<B, ?>)) {
++ throw new IllegalArgumentException(delegateHolder + " must be a memoized holder");
++ }
++ this.delayedRegistry.load(((Memoized<B, R>) delegateHolder).memoizedSupplier);
+ }
+ }
+}
diff --git a/src/main/java/io/papermc/paper/registry/entry/BaseRegistryEntry.java b/src/main/java/io/papermc/paper/registry/entry/BaseRegistryEntry.java
new file mode 100644
-index 0000000000000000000000000000000000000000..6ce94c2399817a74771ade0bb82905763a8e9df2
+index 0000000000000000000000000000000000000000..8cb8630304f2b7604f420fe9dbdee9c460ee7bda
--- /dev/null
+++ b/src/main/java/io/papermc/paper/registry/entry/BaseRegistryEntry.java
@@ -0,0 +1,38 @@
@@ -316,13 +320,13 @@ index 0000000000000000000000000000000000000000..6ce94c2399817a74771ade0bb8290576
+ }
+
+ @Override
-+ public final Class<?> toPreload() {
++ public final Class<?> classToPreload() {
+ return this.classToPreload;
+ }
+}
diff --git a/src/main/java/io/papermc/paper/registry/entry/CraftRegistryEntry.java b/src/main/java/io/papermc/paper/registry/entry/CraftRegistryEntry.java
new file mode 100644
-index 0000000000000000000000000000000000000000..1639380c9db4249f9e49b23588720d5cec2d63fd
+index 0000000000000000000000000000000000000000..03ffc325c008af97e848e747d8860c58e308bdf3
--- /dev/null
+++ b/src/main/java/io/papermc/paper/registry/entry/CraftRegistryEntry.java
@@ -0,0 +1,34 @@
@@ -352,17 +356,17 @@ index 0000000000000000000000000000000000000000..1639380c9db4249f9e49b23588720d5c
+ }
+
+ @Override
-+ public RegistryHolder<B, CraftRegistry<B, M>> createRegistryHolder(final Registry<M> nmsRegistry) {
-+ return new RegistryHolder<>(() -> this.createApiRegistry(nmsRegistry));
++ public RegistryHolder<B> createRegistryHolder(final Registry<M> nmsRegistry) {
++ return new RegistryHolder.Memoized<>(() -> this.createApiRegistry(nmsRegistry));
+ }
+
+ private CraftRegistry<B, M> createApiRegistry(final Registry<M> nmsRegistry) {
-+ return new CraftRegistry<>(this.toPreload(), nmsRegistry, this.minecraftToBukkit);
++ return new CraftRegistry<>(this.classToPreload(), nmsRegistry, this.minecraftToBukkit);
+ }
+}
diff --git a/src/main/java/io/papermc/paper/registry/entry/RegistryEntry.java b/src/main/java/io/papermc/paper/registry/entry/RegistryEntry.java
new file mode 100644
-index 0000000000000000000000000000000000000000..9cda87cd03a04998cb527a4be9d3950523646cd3
+index 0000000000000000000000000000000000000000..8daafa1bc3c1dbbc9c902633c61e093668b2f049
--- /dev/null
+++ b/src/main/java/io/papermc/paper/registry/entry/RegistryEntry.java
@@ -0,0 +1,33 @@
@@ -383,7 +387,7 @@ index 0000000000000000000000000000000000000000..9cda87cd03a04998cb527a4be9d39505
+@DefaultQualifier(NonNull.class)
+public interface RegistryEntry<M, B extends Keyed, R extends org.bukkit.Registry<B>> extends RegistryEntryInfo<M, B> { // TODO remove Keyed
+
-+ RegistryHolder<B, R> createRegistryHolder(Registry<M> nmsRegistry);
++ RegistryHolder<B> createRegistryHolder(Registry<M> nmsRegistry);
+
+ /**
+ * This should only be used if the registry instance needs to exist early due to the need
@@ -401,7 +405,7 @@ index 0000000000000000000000000000000000000000..9cda87cd03a04998cb527a4be9d39505
+}
diff --git a/src/main/java/io/papermc/paper/registry/entry/RegistryEntryInfo.java b/src/main/java/io/papermc/paper/registry/entry/RegistryEntryInfo.java
new file mode 100644
-index 0000000000000000000000000000000000000000..abb24093dc81c0ba8a761700be59d4c9a67f4b00
+index 0000000000000000000000000000000000000000..8b8c273b7fb60998a53cf1ce67632315e94599cd
--- /dev/null
+++ b/src/main/java/io/papermc/paper/registry/entry/RegistryEntryInfo.java
@@ -0,0 +1,14 @@
@@ -417,7 +421,7 @@ index 0000000000000000000000000000000000000000..abb24093dc81c0ba8a761700be59d4c9
+
+ RegistryKey<B> apiKey();
+
-+ Class<?> toPreload();
++ Class<?> classToPreload();
+}
diff --git a/src/main/java/io/papermc/paper/registry/entry/package-info.java b/src/main/java/io/papermc/paper/registry/entry/package-info.java
new file mode 100644
@@ -493,7 +497,7 @@ index 0000000000000000000000000000000000000000..5562e8da5ebaef2a3add46e88d64358b
+}
diff --git a/src/main/java/io/papermc/paper/registry/legacy/DelayedRegistryEntry.java b/src/main/java/io/papermc/paper/registry/legacy/DelayedRegistryEntry.java
new file mode 100644
-index 0000000000000000000000000000000000000000..0ca04fac46b2ec6aa8481ad867264050bfda630c
+index 0000000000000000000000000000000000000000..aa85e32961ea258745dc8ed68328528b3458c042
--- /dev/null
+++ b/src/main/java/io/papermc/paper/registry/legacy/DelayedRegistryEntry.java
@@ -0,0 +1,31 @@
@@ -519,12 +523,12 @@ index 0000000000000000000000000000000000000000..0ca04fac46b2ec6aa8481ad867264050
+ }
+
+ @Override
-+ public Class<?> toPreload() {
-+ return this.delegate.toPreload();
++ public Class<?> classToPreload() {
++ return this.delegate.classToPreload();
+ }
+
+ @Override
-+ public RegistryHolder<T, R> createRegistryHolder(final Registry<M> nmsRegistry) {
++ public RegistryHolder<T> createRegistryHolder(final Registry<M> nmsRegistry) {
+ return this.delegate.createRegistryHolder(nmsRegistry);
+ }
+}
diff --git a/patches/server/0486-Add-StructuresLocateEvent.patch b/patches/server/0486-Add-StructuresLocateEvent.patch
index da94da4dad..c8faf662f2 100644
--- a/patches/server/0486-Add-StructuresLocateEvent.patch
+++ b/patches/server/0486-Add-StructuresLocateEvent.patch
@@ -6,7 +6,7 @@ Subject: [PATCH] Add StructuresLocateEvent
Co-authored-by: Jake Potrebic <[email protected]>
diff --git a/src/main/java/io/papermc/paper/registry/PaperRegistries.java b/src/main/java/io/papermc/paper/registry/PaperRegistries.java
-index d45e2855f137d8708139281e8598ed34cc07ddd2..3a2b7f6f2dad856bc1499472970ba8b579df2e33 100644
+index 5fc4c41ec2089d4f69861c5da17e0bef8a203401..e3c16b2aee3da74c43c52a20f52fcde066f0d90d 100644
--- a/src/main/java/io/papermc/paper/registry/PaperRegistries.java
+++ b/src/main/java/io/papermc/paper/registry/PaperRegistries.java
@@ -38,6 +38,12 @@ import static io.papermc.paper.registry.entry.RegistryEntry.entry;
@@ -23,10 +23,10 @@ index d45e2855f137d8708139281e8598ed34cc07ddd2..3a2b7f6f2dad856bc1499472970ba8b5
private static final Map<RegistryKey<?>, RegistryEntry<?, ?, ?>> BY_REGISTRY_KEY;
private static final Map<ResourceKey<?>, RegistryEntry<?, ?, ?>> BY_RESOURCE_KEY;
diff --git a/src/main/java/io/papermc/paper/registry/PaperRegistryAccess.java b/src/main/java/io/papermc/paper/registry/PaperRegistryAccess.java
-index 958e37a80ea486f460f495a4a6f6a55aa5f1c7ee..0de4a2cf8527a0cbdc7de4c9bdba4230047a1252 100644
+index 00a49ae2f0c89b129301e226794fc9c29d4c0ddd..51c45a97503c9a863c97e75ad97b334b8c59225e 100644
--- a/src/main/java/io/papermc/paper/registry/PaperRegistryAccess.java
+++ b/src/main/java/io/papermc/paper/registry/PaperRegistryAccess.java
-@@ -43,8 +43,13 @@ public class PaperRegistryAccess implements RegistryAccess {
+@@ -44,8 +44,13 @@ public class PaperRegistryAccess implements RegistryAccess {
public <T extends Keyed> @Nullable Registry<T> getRegistry(final Class<T> type) {
final RegistryKey<T> registryKey;
final @Nullable RegistryEntry<?, T, ?> entry;
@@ -39,7 +39,7 @@ index 958e37a80ea486f460f495a4a6f6a55aa5f1c7ee..0de4a2cf8527a0cbdc7de4c9bdba4230
+ registryKey = requireNonNull(byType(type), () -> type + " is not a valid registry type");
+ entry = PaperRegistries.getEntry(registryKey);
+ }
- final @Nullable RegistryHolder<T, ?> registry = (RegistryHolder<T, ?>) this.registries.get(registryKey);
+ final @Nullable RegistryHolder<T> registry = (RegistryHolder<T>) this.registries.get(registryKey);
if (registry != null) {
// if the registry exists, return right away. Since this is the "legacy" method, we return DelayedRegistry
diff --git a/src/main/java/io/papermc/paper/world/structure/PaperConfiguredStructure.java b/src/main/java/io/papermc/paper/world/structure/PaperConfiguredStructure.java
diff --git a/patches/server/0989-Flat-bedrock-generator-settings.patch b/patches/server/0989-Flat-bedrock-generator-settings.patch
index 7103386726..b973a4d233 100644
--- a/patches/server/0989-Flat-bedrock-generator-settings.patch
+++ b/patches/server/0989-Flat-bedrock-generator-settings.patch
@@ -105,17 +105,17 @@ index 0000000000000000000000000000000000000000..e0d73113c937ddbcf8144f88b15a8d3d
+ }
+}
diff --git a/src/main/java/net/minecraft/server/Bootstrap.java b/src/main/java/net/minecraft/server/Bootstrap.java
-index 05f4be8dfff37ab6804a2d990b1f8c430d42dc7c..2a49a6a6bccabf588ba67b565d8f16fda04ba0b0 100644
+index a3a2097716430b30c9bac2581b9f67fe0c595bd2..6885a653bfe629c46bface19ff1eb666d74d4f1b 100644
--- a/src/main/java/net/minecraft/server/Bootstrap.java
+++ b/src/main/java/net/minecraft/server/Bootstrap.java
-@@ -76,6 +76,7 @@ public class Bootstrap {
+@@ -77,6 +77,7 @@ public class Bootstrap {
CauldronInteraction.bootStrap();
// Paper start
BuiltInRegistries.bootStrap(() -> {
+ io.papermc.paper.world.worldgen.OptionallyFlatBedrockConditionSource.bootstrap(); // Paper - Flat bedrock generator settings
- io.papermc.paper.plugin.entrypoint.LaunchEntryPointHandler.enterBootstrappers(); // Paper - Entrypoint for bootstrapping
});
// Paper end
+ CreativeModeTabs.validate();
diff --git a/src/main/java/net/minecraft/world/level/levelgen/NoiseBasedChunkGenerator.java b/src/main/java/net/minecraft/world/level/levelgen/NoiseBasedChunkGenerator.java
index dc765b92cc90f5f370254e68bbbdfa5add7935ce..8ce870a5341a61fbbaf42021ef7f7f615a6a3e09 100644
--- a/src/main/java/net/minecraft/world/level/levelgen/NoiseBasedChunkGenerator.java