mirror of
https://github.com/PaperMC/Paper.git
synced 2025-01-16 21:31:25 +01:00
Make sure Registry is loaded after Bukkit.setServer() (#8853)
This commit is contained in:
parent
f9e1ad2c2d
commit
b15172bc8e
@ -225,9 +225,9 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
|||||||
--- a/src/test/java/org/bukkit/support/AbstractTestingBase.java
|
--- a/src/test/java/org/bukkit/support/AbstractTestingBase.java
|
||||||
+++ b/src/test/java/org/bukkit/support/AbstractTestingBase.java
|
+++ b/src/test/java/org/bukkit/support/AbstractTestingBase.java
|
||||||
@@ -0,0 +0,0 @@ public abstract class AbstractTestingBase {
|
@@ -0,0 +0,0 @@ public abstract class AbstractTestingBase {
|
||||||
LayeredRegistryAccess<RegistryLayer> layers = RegistryLayer.createRegistryAccess();
|
|
||||||
layers = WorldLoader.loadAndReplaceLayer(resourceManager, layers, RegistryLayer.WORLDGEN, RegistryDataLoader.WORLDGEN_REGISTRIES);
|
layers = WorldLoader.loadAndReplaceLayer(resourceManager, layers, RegistryLayer.WORLDGEN, RegistryDataLoader.WORLDGEN_REGISTRIES);
|
||||||
REGISTRY_CUSTOM = layers.compositeAccess().freeze();
|
REGISTRY_CUSTOM = layers.compositeAccess().freeze();
|
||||||
|
io.papermc.paper.testing.DummyServer.setup(); // Paper
|
||||||
+ // Paper start
|
+ // Paper start
|
||||||
+ try {
|
+ try {
|
||||||
+ java.lang.reflect.Field field = io.papermc.paper.registry.PaperRegistry.class.getDeclaredField("REGISTRY_ACCESS");
|
+ java.lang.reflect.Field field = io.papermc.paper.registry.PaperRegistry.class.getDeclaredField("REGISTRY_ACCESS");
|
||||||
|
@ -105,18 +105,18 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
|||||||
ChunkGeneratorStructureState chunkgeneratorstructurestate = world.getChunkSource().getGeneratorState();
|
ChunkGeneratorStructureState chunkgeneratorstructurestate = world.getChunkSource().getGeneratorState();
|
||||||
Map<StructurePlacement, Set<Holder<Structure>>> map = new Object2ObjectArrayMap();
|
Map<StructurePlacement, Set<Holder<Structure>>> map = new Object2ObjectArrayMap();
|
||||||
Iterator iterator = structures.iterator();
|
Iterator iterator = structures.iterator();
|
||||||
diff --git a/src/main/java/net/minecraft/world/level/levelgen/structure/Structure.java b/src/main/java/net/minecraft/world/level/levelgen/structure/Structure.java
|
diff --git a/src/main/java/org/bukkit/craftbukkit/CraftServer.java b/src/main/java/org/bukkit/craftbukkit/CraftServer.java
|
||||||
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
|
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
|
||||||
--- a/src/main/java/net/minecraft/world/level/levelgen/structure/Structure.java
|
--- a/src/main/java/org/bukkit/craftbukkit/CraftServer.java
|
||||||
+++ b/src/main/java/net/minecraft/world/level/levelgen/structure/Structure.java
|
+++ b/src/main/java/org/bukkit/craftbukkit/CraftServer.java
|
||||||
@@ -0,0 +0,0 @@ public abstract class Structure {
|
@@ -0,0 +0,0 @@ public final class CraftServer implements Server {
|
||||||
public static final Codec<Structure> DIRECT_CODEC = BuiltInRegistries.STRUCTURE_TYPE.byNameCodec().dispatch(Structure::type, StructureType::codec);
|
this.structureManager = new CraftStructureManager(console.getStructureManager());
|
||||||
public static final Codec<Holder<Structure>> CODEC = RegistryFileCodec.create(Registries.STRUCTURE, DIRECT_CODEC);
|
|
||||||
protected final Structure.StructureSettings settings;
|
|
||||||
+ static { io.papermc.paper.world.structure.PaperConfiguredStructure.init(); } // Paper
|
|
||||||
|
|
||||||
public static <S extends Structure> RecordCodecBuilder<S, Structure.StructureSettings> settingsCodec(RecordCodecBuilder.Instance<S> instance) {
|
Bukkit.setServer(this);
|
||||||
return Structure.StructureSettings.CODEC.forGetter((feature) -> {
|
+ io.papermc.paper.world.structure.PaperConfiguredStructure.init(); // Paper
|
||||||
|
|
||||||
|
// Register all the Enchantments and PotionTypes now so we can stop new registration immediately after
|
||||||
|
Enchantments.SHARPNESS.getClass();
|
||||||
diff --git a/src/test/java/io/papermc/paper/world/structure/ConfiguredStructureTest.java b/src/test/java/io/papermc/paper/world/structure/ConfiguredStructureTest.java
|
diff --git a/src/test/java/io/papermc/paper/world/structure/ConfiguredStructureTest.java b/src/test/java/io/papermc/paper/world/structure/ConfiguredStructureTest.java
|
||||||
new file mode 100644
|
new file mode 100644
|
||||||
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000
|
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000
|
||||||
|
@ -130,13 +130,13 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
|||||||
import net.minecraft.SharedConstants;
|
import net.minecraft.SharedConstants;
|
||||||
import net.minecraft.commands.Commands;
|
import net.minecraft.commands.Commands;
|
||||||
@@ -0,0 +0,0 @@ public abstract class AbstractTestingBase {
|
@@ -0,0 +0,0 @@ public abstract class AbstractTestingBase {
|
||||||
public static final Registry<Biome> BIOMES;
|
LayeredRegistryAccess<RegistryLayer> layers = RegistryLayer.createRegistryAccess();
|
||||||
|
layers = WorldLoader.loadAndReplaceLayer(resourceManager, layers, RegistryLayer.WORLDGEN, RegistryDataLoader.WORLDGEN_REGISTRIES);
|
||||||
static {
|
REGISTRY_CUSTOM = layers.compositeAccess().freeze();
|
||||||
+ io.papermc.paper.testing.DummyServer.setup(); // Paper
|
+ io.papermc.paper.testing.DummyServer.setup(); // Paper
|
||||||
SharedConstants.tryDetectVersion();
|
// Register vanilla pack
|
||||||
Bootstrap.bootStrap();
|
DATA_PACK = ReloadableServerResources.loadResources(resourceManager, REGISTRY_CUSTOM, FeatureFlags.REGISTRY.allFlags(), Commands.CommandSelection.DEDICATED, 0, MoreExecutors.directExecutor(), MoreExecutors.directExecutor()).join();
|
||||||
// Set up resource manager
|
// Bind tags
|
||||||
@@ -0,0 +0,0 @@ public abstract class AbstractTestingBase {
|
@@ -0,0 +0,0 @@ public abstract class AbstractTestingBase {
|
||||||
// Biome shortcut
|
// Biome shortcut
|
||||||
BIOMES = REGISTRY_CUSTOM.registryOrThrow(Registries.BIOME);
|
BIOMES = REGISTRY_CUSTOM.registryOrThrow(Registries.BIOME);
|
||||||
|
Loading…
Reference in New Issue
Block a user