ProtocolLib

3M Downloads

Accessing the SquidEntity NMS class returns Failed to find NMS class

CubitsDev opened this issue ยท 3 comments

commented

Make sure you're doing the following

  • You're using the latest build for your server version
  • This isn't an issue caused by another plugin
  • You've checked for duplicate issues
  • You didn't use /reload

Describe the question
Using the EntitySquid class in the .getMinecraftClass returns the following:

[02:29:42] [Server thread/WARN]: java.lang.RuntimeException: Failed to find NMS class: EntitySquid
[02:29:42] [Server thread/WARN]:     at com.comphenix.protocol.utility.MinecraftReflection.lambda$getMinecraftClass$1(MinecraftReflection.java:2063)
[02:29:42] [Server thread/WARN]:     at java.base/java.util.Optional.orElseThrow(Optional.java:403)
[02:29:42] [Server thread/WARN]:     at com.comphenix.protocol.utility.MinecraftReflection.getMinecraftClass(MinecraftReflection.java:2063)

API method(s) used
MinecraftReflection.getMinecraftClass
Accessors.getConstructorAccessor
MinecraftReflection.getCraftBukkitClass

Expected behavior
No error returned and an entity constructed from the methods used.

Code

Entity fakeSquid = (Entity) Accessors.getConstructorAccessor(MinecraftReflection.getCraftBukkitClass(
                "entity.CraftSquid"), MinecraftReflection.getCraftBukkitClass("CraftServer"),
                MinecraftReflection.getMinecraftClass("EntitySquid")).invoke(null,
                Accessors.getConstructorAccessor(MinecraftReflection.getMinecraftClass("EntitySquid"),
                        MinecraftReflection.getNmsWorldClass()).invoke(new Object[]{null}));
commented

I think the squid class is something like entity.Squid

commented

Same error from that unfortunately

[22:18:43 WARN]: java.lang.RuntimeException: Failed to find NMS class: entity.Squid
[22:18:43 WARN]:        at com.comphenix.protocol.utility.MinecraftReflection.lambda$getMinecraftClass$1(MinecraftReflection.java:2063)
[22:18:43 WARN]:        at java.base/java.util.Optional.orElseThrow(Optional.java:408)
[22:18:43 WARN]:        at com.comphenix.protocol.utility.MinecraftReflection.getMinecraftClass(MinecraftReflection.java:2063)
commented

Sorry, world.entity.animal.EntitySquid