ProtocolLib

3M Downloads

Unliving entities don't work correctly.

KingAlterIV opened this issue ยท 2 comments

commented

Describe the bug
Unliving entities are not working correctly and their hitboxes are wide.

To Reproduce

  1. Go to 'https://gist.github.com/KingAlterIV/6ab2fb0a233d4ff951926fbedcf94bb9'
  2. Copy and paste it into a class file
  3. Do the basic set up of a command
  4. Compile it
  5. Go in-game and execute /test

Expected behavior
Something like this, but instead of eggs it's pearls.
https://cdn.discordapp.com/attachments/336551419970846720/707666314734469120/Screenshot_2020-05-06_at_20.53.06.png

Screenshots
Gif of their wide hitboxes
https://i.imgur.com/OlLWLxy.gif

Version Info
https://gist.github.com/KingAlterIV/93c5412f362dd36bfabce88b84716b40

Additional context

ver
[12:11:43 INFO]: This server is running Tuinity version git-Tuinity-"c2ad42c" (MC: 1.15.2) (Implementing API version 1.15.2-R0.1-SNAPSHOT)
[12:11:43 INFO]: Checking version, please wait...
[12:11:44 INFO]: You are 59 version(s) behind
ver ProtocolLib
[12:11:47 INFO]: ProtocolLib version 4.5.1-SNAPSHOT-b451
[12:11:47 INFO]: Provides read/write access to the Minecraft protocol.
[12:11:47 INFO]: Authors: dmulloy2 and comphenix
commented

Protocollib doesn't alter packets in any way. If stuff is displayed dum, is cause you send dum data.

In your code, you try to write the entity id using:
packet.getIntegers().write(1, 80);
what you actually want to do is:
handle.getEntityTypeModifier().write(0, EntityType.ENDERPEARL);

you most likely made a common beginner mistake: looking at wiki vg.
Protocollib writes to minecrafts packet class, not to the wire, so you need to use the format minecraft uses in the packet, not the wire format:
https://i.imgur.com/Rz48VgB.png
as you can see, the packet uses an entity type field, so thats what you want to write to, not the second integer, which is xa or the x speed.

minecraft will write the int for you:
https://i.imgur.com/yR9oI4W.png

commented

Solved with @MiniDigger getting himself a Balmer's Peak