Don't use delayed registries in impl anywhere (#11918)

This commit is contained in:
Jake Potrebic
2025-01-11 11:02:28 -08:00
committed by GitHub
parent 19ddbeff9e
commit ac3aaa248b
55 changed files with 145 additions and 133 deletions

View File

@@ -34,11 +34,11 @@ public class PerRegistryTest {
try {
Object object = registryField.get(null);
// Ignore Bukkit's default SimpleRegistry. It cannot be tested correctly
if (!(object instanceof CraftRegistry<?, ?> registry)) {
if (object instanceof Registry.NotARegistry) {
continue;
}
data.add(Arguments.of(registry));
data.add(Arguments.of(object));
} catch (ReflectiveOperationException e) {
e.printStackTrace();
}

View File

@@ -1,8 +1,5 @@
package org.bukkit.registry;
import static org.junit.jupiter.api.Assertions.*;
import static org.junit.jupiter.api.Assumptions.*;
import static org.mockito.Mockito.*;
import com.google.common.base.Joiner;
import io.papermc.paper.registry.RegistryKey;
import java.lang.reflect.InvocationTargetException;
@@ -13,7 +10,6 @@ import java.util.HashSet;
import java.util.Map;
import java.util.Set;
import net.minecraft.resources.ResourceKey;
import org.bukkit.Bukkit;
import org.bukkit.Keyed;
import org.bukkit.Registry;
import org.bukkit.craftbukkit.util.Handleable;
@@ -25,6 +21,13 @@ import org.junit.jupiter.api.Order;
import org.junit.jupiter.api.TestMethodOrder;
import org.junit.jupiter.params.provider.Arguments;
import static org.junit.jupiter.api.Assertions.assertSame;
import static org.junit.jupiter.api.Assertions.assertTrue;
import static org.junit.jupiter.api.Assertions.fail;
import static org.junit.jupiter.api.Assumptions.assumeFalse;
import static org.junit.jupiter.api.Assumptions.assumeTrue;
import static org.mockito.Mockito.mock;
@AllFeatures
@TestMethodOrder(MethodOrderer.OrderAnnotation.class)
public class RegistryConversionTest {
@@ -260,7 +263,7 @@ public class RegistryConversionTest {
Joiner.on('\n').withKeyValueSeparator(" got: ").join(notMatching)));
}
static final Set<RegistryKey<?>> IGNORE_FOR_DIRECT_HOLDER = Set.of(RegistryKey.TRIM_MATERIAL, RegistryKey.TRIM_PATTERN, RegistryKey.INSTRUMENT, RegistryKey.PAINTING_VARIANT, RegistryKey.BANNER_PATTERN, RegistryKey.SOUND_EVENT); // Paper
static final Set<RegistryKey<?>> IGNORE_FOR_DIRECT_HOLDER = Set.of(RegistryKey.TRIM_MATERIAL, RegistryKey.TRIM_PATTERN, RegistryKey.INSTRUMENT, RegistryKey.PAINTING_VARIANT, RegistryKey.BANNER_PATTERN, RegistryKey.SOUND_EVENT, RegistryKey.ENCHANTMENT); // Paper
/**
* Minecraft registry can return a default key / value