Commit Graph

66 Commits

Author SHA1 Message Date
Nassim Jahnke
f868dfa125
Update ViaNBT 2024-03-07 13:30:33 +01:00
Nassim Jahnke
8a485db580
Replace tag instanceof checks/unchecked casts with helper methods 2024-02-10 23:28:36 +01:00
EnZaXD
0d788b0d7a
Clean up more item type usage in ItemRewriter (#3674) 2024-01-29 17:21:59 +01:00
Nassim Jahnke
5991ac5633
Update old metadata handlers, some cleanup 2024-01-09 20:43:43 +01:00
Nassim Jahnke
bd2c4c8a16
Update license headers 2024-01-01 12:39:45 +01:00
RK_01
1f453dc0d9
Change gamemode data type in JOIN_GAME handlers (#3541) 2023-12-03 18:35:19 +01:00
Nassim Jahnke
a2d287ff9f
23w45a 2023-11-09 15:35:07 +10:00
Nassim Jahnke
7edde72416
Reuse 1.15, 1.16 and 1.16.2 chunk types as well 2023-10-20 12:43:46 +10:00
Nassim Jahnke
a30d62a995
Move and rename chunk types 2023-10-19 21:03:00 +10:00
Nassim Jahnke
fdfc528a9a
Cleanup and renames around types 2023-10-19 09:28:21 +10:00
Nassim Jahnke
c211b10eaa
Rename NBT and NBT_ARRAY types, add TagType
In theory the nameless compound tag type doesn't exist as it is written as any tag, but in practice is almost always cast and checked for its type, so we keep the extra CompoundTagType (nameless) and add the proper TagType (nameless, any tag) used for components
2023-10-06 22:35:00 +10:00
RK_01
2b9e0cec5c
Fix maps with no map id set showing up as empty on 1.17+ (#3395) 2023-08-06 11:11:42 +10:00
Nassim Jahnke
1a46346789
Handle optional block state entity meta 2023-04-18 13:34:20 +02:00
Nassim Jahnke
51d4e11b5f
Minimize/optimize mapping data files 2023-03-04 00:08:08 +01:00
Nassim Jahnke
1faf1f3f49
Reduce RecipeRewriter extends chain 2023-02-16 12:27:31 +01:00
Nassim Jahnke
cb2165eb93
Greatly reduce the number of (anonymous) inner classes
Reduces code complexity, and much more importantly, reduces the number of classes loaded at runtime by *hundreds*
2023-02-12 11:46:48 +01:00
Nassim Jahnke
de5b7bf828
Allow registration of simple packet handlers over extending an abstract class 2023-02-12 10:54:47 +01:00
Nassim Jahnke
088f654159
Remove some deprecated api usage, small cleanup 2023-02-04 19:42:26 +01:00
Nassim Jahnke
1a5f83619d
Ensure correct packet types are used on rewriters 2023-02-04 18:29:22 +01:00
Nassim Jahnke
4fb95581ce
Update copyright headers 2023-01-12 12:45:53 +01:00
Nassim Jahnke
14b11bdd10
Start working on 22w42a 2022-10-19 21:58:08 +02:00
Nassim Jahnke
3eba8ba922
More consistent client entity tracking 2022-05-20 09:53:39 +02:00
RK_01
823eb1f392
Fix inventory acknowledgements being dropped sometimes (#2848) 2022-03-16 18:35:58 +01:00
Nassim Jahnke
d5a568b3fc
Update copyright header 2022-01-09 22:36:07 +01:00
Nassim Jahnke
06a7260173
Fill dirt block tag to fix flower place animation 2021-12-20 10:53:11 +01:00
Nassim Jahnke
20e9723d21
Update Gradle, particles finally work everywhere™️
Fixes #2746
2021-12-02 10:54:32 +01:00
Nassim Jahnke
a49c395486
Make changes in particles easier to handle 2021-11-10 11:35:44 +01:00
Gero
02122f8ce6 Fix #2532 2021-10-01 15:35:04 +02:00
Nassim Jahnke
f2147179c2
Small fixes, add majorVersion method, nicer getter names in some classes
None of the deprecated methods will be removed anytime soon.
2021-08-28 22:15:28 +02:00
kennytv
db87774426
Fix ProtocolSupport compat on 1.17
Fixes #2632

Thank you md_5, very cool
2021-07-23 10:15:59 +02:00
KennyTV
24393d4ef4
1.17.1-pre2 2021-06-29 18:11:51 +02:00
LemonCaramel
14cd568e46
Add Resource pack prompt message option (1.17+) (#2544) 2021-06-21 14:55:49 +02:00
KennyTV
5cdaabeaec
Handle particle id change in 1.16 metadata
Fixes #2551
2021-06-17 11:55:22 +02:00
KennyTV
593aa7564a
Put the other filled 1.17 tags into the diff file 2021-06-07 09:58:52 +02:00
KennyTV
24efb48004
Add method to load extra tags from diff files 2021-06-06 17:17:51 +02:00
KennyTV
d89f916546
Cleanup 1.17 entity rewriter, fix DataItem amount check 2021-06-06 10:08:15 +02:00
KennyTV
2b8c5082ed
Make Item an interface, more OOP for the ItemRewriter 2021-06-04 12:15:14 +02:00
KennyTV
fc1450fe38
Slightly more OOP, move registerPackets out of Protocol constructor
registerPackets being called within the constructor made it impossible to create instance objects then used in registerPackets (vs. having to then create the objects in registerPackets).
2021-06-03 17:28:02 +02:00
KennyTV
b2855c2cd4
F 2021-06-02 23:22:09 +02:00
KennyTV
fec777b349
Don't wrap direct type mappers 2021-06-02 23:22:00 +02:00
KennyTV
7b1f9c199a
Produce less overhead in packet handler registering
Instead of creating a void type reader for every single PacketHandler registered, this just directly uses the consumer-like PacketHandler.

The distinction between ValueCreator and the normal PacketHandler was unnecessary given you could also just read something in a ValueCreator instance, effectively just being a consumer of a PacketWrapper instance.
2021-06-02 22:00:20 +02:00
KennyTV
a8b3444ff5
1.17-pre4 2021-06-02 18:44:47 +02:00
KennyTV
6839334c1a
Fix confirmation id encoding, remove old send methods 2021-06-02 12:44:49 +02:00
KennyTV
37fd69fa86
Make packet send methods use the current thread by default
Defaulting to submitting to the netty event loop caused issues more often than not - this also removes the `currentThread` flag and instead provides new scheduleSend methods so it is always obvious whether the packet is sent immediately.
2021-06-01 10:13:49 +02:00
KennyTV
3fb125592b
Send entity destroy on current thread 2021-05-31 20:45:56 +02:00
KennyTV
7925fd2d8f
Fix shulker meta handling 2021-05-31 20:17:43 +02:00
KennyTV
53642e9a3c
1.17-pre1 2021-05-27 15:36:53 +02:00
KennyTV
fd9dab8aa1
Replace inventory ack by using 1.17 ping packets 2021-05-26 21:36:20 +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