NBT-API

NBT-API

98.9k Downloads

1.8.8: Entity wasn't the correct class error

kangarko opened this issue ยท 5 comments

commented

Using the following code snippet:

a

Getting the following error on PaperSpigot for 1.8.8:

[16:30:23] [Server thread/INFO]: [Orion] !-----------------------------------------------------!
[16:30:23] [Server thread/INFO]: [Orion] Failed to get NBT tag for CREEPER. Tag: OrionBoss
[16:30:23] [Server thread/INFO]: [Orion] !-----------------------------------------------------!
[16:30:24] [Server thread/INFO]: This server is running CraftBukkit version git-PaperSpigot-"4c7641d" (MC: 1.8.8) (Implementing API version 1.8.8-R0.1-SNAPSHOT)
[16:30:24] [Server thread/INFO]: Checking version, please wait...
[16:30:24] [Server thread/INFO]: Entity wasn't the correct class! 'net.minecraft.server.v1_8_R3.EntityPlayer'
[16:30:24] [Server thread/INFO]: [Orion] Orion 1.0.0 encountered a NullPointerException! Please check your error.log and report this issue with the information in that file.
[16:30:24] [Server thread/INFO]: java.lang.NullPointerException
[16:30:24] [Server thread/INFO]: at org.mineacademy.fo.remain.CompMetadata.getMetadata(CompMetadata.java:183)
[16:30:24] [Server thread/INFO]: at org.mineacademy.orion.boss.model.Boss.findBoss(Boss.java:329)
[16:30:24] [Server thread/INFO]: at org.mineacademy.orion.boss.BossTimedTask.getBossesInWorld(BossTimedTask.java:73)
[16:30:24] [Server thread/INFO]: at org.mineacademy.orion.boss.BossTimedTask.run(BossTimedTask.java:44)
[16:30:24] [Server thread/INFO]: at java.lang.Thread.run(Thread.java:748)
[16:30:24] [Server thread/INFO]: [Orion] !-----------------------------------------------------!
[16:30:24] [Server thread/INFO]: [Orion] Failed to get NBT tag for PLAYER. Tag: OrionBoss
[16:30:24] [Server thread/INFO]: [Orion] !-----------------------------------------------------!
[16:30:24] [Server thread/INFO]: Entity wasn't the correct class! 'net.minecraft.server.v1_8_R3.EntityCreeper'
[16:30:24] [Server thread/INFO]: [Orion] Orion 1.0.0 encountered a NullPointerException! Please check your error.log and report this issue with the information in that file.
[16:30:24] [Server thread/INFO]: java.lang.NullPointerException
[16:30:24] [Server thread/INFO]: at org.mineacademy.fo.remain.CompMetadata.getMetadata(CompMetadata.java:183)
[16:30:24] [Server thread/INFO]: at org.mineacademy.orion.boss.model.Boss.findBoss(Boss.java:329)
[16:30:24] [Server thread/INFO]: at org.mineacademy.orion.boss.BossTimedTask.getBossesInWorld(BossTimedTask.java:73)
[16:30:24] [Server thread/INFO]: at org.mineacademy.orion.boss.BossTimedTask.run(BossTimedTask.java:44)
[16:30:24] [Server thread/INFO]: at java.lang.Thread.run(Thread.java:748)
commented

I forgot to include the startup log, here it is:

[16:33:52] [Server thread/INFO]: [NBTAPI] Loading NBTAPI v2.0.0-SNAPSHOT
[16:33:52] [Server thread/INFO]: [NBTAPI] Injecting custom NBT
[16:33:52] [Server thread/INFO]: [NBTINJECTOR] Injecting Entity classes...
[16:33:52] [Server thread/INFO]: [NBTAPI] Found Spigot: v1_8_R3! Trying to find NMS support
[16:33:52] [Server thread/INFO]: [NBTAPI] NMS support 'MC1_8_R3' loaded!
[16:33:52] [Server thread/INFO]: [NBTAPI] Using the plugin 'PermissionsEx' to create a bStats instance!
[16:33:52] [Server thread/INFO]: [NBTINJECTOR] Injecting Tile Entity classes...
[16:33:52] [Server thread/INFO]: [NBTAPI] Injected!
[16:33:52] [Server thread/INFO]: [Orion] Loading Orion v1.0.0
[16:33:52] [Server thread/INFO]: [Vault] Loading Vault v1.5.6-b49
[16:33:52] [Server thread/INFO]: [WorldEditBridge] Loading WorldEditBridge v2.0.1
[16:33:52] [Server thread/INFO]: [FuckWeather] Loading FuckWeather v2.0.4
[16:33:52] [Server thread/INFO]: [ProtocolLib] Loading ProtocolLib v4.2.0
[16:33:52] [Server thread/INFO]: [Essentials] Loading Essentials v2.0.1-b468
[16:33:52] [Server thread/INFO]: [EssentialsSpawn] Loading EssentialsSpawn v2.0.1-b468
[16:33:52] [Server thread/INFO]: [Vault] Enabling Vault v1.5.6-b49
[16:33:52] [Server thread/INFO]: [Vault] [Economy] Essentials Economy found: Waiting
[16:33:53] [Server thread/INFO]: [Vault] [Permission] SuperPermissions loaded as backup permission system.
[16:33:53] [Server thread/INFO]: [ProtocolLib] Enabling ProtocolLib v4.2.0
[16:33:53] [Server thread/INFO]: Preparing level "world"
[16:33:53] [Server thread/INFO]: Preparing start region for level 0 (Seed: -7500048441588520522)
[16:33:53] [Server thread/INFO]: [PermissionsEx] Enabling PermissionsEx v1.23.3
[16:33:53] [Server thread/INFO]: [WorldEdit] Enabling WorldEdit v6.1.8-SNAPSHOT;cd4729f
[16:33:53] [Server thread/INFO]: [GameAPI] Enabling GameAPI v3.1.1
[16:33:53] [Server thread/INFO]: [NBTAPI] Enabling NBTAPI v2.0.0-SNAPSHOT
[16:33:53] [Server thread/INFO]: [NBTAPI] Checking bindings...
[16:33:53] [Server thread/INFO]: [NBTAPI] Gson:
[16:33:53] [Server thread/INFO]: [NBTAPI] Found Gson: class com.google.gson.Gson
[16:33:53] [Server thread/INFO]: [NBTAPI] Classes:
[16:33:53] [Server thread/INFO]: [NBTAPI] All Classes where able to link!
[16:33:53] [Server thread/INFO]: [NBTAPI] Methods:
[16:33:53] [Server thread/INFO]: [NBTAPI] All Methods where able to link!
[16:33:53] [Server thread/INFO]: [NBTAPI] Running NBT reflection test...
[16:33:53] [Server thread/INFO]: [NBTAPI] GetterSetterTest: Ok
[16:33:53] [Server thread/INFO]: [NBTAPI] MergeTest: Ok
[16:33:53] [Server thread/INFO]: [NBTAPI] ListTest: Ok
[16:33:53] [Server thread/INFO]: [NBTAPI] TilesCustomNBTTest: Ok
[16:33:53] [Server thread/INFO]: [NBTAPI] TypeTest: Ok
[16:33:53] [Server thread/INFO]: [NBTAPI] EntityCustomNbtTest: Ok
[16:33:53] [Server thread/INFO]: [NBTAPI] NBTFileTest: Ok
[16:33:53] [Server thread/INFO]: [NBTAPI] RemovingKeys: Ok
[16:33:53] [Server thread/INFO]: [NBTAPI] SubCompoundsTest: Ok
[16:33:53] [Server thread/INFO]: [NBTAPI] EntityTest: Ok
[16:33:53] [Server thread/INFO]: [NBTAPI] ItemConvertionTest: Ok
[16:33:53] [Server thread/INFO]: [NBTAPI] EmptyItemTest: Ok
[16:33:53] [Server thread/INFO]: [NBTAPI] Success! This version of NBT-API is compatible with your server.
commented

To use custom data on an Entity, you need to call patchEntity(ent) on it at least once. This will respawn the entity and return the new Entity. Since people might not expect this to happen, the getNbtData method doesn't do it by itself like with Tiles.

commented

Yea that method only does anything if needed, so you can call it however often you want/anytime before using custom nbt. With riding entities... Eh don't? Bestcase the entity gets ejected, worstcase it vanishes or gets corrupted because it's mount is gone. If you plan to have custom nbt and using mounting, patch the Entity before putting anything on it(Best case just spawn and patch it in one line of code).

commented

Alright thanks,

is it okay if I call it each time before I am about to set the metadata?

If the entity is riding something will the mount eject, as well as are there any other implications?

commented

Thanks, yep, we're tagging it before we transform it into a custom entity.

Have an excellent day!