Commit Graph

47 Commits

Author SHA1 Message Date
FlorianMichael
b9e92e5c1f
Fix zombie metadata in 1.10->1.11 2024-04-21 11:24:20 +02:00
EnZaXD
f44782d21d
Fix minor inconsistencies in protocol packages (#3768) 2024-04-01 12:55:50 +02:00
Nassim Jahnke
feefe6f278
Merge branch 'master' into dev
# Conflicts:
#	bukkit-legacy/src/main/java/com/viaversion/viaversion/bukkit/util/ProtocolSupportUtil.java
#	bukkit/src/main/java/com/viaversion/viaversion/bukkit/platform/BukkitViaInjector.java
#	bungee/src/main/java/com/viaversion/viaversion/bungee/handlers/BungeeServerHandler.java
#	bungee/src/main/java/com/viaversion/viaversion/bungee/providers/BungeeVersionProvider.java
#	common/src/main/java/com/viaversion/viaversion/protocols/protocol1_9to1_8/storage/EntityTracker1_9.java
#	common/src/main/java/com/viaversion/viaversion/update/UpdateUtil.java
#	velocity/src/main/java/com/viaversion/viaversion/velocity/platform/VelocityViaInjector.java
#	velocity/src/main/java/com/viaversion/viaversion/velocity/service/ProtocolDetectorService.java
2024-03-22 20:54:44 +01:00
EnZaXD
7b0c2fb51a
Replace printStackTrace usages with proper logging (#3741) 2024-03-09 13:57:41 +01:00
RK_01
4cf271af81
Use equals in legacy custom payload channel comparisons (#3721) 2024-02-29 11:11:00 +01:00
Nassim Jahnke
4e1d4a75b2
Small refactors around ProtocolPipeline and concurrent collections
Make concurrency handling in ProtocolPipelineImpl more defensive, as generally the pipeline is expected to never be called from multiple threads. The only case to look out for is pipeline additions during protocol transformation in a base protocol
2024-02-21 12:18:19 +01:00
Nassim Jahnke
cfc048ba53
Small random cleanup 2024-02-11 10:46:08 +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
Nassim Jahnke
a0f8ab7bbb
Some cleanup 2023-11-20 19:56:48 +01:00
RK_01
68a32ed2f0
Fix identifier handling and validation (#3498) 2023-10-24 09:58:43 +10:00
Nassim Jahnke
815e0820da Fix 1.13->1.13.1 recipes, rename ITEM1_8_ARRAY 2023-10-21 13:22:25 +10:00
Nassim Jahnke
8ebc8c34f3
Reuse old chunk type instances, more type cleanup 2023-10-20 12:30:03 +10:00
Nassim Jahnke
50e55529d9
Rename old position type 2023-10-19 21:15:26 +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
b1b0874c0f Some cosmetic code changes and typo fixes 2023-10-08 20:54:04 +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
EnZaXD
00625be890
Move 1.9 backwards protocols to VB and move Chunk Types to the correct package (#3404) 2023-08-14 10:46:30 +10: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
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
1d5ae0e3e0
Use mappings instead of hardcoding entity ids 2022-05-14 11:58:45 +02:00
Nassim Jahnke
d5a568b3fc
Update copyright header 2022-01-09 22:36:07 +01:00
RK_01
101a4f63de
Fixed 1.9.2 -> 1.9.3 block entity translation (#2784) 2022-01-03 11:05:15 +01:00
Nassim Jahnke
dbe8b6551a
Readd flare
Issues were addressed in 2.0.0
2021-10-19 09:10:17 +02:00
Nassim Jahnke
7e3a157fcf
Revert flare usage for now
Caused some issues I have no time to investigate at the moment, but worrying enough to warrant a temporary removal
Closes ViaVersion/ViaBackwards#402
2021-10-16 13:25:56 +02:00
Nassim Jahnke
36b8884d92
Fix leftover FU load factors 2021-10-08 09:37:04 +02:00
Connor Hartley
e5338688bb
Replace use of concurrenthashmap in entity tracker and block storage (#2705) 2021-10-07 12:26:14 +02:00
Nassim Jahnke
32a84f24ef
Nicer getters in Pair and Triple 2021-09-14 11:13:39 +02:00
kennytv
b81109f512
Semi force packet types in PacketWrapper at creation and transformation 2021-07-31 15:08:45 +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
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
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
KennyTV
cad358322d
Rename outgoing->clientbound, incoming->serverbound
Via can both be used on servers and clients, making a direction like "incoming" ambiguous
2021-04-28 16:30:34 +02:00
KennyTV
cadb5ec64c
Rename abstract Protocol to AbstractProtocol
This prevents confusion around the previously equally named interface and abstract class
2021-04-27 18:21:51 +02:00
KennyTV
f1c8d271b1
Reformat imports
The package rename wasn't done through refactoring but through simple replaces to not make git choke on diffs
2021-04-27 13:42:36 +02:00
KennyTV
30d122e7fa
Create some fancy interfaces 2021-04-26 23:01:55 +02:00
KennyTV
49d386063d
Add ProtocolVersion to legacy api 2021-04-26 21:45:27 +02:00
KennyTV
deec4b521e
Move some packages and classes around 2021-04-26 21:27:59 +02:00
KennyTV
a25a5634de
Change package/imports in classes and build configs 2021-04-26 20:52:34 +02:00
KennyTV
a3b1ce817e
Repackage to com.viaversion
This process will be split into multiple commits for git not to choke on.
2021-04-26 20:46:30 +02:00