packetevents
packetevents copied to clipboard
Added WrapperPlayServerMapData
https://wiki.vg/Protocol#Map_Data
On which versions have you tested it yet?
I tested it on 1.8 only, for newer version I find information from spigot source and wiki
Great! Now 2 last things are still missing:
- Getters and Setters in the wrapper class for the local parameters
- I'd suggest adding some abstraction for the MapIcon type. It's currently just a plain byte but it'd to better to have a separate MapType (?) Class which would provide its type as a enum
Firstly, use serverVersion instead of clientVersion. Secondly please announce what you're going to work on before hand in either a GitHub issue or in our Discord. Right now I wasn't trying to accept further wrapper pull requests as I am trying to do some refactoring for our wrapper abstraction.
I'll get to this soon though.
I made this PR simply because it's missing when I'm trying to use it in one of my project, do I need to create an issue called "Missing wrapper for map data" or something like that?
Yea, making an issue beforehand is always good.
Potential bug on WrapperPlayServerMapData::write line 95? I think should be this.writeByte((icon.getType().getId() % 27) << 4 | icon.getRotation() & 15); or just this.writeByte((icon.getType().getId() << 4) | (icon.getRotation() & 15)); assuming getId will only have correct values... because with current implementation you will get wrong type in MapIcon line 22. Just need this.type = Type.getById((byte) (s >> 4)); this.rotation = (byte) (s & 15); will still work if you make the above change and get rid of (icon.getType().getId() & 15) << 4 on line 95 @LeeGodSRC @retrooper
val & 15 is equivalent to val % 16
What are we waiting for?
I'll reopen another PR for this.