aadnk / ProtocolLib

Provides read and write access to the Minecraft protocol with Bukkit.
GNU General Public License v2.0
288 stars 92 forks source link

FieldAccessException: No field with type double exists in class PacketPlayOutNamedEntitySpawn #167

Closed noahcoetsee closed 4 years ago

noahcoetsee commented 4 years ago

I have attempted to create a basic nicking system in my plugin:

Before I show you my full code, just know that here are the lines causing the error:

namedEntitySpawn.getDoubles().write(0, location.getX());
namedEntitySpawn.getDoubles().write(1, location.getY());
namedEntitySpawn.getDoubles().write(2, location.getZ());

It's clear that PacketPlayOutNamedEntitySpawn contains these: https://wiki.vg/Protocol#Spawn_Player

I don't know where I'm going wrong?

@dmulloy2 :D

Here's the full error:

FieldAccessException: No field with type double exists in class PacketPlayOutNamedEntitySpawn.
24.09 20:16:06 [Server] INFO at com.comphenix.protocol.reflect.StructureModifier.writeInternal(StructureModifier.java:363)
24.09 20:16:06 [Server] INFO at com.comphenix.protocol.reflect.StructureModifier.write(StructureModifier.java:343)
24.09 20:16:06 [Server] INFO at com.featuredspace.plugin.Core.test.nick.NameTag.applyTo(NameTag.java:78)
24.09 20:16:06 [Server] INFO at com.featuredspace.plugin.Core.test.TestNickCommand.onCommand(TestNickCommand.java:22)
24.09 20:16:06 [Server] INFO at com.featuredspace.plugin.Core.lib.fo.command.SimpleCommand.execute(SimpleCommand.java:305)
24.09 20:16:06 [Server] INFO at org.bukkit.command.SimpleCommandMap.dispatch(SimpleCommandMap.java:146)
24.09 20:16:06 [Server] INFO at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511)
24.09 20:16:06 [Server] INFO at java.util.concurrent.FutureTask.run(FutureTask.java:266)
24.09 20:16:06 [Server] INFO at java.lang.Thread.run(Thread.java:748)
MiniDigger commented 4 years ago

to me it looks like you are running the server on an outdated version. 16w06a (protocol version 100) changed this over 3 and a half years ago from fixed point ints to doubles. that means, 1.8 still has integers, while anything newer uses doubles.

protocollib behaves as expected.

in the future: please fill out the issue template, it contains important stuff needing to debug any issues. having the server version would have made this way more obvious.

noahcoetsee commented 4 years ago

Ok, my apologies.