packetevents icon indicating copy to clipboard operation
packetevents copied to clipboard

Added WrapperPlayServerMapData

Open LeeGodSRC opened this issue 3 years ago • 9 comments
trafficstars

https://wiki.vg/Protocol#Map_Data

LeeGodSRC avatar Jul 22 '22 03:07 LeeGodSRC

On which versions have you tested it yet?

NoJokeFNA avatar Jul 23 '22 14:07 NoJokeFNA

I tested it on 1.8 only, for newer version I find information from spigot source and wiki

LeeGodSRC avatar Jul 23 '22 14:07 LeeGodSRC

Great! Now 2 last things are still missing:

  1. Getters and Setters in the wrapper class for the local parameters
  2. 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

NoJokeFNA avatar Jul 24 '22 10:07 NoJokeFNA

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.

retrooper avatar Jul 25 '22 16:07 retrooper

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?

LeeGodSRC avatar Jul 27 '22 03:07 LeeGodSRC

Yea, making an issue beforehand is always good.

retrooper avatar Jul 27 '22 22:07 retrooper

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

markvolkov avatar Aug 12 '22 06:08 markvolkov

val & 15 is equivalent to val % 16

markvolkov avatar Aug 12 '22 06:08 markvolkov

What are we waiting for?

SquidXTV avatar Dec 18 '23 13:12 SquidXTV

I'll reopen another PR for this.

LeeGodSRC avatar Apr 16 '24 08:04 LeeGodSRC