Code Generation for TypedKeys (#9233)
Currently includes generated key holder classes for types used in the Registry Modification API
This commit is contained in:
parent
e1cd9e59e5
commit
96d5e6ca48
456 changed files with 2073 additions and 17 deletions
|
@ -21,6 +21,45 @@ index ff4d0f970990187e9b46324b5cf051fcc546119f..844eff88c9ad95871900c2d8aa3136b3
|
|||
publishing {
|
||||
publications.create<MavenPublication>("maven") {
|
||||
artifact(tasks.shadowJar)
|
||||
diff --git a/src/test/java/io/papermc/paper/registry/RegistryKeyTest.java b/src/test/java/io/papermc/paper/registry/RegistryKeyTest.java
|
||||
new file mode 100644
|
||||
index 0000000000000000000000000000000000000000..e070aa1bb69859224493d958621389ee757f8752
|
||||
--- /dev/null
|
||||
+++ b/src/test/java/io/papermc/paper/registry/RegistryKeyTest.java
|
||||
@@ -0,0 +1,33 @@
|
||||
+package io.papermc.paper.registry;
|
||||
+
|
||||
+import java.util.Optional;
|
||||
+import java.util.stream.Stream;
|
||||
+import net.minecraft.core.Registry;
|
||||
+import net.minecraft.resources.ResourceKey;
|
||||
+import net.minecraft.resources.ResourceLocation;
|
||||
+import org.bukkit.support.AbstractTestingBase;
|
||||
+import org.junit.jupiter.api.BeforeAll;
|
||||
+import org.junit.jupiter.params.ParameterizedTest;
|
||||
+import org.junit.jupiter.params.provider.MethodSource;
|
||||
+
|
||||
+import static org.junit.jupiter.api.Assertions.assertTrue;
|
||||
+
|
||||
+class RegistryKeyTest extends AbstractTestingBase {
|
||||
+
|
||||
+ @BeforeAll
|
||||
+ static void before() throws ClassNotFoundException {
|
||||
+ Class.forName(RegistryKey.class.getName()); // load all keys so they are found for the test
|
||||
+ }
|
||||
+
|
||||
+ static Stream<RegistryKey<?>> data() {
|
||||
+ return RegistryKeyImpl.REGISTRY_KEYS.stream();
|
||||
+ }
|
||||
+
|
||||
+ @ParameterizedTest
|
||||
+ @MethodSource("data")
|
||||
+ void testApiRegistryKeysExist(final RegistryKey<?> key) {
|
||||
+ final Optional<Registry<Object>> registry = AbstractTestingBase.REGISTRY_CUSTOM.registry(ResourceKey.createRegistryKey(new ResourceLocation(key.key().asString())));
|
||||
+ assertTrue(registry.isPresent(), "Missing vanilla registry for " + key.key().asString());
|
||||
+
|
||||
+ }
|
||||
+}
|
||||
diff --git a/src/test/java/io/papermc/paper/util/EmptyTag.java b/src/test/java/io/papermc/paper/util/EmptyTag.java
|
||||
new file mode 100644
|
||||
index 0000000000000000000000000000000000000000..6eb95a5e2534974c0e52e2b78b04e7c2b2f28525
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue