Issue with negative map ids #14

Open
opened 2023-02-02 15:29:17 +01:00 by cerus · 6 comments
cerus commented 2023-02-02 15:29:17 +01:00 (Migrated from github.com)

Hello,

I've noticed that you're negating negative map ids when a map packet is sent and I'm wondering why exactly you're doing that. Is there a specific reason for that? It's breaking other plugins and potentially Vanilla behavior as well.

https://github.com/SBDPlugins/MapReflectionAPI/blob/master/src/main/java/tech/sbdevelopment/mapreflectionapi/listeners/PacketListener.java#L68-L71

Thank you!

Hello, I've noticed that you're negating negative map ids when a map packet is sent and I'm wondering why exactly you're doing that. Is there a specific reason for that? It's breaking other plugins and potentially Vanilla behavior as well. https://github.com/SBDPlugins/MapReflectionAPI/blob/master/src/main/java/tech/sbdevelopment/mapreflectionapi/listeners/PacketListener.java#L68-L71 Thank you!
stijnb1234 commented 2023-02-02 16:06:24 +01:00 (Migrated from github.com)

That's done to detect map ids created by MapReflectionAPI. In the packet listener, the event is called and the number is swapped again (negative to positive).

That's done to detect map ids created by MapReflectionAPI. In the packet listener, the event is called and the number is swapped again (negative to positive).
cerus commented 2023-02-02 16:45:57 +01:00 (Migrated from github.com)

That unfortunately breaks other plugins that also use negative map ids. Is the negative -> positive conversion needed? The Minecraft client will accept negative ids, that shouldn't be a problem.

That unfortunately breaks other plugins that also use negative map ids. Is the negative -> positive conversion needed? The Minecraft client will accept negative ids, that shouldn't be a problem.
stijnb1234 commented 2023-02-02 16:55:31 +01:00 (Migrated from github.com)

Do you have some example plugins broken?

Do you have some example plugins broken?
cerus commented 2023-02-02 17:38:59 +01:00 (Migrated from github.com)

I only have one example: cerus/maps.
maps also uses negative ids for clientside maps. The id counter starts at Integer.MIN_VALUE and counts up whenever a new clientside map is created. The map id is also used to send item frame packets that contain these maps. Changing the id will make the maps appear without any drawings to the client, because the item frame packets still contain the negative id.

I only have one example: [cerus/maps](https://github.com/cerus/maps). maps also uses negative ids for clientside maps. The id counter starts at Integer.MIN_VALUE and counts up whenever a new clientside map is created. The map id is also used to send item frame packets that contain these maps. Changing the id will make the maps appear without any drawings to the client, because the item frame packets still contain the negative id.
stijnb1234 commented 2023-02-02 17:54:29 +01:00 (Migrated from github.com)

I see. This plugin is a fork, so I have to look into that further to see what's the exact reason it's used.

I see. This plugin is a fork, so I have to look into that further to see what's the exact reason it's used.
cerus commented 2023-02-02 18:00:52 +01:00 (Migrated from github.com)

I appreciate the help, let me know if you need anything else

I appreciate the help, let me know if you need anything else
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference: SBDevelopment/MapReflectionAPI#14
No description provided.