check now succeeds
This commit is contained in:
parent
b344c04a4a
commit
6f65677ca2
8 changed files with 31 additions and 38 deletions
|
@ -126,7 +126,8 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
|||
+package io.papermc.paper.world.structure;
|
||||
+
|
||||
+import io.papermc.paper.registry.Reference;
|
||||
+import net.minecraft.data.BuiltinRegistries;
|
||||
+import net.minecraft.core.Registry;
|
||||
+import net.minecraft.core.registries.Registries;
|
||||
+import net.minecraft.resources.ResourceKey;
|
||||
+import net.minecraft.resources.ResourceLocation;
|
||||
+import net.minecraft.server.Bootstrap;
|
||||
|
@ -176,11 +177,12 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
|||
+
|
||||
+ @Test
|
||||
+ public void testMinecraftToApi() {
|
||||
+ assertEquals("configured structure maps should be the same size", BUILT_IN_STRUCTURES.size(), BuiltinRegistries.STRUCTURES.size());
|
||||
+ Registry<Structure> structureRegistry = AbstractTestingBase.REGISTRY_CUSTOM.registryOrThrow(Registries.STRUCTURE);
|
||||
+ assertEquals("configured structure maps should be the same size", BUILT_IN_STRUCTURES.size(), structureRegistry.size());
|
||||
+
|
||||
+ Map<ResourceLocation, Structure> missing = new LinkedHashMap<>();
|
||||
+ for (Structure feature : BuiltinRegistries.STRUCTURES) {
|
||||
+ final ResourceLocation key = BuiltinRegistries.STRUCTURES.getKey(feature);
|
||||
+ for (Structure feature : structureRegistry) {
|
||||
+ final ResourceLocation key = structureRegistry.getKey(feature);
|
||||
+ assertNotNull("Missing built-in registry key", key);
|
||||
+ if (key.equals(BuiltinStructures.ANCIENT_CITY.location())) {
|
||||
+ continue; // TODO remove when upstream adds "jigsaw" StructureType
|
||||
|
@ -195,8 +197,9 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
|||
+
|
||||
+ @Test
|
||||
+ public void testApiToMinecraft() {
|
||||
+ Registry<Structure> structureRegistry = AbstractTestingBase.REGISTRY_CUSTOM.registryOrThrow(Registries.STRUCTURE);
|
||||
+ for (NamespacedKey apiKey : DEFAULT_CONFIGURED_STRUCTURES.keySet()) {
|
||||
+ assertTrue(apiKey + " does not have a minecraft counterpart", BuiltinRegistries.STRUCTURES.containsKey(CraftNamespacedKey.toMinecraft(apiKey)));
|
||||
+ assertTrue(apiKey + " does not have a minecraft counterpart", structureRegistry.containsKey(CraftNamespacedKey.toMinecraft(apiKey)));
|
||||
+ }
|
||||
+ }
|
||||
+
|
||||
|
@ -215,16 +218,3 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
|||
+ System.setOut(out);
|
||||
+ }
|
||||
+}
|
||||
diff --git a/src/test/java/org/bukkit/support/AbstractTestingBase.java b/src/test/java/org/bukkit/support/AbstractTestingBase.java
|
||||
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
|
||||
--- a/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 {
|
||||
REGISTRY_CUSTOM = layers.compositeAccess().freeze();
|
||||
// Paper start
|
||||
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("REGISTRgY_ACCESS");
|
||||
field.trySetAccessible();
|
||||
field.set(null, com.google.common.base.Suppliers.ofInstance(REGISTRY_CUSTOM));
|
||||
} catch (ReflectiveOperationException ex) {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue