Compare commits

...

601 Commits

Author SHA1 Message Date
Nassim Jahnke 2d41eb52a6
Remove invalid chunk entities for 1.20.5 clients
Fixes #3804
2024-05-14 18:47:57 +02:00
Nassim Jahnke 7e268a6f87
Bump version to 4.10.3-SNAPSHOT 2024-05-14 16:33:39 +02:00
Nassim Jahnke 113bf1e275
4.10.2 Release 2024-05-10 13:24:23 +02:00
EnZaXD 2aec3ce6d1
Expose StructuredDataConverter#removeBackupTag (#3838) 2024-05-09 20:50:45 +02:00
EnZaXD f60e31ac78
Add block entity ids in 1.20.3->.5 conversion (#3837) 2024-05-09 20:37:20 +02:00
EnZaXD 8c4ff7ebfc
Remove fix which got merged into MCStructs (#3836) 2024-05-09 20:04:36 +02:00
Nassim Jahnke 4c7729e602
Fixup banner handling, some other fixes 2024-05-09 19:33:26 +02:00
Nassim Jahnke 3dfc3bb15b
Actually add properties tag in 1.20.5->1.20.4 item handler 2024-05-09 17:21:53 +02:00
EnZaXD 69b33dc2d2
Handle invalid disconnect message in 1.8->1.9 (#3834) 2024-05-09 09:26:28 +02:00
EnZaXD c24169c410
[ci skip] Use login/status packet enums in older protocols (#3835) 2024-05-09 09:25:54 +02:00
Nassim Jahnke 31211c2214
Fix tipped arrow and area effect cloud color 2024-05-08 20:28:55 +02:00
Nassim Jahnke cb5fc9fb08
Fix empty effect handling
Fixes #3832
2024-05-08 11:55:35 +02:00
EnZaXD a8d7ab62e3
Add alpha to particle colors in 1.20.3->.5 (#3827) 2024-05-06 09:51:41 +02:00
Nassim Jahnke 71313b4753
Simplify raider check in 1.13->1.14 entity data handler 2024-05-06 09:42:49 +02:00
Nassim Jahnke 994bc8eefc
Move down super onMappingDataLoaded calls 2024-05-05 23:15:20 +02:00
Nassim Jahnke 7d35826637
Bump version to 4.10.2-SNAPSHOT 2024-05-05 23:12:43 +02:00
Nassim Jahnke 4f40372392
4.10.1 Release 2024-05-05 16:38:28 +02:00
Nassim Jahnke e993be751c
Filter items in entity data with amount < 1 2024-05-05 16:36:46 +02:00
Nassim Jahnke f1b92fea8d
Move loadFullMappings to MappingDataBase, use loadMiMappings 2024-05-05 14:41:30 +02:00
Nassim Jahnke fc9d5b6d9d
Clean up entriesLength usage 2024-05-05 13:33:21 +02:00
EnZaXD 9549a18cec
Handle duplicated registry ids in 1.20.3->.5 (#3825)
Minecraft 1.20.4 and earlier silently overrides the previous values if multiple registry elements have the same id (Tested using a Fabric 1.20.4 mod by parsing a registry sent by a server and then printing the parsed objects).
2024-05-05 13:08:09 +02:00
Nassim Jahnke d691096ce1
Move around types, apply to other enums
This doesn't include ALL abstract types, mostly if they are single-use or not at all relevant to our handling and most likely never will
2024-05-05 12:10:57 +02:00
Nassim Jahnke 73ed425bf7
Fixup entity type hierarchy 2024-05-04 18:11:50 +02:00
EnZaXD cdc9c3ae95
Update mappings (#3823)
48167fe5b6
2024-05-03 19:12:24 +02:00
EnZaXD c113e19d41
Convert plain to json instead of doing component conversion in DeathListener (#3821)
Closes https://github.com/ViaVersion/ViaVersion/issues/3817
2024-05-02 17:09:27 +02:00
EnZaXD d3af70d76c
Add optional registry utils to TagUtil (#3819) 2024-05-02 15:45:19 +02:00
Nassim Jahnke c00bc6b667
Check both namespaced and implicit key when replacing registry 2024-05-01 10:28:53 +02:00
Nassim Jahnke fa3c933b2f
Fix banner pattern backup
Fixes #3816
2024-05-01 00:06:22 +02:00
Nassim Jahnke 07bb0269c3
Auto: Update copyright headers 2024-04-30 22:23:11 +02:00
Nassim Jahnke 57c0d83608
Clean up component rewriter 2024-04-30 16:09:11 +02:00
Nassim Jahnke 4854b131b8
Some cleanup 2024-04-30 09:02:24 +02:00
Nassim Jahnke 1864b66e42
Handle new banner patterns in backwards translation 2024-04-29 23:58:57 +02:00
Nassim Jahnke 8aa6769193
Handle empty items in item lists 2024-04-29 23:11:10 +02:00
Nassim Jahnke 5f90bcbbaf
Fix item cost type reading 2024-04-28 15:15:17 +02:00
Nassim Jahnke d068822143
Add paperweight-mappings-namespace manifest attribute 2024-04-28 03:51:56 +02:00
Nassim Jahnke a77e328dfe
Put components in entity data through component rewriter
Cursed, but possibly needed
2024-04-27 21:39:20 +02:00
Gero 9c84e0dbe9 Fix remapping of 1.20.5 CLICK_WINDOW_BUTTON 2024-04-27 21:26:28 +02:00
Nassim Jahnke 66e0453398
Fix block protocols disconnect packet 2024-04-27 12:13:09 +02:00
Nassim Jahnke 7ec6888a30
Handle invalid command argument types
The client ignores these presumably for modded servers
Fixes #3806
2024-04-27 11:26:18 +02:00
Nassim Jahnke c9733948b3
Use raw data filler in 1.12->1.13 2024-04-27 10:23:04 +02:00
Nassim Jahnke 798b70cbe6
Be even more defensive about half valid items in hover events
While they aren't particularly useful or intended, they were valid
2024-04-26 19:00:37 +02:00
Nassim Jahnke 1f43ff571d
Bump to 4.10.1-SNAPSHOT 2024-04-26 18:26:37 +02:00
Nassim Jahnke d28e7cd652
4.10.0 Release 2024-04-26 15:03:17 +02:00
Nassim Jahnke f20d99fcef
Add 1.20.6 to .5 version
We technically don't know whether that will stay true, but might as well now to prevent confusion, as it wouldn't have any consequences if it did change
2024-04-26 15:02:57 +02:00
Nassim Jahnke a1c182f291
Ignore invalid names in the data component for hover events as well 2024-04-26 10:01:29 +02:00
Nassim Jahnke 8e63fd635b
Ignore invalid names in player heads 2024-04-26 09:29:19 +02:00
FlorianMichael 676e62c71f
Fix via dump throwing an error on sponge 2024-04-25 22:44:42 +02:00
FlorianMichael f422e03348
Rename ranged protocol version names 2024-04-25 20:31:22 +02:00
Nassim Jahnke fdf735420f
Add enforce-secure-chat setting to determine what is sent to the client by default 2024-04-25 20:21:36 +02:00
Nassim Jahnke b13fbbe175
Fix various issues in hover events serialization 2024-04-25 10:34:24 +02:00
Nassim Jahnke 9dd3348510
Move appendClientbound/Serverbound methods to Protocol interface 2024-04-24 20:11:05 +02:00
Nassim Jahnke 0e97af29b4
Add warning on Bungee startup
Without more specific injection points as with Velocity, Via has started failing more and more on Bungee and maintaining the required hackfixes coming from that has shown time intensive
2024-04-24 19:56:09 +02:00
Nassim Jahnke 3dfcd6b9b9
Fix written book hover serialization 2024-04-24 15:47:56 +02:00
Nassim Jahnke 8df0c0ae2e
Catch component parsing exceptions separately instead of failing the entire item 2024-04-24 15:47:47 +02:00
Nassim Jahnke d2ca6a82be
Assume enforce secure chat as false by default
Setting it to true will result in chat validation errors on the client for other players without chat sessions or valid signatures
2024-04-24 10:26:35 +02:00
Nassim Jahnke 9654a613cd
Put combat kill through component rewriter 2024-04-24 10:15:53 +02:00
Nassim Jahnke c5e6fa7d0c
Fix trim material ids at tail 2024-04-24 10:11:22 +02:00
Nassim Jahnke b78f9d350b
Check for lore length, not component length 2024-04-23 23:53:24 +02:00
Nassim Jahnke ebbe1b6da2
Make backwards enchantment code more readable 2024-04-23 23:44:12 +02:00
Nassim Jahnke 3aed7cb949
Fix mending translation from getting the id from the wrong class 2024-04-23 19:56:17 +02:00
Nassim Jahnke e2f3dc7572
Limit enchantments to 0-255 2024-04-23 19:32:32 +02:00
Nassim Jahnke f2b9c42590
Remove snapshot version support 2024-04-23 17:01:46 +02:00
Nassim Jahnke 9894671274
Add back default method 2024-04-23 13:47:05 +02:00
Nassim Jahnke 71ab15b331
Serialize to 1.20.3 components in conversion
Aside from hover events, only reading of components changed and we need the 1.20.3 hover input. Hover events are already handled by us.
2024-04-23 13:39:15 +02:00
Nassim Jahnke 34bc5b9d36
Put item name and lore through component rewriter
An absolute classic moment where servers are putting hover events into not hoverable item names and lore
2024-04-23 13:07:05 +02:00
Nassim Jahnke d80fd46c2f
Update version references 2024-04-23 11:26:17 +02:00
Nassim Jahnke b47446d9f7
Merge branch 'refs/heads/dev' into preview 2024-04-23 10:59:45 +02:00
EnZaXD dcf741a2ba
Fix sound mapping lookup in 1.8->1.9 (#3801) 2024-04-23 10:46:40 +02:00
Nassim Jahnke a4adef3cec
Fix attribute slot handling 2024-04-22 23:57:55 +02:00
Nassim Jahnke f525ad98e7
Fix handling of sweeping 2024-04-22 16:24:13 +02:00
Nassim Jahnke bc0b4470f6
1.20.5-rc3 2024-04-22 16:20:09 +02:00
Nassim Jahnke d3d6d4f1cd
Fixes to hover event handling, some cleanup 2024-04-22 16:05:44 +02:00
Nassim Jahnke 5069b26c2f
Reuse previously sent enforces-secure-chat value 2024-04-22 16:05:40 +02:00
FlorianMichael 079671060c
Remove items from extra-identifiers-1.20.3 file 2024-04-22 07:13:03 +02:00
Nassim Jahnke 89cd8aec1d
Merge branch 'refs/heads/dev' into preview 2024-04-21 23:47:01 +02:00
Nassim Jahnke 7ac7ea485f
Add UserConnection to component rewriters as well 2024-04-21 23:01:58 +02:00
Nassim Jahnke 5e4f25efeb
Merge branch 'refs/heads/dev' into preview
# Conflicts:
#	common/src/main/java/com/viaversion/viaversion/protocols/protocol1_20_5to1_20_3/rewriter/BlockItemPacketRewriter1_20_5.java
#	common/src/main/java/com/viaversion/viaversion/rewriter/EntityRewriter.java
#	common/src/main/java/com/viaversion/viaversion/rewriter/ItemRewriter.java
2024-04-21 22:51:45 +02:00
Nassim Jahnke a152993ffd
Add UserConnection to item rewriters
Already required for ViaBackwards, later required for ViaVersion as well due to synchronized registry entries in items
2024-04-21 22:39:13 +02:00
Nassim Jahnke 73daac471c
Split up version data in dump 2024-04-21 21:55:59 +02:00
Nassim Jahnke f4e9225f85
Store item identifiers, make identifier files more compact via global table 2024-04-21 20:47:38 +02:00
EnZaXD 1ed22327f6
Replace string->component conversion in 1.8->1.9 (#3794) 2024-04-21 16:00:30 +02:00
EnZaXD ce2ad7d5eb
Change default value for new ocelot setting (#3797) 2024-04-21 15:15:17 +02:00
FlorianMichael d7e66260de
Add 1.20.5 nbt->component conversion base
Has to be implemented into ViaBackwards yet and handlers are still missing
2024-04-21 14:53:25 +02:00
FlorianMichael dc6d581123
Update mcstructs and use new component serializer 2024-04-21 12:13:59 +02:00
FlorianMichael bd3f1206e6
[ci skip] document 1.9 metadata in MetaIndex 2024-04-21 11:35:10 +02:00
FlorianMichael b9e92e5c1f
Fix zombie metadata in 1.10->1.11 2024-04-21 11:24:20 +02:00
Gero 0acaed7c7a Use correct item type for 1.20.5 particle reading 2024-04-20 23:50:24 +02:00
FlorianMichael 3055a4277d
Use toString() method in ComponentUtil 2024-04-20 22:52:40 +02:00
Gero bcbe69d24c Fix ITEM_NAME component to tag conversion 2024-04-20 22:44:22 +02:00
EnZaXD 33cc21d6e6
Add setting for ocelot->cat translation in 1.13.2->1.14 (#3796) 2024-04-20 15:17:26 +02:00
Nassim Jahnke 949b3d712e
Fix illager metadata in 1.13->1.14 2024-04-20 13:36:00 +02:00
Nassim Jahnke 216dcb2931
Remove invalid zombified piglin data 2024-04-20 12:43:08 +02:00
Nassim Jahnke bff1536529
Fall back to keys without namespace in registry data 2024-04-20 12:06:39 +02:00
Nassim Jahnke b221e47eb7
Add creative mode range attributes if needed
Add the range argument either with or without modifiers depending on the gamemode to otherwise reset them
2024-04-19 21:35:41 +02:00
EnZaXD fb434a79bd
Use correct deserialization method in SerializerVersion#toComponent (#3795)
MCStructs has multiple methods for parsing jsons depending on the version, we should use them correctly in our wrapper to support all possible cases of components.
2024-04-19 17:05:07 +02:00
Nassim Jahnke 1be0605f51
Eat remaining particle data in spawn particle 2024-04-19 17:02:08 +02:00
Nassim Jahnke c75b4d8ef5
1.20.5-rc2 2024-04-19 15:38:35 +02:00
Gero e08c263ced Add missing dust_color_transition data remapping (changed in 24w03a) 2024-04-19 11:02:11 +02:00
Nassim Jahnke 1bb85b11e9
Merge branch 'refs/heads/dev' into preview 2024-04-19 10:11:05 +02:00
AJ Ferguson 128e191132
Fix 1.15->1.16 item attribute uuid (#3793) 2024-04-19 10:09:17 +02:00
Nassim Jahnke 3520f99d5a
Remove empty items from various block entities 2024-04-19 09:56:24 +02:00
RaphiMC 7825a1e460
Handle show_entity type field 2024-04-18 23:11:19 +02:00
RK_01 bfde4b953c
Fix 1.11->1.12 show_achievement rewriter (#3792) 2024-04-18 20:45:19 +02:00
Nassim Jahnke 57b37457d6
Add spit damage type
The client depends on it
2024-04-18 20:12:38 +02:00
Nassim Jahnke f7aa1a516e
Fill wolf_food item tag 2024-04-18 18:58:29 +02:00
Nassim Jahnke b1468ac6d0
Update particle codec format
Was changed in 1.20.5-pre1
2024-04-18 18:36:22 +02:00
Nassim Jahnke 27b5fdb4ff
Merge branch 'refs/heads/dev' into preview
# Conflicts:
#	common/src/main/java/com/viaversion/viaversion/protocols/protocol1_13_1to1_13/metadata/MetadataRewriter1_13_1To1_13.java
#	common/src/main/java/com/viaversion/viaversion/protocols/protocol1_14to1_13_2/metadata/MetadataRewriter1_14To1_13_2.java
#	common/src/main/java/com/viaversion/viaversion/protocols/protocol1_15to1_14_4/metadata/MetadataRewriter1_15To1_14_4.java
#	common/src/main/java/com/viaversion/viaversion/protocols/protocol1_16_2to1_16_1/metadata/MetadataRewriter1_16_2To1_16_1.java
#	common/src/main/java/com/viaversion/viaversion/protocols/protocol1_16to1_15_2/metadata/MetadataRewriter1_16To1_15_2.java
#	common/src/main/java/com/viaversion/viaversion/protocols/protocol1_17to1_16_4/packets/EntityPackets.java
#	common/src/main/java/com/viaversion/viaversion/protocols/protocol1_18to1_17_1/packets/EntityPackets.java
#	common/src/main/java/com/viaversion/viaversion/protocols/protocol1_19_3to1_19_1/packets/EntityPackets.java
#	common/src/main/java/com/viaversion/viaversion/protocols/protocol1_19to1_18_2/packets/EntityPackets.java
2024-04-18 16:17:05 +02:00
Nassim Jahnke a99273db2e
Always call onMappingDataLoaded in TagRewriter
In case they are needed in the future, so that we don't also have to check whether the different methods are actually called
2024-04-18 16:12:57 +02:00
Nassim Jahnke 64f911ed4a
1.20.5-rc1 2024-04-18 15:47:44 +02:00
EnZaXD 4302dd61aa
Remove Protocol1_9To1_8#FIX_JSON usage in 1.11->1.12 (#3791) 2024-04-18 15:26:13 +02:00
EnZaXD 98c5d38d0c
Push book contents through component conversion in 1.8->1.9 (#3790) 2024-04-18 15:25:48 +02:00
FlorianMichael 033d5ae49a
Handle removed item conversion in component rewriter 2024-04-17 22:39:08 +02:00
Nassim Jahnke 8cf9114403
1.20.5-pre4 2024-04-17 15:01:16 +02:00
EnZaXD bd8e469216
Fix IdAndData constructor without data field (#3789) 2024-04-17 08:46:56 +02:00
EnZaXD 57d7fd59cc
Change IdAndData#setData parameter to int (#3788) 2024-04-16 21:00:04 +02:00
EnZaXD 8fe0681778
Replace incoming/outgoing usages with client/server bound (#3787) 2024-04-16 20:59:48 +02:00
EnZaXD ea5cf3e594
Add IdAndData util and replace conversions (#3786) 2024-04-16 15:55:55 +02:00
Nassim Jahnke 13eec3c2ea
1.20.5-pre3 2024-04-16 15:36:02 +02:00
Nassim Jahnke 31ccd2ab9b
1.20.5-pre2 2024-04-15 17:14:23 +02:00
FlorianMichael 2be190d152
Some consistency cleanup 2024-04-13 22:32:56 +02:00
FlorianMichael 4e25549682
Handle legacy item hover events
Co-authored-by: RaphiMC <50594595+raphimc@users.noreply.github.com>
2024-04-13 21:01:34 +02:00
FlorianMichael 287678c12a
[ci skip] Add comments for conversion direction to classes 2024-04-13 20:58:38 +02:00
FlorianMichael 4343aa17fc
Add missing annotations to StatePropertyMatcher 2024-04-13 20:57:32 +02:00
FlorianMichael 970986bc59
Add component rewriter for 1.20.3->1.20.5 2024-04-13 20:56:54 +02:00
RK_01 2586788bf6
Fix config read/write error when parent file is null (#3783) 2024-04-10 17:35:25 +02:00
EnZaXD 0c2c8400ae
Make handling of optional block metadata more explicit in <1.19.4 (#3782) 2024-04-10 17:34:56 +02:00
Nassim Jahnke ba4404fad6
1.20.5-pre1 2024-04-10 17:33:10 +02:00
RK_01 6f53c069ea
Fix 1.12 -> 1.13 held enderman block translation (#3781) 2024-04-10 10:43:48 +02:00
Nassim Jahnke 99f29e2597
Prepare proper banner id tracking, small other fixes 2024-04-09 12:40:16 +02:00
EnZaXD 7932b79080
Explain backup tags (#1) 2024-04-08 16:59:33 +02:00
FlorianMichael 4b780b92ee
Fix armor trim conversion 2024-04-08 15:05:01 +02:00
Nassim Jahnke d04aaeb926
Handle color in area effect cloud 2024-04-08 14:21:11 +02:00
FlorianMichael 9f1ee27afc
Add missing checks in item id conversions 2024-04-08 13:36:58 +02:00
Nassim Jahnke 5f685884ff
Handle entity effect particle in spawn particle 2024-04-08 13:33:59 +02:00
FlorianMichael ba2e50cc88
Fix StructuredDataConverter#removeItemBackupTag 2024-04-08 13:31:13 +02:00
FlorianMichael 7b28683b6a
Add remaining data backup handling 2024-04-08 13:18:49 +02:00
Nassim Jahnke 510747a7cd
Replace empty items in recipes 2024-04-08 10:53:39 +02:00
Nassim Jahnke 8c5752bb4c
Update unsupported java version warning 2024-04-07 22:34:20 +02:00
Nassim Jahnke 33e2a1fc13
Send unsigned messages if possible
The server cannot guarantee that the last seen values are correct, so in order to avoid kicks from invalid signatures, we will just strip them if possible.
2024-04-07 22:05:14 +02:00
Nassim Jahnke dbe8a389ce
Update authors 2024-04-07 20:41:44 +02:00
Nassim Jahnke 83223c1520
Also handle ack in serverbound chat message 2024-04-07 20:35:07 +02:00
FlorianMichael 935077222e
Simplify code 2024-04-07 20:08:16 +02:00
FlorianMichael 8961660846
Fix chat command handling 2024-04-07 19:43:29 +02:00
Nassim Jahnke 1fe23e4aeb
Fix trade list handling 2024-04-07 13:36:02 +02:00
Nassim Jahnke 06394c1f74
Apply network limits 2024-04-07 11:41:57 +02:00
Nassim Jahnke 68c2af2795
Replace unknown sounds with direct value in registry data 2024-04-06 23:47:27 +02:00
Nassim Jahnke 35a00d0b95
Check for new outbound_config pipeline handler 2024-04-06 23:10:58 +02:00
Nassim Jahnke c2489c7a4c
Back up 1.20.5 data components in VB for creative clients 2024-04-06 21:26:44 +02:00
Nassim Jahnke c743c20334
Update wolf textures again, add utility methods 2024-04-06 21:26:44 +02:00
FlorianMichael 228689f181
Remove temporary goat horn fix 2024-04-06 21:26:44 +02:00
Nassim Jahnke 67e6e1a2e3
24w14a 2024-04-06 21:26:44 +02:00
Nassim Jahnke a2c1c52f51
24w13a 2024-04-06 21:26:44 +02:00
Nassim Jahnke fd4db24d44
Fix intangible projectile data reading 2024-04-06 21:26:43 +02:00
Nassim Jahnke 0b7fdd4c69
Update wild wolf texture field name 2024-04-06 21:26:43 +02:00
Nassim Jahnke 4849ca0745
Start working on 24w12a 2024-04-06 21:26:43 +02:00
Nassim Jahnke 60b782455d
Fix display tag setting and doubled item id rewriting 2024-04-06 21:26:43 +02:00
FlorianMichael 3fef71db2e
Added missing null checks for CONTAINER_LOOT handler 2024-04-06 21:26:43 +02:00
Nassim Jahnke 9ca02680c8
Fix enchantment level 2024-04-06 21:26:43 +02:00
FlorianMichael 5899886b42
Fixes 2024-04-06 21:26:42 +02:00
Nassim Jahnke c2567115d8
Fix various issues 2024-04-06 21:26:42 +02:00
Nassim Jahnke 4255876c22
Fix up block state handling, add PotDecorations wrapper 2024-04-06 21:26:42 +02:00
FlorianMichael 57a589924d
More structured data handling 2024-04-06 21:26:42 +02:00
Nassim Jahnke 936dcafc11
Make HolderSet an interface 2024-04-06 21:26:42 +02:00
Nassim Jahnke b6489b8343
Fix block predicate parsing 2024-04-06 21:26:41 +02:00
Nassim Jahnke bf11a0a7de
Start working on 24w11a 2024-04-06 21:26:41 +02:00
Nassim Jahnke 7d41706026
Rewrite block predicates the other way around as well 2024-04-06 21:26:41 +02:00
FlorianMichael 93f081dd84
Add even more backwards rewriters 2024-04-06 21:26:41 +02:00
Nassim Jahnke 3f82b150d2
Handle CanPlaceOn and CanDestroy tags 2024-04-06 21:26:39 +02:00
Nassim Jahnke 7a96498f6d
Some sanity checks, get item id by name fast 2024-04-06 21:26:17 +02:00
FlorianMichael 817febe605
Even more work! 2024-04-06 21:26:16 +02:00
Nassim Jahnke bb4a8b73e0
Small cleanup 2024-04-06 21:26:16 +02:00
Nassim Jahnke 8d3492ba30
Add more structured data -> nbt converters 2024-04-06 21:26:16 +02:00
Nassim Jahnke 658364b643
Add a few structured data -> nbt converters 2024-04-06 21:26:16 +02:00
Nassim Jahnke 666b204ebb
Prepare class for structured data->tag rewriting 2024-04-06 21:26:16 +02:00
Nassim Jahnke bfab9b0c11
Banner patterns and wolves 2024-04-06 21:26:15 +02:00
Nassim Jahnke 121f107ff3
More handled structures 2024-04-06 21:26:15 +02:00
Nassim Jahnke 426bd9aa99
More handled structures 2024-04-06 21:26:13 +02:00
Nassim Jahnke 7a66bb8e1c
More handled structures 2024-04-06 21:25:39 +02:00
Nassim Jahnke 329abcac7d
More handled structures 2024-04-06 21:25:08 +02:00
Nassim Jahnke 0961de898d
Handle books, among other things 2024-04-06 21:25:05 +02:00
Nassim Jahnke b4ee564aa2
24w10a, more item component work 2024-04-06 21:23:57 +02:00
EnZaXD 73178b504e
Inline player on-ground movement handler (#3777) 2024-04-06 09:29:57 +02:00
EnZaXD d0cc531386
Cleanup MetaIndex style and field names (#3775) 2024-04-05 20:15:41 +02:00
EnZaXD 617ef10667
Remove MetaType1_8#NonExistent (#3774) 2024-04-05 19:48:59 +02:00
EnZaXD 5569caf610
Improve horse armor patch in 1.8->1.9 (#3773) 2024-04-05 15:46:20 +02:00
EnZaXD 868a5bd24e
Remove non existing metadata from MetaIndex (#3772) 2024-04-05 15:45:13 +02:00
EnZaXD b113a82710
Catch errors in <= 1.20 custom payload reading (#3770) 2024-04-04 22:25:02 +02:00
EnZaXD 3ee4c8ed63
Make ViaVersion fake nbt format consistent (#3771)
Adding ItemRewriter#nbtTagName utils to prefix nbt tags with a consistent format:
<Platform>|<Protocol name>|<original nbt name>
2024-04-04 09:31:58 +02:00
EnZaXD cd65925d6b
Add conversion methods to SerializerVersion and replace missing MCStructs usages (#3769) 2024-04-01 15:52:57 +02:00
Nassim Jahnke 307414eb51
Move simple mcstructs usage into utils 2024-04-01 14:13:43 +02:00
EnZaXD 51745cb2ef
Rewrite 1.12.2->1.13 ComponentRewriter (#3765) 2024-04-01 13:38:43 +02:00
EnZaXD f44782d21d
Fix minor inconsistencies in protocol packages (#3768) 2024-04-01 12:55:50 +02:00
EnZaXD 7556f7b8fa
Move chat registry dumps into nbt files (#3763) 2024-03-31 15:07:46 +02:00
EnZaXD abd58399cd
Remove entity metadata buffering in 1.8->1.9 (#3766) 2024-03-30 22:27:40 +01:00
EnZaXD 0a2fd8f296
Add MappingDataLoader#getLogger and MappingDataLoader#getDataFolder (#3757) 2024-03-24 22:04:41 +01:00
EnZaXD f2c816df72
Add mapped and unmapped identifier read method (#3756) 2024-03-24 12:14:42 +01:00
EnZaXD 098f7ff3c2
Allow platforms to use the mapping system (#3754) 2024-03-24 11:10:20 +01:00
RK_01 18f04bf8ea
Add more functionality to ChunkUtil (#3755) 2024-03-24 11:05:30 +01: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
Nassim Jahnke 4074231a57
Update Hangar publish plugin 2024-03-22 20:49:57 +01:00
Kichura 13efe47a5c
Update build dependencies (#3742) 2024-03-22 20:38:03 +01:00
Nassim Jahnke b07cf03dc1
Check for jsonnull in component conversion
Closes #3745
2024-03-17 16:23:27 +01:00
Nassim Jahnke 0a921d9bdc
Use the correct entity sound rewriter method 2024-03-14 14:43:37 +01:00
EnZaXD 7b0c2fb51a
Replace printStackTrace usages with proper logging (#3741) 2024-03-09 13:57:41 +01:00
Nassim Jahnke b426302e76
Merge branch 'master' into dev
# Conflicts:
#	common/src/main/java/com/viaversion/viaversion/protocols/protocol1_19to1_18_2/packets/EntityPackets.java
#	common/src/main/java/com/viaversion/viaversion/rewriter/EntityRewriter.java
#	gradle/libs.versions.toml
2024-03-09 12:59:36 +01:00
Nassim Jahnke 3442cda8ce
Update ViaNBT 2024-03-09 12:57:55 +01:00
Nassim Jahnke 55a0a70264
Merge branch 'master' into dev 2024-03-09 11:36:41 +01:00
EnZaXD a9bfda4568
Rewrite 1.11->1.12 ChatItemRewriter (#3740) 2024-03-09 10:58:42 +01:00
Nassim Jahnke 93990c8baa
Merge branch 'master' into dev
# Conflicts:
#	common/src/main/java/com/viaversion/viaversion/protocols/protocol1_19to1_18_2/packets/EntityPackets.java
#	common/src/main/java/com/viaversion/viaversion/rewriter/EntityRewriter.java
#	gradle.properties
#	gradle/libs.versions.toml
2024-03-07 13:45:10 +01:00
Nassim Jahnke f868dfa125
Update ViaNBT 2024-03-07 13:30:33 +01:00
Nassim Jahnke 386495e168
Handle map related data and skull owners
Co-authored-by: Drex <nicknamedrex@gmail.com>
2024-03-06 13:26:06 +01:00
Nassim Jahnke cad78ea68f
Trim string tags in component conversion
Somewhat dirty but inconsequential, as the given protocol does not use this method in item conversion and it should only ever be triggered in hover events
Closes #3650
2024-03-06 12:31:31 +01:00
EnZaXD 908823c612
Make ItemRewriter type getters nullable and optional (#3737) 2024-03-05 23:23:57 +01:00
Nassim Jahnke f6d48e258f
4.9.3 Release 2024-03-05 17:51:09 +01:00
Nassim Jahnke 1f5ee6d763
Create FUNDING.yml 2024-03-04 17:32:13 +01:00
Nassim Jahnke 8edad67394
Check if the channel is open in BukkitEncodeHandler 2024-03-02 20:13:58 +01:00
Nassim Jahnke 2d03110f08
Small refactor 2024-03-01 14:10:44 +01:00
Nassim Jahnke 92878a39ef
We continue to fall 2024-03-01 13:46:26 +01:00
Nassim Jahnke aa0423c6e2
Merge branch 'master' into dev 2024-03-01 12:39:25 +01:00
Nassim Jahnke 04e572fa30
Hotfix receiving level screen not closing on Velocity
Closes #3630
2024-03-01 12:38:54 +01:00
Nassim Jahnke 39180e22b8
The endless pit continues to be endless 2024-03-01 12:13:43 +01:00
Nassim Jahnke f68aed464d
Once again refactor structured data storage
Optionals are no more
2024-02-29 19:59:18 +01:00
Nassim Jahnke 6ffa24b50b
Add todos 2024-02-29 18:23:46 +01:00
Nassim Jahnke e51d7b3fdb
Fix initial item sending, add some data translation and more rigid data structures 2024-02-29 17:03:50 +01:00
Nassim Jahnke 01bb8dedda
More renames 2024-02-29 12:08:29 +01:00
EnZaXD 6cdca97d35
Add classic version range to VersionType#CLASSIC javadoc (#3729) 2024-02-29 11:11:23 +01:00
EnZaXD dafce79374
Tidy up fabric.mod.json file of fabric platform (#3728) 2024-02-29 11:11:10 +01:00
RK_01 4cf271af81
Use equals in legacy custom payload channel comparisons (#3721) 2024-02-29 11:11:00 +01:00
Nassim Jahnke aa262bb0a5
Rename itemdata to be more generic 2024-02-28 22:46:33 +01:00
Nassim Jahnke 2480eb6a7f
Start working on 24w09a 2024-02-28 22:15:31 +01:00
Nassim Jahnke 56b82b049a
Move a few methods out of AbstractProtocol 2024-02-27 17:21:27 +01:00
EnZaXD 3c0930c62f
Use existing ProtocolVersion#getProtocol when possible (#3720) 2024-02-27 14:02:16 +01:00
EnZaXD 26a8e5fef1
Fix enabled version sorting in DumpUtil (#3719) 2024-02-27 14:01:47 +01:00
caramel caa6519780
Fix leather armor rendering (#3713) 2024-02-25 20:36:48 +01:00
caramel 1e35c2713f
Fix particle doesn't use new mapping id (#3712) 2024-02-25 20:36:27 +01:00
caramel cd5d88c34f
Fix wrong join game packet handling (#3710) 2024-02-24 20:54:38 +01:00
EnZaXD 7640342165
Don't require a base protocol for current version in BaseProtocol (#3709) 2024-02-23 15:13:33 +01:00
EnZaXD fe0d30df78
paste.gg -> mclo.gs (#3706) 2024-02-21 16:13:15 +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
EnZaXD 343b403cf1
Ensure ProtocolManagerImpl#registerBaseProtocol doesn't support VersionType#SPECIAL protocols (#3705) 2024-02-19 10:09:44 +01:00
RK_01 78aecbddf8
Don't add base protocols when using special versions (#3704) 2024-02-18 21:55:14 +01:00
Nassim Jahnke 48241ba841
Fix Bungee server change 2024-02-18 19:32:55 +01:00
Nassim Jahnke a8fbb000eb
Add ProtocolManager#hasLoadedMappings 2024-02-15 18:27:52 +01:00
EnZaXD ff25cbd6eb
Add RedirectProtocolVersion API to common module (#3701) 2024-02-15 18:21:38 +01:00
Nassim Jahnke e2a7e10312
Add back default getProtocolPath with int versions 2024-02-15 15:45:23 +01:00
EnZaXD c7baa27fd0
Some code cleanup (#3698) 2024-02-14 22:53:50 +01:00
Nassim Jahnke 35578372a1
Fix isWorkingPipe and cursed ProtocolVersion comparator 2024-02-14 22:45:34 +01:00
EnZaXD 293427c172
Only pass ProtocolVersion#toString into via dumps (#3699) 2024-02-14 21:49:40 +01:00
EnZaXD 08d8ccf6ca
Don't add ProtocolVersion#unknown into ProtocolVersion#VERSION_LIST (#3697) 2024-02-14 21:07:36 +01:00
EnZaXD 35ceee1a47
Rename ProtocolVersion#v1_7_1 to v1_7_2 (#3696) 2024-02-14 20:14:17 +01:00
Nassim Jahnke dccda57fc0
Consistent equalTo names 2024-02-14 19:14:41 +01:00
Nassim Jahnke 5c21f60ef7
Fix Bungee ping default 2024-02-14 19:12:05 +01:00
Nassim Jahnke c124c1c809
Sort ProtocolVersions version list, fix base protocol registration 2024-02-14 17:57:00 +01:00
EnZaXD 302716054d
Port of internals and API to ProtocolVersion (#3694) 2024-02-14 17:56:28 +01:00
Nassim Jahnke 46a5bb16d7
24w07a 2024-02-14 17:32:13 +01:00
EnZaXD f3f7ea7987
Fix version ranges in VersionType (#3692) 2024-02-14 09:57:41 +01:00
EnZaXD e62c4a3f9e
Rename comparing methods in ProtocolVersion (#3693) 2024-02-14 09:54:15 +01:00
EnZaXD d58c80cd2f
Add ProtocolVersionRange API (#3691) 2024-02-14 09:51:56 +01:00
Nassim Jahnke 7a6c51331b
Move config load after platform creation 2024-02-13 23:37:00 +01:00
Nassim Jahnke 564286d742
Remove version check from config
The platform might now always be available
2024-02-13 23:18:39 +01:00
Nassim Jahnke dcc0642af9
Replace more raw versions with ProtocolVersion 2024-02-13 22:48:08 +01:00
EnZaXD e449599ae7
Add ProtocolVersion#betweenInclusive and ProtocolVersion#betweenExclusive (#3690) 2024-02-13 21:50:19 +01:00
Nassim Jahnke 621c02f974
Move some data out of extending MappingData classes 2024-02-13 18:41:05 +01:00
Nassim Jahnke 22bd350e35
Add proper ProtocolVersion comparison 2024-02-13 18:40:21 +01:00
Nassim Jahnke a8dc5f0f07
Merge branch 'master' into dev
# Conflicts:
#	common/src/main/java/com/viaversion/viaversion/data/entity/DimensionDataImpl.java
#	common/src/main/java/com/viaversion/viaversion/rewriter/EntityRewriter.java
#	common/src/main/java/com/viaversion/viaversion/update/UpdateUtil.java
2024-02-12 10:44:03 +01:00
Nassim Jahnke d76edced04
Update template protocol 2024-02-12 10:40:17 +01:00
Nassim Jahnke cfc048ba53
Small random cleanup 2024-02-11 10:46:08 +01:00
Nassim Jahnke c7265abfe9
Add editorconfig 2024-02-10 23:44:13 +01:00
Nassim Jahnke 8a485db580
Replace tag instanceof checks/unchecked casts with helper methods 2024-02-10 23:28:36 +01:00
Nassim Jahnke e0f32d9f2f
Merge remote-tracking branch 'origin/master' into dev 2024-02-08 22:02:25 +01:00
EnZaXD ad62d8552c
Use correct logger for configuration warnings (#3685)
Fixes https://github.com/ViaVersion/ViaProxy/issues/179
2024-02-08 22:02:13 +01:00
Nassim Jahnke 4a8bd2cca2
24w06a 2024-02-07 18:29:19 +01:00
Nassim Jahnke 0fcb764652
24w05b 2024-02-01 17:49:58 +01:00
Nassim Jahnke 46e322b2f3
Merge branch 'master' into dev 2024-01-31 22:28:22 +01:00
Nassim Jahnke 87d444a017
Only rewrite pages in written book 2024-01-31 22:24:17 +01:00
Nassim Jahnke e020c616c9
24w05a 2024-01-31 17:36:12 +01:00
Nassim Jahnke da87241549
Merge branch 'master' into dev
# Conflicts:
#	common/src/main/java/com/viaversion/viaversion/rewriter/ItemRewriter.java
2024-01-29 17:26:49 +01:00
EnZaXD 0d788b0d7a
Clean up more item type usage in ItemRewriter (#3674) 2024-01-29 17:21:59 +01:00
Nassim Jahnke 1c6f8426f1
Log the error by default, instead check suppression config 2024-01-29 10:32:02 +01:00
Nassim Jahnke 01f28a052c
Ignore errors in book conversion 2024-01-29 10:17:00 +01:00
Nassim Jahnke cfc9011cee
Push books through component conversion in 1.20.2->1.20.3
Fixes #3579
2024-01-27 20:51:28 +01:00
Nassim Jahnke 6473b608f6
Merge branch 'master' into dev
# Conflicts:
#	.github/workflows/gradle.yml
2024-01-27 13:49:48 +01:00
Nassim Jahnke a5bd8abe93
Resize registry data array to actual size once collected 2024-01-27 13:49:27 +01:00
EnZaXD f3d95b1e5e
Fix elytra not working with firework rockets in 1.14 -> 1.13.2 (#3669)
Closes https://github.com/ViaVersion/ViaFabricPlus/issues/331
2024-01-27 13:46:20 +01:00
Nassim Jahnke c8d339ab30
Add generic types on base protocols 2024-01-27 13:45:40 +01:00
Nassim Jahnke 8000561ae9
Handle registry data with skipped ids 2024-01-26 16:05:58 +01:00
Nassim Jahnke 1dafa7d273
Cleanup config packet registration in newer protocols 2024-01-26 15:48:10 +01:00
Nassim Jahnke ce8fab7c44
Cleanup config packet registering in AbstractProtocol 2024-01-26 14:35:19 +01:00
Nassim Jahnke 37561705ed
24w04a 2024-01-24 20:23:33 +01:00
Nassim Jahnke 00176c4a0c
Merge branch 'master' into dev 2024-01-24 17:27:04 +01:00
Kichura cef6fb35b1
Update JDK to 17, setup-java to v4 (#3660) 2024-01-20 21:18:42 +01:00
Nassim Jahnke 7b8a33cc78
Small refactor to UpdateUtil 2024-01-20 16:34:18 +01:00
Nassim Jahnke ceae2c2094
Rewrite transfer intention on older servers 2024-01-18 21:44:26 +01:00
Nassim Jahnke 52b9db5029
Handle new client intent 2024-01-18 21:22:44 +01:00
Nassim Jahnke 27af372f79
Block entity tags are no longer nullable 2024-01-18 20:46:25 +01:00
Nassim Jahnke c4e50efa90
24w03b 2024-01-18 16:10:09 +01:00
Nassim Jahnke fa1ae5b9c9
Entity sound did not change 2024-01-18 12:00:19 +01:00
Nassim Jahnke 8f6784e0e2
Respect previous buffer types in particle rewriting 2024-01-18 10:25:58 +01:00
Nassim Jahnke 5d5c98acc6
24w03a (maybe, and it's a bit ugly) 2024-01-17 22:55:16 +01:00
vadage 5b29ac0d8a
Support config loading from input stream as fallback if URL cannot be acquired (#3647) 2024-01-14 10:04:15 +01:00
Kichura 3b9d399afd
Update supported Velocity version to 3.3 (#3649) 2024-01-14 10:01:52 +01:00
Nassim Jahnke 0946c72bdc
Update missing filterFamily method name change 2024-01-12 16:01:30 +01:00
Nassim Jahnke 05470c5f1b
Merge branch 'master' into dev 2024-01-12 15:59:42 +01:00
Nassim Jahnke 0392992173
Fix metadata regression
Fixes #3645
2024-01-12 15:58:49 +01:00
Nassim Jahnke 34bd15dec7
Merge branch 'master' into dev
# Conflicts:
#	template/src/main/java/com/viaversion/viaversion/template/protocols/rewriter/EntityPacketRewriter1_99.java
2024-01-12 10:30:24 +01:00
Nassim Jahnke ef78fcd478
Update API license headers and scope 2024-01-12 10:21:45 +01:00
EnZaXD 9d646543b6
Change depthsuspend to mycelium in 1.13 -> 1.12.2 (#3616) 2024-01-12 09:59:17 +01:00
Nassim Jahnke aecef3c3f8
Remove a few deprecated methods 2024-01-09 20:51:32 +01:00
Nassim Jahnke 5991ac5633
Update old metadata handlers, some cleanup 2024-01-09 20:43:43 +01:00
Nassim Jahnke 930454a723
Reset reader 2024-01-09 18:57:33 +01:00
Nassim Jahnke b6ba7dcc44
Handle 1.20->1.20.2 tags 2024-01-09 17:18:32 +01:00
Nassim Jahnke abb05ce902
Merge remote-tracking branch 'origin/master' into dev 2024-01-04 17:50:24 +01:00
Nassim Jahnke a561bad004
Update ViaNBT 2024-01-02 12:55:03 +01:00
Nassim Jahnke bd2c4c8a16
Update license headers 2024-01-01 12:39:45 +01:00
Nassim Jahnke f6c49555bf
Update ViaNBT 2023-12-31 13:38:14 +01:00
Nassim Jahnke bd99b892db
Update ViaNBT (and mcstructs) 2023-12-30 19:02:25 +01:00
Nassim Jahnke 7b4d544e85
Catch tag to json conversion exceptions 2023-12-30 17:25:54 +01:00
Nassim Jahnke fe0fbc7081
Merge branch 'master' into dev
# Conflicts:
#	common/src/main/java/com/viaversion/viaversion/util/NBTConverter.java
2023-12-29 16:50:47 +01:00
Nassim Jahnke bae3d8ec8a
Use viafied mcstructs 2023-12-29 16:50:21 +01:00
RK_01 00b8d22cf6
Fix 1.19 -> 1.18.2 ENTITY_EFFECT translation (#3605) 2023-12-27 22:11:34 +01:00
Nassim Jahnke d62284e9cd
Make NBTConverter public 2023-12-27 20:20:09 +01:00
Nassim Jahnke 3904ed4fd7
Merge branch 'master' into dev 2023-12-27 19:44:46 +01:00
RK_01 28a0813676
Cleanup of mcstructs branch (#3604) 2023-12-27 19:37:48 +01:00
Nassim Jahnke ca4b6fc765
Update copyright profile
Applying it once 2024 hits
2023-12-27 17:49:37 +01:00
Nassim Jahnke f2f357b2ae
Finish up things 2023-12-27 17:30:27 +01:00
Nassim Jahnke dc2986600c
Use 1.12 serializer for json to legacy conversion 2023-12-27 11:40:45 +01:00
Nassim Jahnke 984c625776
Methods for VB 2023-12-26 23:59:48 +01:00
Nassim Jahnke c62a8274ed
Use mcstructs for component conversion 2023-12-26 23:38:02 +01:00
RK_01 64c436c2e1
Handle invalid config data types (#3595) 2023-12-26 13:18:55 +01:00
Jerry Xiao 0e31664bfe
Fix hoverEvent translation from 1.20.2 to 1.20.3 in some cases (#3591) 2023-12-22 12:10:29 +01:00
Valaphee The Meerkat 18f2cf25cd
Read 1.8 chunk block id as unsigned (#3578) 2023-12-22 10:22:22 +01:00
Kichura 84b093a997
[ci skip] Update setup-java to v4 (#3589) 2023-12-21 09:27:06 +01:00
Nassim Jahnke 794f401bd0
Add armadildo state meta type 2023-12-18 19:34:53 +01:00
Nassim Jahnke dc732fac6f
23w51b 2023-12-18 18:52:18 +01:00
Nassim Jahnke 2f8114abb1
Finish 23w51a, maybe 2023-12-18 17:14:24 +01:00
Nassim Jahnke 90781c9d27
Start working on 23w51a 2023-12-18 15:58:49 +01:00
Myles 9b1716b662
Merge pull request #3581 from Jo0001/master
Use our own site for update check
2023-12-16 18:15:23 +00:00
Jo0001 dcd4502f5a Use own update site 2023-12-16 18:02:35 +00:00
Aeltumn 5d4b104b33
Try to schedule sending on switch (#3587) 2023-12-16 16:20:53 +01:00
Nassim Jahnke 8e38e25cba
Update Gradle wrapper 2023-12-13 22:44:20 +01:00
Jo0001 82e05afacf Use GitHub for update check 2023-12-13 15:08:06 +00:00
Nassim Jahnke 5c8c589a40
Change read method type in update score packet 2023-12-13 12:06:44 +01:00
Nassim Jahnke 70645ec5ee
Add system property to print components before conversion 2023-12-11 12:47:00 +01:00
Nassim Jahnke 4aefc23bb8
Fix npe 2023-12-10 12:16:53 +01:00
Nassim Jahnke 2c9affa0e3
Move component conversion into its own class
Remove serialized component type in 1.20.3->1.20.2
2023-12-10 12:10:15 +01:00
Nassim Jahnke 1656ad45a0
Fix quotation marks appearing in mixed json arrays
Fixes #3572
2023-12-10 10:58:44 +01:00
Nassim Jahnke ec2397472d
Fix 1.13->1.13.1 handling of particles with items
Fixes #3553
2023-12-10 10:11:47 +01:00
Nassim Jahnke cf5f5ed4bb
Fix conversion of mixed json arrays 2023-12-09 15:19:05 +01:00
Nassim Jahnke 9387b86e4a
Clone tags instead of abusing double conversion 2023-12-08 21:23:57 +01:00
Nassim Jahnke e3224281a9
Update ViaNBT 2023-12-08 20:31:37 +01:00
Nassim Jahnke f762da2725
Include 1.20.4 in .3 version range 2023-12-07 22:22:30 +01:00
Nassim Jahnke 9a7def62b9
Bump version to 4.9.3-SNAPSHOT 2023-12-07 22:01:36 +01:00
Nassim Jahnke ec27cc7a7b
4.9.2 Release 2023-12-07 11:14:42 +01:00
Nassim Jahnke 3b9ac89d73
Create pack uuid from hash
Fixes #3554
2023-12-07 11:14:04 +01:00
Nassim Jahnke 23ba848a69
Convert chat type in disguised chat packet
Fixes #3551
2023-12-07 10:10:07 +01:00
Nassim Jahnke d98c458a4c
Queue plugin message in 1.20->1.20.2 again 2023-12-06 23:30:31 +01:00
Nassim Jahnke 1ad65d1bb0
Add component types in conversion 2023-12-06 10:55:12 +01:00
David Lüdtke d44d89099b
Fix LazilyParsedNumber conversion ViaVersion/ViaVersion#3546 (#3550) 2023-12-06 09:50:33 +01:00
Nassim Jahnke d5326fad95
Use correct type 2023-12-06 09:44:20 +01:00
Nassim Jahnke 7de9bc604a
Handle configuration tags packet
Fixes #3549
2023-12-06 09:41:49 +01:00
Nassim Jahnke dfee03ddbf
Fix map data reading
Fixes #3545
2023-12-05 22:17:42 +01:00
Nassim Jahnke 3babc7a13a
Bump version to 4.9.2-SNAPSHOT 2023-12-05 22:16:15 +01:00
Nassim Jahnke 0b1423d8b4
4.9.1 Release - fix resource pack status handling 2023-12-05 17:56:18 +01:00
Nassim Jahnke 6efeb16822
4.9.0 Release 2023-12-04 10:11:08 +01:00
RK_01 9b09b1f5f8
Fix #3542 (#3543) 2023-12-04 10:09:25 +01:00
RK_01 851295d48c
Ignore invalid chunk data in legacy versions (#3538) 2023-12-03 18:37:57 +01:00
RK_01 1f453dc0d9
Change gamemode data type in JOIN_GAME handlers (#3541) 2023-12-03 18:35:19 +01:00
RK_01 916c08ce7e
Handle invalid entity equipment slots properly (#3540) 2023-12-03 18:34:14 +01:00
RK_01 0ac29fb2c2
Return air instead of stone for unknown block ids (#3539) 2023-12-03 18:33:34 +01:00
Nassim Jahnke 45d08e9066
Directly send pong, plugin message, and keep alive in 1.20.2->1.20 2023-12-03 10:02:36 +01:00
Nassim Jahnke bc0bef2e07
1.20.3-rc1 2023-11-30 15:56:05 +01:00
Nassim Jahnke 6d82839e6d
1.20.3-pre4 2023-11-28 16:58:32 +01:00
Nassim Jahnke c039f4e24c
1.20.3-pre3 2023-11-27 17:09:59 +01:00
Nassim Jahnke 4add75cda7
Fix reset score writing 2023-11-26 15:31:33 +01:00
Nassim Jahnke 28f661f270
1.20.3-pre2 2023-11-22 16:31:21 +01:00
Nassim Jahnke 42f38c3209
Drop old resource packs 2023-11-21 07:35:44 +01:00
Nassim Jahnke 151ecdcd72
Don't resend pack in 1.20->1.20.2 for 1.20.3 clients 2023-11-20 20:01:06 +01:00
Nassim Jahnke a0f8ab7bbb
Some cleanup 2023-11-20 19:56:48 +01:00
Nassim Jahnke 1af2103f6c
And the serverbound one 2023-11-20 19:07:23 +01:00
Nassim Jahnke 8769742917
Also handle play resource pack 2023-11-20 19:04:32 +01:00
Nassim Jahnke 20f4907a23
1.20.3-pre1 (probably) 2023-11-20 17:55:28 +01:00
Nassim Jahnke 6fb27e5c17
A more probable probably 2023-11-19 16:18:56 +01:00
Nassim Jahnke 07b173bb74
23w46a (probably) 2023-11-19 16:13:04 +01:00
Nassim Jahnke dbf4271c9d
Fix 1.20.3 component meta type 2023-11-09 17:34:06 +10:00
Nassim Jahnke a2d287ff9f
23w45a 2023-11-09 15:35:07 +10:00
Nassim Jahnke 58ca2024e1 Add static chunkKey method in ChunkPosition 2023-11-06 20:17:42 +10:00
Nassim Jahnke 2881fb18e0 Include api sources in common sources jar 2023-11-06 20:04:45 +10:00
Nassim Jahnke ffdddeeb0a Add back sources collection in universal jar publishing 2023-11-06 14:52:37 +10:00
Nassim Jahnke e356a35aa7 Improve Gradle scripts
Don't create runnable platform jars anymore, since all they really do is increase build time. Also fix texts and Gradle deprecations. Also also publish common with its shadowed configuration, not the plain java components.
2023-11-06 14:31:44 +10:00
Nassim Jahnke 0474810b8d 23w44a 2023-11-02 10:46:28 +10:00
Nassim Jahnke ea818b272e FU 8.5.13 doesn't exist yet 2023-10-31 18:56:38 +10:00
Nassim Jahnke 9342b19aad Update dependencies 2023-10-31 13:38:43 +10:00
Nassim Jahnke 2968047571 Merge remote-tracking branch 'origin/master' into dev 2023-10-31 13:01:34 +10:00
Nassim Jahnke dccac81286 Fix Bungee pipeline clearing, some cleanup 2023-10-31 13:00:35 +10:00
Myles bc67e8d952
Merge pull request #3511 from Jo0001/master-link 2023-10-29 14:39:19 +00:00
Myles f9ab1bd811
Merge pull request #3510 from Jo0001/dev-link 2023-10-29 14:39:10 +00:00
Jo0001 8776e8bdc0 Update ViaSetup Link 2023-10-29 15:36:14 +01:00
Jo0001 ba882f8f98 Update ViaSetup Link 2023-10-29 15:35:22 +01:00
fren_gor a022620712
Fix reflection field search on Spigot 1.20.2 (#3503) 2023-10-28 13:47:59 +10:00
EnZaXD f618cdec99
Don't mention Spigot page anymore and move setting to right place in config.yml (#3505) 2023-10-27 09:16:14 +10:00
Nassim Jahnke ec2093cf5d
23w43a 2023-10-26 10:20:18 +10:00
EnZaXD eb9bc2fdce
Remove permission requirements for root command (#3502) 2023-10-24 13:34:29 +10:00
EnZaXD f35b4f1fac
Add own permission for every sub command (#3501) 2023-10-24 12:59:10 +10:00
EnZaXD abe880dae6
Implement provider to allow signed commands in 1.19.x protocols (#3493) 2023-10-24 10:04:54 +10:00
EnZaXD 0f030c86a7
Implement size var int in all chunk types correctly (#3495) 2023-10-24 10:03:32 +10:00
EnZaXD 2c6e18e4fe
Match current command input for sub argument tab completions (#3496) 2023-10-24 10:02:08 +10:00
RK_01 78c7f03923
Fix and improved custom payload handling (#3497) 2023-10-24 10:01:33 +10:00
RK_01 68a32ed2f0
Fix identifier handling and validation (#3498) 2023-10-24 09:58:43 +10:00
EnZaXD 7cf008bb62
Delete unused config option and add missing documentation (#3500) 2023-10-24 09:56:29 +10:00
RK_01 a60342359b
Fix 1.19.0 chat signing causing error message (#3494) 2023-10-23 10:28:44 +10:00
RK_01 0e269fa493
Implement support for chat signing (#3490) 2023-10-22 19:33:59 +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 faedf26b5b Clean up Particle 2023-10-21 13:00:39 +10:00
RK_01 c7c38e70c0
Make ClientChunks a StorableObject (#3487) 2023-10-21 12:13:24 +10:00
Nassim Jahnke 21d293dd7f Rneame CustomByteType -> FixedByteArrayType 2023-10-20 17:22:00 +10:00
Nassim Jahnke 6481cec270
Just store whether to read skylight directly 2023-10-20 17:09:40 +10:00
Nassim Jahnke 54c04a62e0
Store environment instead of clientlevel in chunk types 2023-10-20 16:56:53 +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 84a054aac1
Give PacketValue a generic type 2023-10-20 12:31:16 +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 553dd2cb45
Move missed type 2023-10-19 21:08:00 +10:00
Nassim Jahnke a30d62a995
Move and rename chunk types 2023-10-19 21:03:00 +10:00
Nassim Jahnke 08f6b3ce36
Only remove id field if it actually is a uuid 2023-10-19 12:16:22 +10:00
Nassim Jahnke 7d1b0d83ce
Fix minecart block state id 2023-10-19 11:03:39 +10:00
Nassim Jahnke e7d0b01eee
23w42a 2023-10-19 10:53:14 +10:00
Nassim Jahnke fdfc528a9a
Cleanup and renames around types 2023-10-19 09:28:21 +10:00
Nassim Jahnke dccb6f234b
Add missing switch breaks 2023-10-18 19:48:19 +10:00
Nassim Jahnke 6e7f936e83
Move methods from VB to VV ComponentRewriter 2023-10-18 13:50:08 +10:00
Nassim Jahnke ec26bafd53
Update ComponentRewriter with nbt methods 2023-10-18 13:26:09 +10:00
Nassim Jahnke d7d7940d0b
Move protocol templates from wiki to extra module 2023-10-16 22:30:12 +10:00
Nassim Jahnke 667278f9e6 Handle booleans in json->tag conversion 2023-10-16 15:35:16 +10:00
Nassim Jahnke fa7096c5c1 Convert boss bar packets 2023-10-13 23:28:16 +10:00
Kichura 958064b44c
Suggest Fabric loader 0.14.0+ and ViaFabric 0.4.10+ (#3474) 2023-10-13 23:26:38 +10:00
Nassim Jahnke 26dad99265
23w41a 2023-10-12 01:32:00 +10:00
Pablo Herrera d8007dc73c
Fix valid block placements being prevented (#3407) 2023-10-11 23:29:45 +10:00
Nassim Jahnke 5850a9852d More spring cleaning 2023-10-11 23:14:41 +10:00
Nassim Jahnke 095fe16447 Don't use not yet loaded platform logger in config 2023-10-11 13:23:40 +10:00
Nassim Jahnke cbf8b8f401 Send last tags when re-entering config phase 2023-10-11 01:09:36 +10:00
Nassim Jahnke d600b0cbe1 Queue join game first, then send config packets 2023-10-11 00:06:48 +10:00
Nassim Jahnke 0d70cdbe15 Fix uuid nbt conversion 2023-10-10 23:46:24 +10:00
Nassim Jahnke b1b0874c0f Some cosmetic code changes and typo fixes 2023-10-08 20:54:04 +10:00
Nassim Jahnke 67ba0e9566 Fix typos of entity 2023-10-08 19:03:14 +10:00
Nassim Jahnke bebdc34b4b Register config during manager init 2023-10-08 19:01:00 +10:00
Nassim Jahnke 3e0eb90662 Update OpenNBT (now ViaNBT) 2023-10-08 18:44:54 +10:00
Nassim Jahnke d8f98945e2
Refactor ConfigurationProvider 2023-10-08 14:23:55 +10:00
RK_01 0c3d709456
Clear input buffer instead of reading remaining bytes (#3471) 2023-10-08 03:05:25 +00:00
EnZaXD 868c5ba203
Make registry fields in 1.8 ItemRewriter public (#3472) 2023-10-08 03:05:11 +00:00
Nassim Jahnke 0953ff77e4 Implement dumb nbt<->json component conversion 2023-10-07 23:28:42 +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
Nassim Jahnke def3bf9d4a
Add remaining packet transformers, missing actual component conversion 2023-10-06 08:57:00 +10:00
Nassim Jahnke cb1b33b3e7
Start working on 23w40a 2023-10-05 18:22:13 +10:00
Nassim Jahnke a8acae2d5f
4.8.1 Release 2023-10-03 20:57:47 +10:00
Nassim Jahnke fdb7f47749 Properly throw the client information packet into the queue instead 2023-10-03 20:54:51 +10:00
Nassim Jahnke cabb95a3a4 Schedule send client information 2023-10-03 20:39:46 +10:00
Nassim Jahnke 0b93af88a3 Re-send client information when re-entering play state
Fixes #3442
2023-10-03 19:49:55 +10:00
Unoqwy 11cb113619
Fix disconnecting error for unknown mobs with metadata (#3443) 2023-10-03 09:46:02 +00:00
Nassim Jahnke 429e4f0bff Switch server state after sending game profile
Probably fixes #3453
2023-09-28 11:12:46 +10:00
Nassim Jahnke 3b0d1d961a
Fix secondary effect reading in serverbound beacon
Fixes #3455
2023-09-28 09:34:26 +10:00
Nassim Jahnke b4720c723a Fix biome and chunk size preconditions 2023-09-27 14:35:20 +10:00
Nassim Jahnke 215cbc6310 Fix 1.20.2 custom potion effect handling
Fixes #3448
2023-09-27 11:30:35 +10:00
RK_01 f07ba9b527
Reduce delay for sequence acknowledgements (#3445) 2023-09-26 10:53:36 +10:00
Misode 5a20030ff3
[ci skip] Update Minecraft Wiki link to new domain after fork (#3446) 2023-09-26 10:52:03 +10:00
Nassim Jahnke 1b350c0c53
Try to fix ci 2023-09-26 10:40:44 +10:00
Nassim Jahnke 87db6fc75a [ci skip] Fix branch check 2023-09-26 00:17:33 +10:00
Nassim Jahnke 840770a350 Fix missing server state change 2023-09-25 20:11:29 +10:00
Nassim Jahnke 3997ea70f7
Fixup state splitting 2023-09-25 18:59:15 +10:00
Nassim Jahnke 854696abff
Add separate client and server protocol state 2023-09-25 16:44:41 +10:00
Nassim Jahnke d92b9fdeaa Fix connection field search on 1.20.2 2023-09-25 09:57:55 +10:00
Nassim Jahnke 270d28f259
Don't cancel custom query answer 2023-09-25 08:56:26 +10:00
RK_01 ed1852ba40
Fix 1.20.2 -> 1.20.1 brand custom payloads properly (#3440) 2023-09-25 08:52:17 +10:00
riku6460 f91e6a83f9
Fix sign nbt on 1.20 client (#3436) 2023-09-24 13:02:31 +10:00
Nassim Jahnke 8a0e187621 Drop custom payloads with non-alphanumerical brands
For some reason the client errors only if it contains certain characters, needs further investigation. Mojang changed their string writing implementation, though the actual encoding does not seem to have changed, and this error does not occur anywhere else
2023-09-24 10:48:47 +10:00
Nassim Jahnke 0e8b5e8e98 Bump version to 4.8.1-SNAPSHOT 2023-09-24 10:47:43 +10:00
Nassim Jahnke e30dd63b3c
[ci skip] Only publish releases from the main branch 2023-09-22 15:32:14 +10:00
Nassim Jahnke 489b28e520
4.8.0 Release 2023-09-21 10:34:20 +10:00
Nassim Jahnke d23e743550
Fix particle handling 2023-09-21 10:33:58 +10:00
Nassim Jahnke 16f89f2638
Don't re-enter config state if the dimension registry did not change 2023-09-19 21:14:45 +10:00
Nassim Jahnke fe5646a68c Re-send last resource pack on server switch 2023-09-19 11:54:03 +10:00
Nassim Jahnke 53aca791dd Fix reentering of the configuration state 2023-09-19 00:37:55 +10:00
Nassim Jahnke 1f0a4c26db
1.20.2-rc2 2023-09-19 00:07:43 +10:00
Nassim Jahnke 4c34ced240
Fix record handling due to no mappings
Fixes #3422
2023-09-16 13:28:15 +10:00
Nassim Jahnke 18c4f90cb0
Don't cancel system chat messages 2023-09-16 13:27:44 +10:00
Nassim Jahnke 9c90445c9c
Release ConfigurationState buffers on disconnect
They're heap buffers, but still good practice
2023-09-16 13:27:23 +10:00
Nassim Jahnke 494e6ffc05
1.20.2-rc1 2023-09-16 10:19:49 +10:00
Nassim Jahnke a196dbc16b
1.20.2-pre4 2023-09-14 09:03:13 +10:00
Nassim Jahnke 8934bbdfc3
1.20.2-pre3 2023-09-12 23:06:54 +10:00
Myles 8316c59010
Merge pull request #3420 from Kichura/dev 2023-09-11 19:55:27 +01:00
Kichura 5ea1c1ec95
Use https instead of http for wiki.vg source. 2023-09-11 20:06:27 +02:00
Nassim Jahnke cc7c571a3c 1.20.2-pre2 2023-09-08 09:05:31 +10:00
Nassim Jahnke 06b4678b2d [ci skip] Add IDEA extension plugin 2023-09-06 11:20:32 +10:00
Nassim Jahnke a109118a97 1.20.2-pre1 2023-09-06 00:56:31 +10:00
Nassim Jahnke a135a1414c [ci skip] Update Gradle wrapper 2023-09-05 21:16:24 +10:00
Nassim Jahnke f50751ed48 [ci skip] Update blossom 2023-09-05 21:10:43 +10:00
Kichura 4b7998b4ea
[ci skip] Update checkout to v4, Check for latest JDK 11 build (#3416) 2023-09-05 20:48:36 +10:00
Nassim Jahnke 6db1a2a614 Fix wrong packet type being used 2023-08-31 11:49:54 +10:00
Nassim Jahnke 625373827c Fix MetaTypes1_20_2 item type 2023-08-31 11:44:55 +10:00
Nassim Jahnke a9288ebd3a 23w35a 2023-08-31 00:42:47 +10:00
Nassim Jahnke 01bbb2c1c2 [ci skip] Update Hangar publish plugin 2023-08-26 20:04:06 +10:00
Nassim Jahnke 8dbc8e8eba Update mappings file for 23w33a 2023-08-18 01:28:55 +10:00
Nassim Jahnke 0c9f3aa080 23w33a 2023-08-18 01:27: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
Pablo Herrera e112f81ec8
Optimize memory allocation for data palette (#3402) 2023-08-14 10:40:10 +10:00
Nassim Jahnke 23f776a6ee Handle minecart blocks 2023-08-11 21:12:23 +10:00
Nassim Jahnke 0050872950 Update README 2023-08-11 21:12:03 +10:00
Nassim Jahnke 7e53f55509 Also publish dev branch builds to Hangar 2023-08-11 20:33:47 +10:00
Nassim Jahnke 1bf7962dc3 Call latestCommitHash only once 2023-08-11 16:24:27 +10:00
Nassim Jahnke 50176dc317 Include link to commit in autopublished changelog 2023-08-11 16:21:44 +10:00
Nassim Jahnke 9ed074d0d5 Handle changes block state ids 2023-08-11 15:52:53 +10:00
Nassim Jahnke 8bad8a10be Finish publishing action 2023-08-11 12:28:38 +10:00
Nassim Jahnke 34509e86c0 [ci skip] Add Velocity and Waterfall to publish config 2023-08-11 00:39:45 +10:00
Nassim Jahnke ef75bd567d [ci skip] GH already skips all actions with ci skip 2023-08-10 22:48:22 +10:00
Nassim Jahnke 7ed3e50e93 [ci skip] Skip commits with ci skip prefix 2023-08-10 22:46:15 +10:00
Nassim Jahnke a45eceaf1d Hello Hangar 😎 2023-08-10 22:18:23 +10:00
Nassim Jahnke 573cdfb3ac Merge remote-tracking branch 'origin/master' into dev 2023-08-10 21:49:26 +10:00
Nassim Jahnke 28787340d1 Setup Hangar and modrinth autopublishing 2023-08-10 21:29:03 +10:00
Nassim Jahnke c358245c0b Fix spawn tracker mapping data check 2023-08-10 17:14:01 +10:00
Nassim Jahnke cb073405b7 Effect ids start at 1 before 1.20.2 2023-08-10 17:08:36 +10:00
Nassim Jahnke f618f6a7d6 Actually write effect key 2023-08-10 13:51:15 +10:00
Nassim Jahnke c5e066e050 23w32a 2023-08-10 13:35:47 +10:00
riku6460 d954e1745d
Fix itemArrayType of ItemRewriter on dev branch (#3398) 2023-08-09 07:38:24 +10:00
Nassim Jahnke 9c92ccea77 Finish up state switching 2023-08-06 15:40:15 +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
RK_01 c1cd8bc03e
Allow skylight to be set to null (#3396) 2023-08-06 11:08:52 +10:00
Nassim Jahnke 39efc5262e Add todo 2023-08-05 13:31:43 +10:00
Nassim Jahnke 6e5e115c3b Remove unnecessary rewriting code, fix recipe handlers 2023-08-05 12:28:39 +10:00
Nassim Jahnke fbcbd33c66 Small refactors 2023-08-04 12:35:35 +10:00
Nassim Jahnke 7bea3142bc Fix baseprotocol registration 2023-08-04 12:26:07 +10:00
Nassim Jahnke fb472c3454 Cleanup imports 2023-08-04 12:25:29 +10:00
Nassim Jahnke ac10bb3fd0 Complete 23w31a protocol 2023-08-04 12:22:18 +10:00
Nassim Jahnke 1bc3d407d1 More juicy, untested work 2023-08-03 23:03:42 +10:00
Nassim Jahnke 62c0ef360f More absolutely cursed WIP 2023-08-03 21:58:23 +10:00
Nassim Jahnke 8c6d104faa 23w31a eletric boogaloo 2023-08-03 19:47:18 +10:00
Nassim Jahnke f6b8c4a8c8 Rename rewriter classes 2023-08-03 18:38:18 +10:00
Nassim Jahnke 6586fc1436 More work on the snapshot 2023-08-03 18:36:30 +10:00
Nassim Jahnke 6dfd4747ee Start working on 23w31a 2023-08-03 13:58:22 +10:00
Nassim Jahnke 6377721ebd Fix non item display rotation
Fixes #3383
2023-07-24 20:56:45 +10:00
RK_01 2ec6185c46
Fix <= 1.14 position y sign reading (#3381) 2023-07-12 19:10:49 +02:00
Nassim Jahnke b22907748a
Update gradle wrapper 2023-07-11 23:34:37 +02:00
Nassim Jahnke 1aee8a7a6c
Don't create ack task when already disabled
Fixes #3373
2023-07-02 13:29:07 +02:00
Nassim Jahnke 7edb43844c
Properly handle item display rotation change
Fixes #3354
2023-07-02 13:27:03 +02:00
sandtechnology f28aac5eb3
Handle more null TextComponent for 1.19 to 1.18.2 (#3366) 2023-06-24 11:12:14 +02:00
Nassim Jahnke 4971eeab6a
Don't check block items for armor swapping 2023-06-22 11:03:11 +02:00
Pablo Herrera 0bb940e42d
Fix missing block connection updates on cancelled place/remove (#3359) 2023-06-20 13:39:02 +02:00
Pablo Herrera e32933ada9
Fix late registration of join listener (#3360) 2023-06-19 17:02:05 +02:00
EnZaXD a817746edc
Remove requirement for MovementTransmitterProvider (#3355) 2023-06-18 15:30:58 +02:00
RK_01 408392e796
Fixed some 1.9 -> 1.8 movement issues (#3353) 2023-06-18 14:51:37 +02:00
Kichura 20a4ae3e4b
Use friendly names in CI tasks, Update shadow and blossom (#3349) 2023-06-15 09:48:13 +02:00
Nassim Jahnke 08b2d78165
Move dump creation to util class 2023-06-14 23:13:44 +02:00
FlorianMichael 17eb7b676a
Remap old smithing menu to furnace in 1.20 2023-06-12 18:57:20 +02:00
Nassim Jahnke 9a1598b9ed
Update 1.20/1.20.1 protocol version 2023-06-12 16:47:22 +02:00
Myles 9e7cd151bc
Update version table to 1.20 2023-06-11 12:02:25 +01:00
David Luedtke 2a14f9a0cd
Fix display rotation change 2023-06-09 12:17:11 +02:00
Ossi Erkkilä bf825d5ef6
Fix `SpongeViaInjector#getServerProtocolVersion()` for Sponge API-10+ (#3337) 2023-06-09 11:29:55 +02:00
EnZaXD 28ba4afc27
Added VersionInfo#getVersion to bypass Java inlining (#3344) 2023-06-09 08:52:30 +02:00
Nassim Jahnke 7f347231bb
Bump version to 4.7.1-SNAPSHOT 2023-06-08 13:21:19 +02:00
Nassim Jahnke f1b5f9223a
4.7.0 Release 2023-06-06 13:30:57 +02:00
Nassim Jahnke e4a1530aa8
Fix >1.18 vibration particle handling 2023-06-06 13:28:02 +02:00
Nassim Jahnke 09b67fad63
Small cleanup 2023-06-06 12:30:56 +02:00
Nassim Jahnke 1b3c5b4032
Create its own packets enum for 1.14.4
Acknowledge player digging was only added then, make sure this is represented correctly
2023-06-05 09:06:15 +02:00
Nassim Jahnke b7d8a3c8d5
1.20-rc1 2023-05-31 15:40:23 +02:00
Kichura 9a515df0f3
Update dependencies (#3332) 2023-05-30 09:25:18 +02:00
Nassim Jahnke c6103f2f51
1.20-pre7 2023-05-29 16:54:45 +02:00
Nassim Jahnke 5c0eda76e8
Don't replace unchanged 1.12->1.13 translations with hard text
Also add the remaining unchanged keys to the file
Fixes #3284
2023-05-28 13:48:22 +02:00
Nassim Jahnke 544a28b06b
1.20-pre6 2023-05-25 15:09:42 +02:00
RK_01 5c145d0184
Fixed high CPU usage on Java 8 (#3325)
Fixed https://bugs.openjdk.java.net/browse/JDK-8129861 by setting the core size of the TaskScheduler ThreadPool to 1
2023-05-23 18:18:10 +02:00
Nassim Jahnke ed55bccfe4
Fix 1.19.3->1.19.4 statistics handling
Fixes #3324
2023-05-23 16:39:20 +02:00
Nassim Jahnke 5acc2fefbc
1.20-pre5 2023-05-23 15:40:54 +02:00
Nassim Jahnke 7f748b5c68
1.20-pre4 2023-05-19 15:40:54 +02:00
Nassim Jahnke 0ec03f8b09
1.20-pre3 2023-05-19 14:22:14 +02:00
Nassim Jahnke a70034e0b5
Remove early static initializer call
Weird NoClassDefFoundError going on
2023-05-18 11:53:34 +02:00
Nassim Jahnke 98a0fdca94
1.20-pre2 2023-05-16 16:00:36 +02:00
Nassim Jahnke 82961cc153
Add 1.20 sound mappings
Co-authored-by: Pantera (Mad_Daniel) <89838384+Pantera07@users.noreply.github.com>
2023-05-14 08:42:51 +02:00
Nassim Jahnke 6c0d891c9f
Don't print mapping validity warning if conversion warnings are disabled 2023-05-14 08:38:24 +02:00
Nassim Jahnke 6fa387e6ab
Update the rest of nbt files to be uncompressed 2023-05-10 15:53:53 +02:00
Nassim Jahnke 07bdb57694
1.20-pre1 2023-05-10 15:46:03 +02:00
Nassim Jahnke 75dd79347a
Update mappings 2023-05-05 21:05:35 +02:00
Nassim Jahnke 9257890d3c
Update protocol version 2023-05-05 18:50:15 +02:00
Nassim Jahnke 891f55192d
23w18a, maybe 2023-05-03 15:21:24 +02:00
EnZaXD 7adadc0d21
added PlayerAbilities Provider (#3311) 2023-05-03 09:17:51 +02:00
Camotoy 638378cddf
Let records properly stop in 1.19.3 -> 1.19.4 (#3308)
Fixes #3307
2023-04-28 14:44:29 +02:00
Nassim Jahnke 56d772df34
23w17a 2023-04-26 18:46:52 +02:00
Nassim Jahnke 7bb5cf3ae9
Update Gradle wrapper 2023-04-26 12:23:02 +02:00
Nassim Jahnke b67e3c30fd
Move packet construction of schedule send methods to event loop as well
Fixes #3306
2023-04-26 12:18:08 +02:00
EnZaXD a2e214ae18
Improve InventoryTracker16 Code (#3302) 2023-04-22 08:57:47 +02:00
Nassim Jahnke 54d8e29a7e
23w16a 2023-04-20 17:28:30 +02:00
Joseph Burton a2daa9c989
Fix PlayerLookTargetProvider, apparently this packet is written in two different places (#3301) 2023-04-19 14:43:39 +02:00
Nassim Jahnke 74cc42fecf
Merge remote-tracking branch 'origin/master' into dev 2023-04-19 12:08:15 +02:00
Joseph Burton dd59ddbd4f
Add PlayerLookTargetProvider (#3299) 2023-04-19 12:04:17 +02:00
Nassim Jahnke bcfc77aa7d
Merge branch 'master' into dev 2023-04-18 13:35:14 +02:00
Nassim Jahnke 1a46346789
Handle optional block state entity meta 2023-04-18 13:34:20 +02:00
RK_01 394be165fd
Handle ENTITY_TELEPORT's targeting the client player (#3296) 2023-04-14 16:38:39 +02:00
Nassim Jahnke 20d86374b5
23w14a 2023-04-05 15:25:37 +02:00
Nassim Jahnke 8864b161f9
Print plugin name in unsupported software matching 2023-04-02 09:41:20 +02:00
Nassim Jahnke 7b0160d6c3
Fix redstone blockconnections
Fixes #3281
2023-03-31 16:41:06 +02:00
Nassim Jahnke 7e5173982d
23w13a 2023-03-29 16:32:50 +02:00
Nassim Jahnke ee75f19790
Merge branch 'master' into dev
# Conflicts:
#	gradle.properties
2023-03-29 16:28:57 +02:00
Nassim Jahnke e54f6d1999
Override metatypeimpl tostring 2023-03-28 17:27:22 +02:00
Nassim Jahnke c46bb5bcf5
Update Folia check 2023-03-25 00:31:50 +01:00
Nassim Jahnke 9682b68251
Handle sign nbt changes 2023-03-24 11:19:51 +01:00
Nassim Jahnke 364cfad9d8
23w12a 2023-03-22 18:49:18 +01:00
958 changed files with 29141 additions and 11784 deletions

16
.editorconfig Normal file
View File

@ -0,0 +1,16 @@
[*]
charset = utf-8
indent_size = 4
indent_style = space
insert_final_newline = false
tab_width = 4
[*.java]
ij_java_class_count_to_use_import_on_demand = 999999
ij_java_names_count_to_use_import_on_demand = 999999
ij_java_imports_layout = *,|,$*
ij_java_generate_final_locals = true
ij_java_generate_final_parameters = true
[{*.json,*.yml}]
indent_size = 2

2
.github/FUNDING.yml vendored Normal file
View File

@ -0,0 +1,2 @@
github: kennytv
patreon: kennytv

View File

@ -23,11 +23,11 @@ body:
attributes:
label: Console Error
description: |
If you encounter warnings/errors in your console, **paste them with https://paste.gg/ and put the paste link here**.
If you encounter warnings/errors in your console, **paste them with https://mclo.gs/ and put the paste link here**.
If the error is small/less than 10 lines, you may put it directly into this field.
value: |
```
Put the paste.gg link or text here.
Put the mclo.gs link or text here.
```
placeholder: Please do not remove the grave accents; simply replace the line of text in the middle.
validations:
@ -71,7 +71,7 @@ body:
attributes:
label: Additional Server Info
description: |
Do you use a proxy (eg. BungeeCord)? What software do you use and what plugins?
Do you use a proxy (e.g. BungeeCord)? What software do you use and what plugins?
placeholder: |
Example: "I also use BungeeCord with the following plugins: x, y, z"
validations:

View File

@ -1,6 +1,3 @@
# This workflow will build a Java project with Gradle
# For more information see: https://help.github.com/actions/language-and-framework-guides/building-and-testing-java-with-gradle
name: Java CI with Gradle
on: [push, pull_request]
@ -13,16 +10,15 @@ jobs:
runs-on: ubuntu-22.04
steps:
- uses: actions/checkout@v3
- uses: gradle/wrapper-validation-action@v1
- name: Set up JDK 11
uses: actions/setup-java@v3
- name: Checkout Repository
uses: actions/checkout@v4
- name: Validate Gradle Wrapper
uses: gradle/wrapper-validation-action@v2
- name: Set up JDK 17
uses: actions/setup-java@v4
with:
distribution: 'temurin'
java-version: 11
java-version: 17
check-latest: true
- name: Build with Gradle
run: ./gradlew build
- uses: actions/upload-artifact@v3
with:
name: artifact
path: build/libs

27
.github/workflows/publish.yml vendored Normal file
View File

@ -0,0 +1,27 @@
name: Publish to Hangar and Modrinth
on:
push:
branches:
- master
- dev
jobs:
publish:
if: github.repository_owner == 'ViaVersion'
runs-on: ubuntu-22.04
steps:
- name: Checkout Repository
uses: actions/checkout@v4
- name: Validate Gradle Wrapper
uses: gradle/wrapper-validation-action@v2
- name: Set up JDK 17
uses: actions/setup-java@v4
with:
distribution: 'temurin'
java-version: 17
check-latest: true
- name: Publish
env:
HANGAR_TOKEN: ${{ secrets.HANGAR_TOKEN }}
MODRINTH_TOKEN: ${{ secrets.MODRINTH_TOKEN }}
run: ./gradlew build modrinth publishAllPublicationsToHangar --stacktrace

View File

@ -1,6 +1,6 @@
<component name="CopyrightManager">
<copyright>
<option name="notice" value="This file is part of ViaVersion - https://github.com/ViaVersion/ViaVersion&#10;Copyright (C) &amp;#36;originalComment.match(&quot;Copyright \(C\) (\d+)&quot;, 1, &quot;-&quot;)&amp;#36;today.year ViaVersion and contributors&#10;&#10;This program is free software: you can redistribute it and/or modify&#10;it under the terms of the GNU General Public License as published by&#10;the Free Software Foundation, either version 3 of the License, or&#10;(at your option) any later version.&#10;&#10;This program is distributed in the hope that it will be useful,&#10;but WITHOUT ANY WARRANTY; without even the implied warranty of&#10;MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the&#10;GNU General Public License for more details.&#10;&#10;You should have received a copy of the GNU General Public License&#10;along with this program. If not, see &lt;http://www.gnu.org/licenses/&gt;." />
<option name="notice" value="This file is part of ViaVersion - https://github.com/ViaVersion/ViaVersion&#10;Copyright (C) 2016-&amp;#36;today.year ViaVersion and contributors&#10;&#10;This program is free software: you can redistribute it and/or modify&#10;it under the terms of the GNU General Public License as published by&#10;the Free Software Foundation, either version 3 of the License, or&#10;(at your option) any later version.&#10;&#10;This program is distributed in the hope that it will be useful,&#10;but WITHOUT ANY WARRANTY; without even the implied warranty of&#10;MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the&#10;GNU General Public License for more details.&#10;&#10;You should have received a copy of the GNU General Public License&#10;along with this program. If not, see &lt;http://www.gnu.org/licenses/&gt;." />
<option name="myName" value="viaversion-gpl" />
</copyright>
</component>

View File

@ -1,6 +1,6 @@
<component name="CopyrightManager">
<copyright>
<option name="notice" value="This file is part of ViaVersion - https://github.com/ViaVersion/ViaVersion&#10;Copyright (C) &amp;#36;originalComment.match(&quot;Copyright \(C\) (\d+)&quot;, 1, &quot;-&quot;)&amp;#36;today.year ViaVersion and contributors&#10;&#10;Permission is hereby granted, free of charge, to any person obtaining a copy&#10;of this software and associated documentation files (the &quot;Software&quot;), to deal&#10;in the Software without restriction, including without limitation the rights&#10;to use, copy, modify, merge, publish, distribute, sublicense, and/or sell&#10;copies of the Software, and to permit persons to whom the Software is&#10;furnished to do so, subject to the following conditions:&#10;&#10;The above copyright notice and this permission notice shall be included in all&#10;copies or substantial portions of the Software.&#10;&#10;THE SOFTWARE IS PROVIDED &quot;AS IS&quot;, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR&#10;IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,&#10;FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE&#10;AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER&#10;LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,&#10;OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE&#10;SOFTWARE." />
<option name="notice" value="This file is part of ViaVersion - https://github.com/ViaVersion/ViaVersion&#10;Copyright (C) 2016-&amp;#36;today.year ViaVersion and contributors&#10;&#10;Permission is hereby granted, free of charge, to any person obtaining a copy&#10;of this software and associated documentation files (the &quot;Software&quot;), to deal&#10;in the Software without restriction, including without limitation the rights&#10;to use, copy, modify, merge, publish, distribute, sublicense, and/or sell&#10;copies of the Software, and to permit persons to whom the Software is&#10;furnished to do so, subject to the following conditions:&#10;&#10;The above copyright notice and this permission notice shall be included in all&#10;copies or substantial portions of the Software.&#10;&#10;THE SOFTWARE IS PROVIDED &quot;AS IS&quot;, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR&#10;IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,&#10;FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE&#10;AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER&#10;LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,&#10;OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE&#10;SOFTWARE." />
<option name="myName" value="viaversion-mit" />
</copyright>
</component>

View File

@ -1,3 +1,3 @@
<component name="DependencyValidationManager">
<scope name="ViaVersion-API" pattern="src[viaversion-parent.viaversion-api*]:*..*&amp;&amp;!src[viaversion-parent.viaversion-api.main]:com.viaversion.viaversion.api.minecraft.nbt.*" />
<scope name="ViaVersion-API" pattern="src[viaversion-parent.viaversion-api*]:*..*" />
</component>

View File

@ -1,49 +1,41 @@
# ViaVersion - Spigot, Sponge, BungeeCord, Velocity
# ViaVersion
[![Latest Release](https://img.shields.io/github/v/release/ViaVersion/ViaVersion)](https://viaversion.com)
[![Build Status](https://github.com/ViaVersion/ViaVersion/actions/workflows/gradle.yml/badge.svg?branch=master)](https://github.com/ViaVersion/ViaVersion/actions)
[![Discord](https://img.shields.io/badge/chat-on%20discord-blue.svg)](https://viaversion.com/discord)
**Allows the connection of higher client versions to lower server versions**
**Allows the connection of higher client versions to lower server versions -
it works on any platform you can think of.**
The base ViaVersion jar runs on Paper, Velocity, Bungee, and Sponge. We also have projects integrating ViaVersion to run
on Fabric, Forge, or as a standalone proxy to join from basically any client version on any server version from the
past decade. **See [HERE](https://github.com/ViaVersion) for an overview of the different Via\* projects.**
Supported Versions:
![Table (https://i.imgur.com/aSjHvQk.png)](https://i.imgur.com/aSjHvQk.png)
On Paper you may also use ProtocolSupport, but ensure you have the right build for your server version.
![Table (https://i.imgur.com/sTrVnC2.png)](https://i.imgur.com/sTrVnC2.png)
**User Docs:** https://docs.viaversion.com/display/VIAVERSION/
Sources
Releases/Dev Builds
--------
**[OpenNBT](https://github.com/ViaVersion/OpenNBT)**
You can find official releases in the following places:
**[Via Mappings Generator](https://github.com/ViaVersion/Mappings)**
- **Hangar (for our plugins)**: https://hangar.papermc.io/ViaVersion/ViaVersion
- **Modrinth (for our mods)**: https://modrinth.com/mod/viaversion
- **GitHub**: https://github.com/ViaVersion/ViaVersion/releases
**[Mojang mappings](https://minecraft.fandom.com/wiki/Obfuscation_map)** (Thank you, Mojang, very cool)
Dev builds for **all** of our projects are on our Jenkins server:
**[wiki.vg](https://wiki.vg)** (Used for historic information regarding packet structure, we also contribute back)
**[Burger](https://github.com/Pokechu22/Burger)** (See [PAaaS](https://github.com/Matsv/Paaas))
Releases / Dev Builds
--------
You can find official releases here:
https://www.spigotmc.org/resources/viaversion.19254/history
- **Jenkins**: https://ci.viaversion.com
ViaVersion as a Dependency
----------
You can find official dev builds here:
**Jenkins:** https://ci.viaversion.com
**JavaDocs:** https://jd.viaversion.com
**Maven Repository:**
**Maven:**
```xml
<repository>
<id>viaversion-repo</id>
@ -51,7 +43,6 @@ You can find official dev builds here:
</repository>
```
**API-artifact:**
```xml
<dependency>
<groupId>com.viaversion</groupId>
@ -61,7 +52,17 @@ You can find official dev builds here:
</dependency>
```
Replace the version depending on your needs.
**Gradle:**
```kotlin
repositories {
maven("https://repo.viaversion.com")
}
dependencies {
compileOnly("com.viaversion:viaversion-api:VERSION") // Replace the version
}
```
If you need access to the existing protocol or platform implementations, use the parent artifact `viaversion`.
Please note the [differences in licensing](#license).
@ -69,8 +70,8 @@ Please note the [differences in licensing](#license).
Building
--------
After cloning this repository, build the project with Gradle by running `./gradlew build` and take the created jar out of
the `build/libs` directory.
After cloning this repository, build the project with Gradle by running `./gradlew build` and take the created jar out
of the `build/libs` directory.
Mapping Files
@ -78,12 +79,21 @@ Mapping Files
Mapping files are generated and managed in our [Mappings repository](https://github.com/ViaVersion/Mappings).
Resources
--------
- **[Via Mappings Generator](https://github.com/ViaVersion/Mappings)**
- **[Mojang mappings](https://minecraft.wiki/w/Obfuscation_map)** (Thank you, Mojang, very cool)
- **[wiki.vg](https://wiki.vg)** (Used for historic information regarding packet structure, we also contribute back)
- **[Burger](https://github.com/Pokechu22/Burger)** (See [PAaaS](https://github.com/Matsv/Paaas))
License
--------
The entirety of the [API directory](api) (including the legacy API directory) is licensed under the MIT License; see [licenses/MIT.md](licenses/MIT.md) for
The entirety of the [API directory](api) (including the legacy API directory) is licensed under the MIT License;
see [licenses/MIT.md](licenses/MIT.md) for
details.
Everything else, unless explicitly stated otherwise, is licensed under the GNU General Public License, including the end
product as a whole; see [licenses/GPL.md](licenses/GPL.md) for details.
Everything else, unless explicitly stated otherwise, is licensed under the GNU General Public License v3, including the
end-product as a whole; see [licenses/GPL.md](licenses/GPL.md) for details.
Special thanks to all our [Contributors](https://github.com/ViaVersion/ViaVersion/graphs/contributors).

View File

@ -1,25 +0,0 @@
plugins {
id("com.github.johnrengelman.shadow")
}
// Shade and relocate adventure in an extra module, so that common/the rest can directly depend on a
// relocated adventure without breaking native platform's adventure usage with project wide relocation
tasks {
shadowJar {
relocate("net.kyori", "com.viaversion.viaversion.libs.kyori")
}
build {
dependsOn(shadowJar)
}
}
dependencies {
api(libs.bundles.adventure) {
exclude("org.checkerframework")
exclude("net.kyori", "adventure-api")
exclude("net.kyori", "adventure-bom")
exclude("com.google.code.gson", "gson")
}
}
publishShadowJar()

View File

@ -1,6 +1,6 @@
/*
* This file is part of ViaVersion - https://github.com/ViaVersion/ViaVersion
* Copyright (C) 2016-2023 ViaVersion and contributors
* Copyright (C) 2016-2024 ViaVersion and contributors
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal

View File

@ -1,6 +1,6 @@
/*
* This file is part of ViaVersion - https://github.com/ViaVersion/ViaVersion
* Copyright (C) 2016-2023 ViaVersion and contributors
* Copyright (C) 2016-2024 ViaVersion and contributors
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal

View File

@ -1,6 +1,6 @@
/*
* This file is part of ViaVersion - https://github.com/ViaVersion/ViaVersion
* Copyright (C) 2016-2023 ViaVersion and contributors
* Copyright (C) 2016-2024 ViaVersion and contributors
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal

View File

@ -1,6 +1,6 @@
/*
* This file is part of ViaVersion - https://github.com/ViaVersion/ViaVersion
* Copyright (C) 2016-2023 ViaVersion and contributors
* Copyright (C) 2016-2024 ViaVersion and contributors
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal

View File

@ -1,6 +1,6 @@
/*
* This file is part of ViaVersion - https://github.com/ViaVersion/ViaVersion
* Copyright (C) 2016-2023 ViaVersion and contributors
* Copyright (C) 2016-2024 ViaVersion and contributors
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal

View File

@ -1,6 +1,6 @@
/*
* This file is part of ViaVersion - https://github.com/ViaVersion/ViaVersion
* Copyright (C) 2016-2023 ViaVersion and contributors
* Copyright (C) 2016-2024 ViaVersion and contributors
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal

View File

@ -1,6 +1,6 @@
/*
* This file is part of ViaVersion - https://github.com/ViaVersion/ViaVersion
* Copyright (C) 2016-2023 ViaVersion and contributors
* Copyright (C) 2016-2024 ViaVersion and contributors
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal

View File

@ -1,6 +1,6 @@
/*
* This file is part of ViaVersion - https://github.com/ViaVersion/ViaVersion
* Copyright (C) 2016-2023 ViaVersion and contributors
* Copyright (C) 2016-2024 ViaVersion and contributors
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
@ -23,7 +23,7 @@
package us.myles.ViaVersion.api.protocol;
import com.google.common.base.Preconditions;
import com.viaversion.viaversion.api.protocol.version.VersionRange;
import com.viaversion.viaversion.api.protocol.version.SubVersionRange;
import it.unimi.dsi.fastutil.ints.Int2ObjectMap;
import it.unimi.dsi.fastutil.ints.Int2ObjectOpenHashMap;
import java.util.ArrayList;
@ -42,23 +42,23 @@ public class ProtocolVersion {
private static final Int2ObjectMap<ProtocolVersion> versions = new Int2ObjectOpenHashMap<>();
private static final List<ProtocolVersion> versionList = new ArrayList<>();
public static final ProtocolVersion v1_4_6 = register(51, "1.4.6/7", new VersionRange("1.4", 6, 7));
public static final ProtocolVersion v1_4_6 = register(51, "1.4.6/7", new SubVersionRange("1.4", 6, 7));
public static final ProtocolVersion v1_5_1 = register(60, "1.5.1");
public static final ProtocolVersion v1_5_2 = register(61, "1.5.2");
public static final ProtocolVersion v_1_6_1 = register(73, "1.6.1");
public static final ProtocolVersion v_1_6_2 = register(74, "1.6.2");
public static final ProtocolVersion v_1_6_3 = register(77, "1.6.3");
public static final ProtocolVersion v_1_6_4 = register(78, "1.6.4");
public static final ProtocolVersion v1_7_1 = register(4, "1.7-1.7.5", new VersionRange("1.7", 0, 5));
public static final ProtocolVersion v1_7_6 = register(5, "1.7.6-1.7.10", new VersionRange("1.7", 6, 10));
public static final ProtocolVersion v1_7_1 = register(4, "1.7-1.7.5", new SubVersionRange("1.7", 0, 5));
public static final ProtocolVersion v1_7_6 = register(5, "1.7.6-1.7.10", new SubVersionRange("1.7", 6, 10));
public static final ProtocolVersion v1_8 = register(47, "1.8.x");
public static final ProtocolVersion v1_9 = register(107, "1.9");
public static final ProtocolVersion v1_9_1 = register(108, "1.9.1");
public static final ProtocolVersion v1_9_2 = register(109, "1.9.2");
public static final ProtocolVersion v1_9_3 = register(110, "1.9.3/4", new VersionRange("1.9", 3, 4));
public static final ProtocolVersion v1_9_3 = register(110, "1.9.3/1.9.4", new SubVersionRange("1.9", 3, 4));
public static final ProtocolVersion v1_10 = register(210, "1.10.x");
public static final ProtocolVersion v1_11 = register(315, "1.11");
public static final ProtocolVersion v1_11_1 = register(316, "1.11.1/2", new VersionRange("1.11", 1, 2));
public static final ProtocolVersion v1_11_1 = register(316, "1.11.1/1.11.2", new SubVersionRange("1.11", 1, 2));
public static final ProtocolVersion v1_12 = register(335, "1.12");
public static final ProtocolVersion v1_12_1 = register(338, "1.12.1");
public static final ProtocolVersion v1_12_2 = register(340, "1.12.2");
@ -77,14 +77,19 @@ public class ProtocolVersion {
public static final ProtocolVersion v1_16_1 = register(736, "1.16.1");
public static final ProtocolVersion v1_16_2 = register(751, "1.16.2");
public static final ProtocolVersion v1_16_3 = register(753, "1.16.3");
public static final ProtocolVersion v1_16_4 = register(754, "1.16.4/5", new VersionRange("1.16", 4, 5));
public static final ProtocolVersion v1_16_4 = register(754, "1.16.4/1.16.5", new SubVersionRange("1.16", 4, 5));
public static final ProtocolVersion v1_17 = register(755, "1.17");
public static final ProtocolVersion v1_17_1 = register(756, "1.17.1");
public static final ProtocolVersion v1_18 = register(757, "1.18/1.18.1", new VersionRange("1.18", 0, 1));
public static final ProtocolVersion v1_18 = register(757, "1.18/1.18.1", new SubVersionRange("1.18", 0, 1));
public static final ProtocolVersion v1_18_2 = register(758, "1.18.2");
public static final ProtocolVersion v1_19 = register(759, "1.19");
public static final ProtocolVersion v1_19_1 = register(760, "1.19.1");
public static final ProtocolVersion v1_19_1 = register(760, "1.19.1/1.19.2", new SubVersionRange("1.19", 1, 2));
public static final ProtocolVersion v1_19_3 = register(761, "1.19.3");
public static final ProtocolVersion v1_19_4 = register(762, "1.19.4");
public static final ProtocolVersion v1_20 = register(763, "1.20/1.20.1", new SubVersionRange("1.20", 0, 1));
public static final ProtocolVersion v1_20_2 = register(764, "1.20.2");
public static final ProtocolVersion v1_20_3 = register(765, "1.20.3/1.20.4", new SubVersionRange("1.20", 3, 4));
public static final ProtocolVersion v1_20_5 = register(766, "1.20.5");
public static final ProtocolVersion unknown = register(-1, "UNKNOWN");
public static ProtocolVersion register(int version, String name) {
@ -95,11 +100,11 @@ public class ProtocolVersion {
return register(version, snapshotVersion, name, null);
}
public static ProtocolVersion register(int version, String name, @Nullable VersionRange versionRange) {
public static ProtocolVersion register(int version, String name, @Nullable SubVersionRange versionRange) {
return register(version, -1, name, versionRange);
}
public static ProtocolVersion register(int version, int snapshotVersion, String name, @Nullable VersionRange versionRange) {
public static ProtocolVersion register(int version, int snapshotVersion, String name, @Nullable SubVersionRange versionRange) {
ProtocolVersion protocol = new ProtocolVersion(version, snapshotVersion, name, versionRange);
versionList.add(protocol);
versions.put(protocol.getVersion(), protocol);
@ -162,7 +167,7 @@ public class ProtocolVersion {
this(version, -1, name, null);
}
public ProtocolVersion(int version, int snapshotVersion, String name, @Nullable VersionRange versionRange) {
public ProtocolVersion(int version, int snapshotVersion, String name, @Nullable SubVersionRange versionRange) {
this.version = version;
this.snapshotVersion = snapshotVersion;
this.name = name;

View File

@ -1,22 +1,27 @@
plugins {
id("net.kyori.blossom")
id("via.shadow-conventions")
id("org.jetbrains.gradle.plugin.idea-ext")
}
blossom {
replaceToken("\$VERSION", project.version)
replaceToken("\$IMPL_VERSION", "git-ViaVersion-${project.version}:${rootProject.latestCommitHash()}")
sourceSets {
main {
blossom {
javaSources {
property("version", project.version.toString())
property("impl_version", "git-ViaVersion-${project.version}:${rootProject.latestCommitHash()}")
}
}
}
}
dependencies {
api(projects.adventure) {
targetConfiguration = "shadow"
}
api(libs.fastutil)
api(libs.flare)
api(libs.flareFastutil)
api(libs.openNBT)
api(libs.vianbt)
api(libs.gson)
implementation(rootProject.libs.text) {
exclude("com.google.code.gson", "gson")
exclude("com.viaversion", "nbt")
}
compileOnlyApi(libs.snakeYaml)
compileOnlyApi(libs.netty)
@ -27,3 +32,5 @@ dependencies {
java {
withJavadocJar()
}
publishShadowJar()

View File

@ -1,6 +1,6 @@
/*
* This file is part of ViaVersion - https://github.com/ViaVersion/ViaVersion
* Copyright (C) 2016-2023 ViaVersion and contributors
* Copyright (C) 2016-2024 ViaVersion and contributors
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
@ -31,5 +31,14 @@ public final class VersionInfo {
*
* @see ViaPlatform#getPluginVersion()
*/
public static final String VERSION = "$VERSION";
public static final String VERSION = "{{ version }}";
private static final String IMPLEMENTATION_VERSION = "{{ impl_version }}";
public static String getVersion() {
return VERSION;
}
public static String getImplementationVersion() {
return IMPLEMENTATION_VERSION;
}
}

View File

@ -1,6 +1,6 @@
/*
* This file is part of ViaVersion - https://github.com/ViaVersion/ViaVersion
* Copyright (C) 2016-2023 ViaVersion and contributors
* Copyright (C) 2016-2024 ViaVersion and contributors
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal

View File

@ -1,6 +1,6 @@
/*
* This file is part of ViaVersion - https://github.com/ViaVersion/ViaVersion
* Copyright (C) 2016-2023 ViaVersion and contributors
* Copyright (C) 2016-2024 ViaVersion and contributors
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
@ -27,10 +27,13 @@ import com.viaversion.viaversion.api.connection.UserConnection;
import com.viaversion.viaversion.api.legacy.LegacyViaAPI;
import com.viaversion.viaversion.api.platform.ViaPlatform;
import com.viaversion.viaversion.api.protocol.ProtocolManager;
import com.viaversion.viaversion.api.protocol.version.ProtocolVersion;
import com.viaversion.viaversion.api.protocol.version.ServerProtocolVersion;
import io.netty.buffer.ByteBuf;
import java.util.SortedSet;
import java.util.TreeSet;
import java.util.UUID;
import java.util.stream.Collectors;
import org.checkerframework.checker.nullness.qual.Nullable;
/**
@ -63,7 +66,7 @@ public interface ViaAPI<T> {
* @return API version incremented with meaningful API changes
*/
default int apiVersion() {
return 19;
return 26;
}
/**
@ -80,7 +83,18 @@ public interface ViaAPI<T> {
* @param player the platform's player object, e.g. Bukkit this is Player
* @return protocol version, for example (47=1.8-1.8.8, 107=1.9, 108=1.9.1), or -1 if no longer connected
*/
int getPlayerVersion(T player);
default int getPlayerVersion(T player) {
return getPlayerProtocolVersion(player).getVersion();
}
/**
* Returns the protocol version of a player.
* This will also retrieve the version from ProtocolSupport if it's being used.
*
* @param player the platform's player object, e.g. Bukkit this is Player
* @return the protocol version object (see {@link ProtocolVersion}), or ProtocolVersion.unknown if not connected
*/
ProtocolVersion getPlayerProtocolVersion(T player);
/**
* Returns the protocol version of a player.
@ -88,7 +102,19 @@ public interface ViaAPI<T> {
* @param uuid UUID of a player
* @return protocol version, for example (47=1.8-1.8.8, 107=1.9, 108=1.9.1), or -1 if not connected
*/
int getPlayerVersion(UUID uuid);
default int getPlayerVersion(UUID uuid) {
return getPlayerProtocolVersion(uuid).getVersion();
}
/**
* Returns the protocol version of a player.
* This will also retrieve the version from ProtocolSupport if it's being used.
*
* @param uuid UUID of a player
* @return the protocol version object (see {@link ProtocolVersion}), or ProtocolVersion.unknown if not connected
*/
ProtocolVersion getPlayerProtocolVersion(UUID uuid);
/**
* Returns whether Via injected into this player connection.
@ -117,7 +143,7 @@ public interface ViaAPI<T> {
* Sends a raw packet to the player.
*
* @param player the platform's player object, e.g. for Bukkit this is Player
* @param packet the packet; you need a VarInt Id, then the packet contents
* @param packet the packet; you need a VarInt id, then the packet contents
* @throws IllegalArgumentException if the player is not injected by Via
*/
void sendRawPacket(T player, ByteBuf packet);
@ -126,11 +152,21 @@ public interface ViaAPI<T> {
* Sends a raw packet to the player.
*
* @param uuid the uuid from the player to send packet
* @param packet the packet; you need a VarInt Id, then the packet contents
* @param packet the packet; you need a VarInt id, then the packet contents
* @throws IllegalArgumentException if the player is not injected by Via
*/
void sendRawPacket(UUID uuid, ByteBuf packet);
@Deprecated
default SortedSet<Integer> getSupportedVersions() {
return getSupportedProtocolVersions().stream().map(ProtocolVersion::getVersion).collect(Collectors.toCollection(TreeSet::new));
}
@Deprecated
default SortedSet<Integer> getFullSupportedVersions() {
return getFullSupportedProtocolVersions().stream().map(ProtocolVersion::getVersion).collect(Collectors.toCollection(TreeSet::new));
}
/**
* Returns the supported protocol versions.
* This method removes any blocked protocol versions.
@ -138,14 +174,15 @@ public interface ViaAPI<T> {
* @return a sorted set of protocol versions
* @see #getFullSupportedVersions() for a full list
*/
SortedSet<Integer> getSupportedVersions();
SortedSet<ProtocolVersion> getSupportedProtocolVersions();
/**
* Returns the supported protocol versions, including blocked protocols.
*
* @return a sorted set of protocol versions
*/
SortedSet<Integer> getFullSupportedVersions();
SortedSet<ProtocolVersion> getFullSupportedProtocolVersions();
/**
* Returns legacy api only applicable on/to legacy versions.

View File

@ -1,6 +1,6 @@
/*
* This file is part of ViaVersion - https://github.com/ViaVersion/ViaVersion
* Copyright (C) 2016-2023 ViaVersion and contributors
* Copyright (C) 2016-2024 ViaVersion and contributors
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
@ -23,6 +23,7 @@
package com.viaversion.viaversion.api;
import com.viaversion.viaversion.api.command.ViaVersionCommand;
import com.viaversion.viaversion.api.configuration.ConfigurationProvider;
import com.viaversion.viaversion.api.connection.ConnectionManager;
import com.viaversion.viaversion.api.debug.DebugHandler;
import com.viaversion.viaversion.api.platform.ViaInjector;
@ -91,6 +92,13 @@ public interface ViaManager {
*/
Scheduler getScheduler();
/**
* Returns the configuration provider.
*
* @return the configuration provider
*/
ConfigurationProvider getConfigurationProvider();
/**
* If debug is enabled, packets and other otherwise suppressed warnings will be logged.
*
@ -138,4 +146,5 @@ public interface ViaManager {
* @return whether the manager has been initialized
*/
boolean isInitialized();
}

View File

@ -1,6 +1,6 @@
/*
* This file is part of ViaVersion - https://github.com/ViaVersion/ViaVersion
* Copyright (C) 2016-2023 ViaVersion and contributors
* Copyright (C) 2016-2024 ViaVersion and contributors
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
@ -28,7 +28,7 @@ public interface ViaCommandSender {
/**
* Check if the sender has a permission.
*
* @param permission Permission string eg. viaversion.admin
* @param permission Permission string e.g. viaversion.admin
* @return True if the sender has the permission
*/
boolean hasPermission(String permission);

View File

@ -1,6 +1,6 @@
/*
* This file is part of ViaVersion - https://github.com/ViaVersion/ViaVersion
* Copyright (C) 2016-2023 ViaVersion and contributors
* Copyright (C) 2016-2024 ViaVersion and contributors
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
@ -58,7 +58,7 @@ public abstract class ViaSubCommand {
* @return The permission required to use the commands
*/
public String permission() {
return "viaversion.admin";
return "viaversion.admin." + name();
}
/**

View File

@ -1,6 +1,6 @@
/*
* This file is part of ViaVersion - https://github.com/ViaVersion/ViaVersion
* Copyright (C) 2016-2023 ViaVersion and contributors
* Copyright (C) 2016-2024 ViaVersion and contributors
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
@ -32,7 +32,7 @@ public interface ViaVersionCommand {
* @param command Your own SubCommand instance to handle it.
* @throws Exception throws an exception when the subcommand already exists or if it's not valid, example: spacee
*/
void registerSubCommand(ViaSubCommand command) throws Exception;
void registerSubCommand(ViaSubCommand command);
/**
* Check if a subcommand is registered.

View File

@ -1,6 +1,6 @@
/*
* This file is part of ViaVersion - https://github.com/ViaVersion/ViaVersion
* Copyright (C) 2016-2023 ViaVersion and contributors
* Copyright (C) 2016-2024 ViaVersion and contributors
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
@ -20,20 +20,34 @@
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
* SOFTWARE.
*/
package com.viaversion.viaversion.api.type.types.minecraft;
package com.viaversion.viaversion.api.configuration;
import com.viaversion.viaversion.api.type.Type;
import java.util.Map;
@Deprecated/*(forRemoval = true)*/
public class Particle1_17Type extends AbstractParticleType {
public interface Config {
public Particle1_17Type() {
readers.put(4, blockHandler());
readers.put(25, blockHandler());
readers.put(15, dustHandler());
readers.put(16, dustTransitionHandler());
readers.put(36, itemHandler(Type.FLAT_VAR_INT_ITEM));
readers.put(37, vibrationHandler(Type.POSITION1_14));
}
/**
* Reloads the config
*/
void reload();
/**
* Saves the config
*/
void save();
/**
* Sets the specified path to the given value.
*
* @param path Path of the object to set.
* @param value New value to set the path to
*/
void set(String path, Object value);
/**
* Get all the configuration values
*
* @return Map with key-values
*/
Map<String, Object> getValues();
}

View File

@ -1,6 +1,6 @@
/*
* This file is part of ViaVersion - https://github.com/ViaVersion/ViaVersion
* Copyright (C) 2016-2023 ViaVersion and contributors
* Copyright (C) 2016-2024 ViaVersion and contributors
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
@ -22,32 +22,26 @@
*/
package com.viaversion.viaversion.api.configuration;
import java.util.Map;
import java.util.Collection;
public interface ConfigurationProvider {
/**
* Sets the specified path to the given value.
* Registers a config to be saved or reloaded when {@link #reloadConfigs()} is called.
*
* @param path Path of the object to set.
* @param value New value to set the path to
* @param config the config to register
*/
void set(String path, Object value);
void register(Config config);
/**
* Saves the config
*/
void saveConfig();
/**
* Reloads the config
*/
void reloadConfig();
/**
* Get all the configuration values
* Returns all registered configs.
*
* @return Map with key-values
* @return unmodifiable collection of all registered configs
*/
Map<String, Object> getValues();
Collection<Config> configs();
/**
* Reloads the configuration files.
*/
void reloadConfigs();
}

View File

@ -1,6 +1,6 @@
/*
* This file is part of ViaVersion - https://github.com/ViaVersion/ViaVersion
* Copyright (C) 2016-2023 ViaVersion and contributors
* Copyright (C) 2016-2024 ViaVersion and contributors
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
@ -27,10 +27,8 @@ import com.viaversion.viaversion.api.connection.StorableObject;
import com.viaversion.viaversion.api.connection.UserConnection;
import com.viaversion.viaversion.api.minecraft.WorldIdentifiers;
import com.viaversion.viaversion.api.protocol.version.BlockedProtocolVersions;
import it.unimi.dsi.fastutil.ints.IntSet;
import org.checkerframework.checker.nullness.qual.Nullable;
public interface ViaVersionConfig {
public interface ViaVersionConfig extends Config {
/**
* Get if the plugin should check for updates
@ -87,7 +85,7 @@ public interface ViaVersionConfig {
* <p>
* This option requires {@link #isShowShieldWhenSwordInHand()} to be disabled
*
* @return {@code true} if non delayed shield blocking is enabled.
* @return {@code true} if non-delayed shield blocking is enabled.
*/
boolean isNoDelayShieldBlocking();
@ -126,7 +124,7 @@ public interface ViaVersionConfig {
* Get if the boss bars for 1.9 &amp; 1.10 clients are being stopped from flickering
* This will keep all boss bars on 100% (not recommended)
*
* @return true if boss bar anti flickering is enabled
* @return true if boss bar anti-flickering is enabled
*/
boolean isBossbarAntiflicker();
@ -235,13 +233,6 @@ public interface ViaVersionConfig {
*/
boolean isChunkBorderFix();
/**
* Force json transform
*
* @return true if enabled
*/
boolean isForceJsonTransform();
/**
* Should we fix nbt array's in json chat messages for 1.12 clients
*
@ -272,17 +263,6 @@ public interface ViaVersionConfig {
*/
BlockedProtocolVersions blockedProtocolVersions();
/**
* Get the blocked protocols
*
* @return An Integer list
* @deprecated use {@link #blockedProtocolVersions()}
*/
@Deprecated/*(forRemoval = true)*/
default IntSet getBlockedProtocols() {
return blockedProtocolVersions().singleBlockedVersions();
}
/**
* Get the custom disconnect message
*
@ -384,7 +364,7 @@ public interface ViaVersionConfig {
boolean isTruncate1_14Books();
/**
* Handles left handed info by using unused bit 7 on Client Settings packet
* Handles left-handed info by using unused bit 7 on Client Settings packet
*
* @return true if enabled
*/
@ -443,16 +423,38 @@ public interface ViaVersionConfig {
/***
* Get the world names that should be returned for each Vanilla dimension.
* Note that this can be overriden per-user by using {@link UserConnection#put(StorableObject)} with
* Note that this can be overridden per-user by using {@link UserConnection#put(StorableObject)} with
* a custom instance of {@link WorldIdentifiers} for the user's {@link UserConnection}.
*
* @return the global map from vanilla dimensions to world name
*/
WorldIdentifiers get1_16WorldNamesMap();
/**
* Caches light until chunks are unloaded to allow subsequent chunk update packets as opposed to instantly uncaching when the first chunk data is sent.
*
* @return true if enabled
*/
boolean cache1_17Light();
@Nullable String chatTypeFormat(String translationKey);
/**
* Force-update 1.19.4+ player's inventory when they try to swap armor in a pre-occupied slot.
*
* @return true if enabled
*/
boolean isArmorToggleFix();
/**
* If disabled, tamed cats will be displayed as ocelots to 1.14+ clients on 1.13 servers. Otherwise, ocelots (tamed and untamed) will be displayed as cats.
*
* @return true if enabled
*/
boolean translateOcelotToCat();
/**
* Returns the value of the "enforce secure chat" setting sent to 1.19+ clients on join.
*
* @return the value sent to 1.19+ clients on join
*/
boolean enforceSecureChat();
}

View File

@ -1,6 +1,6 @@
/*
* This file is part of ViaVersion - https://github.com/ViaVersion/ViaVersion
* Copyright (C) 2016-2023 ViaVersion and contributors
* Copyright (C) 2016-2024 ViaVersion and contributors
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
@ -65,7 +65,7 @@ public interface ConnectionManager {
/**
* Returns the UUID from the frontend connection to this proxy server
* Returns null when there isn't a server or this connection isn't frontend or it doesn't have an id
* Returns null when there isn't a server or this connection isn't frontend, or it doesn't have an id
* When ViaVersion is reloaded, this method may not return some players.
* May not return ProtocolSupport players.
* <p>

View File

@ -1,6 +1,6 @@
/*
* This file is part of ViaVersion - https://github.com/ViaVersion/ViaVersion
* Copyright (C) 2016-2023 ViaVersion and contributors
* Copyright (C) 2016-2024 ViaVersion and contributors
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
@ -23,7 +23,9 @@
package com.viaversion.viaversion.api.connection;
import com.viaversion.viaversion.api.protocol.ProtocolPipeline;
import com.viaversion.viaversion.api.protocol.packet.Direction;
import com.viaversion.viaversion.api.protocol.packet.State;
import com.viaversion.viaversion.api.protocol.version.ProtocolVersion;
import java.util.UUID;
import org.checkerframework.checker.nullness.qual.Nullable;
@ -33,30 +35,95 @@ public interface ProtocolInfo {
* Returns the protocol state the user is currently in.
*
* @return protocol state
* @deprecated server and client can be in different states, use {@link #getClientState()} or {@link #getServerState()}
*/
State getState();
void setState(State state);
@Deprecated/*(forRemoval = true)*/
default State getState() {
return this.getServerState();
}
/**
* Returns the user's protocol version, or -1 if not set.
* This is set during the {@link State#HANDSHAKE} state.
* Returns the protocol state the client is currently in.
*
* @return protocol version, or -1 if not set
* @return the client protocol state
*/
int getProtocolVersion();
void setProtocolVersion(int protocolVersion);
State getClientState();
/**
* Returns the server protocol version the user is connected to, or -1 if not set.
* Returns the protocol state the server is currently in.
*
* @return the server protocol state
*/
State getServerState();
/**
* Returns the protocol state for the given direction.
*
* @param direction protocol direction
* @return state for the given direction
*/
default State getState(final Direction direction) {
// Return the state the packet is coming from
return direction == Direction.CLIENTBOUND ? this.getServerState() : this.getClientState();
}
/**
* Sets both client and server state.
*
* @param state the new protocol state
* @see #setClientState(State)
* @see #setServerState(State)
*/
default void setState(final State state) {
this.setClientState(state);
this.setServerState(state);
}
/**
* Sets the client protocol state.
*
* @param clientState the new client protocol state
*/
void setClientState(State clientState);
/**
* Sets the server protocol state.
*
* @param serverState the new server protocol state
*/
void setServerState(State serverState);
/**
* Returns the user's protocol version, or null if not set.
* This is set during the {@link State#HANDSHAKE} state.
*
* @return server protocol version, or -1 if not set
* @return protocol version, may be unknown
* @see ProtocolVersion#isKnown()
*/
int getServerProtocolVersion();
ProtocolVersion protocolVersion();
void setServerProtocolVersion(int serverProtocolVersion);
void setProtocolVersion(ProtocolVersion protocolVersion);
/**
* Returns the server protocol version the user is connected to.
* This is set during the {@link State#HANDSHAKE} state.
*
* @return the server protocol version the user is connected to, may be unknown
* @see ProtocolVersion#isKnown()
*/
ProtocolVersion serverProtocolVersion();
void setServerProtocolVersion(ProtocolVersion protocolVersion);
@Deprecated
default int getProtocolVersion() {
return protocolVersion() != null ? protocolVersion().getVersion() : -1;
}
@Deprecated
default int getServerProtocolVersion() {
return serverProtocolVersion() != null ? serverProtocolVersion().getVersion() : -1;
}
/**
* Returns the username associated with this connection.

View File

@ -1,6 +1,6 @@
/*
* This file is part of ViaVersion - https://github.com/ViaVersion/ViaVersion
* Copyright (C) 2016-2023 ViaVersion and contributors
* Copyright (C) 2016-2024 ViaVersion and contributors
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
@ -38,4 +38,7 @@ public interface StorableObject {
default boolean clearOnServerSwitch() {
return true;
}
default void onRemove() {
}
}

View File

@ -1,6 +1,6 @@
/*
* This file is part of ViaVersion - https://github.com/ViaVersion/ViaVersion
* Copyright (C) 2016-2023 ViaVersion and contributors
* Copyright (C) 2016-2024 ViaVersion and contributors
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal

View File

@ -1,6 +1,6 @@
/*
* This file is part of ViaVersion - https://github.com/ViaVersion/ViaVersion
* Copyright (C) 2016-2023 ViaVersion and contributors
* Copyright (C) 2016-2024 ViaVersion and contributors
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal

View File

@ -1,6 +1,6 @@
/*
* This file is part of ViaVersion - https://github.com/ViaVersion/ViaVersion
* Copyright (C) 2023 ViaVersion and contributors
* Copyright (C) 2016-2024 ViaVersion and contributors
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal

View File

@ -1,6 +1,6 @@
/*
* This file is part of ViaVersion - https://github.com/ViaVersion/ViaVersion
* Copyright (C) 2016-2023 ViaVersion and contributors
* Copyright (C) 2016-2024 ViaVersion and contributors
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal

View File

@ -1,6 +1,6 @@
/*
* This file is part of ViaVersion - https://github.com/ViaVersion/ViaVersion
* Copyright (C) 2016-2023 ViaVersion and contributors
* Copyright (C) 2016-2024 ViaVersion and contributors
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
@ -27,12 +27,7 @@ import org.checkerframework.checker.nullness.qual.Nullable;
/**
* Mappings containing the full string identifier mappings.
*/
public interface FullMappings extends Mappings {
@Deprecated
default Mappings mappings() {
return this;
}
public interface FullMappings extends BiMappings {
/**
* Returns the unmapped integer id for the given identifier, or -1 if not found.
@ -54,17 +49,17 @@ public interface FullMappings extends Mappings {
* Returns the unmapped string identifier for the given mapped id.
*
* @param id unmapped id
* @return unmapped string identifier
* @return unmapped string identifier, or null if out of bounds
*/
String identifier(int id);
@Nullable String identifier(int id);
/**
* Returns the mapped string identifier for the given mapped id.
*
* @param mappedId mapped id
* @return mapped string identifier
* @return mapped string identifier, or null if out of bounds
*/
String mappedIdentifier(int mappedId);
@Nullable String mappedIdentifier(int mappedId);
/**
* Returns the mapped string identifier for the given unmapped identifier.

View File

@ -1,6 +1,6 @@
/*
* This file is part of ViaVersion - https://github.com/ViaVersion/ViaVersion
* Copyright (C) 2016-2023 ViaVersion and contributors
* Copyright (C) 2016-2024 ViaVersion and contributors
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
@ -22,6 +22,7 @@
*/
package com.viaversion.viaversion.api.data;
import com.google.common.base.Preconditions;
import com.viaversion.viaversion.util.Key;
import it.unimi.dsi.fastutil.objects.Object2IntMap;
import it.unimi.dsi.fastutil.objects.Object2IntOpenHashMap;
@ -37,6 +38,7 @@ public class FullMappingsBase implements FullMappings {
private final Mappings mappings;
public FullMappingsBase(final List<String> unmappedIdentifiers, final List<String> mappedIdentifiers, final Mappings mappings) {
Preconditions.checkNotNull(mappings, "Mappings cannot be null");
this.mappings = mappings;
this.stringToId = toInverseMap(unmappedIdentifiers);
this.mappedStringToId = toInverseMap(mappedIdentifiers);
@ -52,11 +54,6 @@ public class FullMappingsBase implements FullMappings {
this.mappings = mappings;
}
@Override
public Mappings mappings() {
return mappings;
}
@Override
public int id(final String identifier) {
return stringToId.getInt(Key.stripMinecraftNamespace(identifier));
@ -69,12 +66,20 @@ public class FullMappingsBase implements FullMappings {
@Override
public String identifier(final int id) {
if (id < 0 || id >= idToString.length) {
return null;
}
final String identifier = idToString[id];
return Key.namespaced(identifier);
}
@Override
public String mappedIdentifier(final int mappedId) {
if (mappedId < 0 || mappedId >= mappedIdToString.length) {
return null;
}
final String identifier = mappedIdToString[mappedId];
return Key.namespaced(identifier);
}

View File

@ -1,6 +1,6 @@
/*
* This file is part of ViaVersion - https://github.com/ViaVersion/ViaVersion
* Copyright (C) 2023 ViaVersion and contributors
* Copyright (C) 2016-2024 ViaVersion and contributors
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal

View File

@ -1,6 +1,6 @@
/*
* This file is part of ViaVersion - https://github.com/ViaVersion/ViaVersion
* Copyright (C) 2016-2023 ViaVersion and contributors
* Copyright (C) 2016-2024 ViaVersion and contributors
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal

View File

@ -1,6 +1,6 @@
/*
* This file is part of ViaVersion - https://github.com/ViaVersion/ViaVersion
* Copyright (C) 2016-2023 ViaVersion and contributors
* Copyright (C) 2016-2024 ViaVersion and contributors
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal

View File

@ -1,6 +1,6 @@
/*
* This file is part of ViaVersion - https://github.com/ViaVersion/ViaVersion
* Copyright (C) 2016-2023 ViaVersion and contributors
* Copyright (C) 2016-2024 ViaVersion and contributors
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
@ -37,11 +37,6 @@ public class IntArrayMappings implements Mappings {
return new IntArrayMappings(mappings, mappedIds);
}
@Deprecated
public static Builder<IntArrayMappings> builder() {
return Mappings.builder(IntArrayMappings::new);
}
@Override
public int getNewId(int id) {
return id >= 0 && id < mappings.length ? mappings[id] : -1;

View File

@ -1,6 +1,6 @@
/*
* This file is part of ViaVersion - https://github.com/ViaVersion/ViaVersion
* Copyright (C) 2016-2023 ViaVersion and contributors
* Copyright (C) 2016-2024 ViaVersion and contributors
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
@ -79,6 +79,8 @@ public interface MappingData {
*/
int getNewParticleId(int id);
int getNewAttributeId(int id);
/**
* Returns a list of tags to send if present.
*
@ -87,8 +89,21 @@ public interface MappingData {
*/
@Nullable List<TagData> getTags(RegistryType type);
/**
* Returns item mappings.
*
* @return item mappings
*/
@Nullable BiMappings getItemMappings();
/**
* Returns item mappings if they also have identifier data present.
*
* @return item mappings if they also have identifier data present
* @see #getItemMappings()
*/
@Nullable FullMappings getFullItemMappings();
@Nullable ParticleMappings getParticleMappings();
@Nullable Mappings getBlockMappings();
@ -101,11 +116,19 @@ public interface MappingData {
@Nullable Mappings getStatisticsMappings();
@Nullable Mappings getMenuMappings();
@Nullable Mappings getEnchantmentMappings();
@Nullable Mappings getAttributeMappings();
@Nullable Mappings getPaintingMappings();
@Nullable FullMappings getEntityMappings();
@Nullable FullMappings getArgumentTypeMappings();
@Nullable Mappings getPaintingMappings();
@Nullable FullMappings getRecipeSerializerMappings();
@Nullable FullMappings getDataComponentSerializerMappings();
}

View File

@ -1,6 +1,6 @@
/*
* This file is part of ViaVersion - https://github.com/ViaVersion/ViaVersion
* Copyright (C) 2016-2023 ViaVersion and contributors
* Copyright (C) 2016-2024 ViaVersion and contributors
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
@ -24,7 +24,6 @@ package com.viaversion.viaversion.api.data;
import com.github.steveice10.opennbt.tag.builtin.CompoundTag;
import com.github.steveice10.opennbt.tag.builtin.IntArrayTag;
import com.github.steveice10.opennbt.tag.builtin.ListTag;
import com.github.steveice10.opennbt.tag.builtin.Tag;
import com.viaversion.viaversion.api.Via;
import com.viaversion.viaversion.api.minecraft.RegistryType;
@ -34,7 +33,6 @@ import java.util.EnumMap;
import java.util.List;
import java.util.Map;
import java.util.logging.Logger;
import java.util.stream.Collectors;
import org.checkerframework.checker.nullness.qual.Nullable;
public class MappingDataBase implements MappingData {
@ -44,6 +42,8 @@ public class MappingDataBase implements MappingData {
protected BiMappings itemMappings;
protected FullMappings argumentTypeMappings;
protected FullMappings entityMappings;
protected FullMappings recipeSerializerMappings;
protected FullMappings itemDataSerializerMappings;
protected ParticleMappings particleMappings;
protected Mappings blockMappings;
protected Mappings blockStateMappings;
@ -52,6 +52,8 @@ public class MappingDataBase implements MappingData {
protected Mappings statisticsMappings;
protected Mappings enchantmentMappings;
protected Mappings paintingMappings;
protected Mappings menuMappings;
protected Mappings attributeMappings;
protected Map<RegistryType, List<TagData>> tags;
public MappingDataBase(final String unmappedVersion, final String mappedVersion) {
@ -65,37 +67,42 @@ public class MappingDataBase implements MappingData {
getLogger().info("Loading " + unmappedVersion + " -> " + mappedVersion + " mappings...");
}
final CompoundTag data = readNBTFile("mappings-" + unmappedVersion + "to" + mappedVersion + ".nbt");
final CompoundTag data = readMappingsFile("mappings-" + unmappedVersion + "to" + mappedVersion + ".nbt");
blockMappings = loadMappings(data, "blocks");
blockStateMappings = loadMappings(data, "blockstates");
blockEntityMappings = loadMappings(data, "blockentities");
soundMappings = loadMappings(data, "sounds");
statisticsMappings = loadMappings(data, "statistics");
menuMappings = loadMappings(data, "menus");
enchantmentMappings = loadMappings(data, "enchantments");
paintingMappings = loadMappings(data, "paintings");
itemMappings = loadBiMappings(data, "items");
attributeMappings = loadMappings(data, "attributes");
final CompoundTag unmappedIdentifierData = MappingDataLoader.loadNBT("identifiers-" + unmappedVersion + ".nbt", true);
final CompoundTag mappedIdentifierData = MappingDataLoader.loadNBT("identifiers-" + mappedVersion + ".nbt", true);
final CompoundTag unmappedIdentifierData = readUnmappedIdentifiersFile("identifiers-" + unmappedVersion + ".nbt");
final CompoundTag mappedIdentifierData = readMappedIdentifiersFile("identifiers-" + mappedVersion + ".nbt");
if (unmappedIdentifierData != null && mappedIdentifierData != null) {
itemMappings = loadFullMappings(data, unmappedIdentifierData, mappedIdentifierData, "items");
entityMappings = loadFullMappings(data, unmappedIdentifierData, mappedIdentifierData, "entities");
argumentTypeMappings = loadFullMappings(data, unmappedIdentifierData, mappedIdentifierData, "argumenttypes");
recipeSerializerMappings = loadFullMappings(data, unmappedIdentifierData, mappedIdentifierData, "recipe_serializers");
itemDataSerializerMappings = loadFullMappings(data, unmappedIdentifierData, mappedIdentifierData, "data_component_type");
final ListTag unmappedParticles = unmappedIdentifierData.get("particles");
final ListTag mappedParticles = mappedIdentifierData.get("particles");
final List<String> unmappedParticles = identifiersFromGlobalIds(unmappedIdentifierData, "particles");
final List<String> mappedParticles = identifiersFromGlobalIds(mappedIdentifierData, "particles");
if (unmappedParticles != null && mappedParticles != null) {
Mappings particleMappings = loadMappings(data, "particles");
if (particleMappings == null) {
particleMappings = new IdentityMappings(unmappedParticles.size(), mappedParticles.size());
}
final List<String> identifiers = unmappedParticles.getValue().stream().map(t -> (String) t.getValue()).collect(Collectors.toList());
final List<String> mappedIdentifiers = mappedParticles.getValue().stream().map(t -> (String) t.getValue()).collect(Collectors.toList());
this.particleMappings = new ParticleMappings(identifiers, mappedIdentifiers, particleMappings);
this.particleMappings = new ParticleMappings(unmappedParticles, mappedParticles, particleMappings);
}
} else {
// Might not have identifiers in older versions
itemMappings = loadBiMappings(data, "items");
}
final CompoundTag tagsTag = data.get("tags");
final CompoundTag tagsTag = data.getCompoundTag("tags");
if (tagsTag != null) {
this.tags = new EnumMap<>(RegistryType.class);
loadTags(RegistryType.ITEM, tagsTag);
@ -105,16 +112,39 @@ public class MappingDataBase implements MappingData {
loadExtras(data);
}
protected @Nullable CompoundTag readNBTFile(final String name) {
return MappingDataLoader.loadNBT(name);
protected @Nullable List<String> identifiersFromGlobalIds(final CompoundTag mappingsTag, final String key) {
return MappingDataLoader.INSTANCE.identifiersFromGlobalIds(mappingsTag, key);
}
protected @Nullable CompoundTag readMappingsFile(final String name) {
return MappingDataLoader.INSTANCE.loadNBT(name);
}
protected @Nullable CompoundTag readUnmappedIdentifiersFile(final String name) {
return MappingDataLoader.INSTANCE.loadNBT(name, true);
}
protected @Nullable CompoundTag readMappedIdentifiersFile(final String name) {
return MappingDataLoader.INSTANCE.loadNBT(name, true);
}
protected @Nullable Mappings loadMappings(final CompoundTag data, final String key) {
return MappingDataLoader.loadMappings(data, key);
return MappingDataLoader.INSTANCE.loadMappings(data, key);
}
protected @Nullable FullMappings loadFullMappings(final CompoundTag data, final CompoundTag unmappedIdentifiers, final CompoundTag mappedIdentifiers, final String key) {
return MappingDataLoader.loadFullMappings(data, unmappedIdentifiers, mappedIdentifiers, key);
protected @Nullable FullMappings loadFullMappings(final CompoundTag data, final CompoundTag unmappedIdentifiersTag, final CompoundTag mappedIdentifiersTag, final String key) {
if (!unmappedIdentifiersTag.contains(key) || !mappedIdentifiersTag.contains(key)) {
return null;
}
final List<String> unmappedIdentifiers = identifiersFromGlobalIds(unmappedIdentifiersTag, key);
final List<String> mappedIdentifiers = identifiersFromGlobalIds(mappedIdentifiersTag, key);
Mappings mappings = loadBiMappings(data, key); // Load as bi-mappings to keep the inverse cached
if (mappings == null) {
mappings = new IdentityMappings(unmappedIdentifiers.size(), mappedIdentifiers.size());
}
return new FullMappingsBase(unmappedIdentifiers, mappedIdentifiers, mappings);
}
protected @Nullable BiMappings loadBiMappings(final CompoundTag data, final String key) {
@ -123,7 +153,7 @@ public class MappingDataBase implements MappingData {
}
private void loadTags(final RegistryType type, final CompoundTag data) {
final CompoundTag tag = data.get(type.resourceLocation());
final CompoundTag tag = data.getCompoundTag(type.resourceLocation());
if (tag == null) {
return;
}
@ -162,6 +192,11 @@ public class MappingDataBase implements MappingData {
return checkValidity(id, particleMappings.getNewId(id), "particles");
}
@Override
public int getNewAttributeId(final int id) {
return checkValidity(id, attributeMappings.getNewId(id), "attributes");
}
@Override
public @Nullable List<TagData> getTags(final RegistryType type) {
return tags != null ? tags.get(type) : null;
@ -172,6 +207,14 @@ public class MappingDataBase implements MappingData {
return itemMappings;
}
@Override
public @Nullable FullMappings getFullItemMappings() {
if (itemMappings instanceof FullMappings) {
return (FullMappings) itemMappings;
}
return null;
}
@Override
public @Nullable ParticleMappings getParticleMappings() {
return particleMappings;
@ -202,11 +245,21 @@ public class MappingDataBase implements MappingData {
return statisticsMappings;
}
@Override
public @Nullable Mappings getMenuMappings() {
return menuMappings;
}
@Override
public @Nullable Mappings getEnchantmentMappings() {
return enchantmentMappings;
}
@Override
public @Nullable Mappings getAttributeMappings() {
return attributeMappings;
}
@Override
public @Nullable FullMappings getEntityMappings() {
return entityMappings;
@ -217,11 +270,21 @@ public class MappingDataBase implements MappingData {
return argumentTypeMappings;
}
@Override
public @Nullable FullMappings getDataComponentSerializerMappings() {
return itemDataSerializerMappings;
}
@Override
public @Nullable Mappings getPaintingMappings() {
return paintingMappings;
}
@Override
public @Nullable FullMappings getRecipeSerializerMappings() {
return recipeSerializerMappings;
}
protected Logger getLogger() {
return Via.getPlatform().getLogger();
}
@ -236,7 +299,9 @@ public class MappingDataBase implements MappingData {
*/
protected int checkValidity(final int id, final int mappedId, final String type) {
if (mappedId == -1) {
getLogger().warning(String.format("Missing %s %s for %s %s %d", mappedVersion, type, unmappedVersion, type, id));
if (!Via.getConfig().isSuppressConversionWarnings()) {
getLogger().warning(String.format("Missing %s %s for %s %s %d", mappedVersion, type, unmappedVersion, type, id));
}
return 0;
}
return mappedId;

View File

@ -1,6 +1,6 @@
/*
* This file is part of ViaVersion - https://github.com/ViaVersion/ViaVersion
* Copyright (C) 2016-2023 ViaVersion and contributors
* Copyright (C) 2016-2024 ViaVersion and contributors
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
@ -22,12 +22,15 @@
*/
package com.viaversion.viaversion.api.data;
import com.github.steveice10.opennbt.NBTIO;
import com.github.steveice10.opennbt.tag.builtin.ByteTag;
import com.github.steveice10.opennbt.tag.builtin.CompoundTag;
import com.github.steveice10.opennbt.tag.builtin.IntArrayTag;
import com.github.steveice10.opennbt.tag.builtin.IntTag;
import com.github.steveice10.opennbt.tag.builtin.ListTag;
import com.github.steveice10.opennbt.tag.builtin.StringTag;
import com.github.steveice10.opennbt.tag.builtin.Tag;
import com.github.steveice10.opennbt.tag.io.NBTIO;
import com.github.steveice10.opennbt.tag.io.TagReader;
import com.google.common.annotations.Beta;
import com.google.gson.JsonArray;
import com.google.gson.JsonElement;
@ -38,33 +41,76 @@ import com.viaversion.viaversion.api.Via;
import com.viaversion.viaversion.util.GsonUtil;
import it.unimi.dsi.fastutil.objects.Object2IntMap;
import it.unimi.dsi.fastutil.objects.Object2IntOpenHashMap;
import java.io.BufferedInputStream;
import java.io.File;
import java.io.FileReader;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.stream.Collectors;
import java.util.logging.Logger;
import org.checkerframework.checker.nullness.qual.Nullable;
public final class MappingDataLoader {
public class MappingDataLoader {
public static final MappingDataLoader INSTANCE = new MappingDataLoader(MappingDataLoader.class, "assets/viaversion/data/");
public static final TagReader<CompoundTag> MAPPINGS_READER = NBTIO.reader(CompoundTag.class).named();
private static final Map<String, String[]> GLOBAL_IDENTIFIER_INDEXES = new HashMap<>();
private static final byte DIRECT_ID = 0;
private static final byte SHIFTS_ID = 1;
private static final byte CHANGES_ID = 2;
private static final byte IDENTITY_ID = 3;
private static final Map<String, CompoundTag> MAPPINGS_CACHE = new HashMap<>();
private static boolean cacheValid = true;
@Deprecated/*(forRemoval = true)*/
public static void enableMappingsCache() {
// Always enabled
private final Map<String, CompoundTag> mappingsCache = new HashMap<>();
private final Class<?> dataLoaderClass;
private final String dataPath;
private boolean cacheValid = true;
public MappingDataLoader(final Class<?> dataLoaderClass, final String dataPath) {
this.dataLoaderClass = dataLoaderClass;
this.dataPath = dataPath;
}
public static void clearCache() {
MAPPINGS_CACHE.clear();
public static void loadGlobalIdentifiers() {
// Load in a file with all the identifiers we need, so that we don't need to duplicate them
// for every single new version with only a couple of changes in them.
final CompoundTag globalIdentifiers = INSTANCE.loadNBT("identifier-table.nbt");
for (final Map.Entry<String, Tag> entry : globalIdentifiers.entrySet()) {
//noinspection unchecked
final ListTag<StringTag> value = (ListTag<StringTag>) entry.getValue();
final String[] array = new String[value.size()];
for (int i = 0, size = value.size(); i < size; i++) {
array[i] = value.get(i).getValue();
}
GLOBAL_IDENTIFIER_INDEXES.put(entry.getKey(), array);
}
}
/**
* Returns the global id of the identifier in the registry.
*
* @param registry registry key
* @param globalId global id
* @return identifier
* @throws IllegalArgumentException if the registry key is invalid
*/
public @Nullable String identifierFromGlobalId(final String registry, final int globalId) {
final String[] array = GLOBAL_IDENTIFIER_INDEXES.get(registry);
if (array == null) {
throw new IllegalArgumentException("Unknown global identifier key: " + registry);
}
if (globalId < 0 || globalId >= array.length) {
throw new IllegalArgumentException("Unknown global identifier index: " + globalId);
}
return array[globalId];
}
public void clearCache() {
mappingsCache.clear();
cacheValid = false;
}
@ -73,8 +119,8 @@ public final class MappingDataLoader {
*
* @return loaded json object, or null if not found or invalid
*/
public static @Nullable JsonObject loadFromDataDir(final String name) {
final File file = new File(Via.getPlatform().getDataFolder(), name);
public @Nullable JsonObject loadFromDataDir(final String name) {
final File file = new File(getDataFolder(), name);
if (!file.exists()) {
return loadData(name);
}
@ -84,7 +130,7 @@ public final class MappingDataLoader {
return GsonUtil.getGson().fromJson(reader, JsonObject.class);
} catch (final JsonSyntaxException e) {
// Users might mess up the format, so let's catch the syntax error
Via.getPlatform().getLogger().warning(name + " is badly formatted!");
getLogger().warning(name + " is badly formatted!");
throw new RuntimeException(e);
} catch (final IOException | JsonIOException e) {
throw new RuntimeException(e);
@ -96,7 +142,7 @@ public final class MappingDataLoader {
*
* @return loaded json object from bundled resources if present
*/
public static @Nullable JsonObject loadData(final String name) {
public @Nullable JsonObject loadData(final String name) {
final InputStream stream = getResource(name);
if (stream == null) {
return null;
@ -109,12 +155,12 @@ public final class MappingDataLoader {
}
}
public static @Nullable CompoundTag loadNBT(final String name, final boolean cache) {
public @Nullable CompoundTag loadNBT(final String name, final boolean cache) {
if (!cacheValid) {
return loadNBTFromFile(name);
}
CompoundTag data = MAPPINGS_CACHE.get(name);
CompoundTag data = mappingsCache.get(name);
if (data != null) {
return data;
}
@ -122,29 +168,29 @@ public final class MappingDataLoader {
data = loadNBTFromFile(name);
if (cache && data != null) {
MAPPINGS_CACHE.put(name, data);
mappingsCache.put(name, data);
}
return data;
}
public static @Nullable CompoundTag loadNBT(final String name) {
public @Nullable CompoundTag loadNBT(final String name) {
return loadNBT(name, false);
}
private static @Nullable CompoundTag loadNBTFromFile(final String name) {
public @Nullable CompoundTag loadNBTFromFile(final String name) {
final InputStream resource = getResource(name);
if (resource == null) {
return null;
}
try (final InputStream stream = resource) {
return NBTIO.readTag(stream);
try (final InputStream stream = new BufferedInputStream(resource)) {
return MAPPINGS_READER.read(stream);
} catch (final IOException e) {
throw new RuntimeException(e);
}
}
public static @Nullable Mappings loadMappings(final CompoundTag mappingsTag, final String key) {
public @Nullable Mappings loadMappings(final CompoundTag mappingsTag, final String key) {
return loadMappings(mappingsTag, key, size -> {
final int[] array = new int[size];
Arrays.fill(array, -1);
@ -153,29 +199,29 @@ public final class MappingDataLoader {
}
@Beta
public static <M extends Mappings, V> @Nullable Mappings loadMappings(
final CompoundTag mappingsTag,
final String key,
final MappingHolderSupplier<V> holderSupplier,
final AddConsumer<V> addConsumer,
final MappingsSupplier<M, V> mappingsSupplier
public <M extends Mappings, V> @Nullable Mappings loadMappings(
final CompoundTag mappingsTag,
final String key,
final MappingHolderSupplier<V> holderSupplier,
final AddConsumer<V> addConsumer,
final MappingsSupplier<M, V> mappingsSupplier
) {
final CompoundTag tag = mappingsTag.get(key);
final CompoundTag tag = mappingsTag.getCompoundTag(key);
if (tag == null) {
return null;
}
final ByteTag serializationStragetyTag = tag.get("id");
final IntTag mappedSizeTag = tag.get("mappedSize");
final ByteTag serializationStragetyTag = tag.getUnchecked("id");
final IntTag mappedSizeTag = tag.getUnchecked("mappedSize");
final byte strategy = serializationStragetyTag.asByte();
final V mappings;
if (strategy == DIRECT_ID) {
final IntArrayTag valuesTag = tag.get("val");
final IntArrayTag valuesTag = tag.getIntArrayTag("val");
return IntArrayMappings.of(valuesTag.getValue(), mappedSizeTag.asInt());
} else if (strategy == SHIFTS_ID) {
final IntArrayTag shiftsAtTag = tag.get("at");
final IntArrayTag shiftsTag = tag.get("to");
final IntTag sizeTag = tag.get("size");
final IntArrayTag shiftsAtTag = tag.getIntArrayTag("at");
final IntArrayTag shiftsTag = tag.getIntArrayTag("to");
final IntTag sizeTag = tag.getUnchecked("size");
final int[] shiftsAt = shiftsAtTag.getValue();
final int[] shiftsTo = shiftsTag.getValue();
final int size = sizeTag.asInt();
@ -199,9 +245,9 @@ public final class MappingDataLoader {
}
}
} else if (strategy == CHANGES_ID) {
final IntArrayTag changesAtTag = tag.get("at");
final IntArrayTag valuesTag = tag.get("val");
final IntTag sizeTag = tag.get("size");
final IntArrayTag changesAtTag = tag.getIntArrayTag("at");
final IntArrayTag valuesTag = tag.getIntArrayTag("val");
final IntTag sizeTag = tag.getUnchecked("size");
final boolean fillBetween = tag.get("nofill") == null;
final int[] changesAt = changesAtTag.getValue();
final int[] values = valuesTag.getValue();
@ -221,7 +267,7 @@ public final class MappingDataLoader {
addConsumer.addTo(mappings, id, values[i]);
}
} else if (strategy == IDENTITY_ID) {
final IntTag sizeTag = tag.get("size");
final IntTag sizeTag = tag.getUnchecked("size");
return new IdentityMappings(sizeTag.asInt(), mappedSizeTag.asInt());
} else {
throw new IllegalArgumentException("Unknown serialization strategy: " + strategy);
@ -229,73 +275,17 @@ public final class MappingDataLoader {
return mappingsSupplier.create(mappings, mappedSizeTag.asInt());
}
public static FullMappings loadFullMappings(final CompoundTag mappingsTag, final CompoundTag unmappedIdentifiers, final CompoundTag mappedIdentifiers, final String key) {
final ListTag unmappedElements = unmappedIdentifiers.get(key);
final ListTag mappedElements = mappedIdentifiers.get(key);
if (unmappedElements == null || mappedElements == null) {
public @Nullable List<String> identifiersFromGlobalIds(final CompoundTag mappingsTag, final String key) {
final Mappings mappings = loadMappings(mappingsTag, key);
if (mappings == null) {
return null;
}
Mappings mappings = loadMappings(mappingsTag, key);
if (mappings == null) {
mappings = new IdentityMappings(unmappedElements.size(), mappedElements.size());
}
return new FullMappingsBase(
unmappedElements.getValue().stream().map(t -> (String) t.getValue()).collect(Collectors.toList()),
mappedElements.getValue().stream().map(t -> (String) t.getValue()).collect(Collectors.toList()),
mappings
);
}
@Deprecated
public static void mapIdentifiers(final int[] output, final JsonObject unmappedIdentifiers, final JsonObject mappedIdentifiers, @Nullable final JsonObject diffIdentifiers, final boolean warnOnMissing) {
final Object2IntMap<String> newIdentifierMap = MappingDataLoader.indexedObjectToMap(mappedIdentifiers);
for (final Map.Entry<String, JsonElement> entry : unmappedIdentifiers.entrySet()) {
final int id = Integer.parseInt(entry.getKey());
final int mappedId = mapIdentifierEntry(id, entry.getValue().getAsString(), newIdentifierMap, diffIdentifiers, warnOnMissing);
if (mappedId != -1) {
output[id] = mappedId;
}
}
}
private static int mapIdentifierEntry(final int id, final String val, final Object2IntMap<String> mappedIdentifiers, @Nullable final JsonObject diffIdentifiers, final boolean warnOnMissing) {
int mappedId = mappedIdentifiers.getInt(val);
if (mappedId == -1) {
// Search in diff mappings
if (diffIdentifiers != null) {
JsonElement diffElement = diffIdentifiers.get(val);
if (diffElement != null || (diffElement = diffIdentifiers.get(Integer.toString(id))) != null) {
final String mappedName = diffElement.getAsString();
if (mappedName.isEmpty()) {
return -1; // "empty" remaps without warnings
}
mappedId = mappedIdentifiers.getInt(mappedName);
}
}
if (mappedId == -1) {
if (warnOnMissing && !Via.getConfig().isSuppressConversionWarnings() || Via.getManager().isDebug()) {
Via.getPlatform().getLogger().warning("No key for " + val + " :( ");
}
return -1;
}
}
return mappedId;
}
@Deprecated
public static void mapIdentifiers(final int[] output, final JsonArray unmappedIdentifiers, final JsonArray mappedIdentifiers, @Nullable final JsonObject diffIdentifiers, final boolean warnOnMissing) {
final Object2IntMap<String> newIdentifierMap = MappingDataLoader.arrayToMap(mappedIdentifiers);
for (int id = 0; id < unmappedIdentifiers.size(); id++) {
final JsonElement unmappedIdentifier = unmappedIdentifiers.get(id);
final int mappedId = mapIdentifierEntry(id, unmappedIdentifier.getAsString(), newIdentifierMap, diffIdentifiers, warnOnMissing);
if (mappedId != -1) {
output[id] = mappedId;
}
final List<String> identifiers = new ArrayList<>(mappings.size());
for (int i = 0; i < mappings.size(); i++) {
identifiers.add(identifierFromGlobalId(key, mappings.getNewId(i)));
}
return identifiers;
}
/**
@ -304,7 +294,7 @@ public final class MappingDataLoader {
* @param object json object
* @return map with indexes hashed by their id value
*/
public static Object2IntMap<String> indexedObjectToMap(final JsonObject object) {
public Object2IntMap<String> indexedObjectToMap(final JsonObject object) {
final Object2IntMap<String> map = new Object2IntOpenHashMap<>(object.size(), .99F);
map.defaultReturnValue(-1);
for (final Map.Entry<String, JsonElement> entry : object.entrySet()) {
@ -319,7 +309,7 @@ public final class MappingDataLoader {
* @param array json array
* @return map with indexes hashed by their id value
*/
public static Object2IntMap<String> arrayToMap(final JsonArray array) {
public Object2IntMap<String> arrayToMap(final JsonArray array) {
final Object2IntMap<String> map = new Object2IntOpenHashMap<>(array.size(), .99F);
map.defaultReturnValue(-1);
for (int i = 0; i < array.size(); i++) {
@ -328,8 +318,16 @@ public final class MappingDataLoader {
return map;
}
public static @Nullable InputStream getResource(final String name) {
return MappingDataLoader.class.getClassLoader().getResourceAsStream("assets/viaversion/data/" + name);
public Logger getLogger() {
return Via.getPlatform().getLogger();
}
public File getDataFolder() {
return Via.getPlatform().getDataFolder();
}
public @Nullable InputStream getResource(final String name) {
return dataLoaderClass.getClassLoader().getResourceAsStream(dataPath + name);
}
@FunctionalInterface

View File

@ -1,6 +1,6 @@
/*
* This file is part of ViaVersion - https://github.com/ViaVersion/ViaVersion
* Copyright (C) 2016-2023 ViaVersion and contributors
* Copyright (C) 2016-2024 ViaVersion and contributors
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
@ -22,11 +22,6 @@
*/
package com.viaversion.viaversion.api.data;
import com.google.gson.JsonArray;
import com.google.gson.JsonElement;
import com.google.gson.JsonObject;
import java.util.Arrays;
public interface Mappings {
/**
@ -89,123 +84,4 @@ public interface Mappings {
* @return mappings with keys and values swapped
*/
Mappings inverse();
static <T extends Mappings> Builder<T> builder(final MappingsSupplier<T> supplier) {
return new Builder<>(supplier);
}
@FunctionalInterface
interface MappingsSupplier<T extends Mappings> {
T supply(int[] mappings, int mappedIds);
}
@Deprecated
class Builder<T extends Mappings> {
protected final MappingsSupplier<T> supplier;
protected JsonElement unmapped;
protected JsonElement mapped;
protected JsonObject diffMappings;
protected int mappedSize = -1;
protected int size = -1;
protected boolean warnOnMissing = true;
protected Builder(final MappingsSupplier<T> supplier) {
this.supplier = supplier;
}
/**
* Sets a custom entry size different to the size of the unmapped collection.
*
* @param size custom entry size
* @return self
*/
public Builder<T> customEntrySize(final int size) {
this.size = size;
return this;
}
/**
* Sets a custom entry mapped ids count different to the size of the mapped collection.
*
* @param size custom mapped id count
* @return self
*/
public Builder<T> customMappedSize(final int size) {
this.mappedSize = size;
return this;
}
/**
* Sets whether warnings should be logged for missing mapped ids.
*
* @param warnOnMissing whether warnings should be logged for missing mapped ids
* @return self
*/
public Builder<T> warnOnMissing(final boolean warnOnMissing) {
this.warnOnMissing = warnOnMissing;
return this;
}
public Builder<T> unmapped(final JsonArray unmappedArray) {
this.unmapped = unmappedArray;
return this;
}
public Builder<T> unmapped(final JsonObject unmappedObject) {
this.unmapped = unmappedObject;
return this;
}
public Builder<T> mapped(final JsonArray mappedArray) {
this.mapped = mappedArray;
return this;
}
public Builder<T> mapped(final JsonObject mappedObject) {
this.mapped = mappedObject;
return this;
}
public Builder<T> diffMappings(final JsonObject diffMappings) {
this.diffMappings = diffMappings;
return this;
}
public T build() {
final int size = this.size != -1 ? this.size : size(unmapped);
final int mappedSize = this.mappedSize != -1 ? this.mappedSize : size(mapped);
final int[] mappings = new int[size];
Arrays.fill(mappings, -1);
// Do conversion if one is an array and the other an object, otherwise directly map
if (unmapped.isJsonArray()) {
if (mapped.isJsonObject()) {
MappingDataLoader.mapIdentifiers(mappings, toJsonObject(unmapped.getAsJsonArray()), mapped.getAsJsonObject(), diffMappings, warnOnMissing);
} else {
MappingDataLoader.mapIdentifiers(mappings, unmapped.getAsJsonArray(), mapped.getAsJsonArray(), diffMappings, warnOnMissing);
}
} else if (mapped.isJsonArray()) {
MappingDataLoader.mapIdentifiers(mappings, unmapped.getAsJsonObject(), toJsonObject(mapped.getAsJsonArray()), diffMappings, warnOnMissing);
} else {
MappingDataLoader.mapIdentifiers(mappings, unmapped.getAsJsonObject(), mapped.getAsJsonObject(), diffMappings, warnOnMissing);
}
return supplier.supply(mappings, mappedSize);
}
protected int size(final JsonElement element) {
return element.isJsonObject() ? element.getAsJsonObject().size() : element.getAsJsonArray().size();
}
protected JsonObject toJsonObject(final JsonArray array) {
final JsonObject object = new JsonObject();
for (int i = 0; i < array.size(); i++) {
final JsonElement element = array.get(i);
object.add(Integer.toString(i), element);
}
return object;
}
}
}

View File

@ -1,6 +1,6 @@
/*
* This file is part of ViaVersion - https://github.com/ViaVersion/ViaVersion
* Copyright (C) 2016-2023 ViaVersion and contributors
* Copyright (C) 2016-2024 ViaVersion and contributors
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
@ -35,6 +35,7 @@ public class ParticleMappings extends FullMappingsBase {
addBlockParticle("block");
addBlockParticle("falling_dust");
addBlockParticle("block_marker");
addBlockParticle("dust_pillar");
addItemParticle("item");
}
@ -55,19 +56,4 @@ public class ParticleMappings extends FullMappingsBase {
public boolean isItemParticle(final int id) {
return itemParticleIds.contains(id);
}
@Deprecated/*(forRemoval = true)*/
public int getBlockId() {
return id("block");
}
@Deprecated/*(forRemoval = true)*/
public int getFallingDustId() {
return id("falling_dust");
}
@Deprecated/*(forRemoval = true)*/
public int getItemId() {
return id("item");
}
}

View File

@ -1,6 +1,6 @@
/*
* This file is part of ViaVersion - https://github.com/ViaVersion/ViaVersion
* Copyright (C) 2016-2023 ViaVersion and contributors
* Copyright (C) 2016-2024 ViaVersion and contributors
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal

View File

@ -1,6 +1,6 @@
/*
* This file is part of ViaVersion - https://github.com/ViaVersion/ViaVersion
* Copyright (C) 2016-2023 ViaVersion and contributors
* Copyright (C) 2016-2024 ViaVersion and contributors
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
@ -24,6 +24,8 @@ package com.viaversion.viaversion.api.data.entity;
public interface DimensionData {
int id();
int minY();
int height();

View File

@ -1,6 +1,6 @@
/*
* This file is part of ViaVersion - https://github.com/ViaVersion/ViaVersion
* Copyright (C) 2016-2023 ViaVersion and contributors
* Copyright (C) 2016-2024 ViaVersion and contributors
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
@ -34,6 +34,7 @@ public interface EntityTracker {
*
* @return user connection
*/
@Deprecated
UserConnection user();
/**
@ -87,7 +88,7 @@ public interface EntityTracker {
*
* @param id entity id
* @return stored entity data if an entity with the id is tracked, else null
* @throws IllegalArgumentException if entitiy data storage has not been enabled via the implementation
* @throws IllegalArgumentException if entity data storage has not been enabled via the implementation
*/
@Nullable StoredEntityData entityData(int id);
@ -96,7 +97,7 @@ public interface EntityTracker {
*
* @param id entity id
* @return stored entity data if it has previously been initialized by {@link #entityData(int)}
* @throws IllegalArgumentException if entitiy data storage has not been enabled via the implementation
* @throws IllegalArgumentException if entity data storage has not been enabled via the implementation
*/
@Nullable StoredEntityData entityDataIfPresent(int id);
@ -165,6 +166,8 @@ public interface EntityTracker {
@Nullable DimensionData dimensionData(String dimension);
@Nullable DimensionData dimensionData(int dimensionId);
void setDimensions(Map<String, DimensionData> dimensions);
/**

View File

@ -1,6 +1,6 @@
/*
* This file is part of ViaVersion - https://github.com/ViaVersion/ViaVersion
* Copyright (C) 2016-2023 ViaVersion and contributors
* Copyright (C) 2016-2024 ViaVersion and contributors
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal

View File

@ -1,6 +1,6 @@
/*
* This file is part of ViaVersion - https://github.com/ViaVersion/ViaVersion
* Copyright (C) 2016-2023 ViaVersion and contributors
* Copyright (C) 2016-2024 ViaVersion and contributors
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal

View File

@ -1,6 +1,6 @@
/*
* This file is part of ViaVersion - https://github.com/ViaVersion/ViaVersion
* Copyright (C) 2016-2023 ViaVersion and contributors
* Copyright (C) 2016-2024 ViaVersion and contributors
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
@ -23,9 +23,11 @@
package com.viaversion.viaversion.api.debug;
import com.google.common.annotations.Beta;
import com.viaversion.viaversion.api.Via;
import com.viaversion.viaversion.api.protocol.packet.Direction;
import com.viaversion.viaversion.api.protocol.packet.PacketType;
import com.viaversion.viaversion.api.protocol.packet.PacketWrapper;
import java.util.logging.Level;
@Beta
public interface DebugHandler {
@ -102,4 +104,16 @@ public interface DebugHandler {
addPacketTypeToLog(packetType);
}
}
/**
* Logs an error if debug mode is enabled or error suppression is disabled.
*
* @param error error message
* @param t thrown exception
*/
default void error(final String error, final Throwable t) {
if (!Via.getConfig().isSuppressConversionWarnings() || enabled()) {
Via.getPlatform().getLogger().log(Level.SEVERE, error, t);
}
}
}

View File

@ -1,6 +1,6 @@
/*
* This file is part of ViaVersion - https://github.com/ViaVersion/ViaVersion
* Copyright (C) 2016-2023 ViaVersion and contributors
* Copyright (C) 2016-2024 ViaVersion and contributors
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal

View File

@ -1,6 +1,6 @@
/*
* This file is part of ViaVersion - https://github.com/ViaVersion/ViaVersion
* Copyright (C) 2016-2023 ViaVersion and contributors
* Copyright (C) 2016-2024 ViaVersion and contributors
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
@ -66,7 +66,7 @@ public interface BossBar {
BossColor getColor();
/**
* Yay colors!
* Yay, colors!
*
* @param color Whatever color you want!
* @return The BossBar object

View File

@ -1,6 +1,6 @@
/*
* This file is part of ViaVersion - https://github.com/ViaVersion/ViaVersion
* Copyright (C) 2016-2023 ViaVersion and contributors
* Copyright (C) 2016-2024 ViaVersion and contributors
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal

View File

@ -1,6 +1,6 @@
/*
* This file is part of ViaVersion - https://github.com/ViaVersion/ViaVersion
* Copyright (C) 2016-2023 ViaVersion and contributors
* Copyright (C) 2016-2024 ViaVersion and contributors
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal

View File

@ -1,6 +1,6 @@
/*
* This file is part of ViaVersion - https://github.com/ViaVersion/ViaVersion
* Copyright (C) 2016-2023 ViaVersion and contributors
* Copyright (C) 2016-2024 ViaVersion and contributors
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal

View File

@ -1,6 +1,6 @@
/*
* This file is part of ViaVersion - https://github.com/ViaVersion/ViaVersion
* Copyright (C) 2016-2023 ViaVersion and contributors
* Copyright (C) 2016-2024 ViaVersion and contributors
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal

View File

@ -1,6 +1,6 @@
/*
* This file is part of ViaVersion - https://github.com/ViaVersion/ViaVersion
* Copyright (C) 2016-2023 ViaVersion and contributors
* Copyright (C) 2016-2024 ViaVersion and contributors
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal

View File

@ -1,6 +1,6 @@
/*
* This file is part of ViaVersion - https://github.com/ViaVersion/ViaVersion
* Copyright (C) 2016-2023 ViaVersion and contributors
* Copyright (C) 2016-2024 ViaVersion and contributors
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal

View File

@ -1,6 +1,6 @@
/*
* This file is part of ViaVersion - https://github.com/ViaVersion/ViaVersion
* Copyright (C) 2016-2023 ViaVersion and contributors
* Copyright (C) 2016-2024 ViaVersion and contributors
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal

View File

@ -0,0 +1,48 @@
/*
* This file is part of ViaVersion - https://github.com/ViaVersion/ViaVersion
* Copyright (C) 2016-2024 ViaVersion and contributors
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in all
* copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
* SOFTWARE.
*/
package com.viaversion.viaversion.api.minecraft;
import com.viaversion.viaversion.api.connection.StorableObject;
import org.checkerframework.checker.nullness.qual.Nullable;
/**
* Stored up until 1.14 to be used in chunk sending.
*/
public class ClientWorld implements StorableObject {
private Environment environment;
public ClientWorld() {
}
public ClientWorld(final Environment environment) {
this.environment = environment;
}
public @Nullable Environment getEnvironment() {
return environment;
}
public void setEnvironment(final int environmentId) {
this.environment = Environment.getEnvironmentById(environmentId);
}
}

View File

@ -1,6 +1,6 @@
/*
* This file is part of ViaVersion - https://github.com/ViaVersion/ViaVersion
* Copyright (C) 2016-2023 ViaVersion and contributors
* Copyright (C) 2016-2024 ViaVersion and contributors
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal

View File

@ -1,6 +1,6 @@
/*
* This file is part of ViaVersion - https://github.com/ViaVersion/ViaVersion
* Copyright (C) 2016-2023 ViaVersion and contributors
* Copyright (C) 2016-2024 ViaVersion and contributors
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal

View File

@ -1,6 +1,6 @@
/*
* This file is part of ViaVersion - https://github.com/ViaVersion/ViaVersion
* Copyright (C) 2016-2023 ViaVersion and contributors
* Copyright (C) 2016-2024 ViaVersion and contributors
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
@ -20,68 +20,56 @@
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
* SOFTWARE.
*/
package com.viaversion.viaversion.api.type.types;
package com.viaversion.viaversion.api.minecraft;
import com.viaversion.viaversion.api.type.Type;
import java.util.ArrayList;
import java.util.List;
import java.util.UUID;
import org.checkerframework.checker.nullness.qual.Nullable;
public class Particle {
private List<ParticleData> arguments = new ArrayList<>(4);
private int id;
public final class GameProfile {
public Particle(int id) {
private final String name;
private final UUID id;
private final Property[] properties;
public GameProfile(@Nullable final String name, @Nullable final UUID id, final Property[] properties) {
this.name = name;
this.id = id;
this.properties = properties;
}
public int getId() {
public @Nullable String name() {
return name;
}
public @Nullable UUID id() {
return id;
}
public void setId(int id) {
this.id = id;
public Property[] properties() {
return properties;
}
public List<ParticleData> getArguments() {
return arguments;
}
public static final class Property {
private final String name;
private final String value;
private final String signature;
@Deprecated/*(forRemoval = true)*/
public void setArguments(List<ParticleData> arguments) {
this.arguments = arguments;
}
public <T> void add(Type<T> type, T value) {
arguments.add(new ParticleData(type, value));
}
public static class ParticleData {
private Type type;
private Object value;
public ParticleData(Type type, Object value) {
this.type = type;
public Property(final String name, final String value, @Nullable final String signature) {
this.name = name;
this.value = value;
this.signature = signature;
}
public Type getType() {
return type;
public String name() {
return name;
}
public void setType(Type type) {
this.type = type;
}
public Object getValue() {
public String value() {
return value;
}
public <T> T get() {
return (T) value;
}
public void setValue(Object value) {
this.value = value;
public @Nullable String signature() {
return signature;
}
}
}

View File

@ -1,6 +1,6 @@
/*
* This file is part of ViaVersion - https://github.com/ViaVersion/ViaVersion
* Copyright (C) 2016-2023 ViaVersion and contributors
* Copyright (C) 2016-2024 ViaVersion and contributors
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal

View File

@ -0,0 +1,82 @@
/*
* This file is part of ViaVersion - https://github.com/ViaVersion/ViaVersion
* Copyright (C) 2016-2024 ViaVersion and contributors
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in all
* copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
* SOFTWARE.
*/
package com.viaversion.viaversion.api.minecraft;
public interface Holder<T> {
/**
* Returns an indirect id holder.
*
* @param id the id
* @param <T> the type of the value
* @return a new holder with the given id
* @throws IllegalArgumentException if the id is negative
*/
static <T> Holder<T> of(final int id) {
return new HolderImpl<>(id);
}
/**
* Returns a direct value holder.
*
* @param value the value
* @param <T> the type of the value
* @return a new direct holder
*/
static <T> Holder<T> of(final T value) {
return new HolderImpl<>(value);
}
/**
* Returns true if this holder is backed by a direct value.
*
* @return true if the holder is direct
* @see #hasId()
*/
boolean isDirect();
/**
* Returns true if this holder has an id.
*
* @return true if this holder has an id
* @see #isDirect()
*/
boolean hasId();
/**
* Returns the value of this holder.
*
* @return the value of this holder
* @throws IllegalArgumentException if this holder is not direct
* @see #isDirect()
*/
T value();
/**
* Returns the id of this holder, or -1 if this holder is direct.
*
* @return the id of this holder, or -1 if this holder is direct
* @see #hasId()
*/
int id();
}

View File

@ -0,0 +1,63 @@
/*
* This file is part of ViaVersion - https://github.com/ViaVersion/ViaVersion
* Copyright (C) 2016-2024 ViaVersion and contributors
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in all
* copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
* SOFTWARE.
*/
package com.viaversion.viaversion.api.minecraft;
import com.google.common.base.Preconditions;
final class HolderImpl<T> implements Holder<T> {
private final T value;
private final int id;
HolderImpl(final int id) {
Preconditions.checkArgument(id >= 0, "id cannot be negative");
this.value = null;
this.id = id;
}
HolderImpl(final T value) {
this.value = value;
this.id = -1;
}
@Override
public boolean isDirect() {
return id == -1;
}
@Override
public boolean hasId() {
return id != -1;
}
@Override
public T value() {
Preconditions.checkArgument(isDirect(), "Holder is not direct");
return value;
}
@Override
public int id() {
return id;
}
}

View File

@ -0,0 +1,79 @@
/*
* This file is part of ViaVersion - https://github.com/ViaVersion/ViaVersion
* Copyright (C) 2016-2024 ViaVersion and contributors
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in all
* copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
* SOFTWARE.
*/
package com.viaversion.viaversion.api.minecraft;
/**
* Set of ids that either holds a string tag key or an array of ids.
*/
public interface HolderSet {
/**
* Creates a new holder set for the given tag.
*
* @param tagKey the tag key
* @return a new holder set
*/
static HolderSet of(final String tagKey) {
return new HolderSetImpl(tagKey);
}
/**
* Creates a new holder set for the given ids.
*
* @param ids the direct ids
* @return a new holder set
*/
static HolderSet of(final int[] ids) {
return new HolderSetImpl(ids);
}
/**
* Gets the tag key.
*
* @return the tag key
* @see #hasTagKey()
*/
String tagKey();
/**
* Returns whether this holder set has a tag key.
*
* @return true if this holder set has a tag key, false if it has direct ids
*/
boolean hasTagKey();
/**
* Gets the direct ids.
*
* @return direct ids
* @see #hasIds()
*/
int[] ids();
/**
* Returns whether this holder set has direct ids.
*
* @return true if this holder set has direct ids, false if it has a tag key
*/
boolean hasIds();
}

View File

@ -0,0 +1,56 @@
/*
* This file is part of ViaVersion - https://github.com/ViaVersion/ViaVersion
* Copyright (C) 2016-2024 ViaVersion and contributors
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in all
* copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
* SOFTWARE.
*/
package com.viaversion.viaversion.api.minecraft;
import com.viaversion.viaversion.util.EitherImpl;
final class HolderSetImpl extends EitherImpl<String, int[]> implements HolderSet {
HolderSetImpl(final String tagKey) {
super(tagKey, null);
}
HolderSetImpl(final int[] ids) {
super(null, ids);
}
@Override
public String tagKey() {
return left();
}
@Override
public boolean hasTagKey() {
return isLeft();
}
@Override
public int[] ids() {
return right();
}
@Override
public boolean hasIds() {
return isRight();
}
}

View File

@ -0,0 +1,125 @@
/*
* This file is part of ViaVersion - https://github.com/ViaVersion/ViaVersion
* Copyright (C) 2016-2024 ViaVersion and contributors
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in all
* copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
* SOFTWARE.
*/
package com.viaversion.viaversion.api.minecraft;
import com.viaversion.viaversion.api.protocol.packet.PacketWrapper;
import com.viaversion.viaversion.api.type.Type;
import com.viaversion.viaversion.util.IdHolder;
import io.netty.buffer.ByteBuf;
import java.util.ArrayList;
import java.util.List;
public final class Particle implements IdHolder {
private final List<ParticleData<?>> arguments = new ArrayList<>(4);
private int id;
public Particle(final int id) {
this.id = id;
}
@Deprecated
public int getId() {
return id;
}
@Override
public int id() {
return id;
}
public void setId(final int id) {
this.id = id;
}
public <T> ParticleData<T> getArgument(final int index) {
//noinspection unchecked
return (ParticleData<T>) arguments.get(index);
}
public <T> ParticleData<T> removeArgument(final int index) {
//noinspection unchecked
return (ParticleData<T>) arguments.remove(index);
}
public List<ParticleData<?>> getArguments() {
return arguments;
}
public <T> void add(final Type<T> type, final T value) {
arguments.add(new ParticleData<>(type, value));
}
public <T> void add(final int index, final Type<T> type, final T value) {
arguments.add(index, new ParticleData<>(type, value));
}
public <T> void set(final int index, final Type<T> type, final T value) {
arguments.set(index, new ParticleData<>(type, value));
}
@Override
public String toString() {
return "Particle{" +
"arguments=" + arguments +
", id=" + id +
'}';
}
public static final class ParticleData<T> {
private final Type<T> type;
private T value;
public ParticleData(final Type<T> type, final T value) {
this.type = type;
this.value = value;
}
public Type<T> getType() {
return type;
}
public T getValue() {
return value;
}
public void setValue(final T value) {
this.value = value;
}
public void write(final ByteBuf buf) throws Exception {
type.write(buf, value);
}
public void write(final PacketWrapper wrapper) {
wrapper.write(type, value);
}
@Override
public String toString() {
return "ParticleData{" +
"type=" + type +
", value=" + value +
'}';
}
}
}

View File

@ -1,6 +1,6 @@
/*
* This file is part of ViaVersion - https://github.com/ViaVersion/ViaVersion
* Copyright (C) 2016-2023 ViaVersion and contributors
* Copyright (C) 2016-2024 ViaVersion and contributors
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal

View File

@ -1,6 +1,6 @@
/*
* This file is part of ViaVersion - https://github.com/ViaVersion/ViaVersion
* Copyright (C) 2016-2023 ViaVersion and contributors
* Copyright (C) 2016-2024 ViaVersion and contributors
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal

View File

@ -1,6 +1,6 @@
/*
* This file is part of ViaVersion - https://github.com/ViaVersion/ViaVersion
* Copyright (C) 2016-2023 ViaVersion and contributors
* Copyright (C) 2016-2024 ViaVersion and contributors
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal

View File

@ -1,6 +1,6 @@
/*
* This file is part of ViaVersion - https://github.com/ViaVersion/ViaVersion
* Copyright (C) 2016-2023 ViaVersion and contributors
* Copyright (C) 2016-2024 ViaVersion and contributors
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal

View File

@ -1,6 +1,6 @@
/*
* This file is part of ViaVersion - https://github.com/ViaVersion/ViaVersion
* Copyright (C) 2016-2023 ViaVersion and contributors
* Copyright (C) 2016-2024 ViaVersion and contributors
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
@ -50,4 +50,14 @@ public final class Quaternion {
public float w() {
return w;
}
@Override
public String toString() {
return "Quaternion{" +
"x=" + x +
", y=" + y +
", z=" + z +
", w=" + w +
'}';
}
}

View File

@ -0,0 +1,48 @@
/*
* This file is part of ViaVersion - https://github.com/ViaVersion/ViaVersion
* Copyright (C) 2016-2024 ViaVersion and contributors
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in all
* copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
* SOFTWARE.
*/
package com.viaversion.viaversion.api.minecraft;
import com.github.steveice10.opennbt.tag.builtin.Tag;
import org.checkerframework.checker.nullness.qual.Nullable;
public final class RegistryEntry {
private final String key;
private final Tag tag;
public RegistryEntry(String key, @Nullable Tag tag) {
this.key = key;
this.tag = tag;
}
public String key() {
return key;
}
public @Nullable Tag tag() {
return tag;
}
public RegistryEntry withKey(final String key) {
return new RegistryEntry(key, tag != null ? tag.copy() : null);
}
}

View File

@ -1,6 +1,6 @@
/*
* This file is part of ViaVersion - https://github.com/ViaVersion/ViaVersion
* Copyright (C) 2016-2023 ViaVersion and contributors
* Copyright (C) 2016-2024 ViaVersion and contributors
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
@ -57,11 +57,6 @@ public enum RegistryType {
this.resourceLocation = resourceLocation;
}
@Deprecated/*(forRemoval = true)*/
public String getResourceLocation() {
return resourceLocation;
}
public String resourceLocation() {
return resourceLocation;
}

View File

@ -0,0 +1,48 @@
/*
* This file is part of ViaVersion - https://github.com/ViaVersion/ViaVersion
* Copyright (C) 2016-2024 ViaVersion and contributors
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in all
* copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
* SOFTWARE.
*/
package com.viaversion.viaversion.api.minecraft;
import org.checkerframework.checker.nullness.qual.Nullable;
public final class SoundEvent {
private final String identifier;
private final Float fixedRange;
public SoundEvent(final String identifier, @Nullable final Float fixedRange) {
this.identifier = identifier;
this.fixedRange = fixedRange;
}
public String identifier() {
return identifier;
}
public @Nullable Float fixedRange() {
return fixedRange;
}
public SoundEvent withIdentifier(final String identifier) {
return new SoundEvent(identifier, this.fixedRange);
}
}

View File

@ -1,6 +1,6 @@
/*
* This file is part of ViaVersion - https://github.com/ViaVersion/ViaVersion
* Copyright (C) 2016-2023 ViaVersion and contributors
* Copyright (C) 2016-2024 ViaVersion and contributors
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
@ -22,6 +22,8 @@
*/
package com.viaversion.viaversion.api.minecraft;
import java.util.Arrays;
public final class TagData {
private final String identifier;
private final int[] entries;
@ -38,4 +40,12 @@ public final class TagData {
public int[] entries() {
return entries;
}
@Override
public String toString() {
return "TagData{" +
"identifier='" + identifier + '\'' +
", entries=" + Arrays.toString(entries) +
'}';
}
}

View File

@ -1,6 +1,6 @@
/*
* This file is part of ViaVersion - https://github.com/ViaVersion/ViaVersion
* Copyright (C) 2016-2023 ViaVersion and contributors
* Copyright (C) 2016-2024 ViaVersion and contributors
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal

View File

@ -1,6 +1,6 @@
/*
* This file is part of ViaVersion - https://github.com/ViaVersion/ViaVersion
* Copyright (C) 2016-2023 ViaVersion and contributors
* Copyright (C) 2016-2024 ViaVersion and contributors
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal

View File

@ -1,6 +1,6 @@
/*
* This file is part of ViaVersion - https://github.com/ViaVersion/ViaVersion
* Copyright (C) 2016-2023 ViaVersion and contributors
* Copyright (C) 2016-2024 ViaVersion and contributors
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal

View File

@ -1,6 +1,6 @@
/*
* This file is part of ViaVersion - https://github.com/ViaVersion/ViaVersion
* Copyright (C) 2016-2023 ViaVersion and contributors
* Copyright (C) 2016-2024 ViaVersion and contributors
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal

View File

@ -1,6 +1,6 @@
/*
* This file is part of ViaVersion - https://github.com/ViaVersion/ViaVersion
* Copyright (C) 2016-2023 ViaVersion and contributors
* Copyright (C) 2016-2024 ViaVersion and contributors
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
@ -27,6 +27,10 @@ import org.checkerframework.checker.nullness.qual.Nullable;
public interface BlockEntity {
static byte pack(int sectionX, int sectionZ) {
return (byte) (((sectionX) & 15) << 4 | (sectionZ & 15));
}
default byte sectionX() {
return (byte) ((packedXZ() >> 4) & 15);
}

View File

@ -1,6 +1,6 @@
/*
* This file is part of ViaVersion - https://github.com/ViaVersion/ViaVersion
* Copyright (C) 2016-2023 ViaVersion and contributors
* Copyright (C) 2016-2024 ViaVersion and contributors
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal

View File

@ -1,6 +1,6 @@
/*
* This file is part of ViaVersion - https://github.com/ViaVersion/ViaVersion
* Copyright (C) 2016-2023 ViaVersion and contributors
* Copyright (C) 2016-2024 ViaVersion and contributors
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal

View File

@ -1,6 +1,6 @@
/*
* This file is part of ViaVersion - https://github.com/ViaVersion/ViaVersion
* Copyright (C) 2016-2023 ViaVersion and contributors
* Copyright (C) 2016-2024 ViaVersion and contributors
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal

View File

@ -1,6 +1,6 @@
/*
* This file is part of ViaVersion - https://github.com/ViaVersion/ViaVersion
* Copyright (C) 2016-2023 ViaVersion and contributors
* Copyright (C) 2016-2024 ViaVersion and contributors
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal

View File

@ -1,6 +1,6 @@
/*
* This file is part of ViaVersion - https://github.com/ViaVersion/ViaVersion
* Copyright (C) 2016-2023 ViaVersion and contributors
* Copyright (C) 2016-2024 ViaVersion and contributors
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal

View File

@ -1,6 +1,6 @@
/*
* This file is part of ViaVersion - https://github.com/ViaVersion/ViaVersion
* Copyright (C) 2016-2023 ViaVersion and contributors
* Copyright (C) 2016-2024 ViaVersion and contributors
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal

View File

@ -1,6 +1,6 @@
/*
* This file is part of ViaVersion - https://github.com/ViaVersion/ViaVersion
* Copyright (C) 2016-2023 ViaVersion and contributors
* Copyright (C) 2016-2024 ViaVersion and contributors
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal

View File

@ -1,6 +1,6 @@
/*
* This file is part of ViaVersion - https://github.com/ViaVersion/ViaVersion
* Copyright (C) 2016-2023 ViaVersion and contributors
* Copyright (C) 2016-2024 ViaVersion and contributors
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
@ -47,6 +47,11 @@ public class ChunkSectionLightImpl implements ChunkSectionLight {
@Override
public void setSkyLight(byte[] data) {
if (data == null) {
this.skyLight = null;
return;
}
if (data.length != LIGHT_LENGTH) throw new IllegalArgumentException("Data length != " + LIGHT_LENGTH);
if (this.skyLight == null) {
this.skyLight = new NibbleArray(data);

View File

@ -1,6 +1,6 @@
/*
* This file is part of ViaVersion - https://github.com/ViaVersion/ViaVersion
* Copyright (C) 2016-2023 ViaVersion and contributors
* Copyright (C) 2016-2024 ViaVersion and contributors
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal

View File

@ -1,6 +1,6 @@
/*
* This file is part of ViaVersion - https://github.com/ViaVersion/ViaVersion
* Copyright (C) 2016-2023 ViaVersion and contributors
* Copyright (C) 2016-2024 ViaVersion and contributors
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
@ -29,21 +29,24 @@ import it.unimi.dsi.fastutil.ints.IntList;
public final class DataPaletteImpl implements DataPalette {
private static final int DEFAULT_INITIAL_SIZE = 16;
private final IntList palette;
private final Int2IntMap inversePalette;
private final int[] values;
private final int sizeBits;
private ChunkData values;
public DataPaletteImpl(final int valuesLength) {
this(valuesLength, 8);
this(valuesLength, DEFAULT_INITIAL_SIZE);
}
public DataPaletteImpl(final int valuesLength, final int expectedPaletteLength) {
this.values = new int[valuesLength];
public DataPaletteImpl(final int valuesLength, final int initialSize) {
values = new EmptyChunkData(valuesLength);
sizeBits = Integer.numberOfTrailingZeros(valuesLength) / 3;
// Pre-size the palette array/map
palette = new IntArrayList(expectedPaletteLength);
inversePalette = new Int2IntOpenHashMap(expectedPaletteLength);
palette = new IntArrayList(initialSize);
// To get an initial table size of initialSize, need to scale it down by load factor.
inversePalette = new Int2IntOpenHashMap((int) (initialSize * Int2IntOpenHashMap.DEFAULT_LOAD_FACTOR));
inversePalette.defaultReturnValue(-1);
}
@ -54,7 +57,7 @@ public final class DataPaletteImpl implements DataPalette {
@Override
public int idAt(final int sectionCoordinate) {
final int index = values[sectionCoordinate];
final int index = values.get(sectionCoordinate);
return palette.getInt(index);
}
@ -67,17 +70,17 @@ public final class DataPaletteImpl implements DataPalette {
inversePalette.put(id, index);
}
values[sectionCoordinate] = index;
values.set(sectionCoordinate, index);
}
@Override
public int paletteIndexAt(final int packedCoordinate) {
return values[packedCoordinate];
return values.get(packedCoordinate);
}
@Override
public void setPaletteIndexAt(final int sectionCoordinate, final int index) {
values[sectionCoordinate] = index;
values.set(sectionCoordinate, index);
}
@Override
@ -131,4 +134,77 @@ public final class DataPaletteImpl implements DataPalette {
palette.clear();
inversePalette.clear();
}
interface ChunkData {
int get(int idx);
void set(int idx, int val);
}
private class EmptyChunkData implements ChunkData {
private final int size;
public EmptyChunkData(int size) {
this.size = size;
}
@Override
public int get(int idx) {
return 0;
}
@Override
public void set(int idx, int val) {
if (val != 0) {
values = new ByteChunkData(size);
values.set(idx, val);
}
}
}
private class ByteChunkData implements ChunkData {
private final byte[] data;
public ByteChunkData(int size) {
this.data = new byte[size];
}
@Override
public int get(int idx) {
return data[idx] & 0xFF;
}
@Override
public void set(int idx, int val) {
// Overflowed size of byte (over 256 different materials), go up to short
if (val > 0xFF) {
values = new ShortChunkData(data);
values.set(idx, val);
return;
}
data[idx] = (byte) val;
}
}
private static class ShortChunkData implements ChunkData {
private final short[] data;
public ShortChunkData(byte[] data) {
this.data = new short[data.length];
for (int i = 0; i < data.length; i++) {
this.data[i] = (short) (data[i] & 0xFF);
}
}
@Override
public int get(int idx) {
return data[idx];
}
@Override
public void set(int idx, int val) {
data[idx] = (short) val;
}
}
}

View File

@ -1,6 +1,6 @@
/*
* This file is part of ViaVersion - https://github.com/ViaVersion/ViaVersion
* Copyright (C) 2016-2023 ViaVersion and contributors
* Copyright (C) 2016-2024 ViaVersion and contributors
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal

View File

@ -1,6 +1,6 @@
/*
* This file is part of ViaVersion - https://github.com/ViaVersion/ViaVersion
* Copyright (C) 2016-2023 ViaVersion and contributors
* Copyright (C) 2016-2024 ViaVersion and contributors
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal

View File

@ -0,0 +1,94 @@
/*
* This file is part of ViaVersion - https://github.com/ViaVersion/ViaVersion
* Copyright (C) 2016-2024 ViaVersion and contributors
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in all
* copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
* SOFTWARE.
*/
package com.viaversion.viaversion.api.minecraft.data;
import io.netty.buffer.ByteBuf;
final class EmptyStructuredData<T> implements StructuredData<T> {
private final StructuredDataKey<T> key;
private int id;
EmptyStructuredData(final StructuredDataKey<T> key, final int id) {
this.key = key;
this.id = id;
}
@Override
public void setValue(final T value) {
throw new UnsupportedOperationException();
}
@Override
public void write(final ByteBuf buffer) {
}
@Override
public void setId(final int id) {
this.id = id;
}
@Override
public StructuredDataKey<T> key() {
return this.key;
}
@Override
public T value() {
return null;
}
@Override
public boolean isEmpty() {
return true;
}
@Override
public int id() {
return this.id;
}
@Override
public boolean equals(final Object o) {
if (this == o) return true;
if (o == null || getClass() != o.getClass()) return false;
final EmptyStructuredData<?> that = (EmptyStructuredData<?>) o;
if (id != that.id) return false;
return key.equals(that.key);
}
@Override
public int hashCode() {
int result = key.hashCode();
result = 31 * result + id;
return result;
}
@Override
public String toString() {
return "EmptyStructuredData{" +
"key=" + key +
", id=" + id +
'}';
}
}

View File

@ -0,0 +1,103 @@
/*
* This file is part of ViaVersion - https://github.com/ViaVersion/ViaVersion
* Copyright (C) 2016-2024 ViaVersion and contributors
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in all
* copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
* SOFTWARE.
*/
package com.viaversion.viaversion.api.minecraft.data;
import com.google.common.base.Preconditions;
import io.netty.buffer.ByteBuf;
import java.util.Objects;
final class FilledStructuredData<T> implements StructuredData<T> {
private final StructuredDataKey<T> key;
private T value;
private int id;
FilledStructuredData(final StructuredDataKey<T> key, final T value, final int id) {
Preconditions.checkNotNull(key);
this.key = key;
this.value = value;
this.id = id;
}
@Override
public void setValue(final T value) {
this.value = value;
}
@Override
public void write(final ByteBuf buffer) throws Exception {
key.type().write(buffer, value);
}
@Override
public void setId(final int id) {
this.id = id;
}
@Override
public StructuredDataKey<T> key() {
return key;
}
@Override
public T value() {
return value;
}
@Override
public boolean isEmpty() {
return false;
}
@Override
public int id() {
return id;
}
@Override
public boolean equals(final Object o) {
if (this == o) return true;
if (o == null || getClass() != o.getClass()) return false;
final FilledStructuredData<?> that = (FilledStructuredData<?>) o;
if (id != that.id) return false;
if (!key.equals(that.key)) return false;
return Objects.equals(value, that.value);
}
@Override
public int hashCode() {
int result = key.hashCode();
result = 31 * result + (value != null ? value.hashCode() : 0);
result = 31 * result + id;
return result;
}
@Override
public String toString() {
return "FilledStructuredData{" +
"key=" + key +
", value=" + value +
", id=" + id +
'}';
}
}

Some files were not shown because too many files have changed in this diff Show More