ViaVersion/common/src/main/java/com/viaversion/viaversion/protocols
KennyTV 3a1e364d4a
Refactor entity tracking and meta handling
This essentially merges the two approaches to the metadata handling from ViaVersion and ViaBackwards and improves on both designs.

ViaVersion did not track every single entity, but only those needed (at least in theory) and can work with untracked entities' metadata. It had a very simple method overridden by metadata rewriter implementations, directly operating on the full metadata list and manually handling meta index changes as well as item/block/particle id changes.

ViaBackwards on the other hand had to track *every single* entity and threw warnings otherwise - while less prone to errors due to giving obvious warnings in the console, it unnecessarily tracks a lot of entities, and those warnings also annoys users when encountering virtual entity plugins (operating asynchronously and sending update packets while already untracked or not yet tracked). Dedicated MetaHandlers made id changes and filtering a lot easier to read and write. However, the actual metadata list handling and its distribution to handlers was not very well implemented and required a lot of list copying and creation as well as exception throws to cancel individual metadata entries.

This version has MetaFilters built with a Builder containing multiple helper functions, and the entity tracking is properly given its own map, hashed by a Protocol's class, to be easily and generically accessible from anywhere with only a Protocol class from the UserConnection, along with more optimized metadata list iteration. The entity tracking is largely unchanged, keeping ViaVersion's approach to not having to track *all* entities (and being able to handle null types in meta handlers).

All of this is by no means absolutely perfect, but is much less prone to errors than both previous systems and takes a lot less effort to actually write. A last possible change would be to use a primitive int to object map that is built to be concurrency save for the EntityTracker, tho that would have to be chosen carefully.
2021-05-25 15:37:07 +02:00
..
base Rename outgoing->clientbound, incoming->serverbound 2021-04-28 16:30:34 +02:00
protocol1_8 Rename PacketType methods 2021-05-02 11:14:38 +02:00
protocol1_9_1_2to1_9_3_4 Make ChunkSection an interface, don't allocate light arrays if not needed 2021-05-20 18:32:28 +02:00
protocol1_9_1to1_9 Rename outgoing->clientbound, incoming->serverbound 2021-04-28 16:30:34 +02:00
protocol1_9_3to1_9_1_2 Make ChunkSection an interface, don't allocate light arrays if not needed 2021-05-20 18:32:28 +02:00
protocol1_9to1_8 Refactor entity tracking and meta handling 2021-05-25 15:37:07 +02:00
protocol1_9to1_9_1 Rename outgoing->clientbound, incoming->serverbound 2021-04-28 16:30:34 +02:00
protocol1_10to1_9_3 Refactor entity tracking and meta handling 2021-05-25 15:37:07 +02:00
protocol1_11_1to1_11 Rename abstract Protocol to AbstractProtocol 2021-04-27 18:21:51 +02:00
protocol1_11to1_10 Refactor entity tracking and meta handling 2021-05-25 15:37:07 +02:00
protocol1_12_1to1_12 Rename PacketType methods 2021-05-02 11:14:38 +02:00
protocol1_12_2to1_12_1 Rename outgoing->clientbound, incoming->serverbound 2021-04-28 16:30:34 +02:00
protocol1_12to1_11_1 Refactor entity tracking and meta handling 2021-05-25 15:37:07 +02:00
protocol1_13_1to1_13 Refactor entity tracking and meta handling 2021-05-25 15:37:07 +02:00
protocol1_13_2to1_13_1 Refactor entity tracking and meta handling 2021-05-25 15:37:07 +02:00
protocol1_13to1_12_2 Refactor entity tracking and meta handling 2021-05-25 15:37:07 +02:00
protocol1_14_1to1_14 Refactor entity tracking and meta handling 2021-05-25 15:37:07 +02:00
protocol1_14_2to1_14_1 Rename abstract Protocol to AbstractProtocol 2021-04-27 18:21:51 +02:00
protocol1_14_3to1_14_2 Rename outgoing->clientbound, incoming->serverbound 2021-04-28 16:30:34 +02:00
protocol1_14_4to1_14_3 Rename outgoing->clientbound, incoming->serverbound 2021-04-28 16:30:34 +02:00
protocol1_14to1_13_2 Refactor entity tracking and meta handling 2021-05-25 15:37:07 +02:00
protocol1_15_1to1_15 Rename abstract Protocol to AbstractProtocol 2021-04-27 18:21:51 +02:00
protocol1_15_2to1_15_1 Rename abstract Protocol to AbstractProtocol 2021-04-27 18:21:51 +02:00
protocol1_15to1_14_4 Refactor entity tracking and meta handling 2021-05-25 15:37:07 +02:00
protocol1_16_1to1_16 Rename abstract Protocol to AbstractProtocol 2021-04-27 18:21:51 +02:00
protocol1_16_2to1_16_1 Refactor entity tracking and meta handling 2021-05-25 15:37:07 +02:00
protocol1_16_3to1_16_2 Rename abstract Protocol to AbstractProtocol 2021-04-27 18:21:51 +02:00
protocol1_16_4to1_16_3 Rename outgoing->clientbound, incoming->serverbound 2021-04-28 16:30:34 +02:00
protocol1_16to1_15_2 Refactor entity tracking and meta handling 2021-05-25 15:37:07 +02:00
protocol1_17to1_16_4 Refactor entity tracking and meta handling 2021-05-25 15:37:07 +02:00