ProtocolLib

3M Downloads

REL_ENTITY_MOVE_LOOK causes exception on v1_13_R2 (1.13.2)

patrick-choe opened this issue ยท 4 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
A clear and concise description of what your question is.

  • PacketContainer(PacketType.Play.Server.REL_ENTITY_MOVE_LOOK) does not work as expected on v1_13_R2 (1.13.2)

API method(s) used
List what API method(s) you're using

  • PacketContainer(PacketType.Play.Server.REL_ENTITY_MOVE_LOOK)

Expected behavior
A clear and concise description of what you expected to happen.

  • No exception should occur (Tested the same code on v1_15_R1/1.15.2)

Code
If applicable, add relevant code from your project

    fun lookAndRelativeMove(
        entityId: Int,
        deltaX: Short,
        deltaY: Short,
        deltaZ: Short,
        yaw: Float,
        pitch: Float,
        onGround: Boolean
    ): PacketContainer {
        return PacketContainer(PacketType.Play.Server.REL_ENTITY_MOVE_LOOK).apply {
            integers
                .write(0, entityId)
            shorts
                .write(0, deltaX)
                .write(1, deltaY)
                .write(2, deltaZ)
            bytes
                .write(0, (yaw * 256.0 / 360.0).toByte())
                .write(1, (pitch * 256.0 / 360.0).toByte())
            booleans
                .write(0, onGround)
        }
    }

Additional context
Add any other context about the problem here.
I'm not sure why this exception occurs.

[21:03:20 WARN]: [Tap] Task #3 for Tap v2.5 generated an exception
com.comphenix.protocol.reflect.FieldAccessException: No field with type short exists in class PacketPlayOutRelEntityMoveLook.
        at com.comphenix.protocol.reflect.StructureModifier.writeInternal(StructureModifier.java:363) ~[?:?]
        at com.comphenix.protocol.reflect.StructureModifier.write(StructureModifier.java:343) ~[?:?]
        at com.github.noonmaru.tap.protocol.EntityPacketSupport.lookAndRelativeMove(PacketSupport.kt:214) ~[?:?]
        at com.github.noonmaru.tap.fake.internal.FakeEntityImpl.updateLocation(FakeEntityImpl.kt:322) ~[?:?]
        at com.github.noonmaru.tap.fake.internal.FakeEntityImpl.update$api(FakeEntityImpl.kt:259) ~[?:?]
        at com.github.noonmaru.tap.fake.internal.FakeServerImpl.update(FakeServerImpl.kt:108) ~[?:?]
        at com.github.noonmaru.tap.TapPlugin$debug$$inlined$apply$lambda$1.run(TapPlugin.kt:61) ~[?:?]
        at org.bukkit.craftbukkit.v1_13_R2.scheduler.CraftTask.run(CraftTask.java:84) ~[patched_1.13.2.jar:git-Paper-655]
        at org.bukkit.craftbukkit.v1_13_R2.scheduler.CraftScheduler.mainThreadHeartbeat(CraftScheduler.java:449) ~[patched_1.13.2.jar:git-Paper-655]
        at net.minecraft.server.v1_13_R2.MinecraftServer.b(MinecraftServer.java:1010) ~[patched_1.13.2.jar:git-Paper-655]
        at net.minecraft.server.v1_13_R2.DedicatedServer.b(DedicatedServer.java:439) ~[patched_1.13.2.jar:git-Paper-655]
        at net.minecraft.server.v1_13_R2.MinecraftServer.a(MinecraftServer.java:940) ~[patched_1.13.2.jar:git-Paper-655]
        at net.minecraft.server.v1_13_R2.MinecraftServer.run(MinecraftServer.java:837) ~[patched_1.13.2.jar:git-Paper-655]
        at java.lang.Thread.run(Thread.java:748) [?:1.8.0_251]
commented

Protocol for 1.13.2 shows the method exists.

commented

v1_14_R1 (1.14.4) Works as expected.

commented

Try decompiling the packet class to look at the fields, this isn't a protocollib issue.

commented

Try decompiling the packet class to look at the fields, this isn't a protocollib issue.

Thank you so much! The type of deltas were changed from long to short. Thanks!