Bukkit.getRegistry(EntityType.class) returns null

XMLWordPrintable

    • Type: Bug
    • Resolution: Unresolved
    • Priority: Minor
    • None
    • Affects Version/s: None
    • Environment:
    • This server is running CraftBukkit version 4423-Spigot-aa7842e-c16b696 (MC: 1.21.4) (Implementing API version 1.21.4-R0.1-SNAPSHOT)
    • WeaponMechanics
    • Yes

      Spigot includes a registry for the `EntityType` class (`Registry.ENTITY_TYPE`). Thus, I expect:

      ```java
      Bukkit.getRegistry(EntityType.class)
      ``` 
      to return the registry... However, in practice (please forgive the kotlin code):
      ```kotlin
      class RegistryValueSerializer<T : Keyed>
      @JvmOverloads
      constructor(
      val clazz: Class<T>,
      val isAllowWildcard: Boolean,
      val registry: Registry<T> =
      Bukkit.getRegistry(clazz)
      ?: throw IllegalArgumentException("Registry for $clazz does not exist."),
      ) : SimpleSerializer<List<T>> {
      ```
      throws the error (implying that it returned null):
      ```
      at java.base/java.lang.Thread.run(Thread.java:1583) [?:?]
      Caused by: java.lang.IllegalArgumentException: Registry for class org.bukkit.entity.EntityType does not exist.
      at me.deecaad.core.file.simple.RegistryValueSerializer.<init>(RegistryValueSerializer.kt:23) ~[?:?]
      at me.deecaad.core.file.simple.RegistryValueSerializer.<init>(RegistryValueSerializer.kt) ~[?:?]
      at me.deecaad.weaponmechanics.weapon.damage.DamageModifier.serialize(DamageModifier.java:417) ~[?:?]
      at me.deecaad.weaponmechanics.weapon.damage.DamageModifier.serialize(DamageModifier.java:35) ~[?:?]
      at me.deecaad.core.file.FileReader.fillOneFile(FileReader.java:255) ~[?:?]
      ```

      I rebuilt Spigot from BuildTools just an hour ago to make sure... Could this be a Spigot bug? I haven't looked at the Spigot internals for Registries yet.

            Assignee:
            Unassigned
            Reporter:
            Collin Barber
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

              Created:
              Updated: