Commit Graph

13 Commits

Author SHA1 Message Date
Nassim Jahnke ef78fcd478
Update API license headers and scope 2024-01-12 10:21:45 +01:00
Nassim Jahnke 67ba0e9566 Fix typos of entity 2023-10-08 19:03:14 +10:00
Nassim Jahnke 98c645f7ed
Store tracked entity data a little differently 2023-02-10 12:00:20 +01:00
Nassim Jahnke 4fb95581ce
Update copyright headers 2023-01-12 12:45:53 +01:00
Nassim Jahnke 71a68bf36e
Fix the client entity being untracked on world changes
Fixes #2894 and probably other things
2022-05-19 23:04:18 +02:00
Nassim Jahnke 7dc7b62cc9
22w19a (and a varying mix of removed and added dread) 2022-05-12 23:49:15 +02:00
Nassim Jahnke 4693b95bea
22w14a 2022-04-06 19:07:16 +02:00
Nassim Jahnke d5a568b3fc
Update copyright header 2022-01-09 22:36:07 +01:00
Nassim Jahnke 73093c0ff2
Read/write palette based on block/biome size variables 2021-09-16 18:12:33 +02:00
Nassim Jahnke c264e639d6
Clear entity data on world change in world tracker 2021-09-14 17:35:27 +02:00
Nassim Jahnke 533572e8cd
Add CREATE_FOG BossFlag 2021-08-27 19:29:07 +02:00
KennyTV 2d0a597f74
Make Metadata fully type safe, remove "Discontinued" meta types
The Discontinued entry was a special edge case that could lead to a Metadata type returning null. Instead, just directly use null in the 1.8->1.9 code where it is checked against. Also renamed the Meta1_17Types entries to be in uppercase and properly represent their value type.
2021-05-26 16:36:47 +02:00
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