mirror of
https://github.com/ViaVersion/ViaVersion.git
synced 2026-11-04 08:52:10 -05:00
Compare commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
f040077c13 | ||
|
|
1f404820b7 | ||
|
|
742e70fff6 | ||
|
|
dd6a1a7f6e | ||
|
|
08ef7c2f35 | ||
|
|
e128469313 | ||
|
|
cbb753271e | ||
|
|
29f299d882 | ||
|
|
41138aabd1 | ||
|
|
b90f20cfeb | ||
|
|
585028beb7 | ||
|
|
160eaa35aa | ||
|
|
9fb02581a6 | ||
|
|
7d01d5363b | ||
|
|
8a549d7f11 | ||
|
|
50e2db93b4 | ||
|
|
2d80c9526a | ||
|
|
80d72121cf | ||
|
|
ba11b3c214 | ||
|
|
2ee4c86dcb | ||
|
|
97b8cbbc6f | ||
|
|
1a1ae41a7b | ||
|
|
2b7a86bc55 | ||
|
|
175c320389 | ||
|
|
b22430a923 | ||
|
|
c9f9e88ebe | ||
|
|
7f0b3fc241 | ||
|
|
e13b99e73a | ||
|
|
304d9f04ec | ||
|
|
92b59fd904 | ||
|
|
7e42ce2a5c | ||
|
|
d3475dc751 | ||
|
|
cd6e5a3d7a | ||
|
|
67e50ed6f4 | ||
|
|
097ad1c721 | ||
|
|
6a4f5732e2 | ||
|
|
000769e7c5 | ||
|
|
c725242713 | ||
|
|
fd9d7d674b | ||
|
|
5c87388353 | ||
|
|
3b65720d04 | ||
|
|
44af621c12 | ||
|
|
4e33615d9e | ||
|
|
a5b34b9fac | ||
|
|
674b81a5ce | ||
|
|
36a3a7bd32 | ||
|
|
d2b2f56438 | ||
|
|
5cb147f8c5 | ||
|
|
c1c6d7378d | ||
|
|
3cd9d8c20b | ||
|
|
8faa00af14 | ||
|
|
2aa02cfc20 | ||
|
|
1071e68e6e | ||
|
|
bcf4efacc5 | ||
|
|
4ab3148dd9 | ||
|
|
b0269b53b7 | ||
|
|
5df2ffe6a8 | ||
|
|
0e8e58dc5c | ||
|
|
d1e27617a9 | ||
|
|
5ab4f49148 | ||
|
|
494da63b66 | ||
|
|
a0b0ed4b68 | ||
|
|
e9ec29a217 | ||
|
|
fb5bc8254a | ||
|
|
a7bc03f6a9 | ||
|
|
d1bea0326c | ||
|
|
d3512c9e7f | ||
|
|
2f1f7538e5 | ||
|
|
ac3362f950 | ||
|
|
74e510b056 | ||
|
|
fdd263b806 | ||
|
|
a764cec4a9 | ||
|
|
764861e29b | ||
|
|
3e946ff67e | ||
|
|
dca45ceb0e | ||
|
|
327ec23ae9 | ||
|
|
9cf7737502 | ||
|
|
0c5fa1b00a | ||
|
|
1ca075fe89 | ||
|
|
d7c50a0c06 | ||
|
|
0e98839cee | ||
|
|
512ceeb401 | ||
|
|
1bf04b4769 | ||
|
|
e24981031b | ||
|
|
261188569d | ||
|
|
d2f35708ed | ||
|
|
d282f37483 | ||
|
|
b244776cc9 | ||
|
|
3418e2c21a | ||
|
|
d05bdd9eda | ||
|
|
a92e75b8cc | ||
|
|
280b1476ed | ||
|
|
9f6e7fa4e5 | ||
|
|
7ea38a9447 | ||
|
|
30df64b4d4 | ||
|
|
73286fd946 | ||
|
|
82373acf44 | ||
|
|
3aa3e3d2f9 | ||
|
|
33d2376e5c | ||
|
|
5aae4ab10a | ||
|
|
c17b6c5099 | ||
|
|
e41e8dfd63 | ||
|
|
ce26107730 | ||
|
|
60dd68184d | ||
|
|
08b921729d | ||
|
|
3b27af0964 | ||
|
|
742911a679 | ||
|
|
4773ba41cf | ||
|
|
f2456abd5b | ||
|
|
366675f7f8 | ||
|
|
bccbf80446 | ||
|
|
75c6662665 | ||
|
|
813cf813cf | ||
|
|
037410d405 | ||
|
|
c9d5632143 | ||
|
|
fd164d20e7 | ||
|
|
488a6b6919 | ||
|
|
3cd01978df | ||
|
|
0c4dbbe0bb | ||
|
|
1750131831 | ||
|
|
5ac7aaccb7 | ||
|
|
ae60e2f28d | ||
|
|
17a73dff82 | ||
|
|
5e9d213082 | ||
|
|
210b0a6f0e | ||
|
|
f0f87b26d7 | ||
|
|
45a55a81c7 | ||
|
|
b2ec9eab50 | ||
|
|
2f08f0d58c | ||
|
|
d3f92ce9b8 | ||
|
|
cfa20ba418 | ||
|
|
de6ac47a2f | ||
|
|
b41733bdf6 | ||
|
|
8f8bc55bd0 | ||
|
|
81d92a728d | ||
|
|
68666d2d44 | ||
|
|
e539375143 | ||
|
|
0acec719b1 | ||
|
|
93e92ffc82 | ||
|
|
82c55b1d78 | ||
|
|
dd660a2de0 | ||
|
|
96c12ef483 | ||
|
|
1653de70c8 | ||
|
|
b57265e64f | ||
|
|
9d4af84872 | ||
|
|
40665782e7 | ||
|
|
2d663db53f | ||
|
|
896c6accfb | ||
|
|
1785677901 | ||
|
|
e32205ddaf | ||
|
|
f93c64d6aa | ||
|
|
b5eb568515 | ||
|
|
7897fca5be | ||
|
|
3ba86741f9 | ||
|
|
5515011644 | ||
|
|
f59e2a2de4 | ||
|
|
88c103c0a5 | ||
|
|
5772ee4a93 | ||
|
|
c525575d37 | ||
|
|
b8a170873d | ||
|
|
04e936d487 | ||
|
|
6553fc9ae9 | ||
|
|
ddbe8ef0fb | ||
|
|
8e4da81022 | ||
|
|
1620fc35f5 | ||
|
|
e878d77959 | ||
|
|
deab6a0cac | ||
|
|
77f0826ec8 | ||
|
|
76db43cab3 | ||
|
|
f0eab71644 | ||
|
|
e9985adafc | ||
|
|
157a1fe249 | ||
|
|
d48d0a21db | ||
|
|
908078becb | ||
|
|
d0815baac7 | ||
|
|
bc6ad16d40 | ||
|
|
33aecef7b3 | ||
|
|
b7d37b16ae | ||
|
|
2b840abfef | ||
|
|
bc4ad7faa3 | ||
|
|
f08a412db5 | ||
|
|
dcf050a604 | ||
|
|
1f8d1339f5 | ||
|
|
5278f8ba65 | ||
|
|
8fdae33333 | ||
|
|
4054e83ffe | ||
|
|
10f2cad8fd | ||
|
|
74b9eb9f45 | ||
|
|
dde599c128 | ||
|
|
af8cbaf439 | ||
|
|
ad83d01fad | ||
|
|
7eb3632144 | ||
|
|
1ac668d9f2 | ||
|
|
f5033342c9 | ||
|
|
a0c0b7eff2 | ||
|
|
7985b39ed5 | ||
|
|
f26e370a49 | ||
|
|
cb0c301baf | ||
|
|
3858a83972 | ||
|
|
82ff0bae49 | ||
|
|
ee16d7af28 | ||
|
|
f914d57678 | ||
|
|
c13b40a373 | ||
|
|
d60a37f7e6 | ||
|
|
3caaed00dc | ||
|
|
f56bfbebb5 | ||
|
|
3eec520ebd | ||
|
|
df69f1f344 | ||
|
|
009b6c810c | ||
|
|
65b76d53ef | ||
|
|
7be7139241 | ||
|
|
9bc943ea67 | ||
|
|
f880adced2 | ||
|
|
fc07601f24 | ||
|
|
ecb241c187 | ||
|
|
46040b1f5d | ||
|
|
54daa11ce4 | ||
|
|
c556420870 | ||
|
|
84d928ebe7 | ||
|
|
fa6eab5cc3 | ||
|
|
94b26a903c | ||
|
|
c242456c30 | ||
|
|
8391e9d924 | ||
|
|
f5aac9b1ab | ||
|
|
a6850392e1 | ||
|
|
2b37178482 | ||
|
|
82199d9f39 | ||
|
|
c2d2c6d067 | ||
|
|
4066a7b5b6 | ||
|
|
4a7624fef4 | ||
|
|
e38b3f3824 | ||
|
|
4573035aab | ||
|
|
393a5ee973 | ||
|
|
080dc18165 | ||
|
|
6fd421d36e | ||
|
|
84bd1d0782 | ||
|
|
cff2303c62 | ||
|
|
f5733c2cb8 | ||
|
|
21fec0e263 | ||
|
|
093acc519e | ||
|
|
886be3161e | ||
|
|
dc7b708556 | ||
|
|
e82f28c1ac | ||
|
|
7c7239a70d | ||
|
|
3e3dad9e33 | ||
|
|
4871977681 | ||
|
|
0a56e57aec | ||
|
|
a6ff477b8a | ||
|
|
ddad0384f3 | ||
|
|
aabe47f8bc | ||
|
|
354a5f1b75 | ||
|
|
f58afd434d | ||
|
|
57d5652cd5 | ||
|
|
25b521dfcf | ||
|
|
ce655d0679 | ||
|
|
e4e8297a82 | ||
|
|
8357fd01aa | ||
|
|
12b420d3e7 | ||
|
|
db20bc0ae4 | ||
|
|
2a2afa3821 | ||
|
|
f0b2d9aafe | ||
|
|
cd427a2a39 | ||
|
|
75537d3f85 | ||
|
|
a88e2f3fb5 | ||
|
|
8a41e7add6 | ||
|
|
9c35228287 | ||
|
|
f9ec6b9d03 | ||
|
|
22d396d909 | ||
|
|
39b28e21ca | ||
|
|
0488cb7fbe | ||
|
|
ec4aa0637e | ||
|
|
ffc5584b1c | ||
|
|
45c6cfedb0 | ||
|
|
c150e50636 | ||
|
|
16e32a62e5 | ||
|
|
1d18f2e45e | ||
|
|
e46b38e58a | ||
|
|
033741d292 | ||
|
|
7a3ef1e0b7 | ||
|
|
5be41ed3e9 | ||
|
|
83e44641d0 | ||
|
|
50084c112d | ||
|
|
81682f4921 | ||
|
|
1c339e8b54 | ||
|
|
1a9cda0579 | ||
|
|
6ad9a71907 | ||
|
|
9f24576ba7 | ||
|
|
8661bbc1fc | ||
|
|
0b5fa37f96 | ||
|
|
dab32bafa1 | ||
|
|
9e5c541f79 | ||
|
|
9674c617ca | ||
|
|
9df1704357 | ||
|
|
c0821de2e2 | ||
|
|
c358c39027 | ||
|
|
451b3a2637 | ||
|
|
619eecacf8 | ||
|
|
6bae039d52 | ||
|
|
b321029886 | ||
|
|
5287d4fb4f | ||
|
|
a0a2794291 | ||
|
|
9e354e956e | ||
|
|
27033e9096 | ||
|
|
e436bbe375 | ||
|
|
050a1dbacb | ||
|
|
ae1838d78a | ||
|
|
7235485802 | ||
|
|
fcb472347e | ||
|
|
e0ce8cc715 | ||
|
|
ebc0e61be8 | ||
|
|
95581a6fa5 | ||
|
|
d0b49009e5 | ||
|
|
369b076cad | ||
|
|
6555bcda74 | ||
|
|
e537dbb024 | ||
|
|
f92dbb655d | ||
|
|
0b2dac9056 | ||
|
|
7cd5514b90 | ||
|
|
5017d4bbb3 | ||
|
|
32e51b52aa | ||
|
|
4f66fd793b | ||
|
|
2a71612aea | ||
|
|
a993a08b8d | ||
|
|
a9c947517c | ||
|
|
2841bf3040 | ||
|
|
7edddda36e | ||
|
|
33de12ceb1 | ||
|
|
f8eb57cdbb | ||
|
|
b2d523f5c0 | ||
|
|
b586b0d361 | ||
|
|
c6381e7f4d | ||
|
|
10ee7e1930 | ||
|
|
78abf8be00 | ||
|
|
1dde24bb68 | ||
|
|
bc57512ca2 | ||
|
|
6ad3beca76 | ||
|
|
9d75125e41 | ||
|
|
8ce4112e86 | ||
|
|
7d542d5667 | ||
|
|
7d6599b90e | ||
|
|
1b03e24160 | ||
|
|
fcd91bb855 | ||
|
|
bda4ea9fd0 | ||
|
|
cbd26ce9d9 | ||
|
|
8d53f4aa5a | ||
|
|
1438f1f68d | ||
|
|
61fcf6f895 | ||
|
|
736834441d | ||
|
|
3f5417be97 | ||
|
|
cc1c88001f | ||
|
|
274f98c24e | ||
|
|
f39b466ac0 | ||
|
|
aa22ca1d56 | ||
|
|
802e868b2e | ||
|
|
02442a9775 | ||
|
|
5349de91c5 | ||
|
|
a8ef3c890a | ||
|
|
b556e6528a | ||
|
|
434b32cad8 | ||
|
|
60b3ba6bb7 | ||
|
|
864beef341 | ||
|
|
7b21df2c12 | ||
|
|
462a10363c | ||
|
|
040f85659d | ||
|
|
48d5aaf8fa | ||
|
|
41b0d95d70 | ||
|
|
b599399c48 | ||
|
|
721e27eb39 | ||
|
|
c9d6fbfcd0 | ||
|
|
b1f64fd081 | ||
|
|
2b508567db | ||
|
|
24d0ae7607 | ||
|
|
40a44d5dc5 | ||
|
|
b5a06181d4 | ||
|
|
35fa7e78a0 | ||
|
|
7f4faab4ab | ||
|
|
3906b47654 | ||
|
|
1476adb281 | ||
|
|
6fb072120b | ||
|
|
f2f0be0581 | ||
|
|
5ec30ef18a | ||
|
|
0915afe43b | ||
|
|
87b041bf3a | ||
|
|
275b09bdbb | ||
|
|
cc87c02020 | ||
|
|
a45985ed58 | ||
|
|
92dedfb950 | ||
|
|
6bbcf7d784 | ||
|
|
465a2354c0 | ||
|
|
c59c15d6f3 | ||
|
|
20f7738f08 | ||
|
|
323f0fa087 | ||
|
|
3138d667a6 | ||
|
|
365040f59d | ||
|
|
303d9ecf51 | ||
|
|
463381b84e | ||
|
|
7fef96d77e | ||
|
|
17358120cd | ||
|
|
e6da77cf47 | ||
|
|
dc503cd613 | ||
|
|
8aa2f4be46 | ||
|
|
c5dc5b2bf8 | ||
|
|
f4d6659760 | ||
|
|
bfbb80f708 | ||
|
|
248da118a9 | ||
|
|
a987882132 | ||
|
|
bca25d4744 | ||
|
|
2417ffe483 | ||
|
|
8606e5d663 | ||
|
|
5a0ca55b97 | ||
|
|
ceb1cffb00 | ||
|
|
1ff3035bc0 | ||
|
|
1f221ea828 | ||
|
|
dd1fad2dd7 | ||
|
|
245f7e24e4 | ||
|
|
9d3db4cf97 | ||
|
|
b67ebecce8 | ||
|
|
d03207289e | ||
|
|
64497b305a | ||
|
|
f5b3799db9 | ||
|
|
00fedc7656 | ||
|
|
05aa05c5b4 | ||
|
|
5243c1800e | ||
|
|
77d702bc9b | ||
|
|
c098e24c4f | ||
|
|
3d083cf463 | ||
|
|
2ab62a8f4f | ||
|
|
296f42086f | ||
|
|
e9f547f7ba | ||
|
|
b7f388b9ee | ||
|
|
824ff375d4 | ||
|
|
8bec05ed38 | ||
|
|
b367caa4b2 | ||
|
|
1c281abf65 |
No files matched your search
+2
-2
@@ -2,7 +2,7 @@
|
||||
charset = utf-8
|
||||
indent_size = 4
|
||||
indent_style = space
|
||||
insert_final_newline = false
|
||||
insert_final_newline = true
|
||||
tab_width = 4
|
||||
|
||||
[*.java]
|
||||
@@ -13,4 +13,4 @@ ij_java_generate_final_locals = true
|
||||
ij_java_generate_final_parameters = true
|
||||
|
||||
[{*.json,*.yml}]
|
||||
indent_size = 2
|
||||
indent_size = 2
|
||||
@@ -1,2 +1,3 @@
|
||||
github: kennytv
|
||||
patreon: kennytv
|
||||
custom: ['https://florianmichael.de/donate']
|
||||
@@ -21,10 +21,11 @@ body:
|
||||
|
||||
- type: textarea
|
||||
attributes:
|
||||
label: Console Error
|
||||
label: Server/Client Error
|
||||
description: |
|
||||
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.
|
||||
**Important**: If you are kicked for `Network Protocol Error` or an encoder/decoder exception, please click the `Open Report Directory` button on your client and paste the newest disconnect file contents.
|
||||
value: |
|
||||
```
|
||||
Put the mclo.gs link or text here.
|
||||
@@ -40,7 +41,7 @@ body:
|
||||
Describe the unexpected behavior.
|
||||
If you want to attach screenshots, use the comment field at the bottom of the page.
|
||||
placeholder: |
|
||||
Example: "Placing signs on 1.13.2 causes text to disappear."
|
||||
Example: "Placing signs on 1.21.3 causes text to disappear."
|
||||
validations:
|
||||
required: true
|
||||
|
||||
@@ -51,7 +52,7 @@ body:
|
||||
List the steps on how we can reproduce the issue. Make sure we can easily understand what you mean with each step.
|
||||
placeholder: |
|
||||
Example:
|
||||
1. Login with a 1.13.2 client
|
||||
1. Login with a 1.21.3 client
|
||||
2. Place a sign
|
||||
3. The sign text is displayed wrong
|
||||
validations:
|
||||
|
||||
@@ -0,0 +1,6 @@
|
||||
version: 2
|
||||
updates:
|
||||
- package-ecosystem: "github-actions"
|
||||
directory: "/"
|
||||
schedule:
|
||||
interval: "weekly"
|
||||
@@ -7,13 +7,15 @@ jobs:
|
||||
# Only run on PRs if the source branch is on a different repo. We do not need to run everything twice.
|
||||
if: ${{ github.event_name != 'pull_request' || github.repository != github.event.pull_request.head.repo.full_name }}
|
||||
|
||||
runs-on: ubuntu-22.04
|
||||
runs-on: ubuntu-24.04
|
||||
|
||||
steps:
|
||||
- name: Checkout Repository
|
||||
uses: actions/checkout@v4
|
||||
- name: Validate Gradle Wrapper
|
||||
uses: gradle/actions/wrapper-validation@v3
|
||||
with:
|
||||
persist-credentials: false
|
||||
- name: Set up Gradle
|
||||
uses: gradle/actions/setup-gradle@v4
|
||||
- name: Set up JDK 17
|
||||
uses: actions/setup-java@v4
|
||||
with:
|
||||
@@ -22,3 +24,10 @@ jobs:
|
||||
check-latest: true
|
||||
- name: Build with Gradle
|
||||
run: ./gradlew build
|
||||
- name: Upload Artifacts to GitHub
|
||||
# Only upload on the preview repository as there is no CI job for it.
|
||||
if: ${{ github.repository == 'ViaVersion/ViaVersionDev' && github.ref_name == 'preview' }}
|
||||
uses: actions/upload-artifact@v4
|
||||
with:
|
||||
name: Artifacts
|
||||
path: build/libs/
|
||||
@@ -8,12 +8,14 @@ on:
|
||||
jobs:
|
||||
publish:
|
||||
if: github.repository_owner == 'ViaVersion'
|
||||
runs-on: ubuntu-22.04
|
||||
runs-on: ubuntu-24.04
|
||||
steps:
|
||||
- name: Checkout Repository
|
||||
uses: actions/checkout@v4
|
||||
- name: Validate Gradle Wrapper
|
||||
uses: gradle/actions/wrapper-validation@v3
|
||||
with:
|
||||
persist-credentials: false
|
||||
- name: Set up Gradle
|
||||
uses: gradle/actions/setup-gradle@v4
|
||||
- name: Set up JDK 17
|
||||
uses: actions/setup-java@v4
|
||||
with:
|
||||
|
||||
@@ -0,0 +1,16 @@
|
||||
name: Update Gradle Wrapper
|
||||
on:
|
||||
workflow_dispatch:
|
||||
schedule:
|
||||
- cron: "0 0 * * 0"
|
||||
|
||||
jobs:
|
||||
update-gradle-wrapper:
|
||||
runs-on: ubuntu-24.04
|
||||
steps:
|
||||
- name: Checkout Repository
|
||||
uses: actions/checkout@v4
|
||||
with:
|
||||
persist-credentials: false
|
||||
- name: Update Gradle Wrapper
|
||||
uses: gradle-update/update-gradle-wrapper-action@v2
|
||||
+4
-1
@@ -109,4 +109,7 @@ nb-configuration.xml
|
||||
.nb-gradle/
|
||||
|
||||
### MacOS ###
|
||||
.DS_Store
|
||||
.DS_Store
|
||||
|
||||
### Run Folder (ViaProxy) ###
|
||||
common/run/
|
||||
@@ -1,7 +1,7 @@
|
||||
# ViaVersion
|
||||
|
||||
[](https://viaversion.com)
|
||||
[](https://github.com/ViaVersion/ViaVersion/actions)
|
||||
[](https://github.com/ViaVersion/ViaVersion/actions)
|
||||
[](https://viaversion.com/discord)
|
||||
|
||||
**Allows the connection of higher client versions to lower server versions -
|
||||
@@ -9,13 +9,23 @@ it works on any platform you can think of.**
|
||||
|
||||
The base ViaVersion jar runs on Paper and Velocity. We also have projects integrating ViaVersion to run
|
||||
on Fabric, Forge, Bungee, Sponge, 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.**
|
||||
any server version from the past decade. **See [HERE](https://viaversion.com) for an overview of the different Via\* projects.**
|
||||
|
||||
Note that ViaVersion will be able to **run best on either Paper servers or through [ViaFabricPlus](https://github.com/ViaVersion/ViaFabricPlus?tab=readme-ov-file#viafabricplus)** due to having
|
||||
direct access to client/server state and more extensive API.
|
||||
|
||||
Supported Versions:
|
||||
|
||||

|
||||

|
||||
|
||||
**User Docs:** https://docs.viaversion.com/display/VIAVERSION/
|
||||
**User Docs:** https://docs.viaversion.com
|
||||
|
||||
Snapshot support
|
||||
--------
|
||||
**ViaVersion will only be released a few days *after* a Minecraft update** unless the protocol changes of the update were trivial. If you want early-access, usually days or even weeks before the final release, you can subscribe to either:
|
||||
- [GitHub Sponsors](https://github.com/sponsors/kennytv/sponsorships?sponsor=kennytv&tier_id=385613&preview=false) (preferred option. Use the `/verify` command on this Discord after), or alternatively
|
||||
- [Patreon](https://www.patreon.com/kennytv/membership) (see the highest tier and make sure to link Patreon to your Discord account under Settings->Connections)
|
||||
This also includes access to a private repository with the code, which will be pushed to the public repository after the given delay on a Minecraft update.
|
||||
|
||||
Releases/Dev Builds
|
||||
--------
|
||||
@@ -67,6 +77,8 @@ dependencies {
|
||||
If you need access to the existing protocol or platform implementations, use the parent artifact `viaversion`.
|
||||
Please note the [differences in licensing](#license).
|
||||
|
||||
Note: If you want to make your own platform implementation of ViaVersion (and additional addons),
|
||||
you can use the [ViaLoader](https://github.com/ViaVersion/ViaLoader) project.
|
||||
|
||||
Building
|
||||
--------
|
||||
@@ -78,7 +90,7 @@ You need JDK 17 or newer to build ViaVersion.
|
||||
|
||||
Mapping Files
|
||||
--------------
|
||||
Mapping files are generated and managed in our [Mappings repository](https://github.com/ViaVersion/Mappings).
|
||||
Mapping files are generated and managed in our [Mappings repository](https://github.com/ViaVersion/Mappings). The generated mapping output is stored [here](./common/src/main/resources/assets/viaversion).
|
||||
|
||||
|
||||
Resources
|
||||
@@ -86,12 +98,11 @@ 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))
|
||||
- Previously: **[Burger](https://github.com/Pokechu22/Burger)** (see [PAaaS](https://github.com/Matsv/Paaas)) and **wiki.vg**
|
||||
|
||||
License
|
||||
--------
|
||||
The entirety of the [API directory](api) (including the legacy API directory) is licensed under the MIT License;
|
||||
The entirety of the [API directory](api) is licensed under the MIT License;
|
||||
see [licenses/MIT.md](licenses/MIT.md) for
|
||||
details.
|
||||
|
||||
|
||||
@@ -19,13 +19,16 @@ dependencies {
|
||||
api(libs.vianbt) {
|
||||
exclude("it.unimi.dsi", "fastutil")
|
||||
}
|
||||
api(libs.gson)
|
||||
api(libs.gson) {
|
||||
exclude("com.google.errorprone", "error_prone_annotations")
|
||||
}
|
||||
implementation(rootProject.libs.text) {
|
||||
exclude("com.google.code.gson", "gson")
|
||||
exclude("com.google.guava", "guava")
|
||||
exclude("com.viaversion", "nbt")
|
||||
}
|
||||
api(libs.snakeYaml)
|
||||
|
||||
compileOnlyApi(libs.snakeYaml)
|
||||
compileOnlyApi(libs.netty)
|
||||
compileOnlyApi(libs.guava)
|
||||
compileOnlyApi(libs.checkerQual)
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
/*
|
||||
* This file is part of ViaVersion - https://github.com/ViaVersion/ViaVersion
|
||||
* Copyright (C) 2016-2024 ViaVersion and contributors
|
||||
* Copyright (C) 2016-2025 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
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
/*
|
||||
* This file is part of ViaVersion - https://github.com/ViaVersion/ViaVersion
|
||||
* Copyright (C) 2016-2024 ViaVersion and contributors
|
||||
* Copyright (C) 2016-2025 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
|
||||
@@ -114,7 +114,8 @@ public interface ViaAPI<T> {
|
||||
ProtocolVersion getPlayerProtocolVersion(UUID uuid);
|
||||
|
||||
/**
|
||||
* Returns whether Via injected into this player connection.
|
||||
* Returns whether Via injected into this player connection. Note that this method may not work on
|
||||
* clientside implementations and is generally not recommended to be used. Use {@link ConnectionManager} instead.
|
||||
*
|
||||
* @param uuid uuid of the player
|
||||
* @return whether Via has a cached a UserConnection for this player
|
||||
@@ -122,7 +123,8 @@ public interface ViaAPI<T> {
|
||||
boolean isInjected(UUID uuid);
|
||||
|
||||
/**
|
||||
* Returns the Via injected UserConnection if present.
|
||||
* Returns whether Via injected into this player connection. Note that this method may not work on
|
||||
* clientside implementations and is generally not recommended to be used. Use {@link ConnectionManager} instead.
|
||||
*
|
||||
* @param uuid uuid of the player
|
||||
* @return user connection if present
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
/*
|
||||
* This file is part of ViaVersion - https://github.com/ViaVersion/ViaVersion
|
||||
* Copyright (C) 2016-2024 ViaVersion and contributors
|
||||
* Copyright (C) 2016-2025 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
|
||||
@@ -140,6 +140,13 @@ public interface ViaManager {
|
||||
*/
|
||||
void addEnableListener(Runnable runnable);
|
||||
|
||||
/**
|
||||
* Adds a runnable to be executed when ViaVersion has finished its init after the full server load.
|
||||
*
|
||||
* @param runnable runnable to be executed
|
||||
*/
|
||||
void addPostEnableListener(Runnable runnable);
|
||||
|
||||
/**
|
||||
* Returns whether the manager has been initialized (and protocols have been loaded).
|
||||
*
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
/*
|
||||
* This file is part of ViaVersion - https://github.com/ViaVersion/ViaVersion
|
||||
* Copyright (C) 2016-2024 ViaVersion and contributors
|
||||
* Copyright (C) 2016-2025 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
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
/*
|
||||
* This file is part of ViaVersion - https://github.com/ViaVersion/ViaVersion
|
||||
* Copyright (C) 2016-2024 ViaVersion and contributors
|
||||
* Copyright (C) 2016-2025 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 ViaSubCommand {
|
||||
*
|
||||
* @param sender Command sender
|
||||
* @param args Arguments
|
||||
* @return commands executed succesfully if false, show usage
|
||||
* @return commands executed successfully if false, show usage
|
||||
*/
|
||||
boolean execute(ViaCommandSender sender, String[] args);
|
||||
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
/*
|
||||
* This file is part of ViaVersion - https://github.com/ViaVersion/ViaVersion
|
||||
* Copyright (C) 2016-2024 ViaVersion and contributors
|
||||
* Copyright (C) 2016-2025 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
|
||||
@@ -30,7 +30,7 @@ public interface ViaVersionCommand {
|
||||
* Register your own subcommand inside ViaVersion
|
||||
*
|
||||
* @param command Your own SubCommand instance to handle it.
|
||||
* @throws IllegalArgumentException throws an exception when the subcommand already exists or if it's not valid, example: spacee
|
||||
* @throws IllegalArgumentException throws an exception when the subcommand already exists or if it's not valid, example: space
|
||||
*/
|
||||
void registerSubCommand(ViaSubCommand command);
|
||||
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
/*
|
||||
* This file is part of ViaVersion - https://github.com/ViaVersion/ViaVersion
|
||||
* Copyright (C) 2016-2024 ViaVersion and contributors
|
||||
* Copyright (C) 2016-2025 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
|
||||
|
||||
+1
-1
@@ -1,6 +1,6 @@
|
||||
/*
|
||||
* This file is part of ViaVersion - https://github.com/ViaVersion/ViaVersion
|
||||
* Copyright (C) 2016-2024 ViaVersion and contributors
|
||||
* Copyright (C) 2016-2025 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
-10
@@ -1,6 +1,6 @@
|
||||
/*
|
||||
* This file is part of ViaVersion - https://github.com/ViaVersion/ViaVersion
|
||||
* Copyright (C) 2016-2024 ViaVersion and contributors
|
||||
* Copyright (C) 2016-2025 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
|
||||
@@ -67,9 +67,9 @@ public interface ViaVersionConfig extends Config {
|
||||
boolean isShowNewDeathMessages();
|
||||
|
||||
/**
|
||||
* Get if metadata errors will be suppressed
|
||||
* Get if entity data errors will be suppressed
|
||||
*
|
||||
* @return true if metadata errors suppression is enabled
|
||||
* @return true if entity data errors suppression is enabled
|
||||
*/
|
||||
boolean isSuppressMetadataErrors();
|
||||
|
||||
@@ -292,13 +292,6 @@ public interface ViaVersionConfig extends Config {
|
||||
*/
|
||||
boolean isDisable1_13AutoComplete();
|
||||
|
||||
/**
|
||||
* Tries to minimize cooldown animation.
|
||||
*
|
||||
* @return true if enabled
|
||||
*/
|
||||
boolean isMinimizeCooldown();
|
||||
|
||||
/**
|
||||
* Enable the serverside blockconnections for 1.13+ clients
|
||||
*
|
||||
@@ -464,4 +457,25 @@ public interface ViaVersionConfig extends Config {
|
||||
* @return true if enabled
|
||||
*/
|
||||
boolean handleInvalidItemCount();
|
||||
|
||||
/**
|
||||
* Tries to cancel block break/place sounds sent by 1.8 servers to 1.9+ clients to prevent them from playing twice
|
||||
*
|
||||
* @return true if enabled
|
||||
*/
|
||||
boolean cancelBlockSounds();
|
||||
|
||||
/**
|
||||
* Hides scoreboard numbers for 1.20.3+ clients on older server versions.
|
||||
*
|
||||
* @return true if enabled
|
||||
*/
|
||||
boolean hideScoreboardNumbers();
|
||||
|
||||
/**
|
||||
* Fixes 1.21+ clients on 1.20.5 servers placing water/lava buckets at the wrong location when moving fast.
|
||||
*
|
||||
* @return true if enabled
|
||||
*/
|
||||
boolean fix1_21PlacementRotation();
|
||||
}
|
||||
@@ -1,6 +1,6 @@
|
||||
/*
|
||||
* This file is part of ViaVersion - https://github.com/ViaVersion/ViaVersion
|
||||
* Copyright (C) 2016-2024 ViaVersion and contributors
|
||||
* Copyright (C) 2016-2025 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,51 +28,81 @@ import java.util.UUID;
|
||||
import org.checkerframework.checker.nullness.qual.Nullable;
|
||||
|
||||
/**
|
||||
* Handles injected UserConnections
|
||||
* Handles injected UserConnections.
|
||||
* Check {@link UserConnection#isServerSide()} and {@link UserConnection#isClientSide()} to determine the connection type.
|
||||
*/
|
||||
public interface ConnectionManager {
|
||||
|
||||
/**
|
||||
* Returns if Via injected into this player connection.
|
||||
* Returns if Via has injected. See above for the connection types.
|
||||
*
|
||||
* @param playerId player uuid
|
||||
* @param uuid player uuid
|
||||
* @return true if the player is handled by Via
|
||||
*/
|
||||
boolean isClientConnected(UUID playerId);
|
||||
boolean hasServerConnection(UUID uuid);
|
||||
|
||||
/**
|
||||
* Frontend connections will have the UUID stored. Override this if your platform isn't always frontend.
|
||||
* UUIDs can't be duplicate between frontend connections.
|
||||
*
|
||||
* @return true if the user is a frontend connection
|
||||
*/
|
||||
default boolean isFrontEnd(UserConnection connection) {
|
||||
return !connection.isClientSide();
|
||||
@Deprecated
|
||||
default boolean isClientConnected(UUID uuid) {
|
||||
return hasServerConnection(uuid);
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the frontend UserConnection from the player connected to this proxy server
|
||||
* Returns null when there isn't a server or connection was not found
|
||||
* When ViaVersion is reloaded, this method may not return some players.
|
||||
* <p>
|
||||
* Note that connections are removed as soon as their channel is closed,
|
||||
* so avoid using this method during player quits for example.
|
||||
* Returns if Via has injected. See above for the connection types.
|
||||
*
|
||||
* @return frontend UserConnection of the player connected to this proxy server
|
||||
* @param uuid player uuid
|
||||
* @return true if the player is handled by Via
|
||||
*/
|
||||
@Nullable UserConnection getConnectedClient(UUID clientIdentifier);
|
||||
boolean hasClientConnection(UUID uuid);
|
||||
|
||||
/**
|
||||
* 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 the server UserConnection. See above for the connection types.
|
||||
* When ViaVersion is reloaded, this method may not return some players.
|
||||
* <p>
|
||||
* Note that connections are removed as soon as their channel is closed,
|
||||
* so avoid using this method during player quits for example.
|
||||
*
|
||||
* @return UUID of the frontend connection to this proxy server
|
||||
* @return server UserConnection of the player or null
|
||||
*/
|
||||
@Nullable UUID getConnectedClientId(UserConnection connection);
|
||||
@Nullable
|
||||
UserConnection getServerConnection(UUID uuid);
|
||||
|
||||
@Deprecated
|
||||
@Nullable default UserConnection getConnectedClient(UUID uuid) {
|
||||
return getServerConnection(uuid);
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the client UserConnection. See above for the connection types.
|
||||
* When ViaVersion is reloaded, this method may not return some players.
|
||||
* <p>
|
||||
* Note that connections are removed as soon as their channel is closed,
|
||||
* so avoid using this method during player quits for example.
|
||||
*
|
||||
* @return client UserConnection of the player or null
|
||||
*/
|
||||
@Nullable
|
||||
UserConnection getClientConnection(UUID uuid);
|
||||
|
||||
/**
|
||||
* Returns a map containing the UUIDs and server UserConnections
|
||||
* When ViaVersion is reloaded, this method may not return some players.
|
||||
*
|
||||
* @return map containing the UUIDs and frontend UserConnections
|
||||
*/
|
||||
Map<UUID, UserConnection> getServerConnections();
|
||||
|
||||
@Deprecated
|
||||
default Map<UUID, UserConnection> getConnectedClients() {
|
||||
return getServerConnections();
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns a map containing the UUIDs and client UserConnections
|
||||
* When ViaVersion is reloaded, this method may not return some players.
|
||||
*
|
||||
* @return map containing the UUIDs and client UserConnections
|
||||
*/
|
||||
Map<UUID, UserConnection> getClientConnections();
|
||||
|
||||
/**
|
||||
* Returns all UserConnections which are registered
|
||||
@@ -84,15 +114,6 @@ public interface ConnectionManager {
|
||||
*/
|
||||
Set<UserConnection> getConnections();
|
||||
|
||||
/**
|
||||
* Returns a map containing the UUIDs and frontend UserConnections from players connected to this proxy server
|
||||
* Returns empty list when there isn't a server
|
||||
* When ViaVersion is reloaded, this method may not return some players.
|
||||
*
|
||||
* @return map containing the UUIDs and frontend UserConnections from players connected to this proxy server
|
||||
*/
|
||||
Map<UUID, UserConnection> getConnectedClients();
|
||||
|
||||
void onLoginSuccess(UserConnection connection);
|
||||
|
||||
void onDisconnect(UserConnection connection);
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
/*
|
||||
* This file is part of ViaVersion - https://github.com/ViaVersion/ViaVersion
|
||||
* Copyright (C) 2016-2024 ViaVersion and contributors
|
||||
* Copyright (C) 2016-2025 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
|
||||
@@ -142,4 +142,4 @@ public interface ProtocolInfo {
|
||||
ProtocolPipeline getPipeline();
|
||||
|
||||
void setPipeline(ProtocolPipeline pipeline);
|
||||
}
|
||||
}
|
||||
@@ -1,6 +1,6 @@
|
||||
/*
|
||||
* This file is part of ViaVersion - https://github.com/ViaVersion/ViaVersion
|
||||
* Copyright (C) 2016-2024 ViaVersion and contributors
|
||||
* Copyright (C) 2016-2025 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
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
/*
|
||||
* This file is part of ViaVersion - https://github.com/ViaVersion/ViaVersion
|
||||
* Copyright (C) 2016-2024 ViaVersion and contributors
|
||||
* Copyright (C) 2016-2025 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,6 +29,11 @@ public abstract class StoredObject implements StorableObject {
|
||||
this.user = user;
|
||||
}
|
||||
|
||||
public UserConnection user() {
|
||||
return this.user;
|
||||
}
|
||||
|
||||
@Deprecated
|
||||
public UserConnection getUser() {
|
||||
return user;
|
||||
}
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
/*
|
||||
* This file is part of ViaVersion - https://github.com/ViaVersion/ViaVersion
|
||||
* Copyright (C) 2016-2024 ViaVersion and contributors
|
||||
* Copyright (C) 2016-2025 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,7 @@ package com.viaversion.viaversion.api.connection;
|
||||
|
||||
import com.viaversion.viaversion.api.configuration.ViaVersionConfig;
|
||||
import com.viaversion.viaversion.api.data.entity.EntityTracker;
|
||||
import com.viaversion.viaversion.api.minecraft.ClientWorld;
|
||||
import com.viaversion.viaversion.api.protocol.Protocol;
|
||||
import com.viaversion.viaversion.api.protocol.packet.PacketTracker;
|
||||
import com.viaversion.viaversion.api.protocol.packet.PacketWrapper;
|
||||
@@ -99,14 +100,33 @@ public interface UserConnection {
|
||||
void addEntityTracker(Class<? extends Protocol> protocolClass, EntityTracker tracker);
|
||||
|
||||
/**
|
||||
* Clear stored objects and entity trackers.
|
||||
* Returns the client world by the given protocol class if present.
|
||||
*
|
||||
* @param protocolClass protocol class
|
||||
* @param <T> client world type
|
||||
* @return client world if present
|
||||
*/
|
||||
@Nullable
|
||||
<T extends ClientWorld> T getClientWorld(Class<? extends Protocol> protocolClass);
|
||||
|
||||
/**
|
||||
* Adds a client world to the user connection.
|
||||
* Does not override existing client worlds.
|
||||
*
|
||||
* @param protocolClass protocol class
|
||||
* @param clientWorld client world
|
||||
*/
|
||||
void addClientWorld(Class<? extends Protocol> protocolClass, ClientWorld clientWorld);
|
||||
|
||||
/**
|
||||
* Clear stored objects, entity trackers and client worlds.
|
||||
*/
|
||||
default void clearStoredObjects() {
|
||||
clearStoredObjects(false);
|
||||
}
|
||||
|
||||
/**
|
||||
* Clear stored objects and entity trackers.
|
||||
* Clear stored objects, entity trackers and client worlds.
|
||||
* If cleared for a proxy server switch, some stored objects and tracker data will be retained.
|
||||
*
|
||||
* @param isServerSwitch whether the clear is due to a server switch
|
||||
@@ -299,23 +319,35 @@ public interface UserConnection {
|
||||
void setPendingDisconnect(boolean pendingDisconnect);
|
||||
|
||||
/**
|
||||
* Returns whether this is a client-side connection.
|
||||
* This is a mod integrated into the client itself, or for example a backend Velocity connection.
|
||||
* Returns whether this is a backend connection.
|
||||
* This is a mod integrated into the client, or for example a backend Velocity connection.
|
||||
*
|
||||
* @return whether this is a client-side connection
|
||||
* @return whether this is a backend connection
|
||||
*/
|
||||
boolean isClientSide();
|
||||
|
||||
/**
|
||||
* Returns whether this is a frontend connection.
|
||||
* This is a plugin integrated into the server, or for example a frontend Velocity connection.
|
||||
*
|
||||
* @return whether this is a frontend connection
|
||||
*/
|
||||
default boolean isServerSide() {
|
||||
return !isClientSide();
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns whether {@link ViaVersionConfig#blockedProtocolVersions()} should be checked for this connection.
|
||||
*
|
||||
* @return whether blocked protocols should be applied
|
||||
*/
|
||||
boolean shouldApplyBlockProtocol();
|
||||
default boolean shouldApplyBlockProtocol() {
|
||||
return isServerSide();
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns a newly generated uuid that will let a packet be passed through without
|
||||
* transformig its contents if used together with {@link PacketWrapper#PASSTHROUGH_ID}.
|
||||
* transforming its contents if used together with {@link PacketWrapper#PASSTHROUGH_ID}.
|
||||
*
|
||||
* @return generated passthrough token
|
||||
*/
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
/*
|
||||
* This file is part of ViaVersion - https://github.com/ViaVersion/ViaVersion
|
||||
* Copyright (C) 2016-2024 ViaVersion and contributors
|
||||
* Copyright (C) 2016-2025 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
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
/*
|
||||
* This file is part of ViaVersion - https://github.com/ViaVersion/ViaVersion
|
||||
* Copyright (C) 2016-2024 ViaVersion and contributors
|
||||
* Copyright (C) 2016-2025 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
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
/*
|
||||
* This file is part of ViaVersion - https://github.com/ViaVersion/ViaVersion
|
||||
* Copyright (C) 2016-2024 ViaVersion and contributors
|
||||
* Copyright (C) 2016-2025 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
|
||||
@@ -53,6 +53,14 @@ public interface FullMappings extends BiMappings {
|
||||
*/
|
||||
@Nullable String identifier(int id);
|
||||
|
||||
/**
|
||||
* Returns the unmapped string identifier for the given mapped identifier.
|
||||
*
|
||||
* @param mappedIdentifier mapped identifier
|
||||
* @return unmapped string identifier, or null if not found
|
||||
*/
|
||||
@Nullable String identifier(String mappedIdentifier);
|
||||
|
||||
/**
|
||||
* Returns the mapped string identifier for the given mapped id.
|
||||
*
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
/*
|
||||
* This file is part of ViaVersion - https://github.com/ViaVersion/ViaVersion
|
||||
* Copyright (C) 2016-2024 ViaVersion and contributors
|
||||
* Copyright (C) 2016-2025 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
|
||||
@@ -84,7 +84,18 @@ public class FullMappingsBase implements FullMappings {
|
||||
}
|
||||
|
||||
@Override
|
||||
public String mappedIdentifier(final int mappedId) {
|
||||
public @Nullable String identifier(final String mappedIdentifier) {
|
||||
final int mappedId = mappedId(mappedIdentifier);
|
||||
if (mappedId == -1) {
|
||||
return null;
|
||||
}
|
||||
|
||||
final int id = mappings.inverse().getNewId(mappedId);
|
||||
return id != -1 ? identifier(id) : null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public @Nullable String mappedIdentifier(final int mappedId) {
|
||||
if (mappedId < 0 || mappedId >= mappedIdToString.length) {
|
||||
return null;
|
||||
}
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
/*
|
||||
* This file is part of ViaVersion - https://github.com/ViaVersion/ViaVersion
|
||||
* Copyright (C) 2016-2024 ViaVersion and contributors
|
||||
* Copyright (C) 2016-2025 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
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
/*
|
||||
* This file is part of ViaVersion - https://github.com/ViaVersion/ViaVersion
|
||||
* Copyright (C) 2016-2024 ViaVersion and contributors
|
||||
* Copyright (C) 2016-2025 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
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
/*
|
||||
* This file is part of ViaVersion - https://github.com/ViaVersion/ViaVersion
|
||||
* Copyright (C) 2016-2024 ViaVersion and contributors
|
||||
* Copyright (C) 2016-2025 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
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
/*
|
||||
* This file is part of ViaVersion - https://github.com/ViaVersion/ViaVersion
|
||||
* Copyright (C) 2016-2024 ViaVersion and contributors
|
||||
* Copyright (C) 2016-2025 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
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
/*
|
||||
* This file is part of ViaVersion - https://github.com/ViaVersion/ViaVersion
|
||||
* Copyright (C) 2016-2024 ViaVersion and contributors
|
||||
* Copyright (C) 2016-2025 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,54 +35,84 @@ public interface MappingData {
|
||||
void load();
|
||||
|
||||
/**
|
||||
* Returns the mapped block state id, or -1 if unmapped.
|
||||
* Returns the mapped block state id, or 0 if unmapped.
|
||||
*
|
||||
* @param id unmapped block state id
|
||||
* @return mapped block state id, or -1 if unmapped
|
||||
* @return mapped block state id, or 0 if unmapped
|
||||
* @throws NullPointerException if this mappingdata does not hold block state mappings
|
||||
*/
|
||||
int getNewBlockStateId(int id);
|
||||
|
||||
/**
|
||||
* Returns the mapped block id, or -1 if unmapped.
|
||||
* Returns the mapped block id, or 0 if unmapped.
|
||||
*
|
||||
* @param id unmapped block id
|
||||
* @return mapped block id, or -1 if unmapped
|
||||
* @return mapped block id, or 0 if unmapped
|
||||
* @throws NullPointerException if this mappingdata does not hold block mappings
|
||||
*/
|
||||
int getNewBlockId(int id);
|
||||
|
||||
/**
|
||||
* Returns the backwards mapped block id, or 1 if unmapped.
|
||||
*
|
||||
* @param id mapped block id
|
||||
* @return backwards mapped block id, or 1 if unmapped
|
||||
*/
|
||||
int getOldBlockId(int id);
|
||||
|
||||
/**
|
||||
* Returns the mapped item id, or -1 if unmapped.
|
||||
* Returns the mapped item id, or 0 if unmapped.
|
||||
*
|
||||
* @param id unmapped item id
|
||||
* @return mapped item id, or -1 if unmapped
|
||||
* @return mapped item id, or 0 if unmapped
|
||||
* @throws NullPointerException if this mappingdata does not hold item mappings
|
||||
*/
|
||||
int getNewItemId(int id);
|
||||
|
||||
/**
|
||||
* Returns the backwards mapped item id, or -1 if unmapped.
|
||||
* Returns the backwards mapped item id, or 1 if unmapped.
|
||||
*
|
||||
* @param id mapped item id
|
||||
* @return backwards mapped item id, or -1 if unmapped
|
||||
* @return backwards mapped item id, or 1 if unmapped
|
||||
* @throws NullPointerException if this mappingdata does not hold item mappings
|
||||
*/
|
||||
int getOldItemId(int id);
|
||||
|
||||
/**
|
||||
* Returns the mapped particle id, or -1 if unmapped.
|
||||
* Returns the mapped particle id, or 0 if unmapped.
|
||||
*
|
||||
* @param id unmapped particle id
|
||||
* @return mapped particle id, or -1 if unmapped
|
||||
* @return mapped particle id, or 0 if unmapped
|
||||
* @throws NullPointerException if this mappingdata does not hold particle mappings
|
||||
*/
|
||||
int getNewParticleId(int id);
|
||||
|
||||
/**
|
||||
* Returns the mapped attribute id, or 0 if unmapped.
|
||||
*
|
||||
* @param id unmapped attribute id
|
||||
* @return mapped attribute id, or 0 if unmapped
|
||||
* @throws NullPointerException if this mappingdata does not hold attribute mappings
|
||||
*/
|
||||
int getNewAttributeId(int id);
|
||||
|
||||
/**
|
||||
* Returns the mapped sound id, or 0 if unmapped.
|
||||
*
|
||||
* @param id unmapped sound id
|
||||
* @return mapped sound id, or 0 if unmapped
|
||||
* @throws NullPointerException if this mappingdata does not hold sound mappings
|
||||
*/
|
||||
int getNewSoundId(int id);
|
||||
|
||||
/**
|
||||
* Returns the backwards mapped sound id, or 1 if unmapped.
|
||||
*
|
||||
* @param i mapped sound id
|
||||
* @return backwards mapped sound id, or 1 if unmapped
|
||||
*/
|
||||
int getOldSoundId(int i);
|
||||
|
||||
/**
|
||||
* Returns a list of tags to send if present.
|
||||
*
|
||||
@@ -122,10 +152,10 @@ public interface MappingData {
|
||||
|
||||
@Nullable Mappings getEnchantmentMappings();
|
||||
|
||||
@Nullable Mappings getAttributeMappings();
|
||||
|
||||
@Nullable Mappings getPaintingMappings();
|
||||
|
||||
@Nullable FullMappings getAttributeMappings();
|
||||
|
||||
@Nullable FullMappings getEntityMappings();
|
||||
|
||||
@Nullable FullMappings getArgumentTypeMappings();
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
/*
|
||||
* This file is part of ViaVersion - https://github.com/ViaVersion/ViaVersion
|
||||
* Copyright (C) 2016-2024 ViaVersion and contributors
|
||||
* Copyright (C) 2016-2025 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
|
||||
@@ -43,6 +43,7 @@ public class MappingDataBase implements MappingData {
|
||||
protected FullMappings entityMappings;
|
||||
protected FullMappings recipeSerializerMappings;
|
||||
protected FullMappings itemDataSerializerMappings;
|
||||
protected FullMappings attributeMappings;
|
||||
protected ParticleMappings particleMappings;
|
||||
protected BiMappings itemMappings;
|
||||
protected BiMappings blockMappings;
|
||||
@@ -53,7 +54,6 @@ public class MappingDataBase implements MappingData {
|
||||
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) {
|
||||
@@ -76,8 +76,6 @@ public class MappingDataBase implements MappingData {
|
||||
menuMappings = loadMappings(data, "menus");
|
||||
enchantmentMappings = loadMappings(data, "enchantments");
|
||||
paintingMappings = loadMappings(data, "paintings");
|
||||
attributeMappings = loadMappings(data, "attributes");
|
||||
|
||||
|
||||
final CompoundTag unmappedIdentifierData = readUnmappedIdentifiersFile("identifiers-" + unmappedVersion + ".nbt");
|
||||
final CompoundTag mappedIdentifierData = readMappedIdentifiersFile("identifiers-" + mappedVersion + ".nbt");
|
||||
@@ -87,6 +85,7 @@ public class MappingDataBase implements MappingData {
|
||||
argumentTypeMappings = loadFullMappings(data, unmappedIdentifierData, mappedIdentifierData, "argumenttypes");
|
||||
recipeSerializerMappings = loadFullMappings(data, unmappedIdentifierData, mappedIdentifierData, "recipe_serializers");
|
||||
itemDataSerializerMappings = loadFullMappings(data, unmappedIdentifierData, mappedIdentifierData, "data_component_type");
|
||||
attributeMappings = loadFullMappings(data, unmappedIdentifierData, mappedIdentifierData, "attributes");
|
||||
|
||||
final List<String> unmappedParticles = identifiersFromGlobalIds(unmappedIdentifierData, "particles");
|
||||
final List<String> mappedParticles = identifiersFromGlobalIds(mappedIdentifierData, "particles");
|
||||
@@ -180,7 +179,7 @@ public class MappingDataBase implements MappingData {
|
||||
|
||||
@Override
|
||||
public int getOldBlockId(final int id) {
|
||||
return blockMappings.getNewIdOrDefault(id, 1);
|
||||
return blockMappings.inverse().getNewIdOrDefault(id, 1);
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -203,6 +202,16 @@ public class MappingDataBase implements MappingData {
|
||||
return checkValidity(id, attributeMappings.getNewId(id), "attributes");
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getNewSoundId(final int id) {
|
||||
return checkValidity(id, soundMappings.getNewId(id), "sound");
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getOldSoundId(final int i) {
|
||||
return soundMappings.getNewIdOrDefault(i, 0);
|
||||
}
|
||||
|
||||
@Override
|
||||
public @Nullable List<TagData> getTags(final RegistryType type) {
|
||||
return tags != null ? tags.get(type) : null;
|
||||
@@ -262,7 +271,7 @@ public class MappingDataBase implements MappingData {
|
||||
}
|
||||
|
||||
@Override
|
||||
public @Nullable Mappings getAttributeMappings() {
|
||||
public @Nullable FullMappings getAttributeMappings() {
|
||||
return attributeMappings;
|
||||
}
|
||||
|
||||
@@ -315,4 +324,4 @@ public class MappingDataBase implements MappingData {
|
||||
|
||||
protected void loadExtras(final CompoundTag data) {
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,6 +1,6 @@
|
||||
/*
|
||||
* This file is part of ViaVersion - https://github.com/ViaVersion/ViaVersion
|
||||
* Copyright (C) 2016-2024 ViaVersion and contributors
|
||||
* Copyright (C) 2016-2025 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
|
||||
@@ -30,7 +30,6 @@ import com.google.gson.JsonObject;
|
||||
import com.google.gson.JsonSyntaxException;
|
||||
import com.viaversion.nbt.io.NBTIO;
|
||||
import com.viaversion.nbt.io.TagReader;
|
||||
import com.viaversion.nbt.tag.ByteTag;
|
||||
import com.viaversion.nbt.tag.CompoundTag;
|
||||
import com.viaversion.nbt.tag.IntArrayTag;
|
||||
import com.viaversion.nbt.tag.IntTag;
|
||||
@@ -211,68 +210,64 @@ public class MappingDataLoader {
|
||||
return null;
|
||||
}
|
||||
|
||||
final ByteTag serializationStragetyTag = tag.getUnchecked("id");
|
||||
final IntTag mappedSizeTag = tag.getUnchecked("mappedSize");
|
||||
final byte strategy = serializationStragetyTag.asByte();
|
||||
final int mappedSize = tag.getIntTag("mappedSize").asInt();
|
||||
final byte strategy = tag.getByteTag("id").asByte();
|
||||
final V mappings;
|
||||
if (strategy == DIRECT_ID) {
|
||||
final IntArrayTag valuesTag = tag.getIntArrayTag("val");
|
||||
return IntArrayMappings.of(valuesTag.getValue(), mappedSizeTag.asInt());
|
||||
return IntArrayMappings.of(valuesTag.getValue(), mappedSize);
|
||||
} else if (strategy == SHIFTS_ID) {
|
||||
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();
|
||||
final int[] shiftsAt = tag.getIntArrayTag("at").getValue();
|
||||
final int[] shiftsTo = tag.getIntArrayTag("to").getValue();
|
||||
final int size = tag.getIntTag("size").asInt();
|
||||
mappings = holderSupplier.get(size);
|
||||
|
||||
// Handle values until first shift
|
||||
if (shiftsAt[0] != 0) {
|
||||
// Add identity values before the first shift
|
||||
final int to = shiftsAt[0];
|
||||
for (int id = 0; id < to; id++) {
|
||||
addConsumer.addTo(mappings, id, id);
|
||||
}
|
||||
}
|
||||
|
||||
// Handle shifts
|
||||
// Read shifts
|
||||
for (int i = 0; i < shiftsAt.length; i++) {
|
||||
final boolean isLast = i == shiftsAt.length - 1;
|
||||
final int from = shiftsAt[i];
|
||||
final int to = i == shiftsAt.length - 1 ? size : shiftsAt[i + 1];
|
||||
final int to = isLast ? size : shiftsAt[i + 1];
|
||||
int mappedId = shiftsTo[i];
|
||||
for (int id = from; id < to; id++) {
|
||||
addConsumer.addTo(mappings, id, mappedId++);
|
||||
}
|
||||
}
|
||||
} else if (strategy == CHANGES_ID) {
|
||||
final IntArrayTag changesAtTag = tag.getIntArrayTag("at");
|
||||
final IntArrayTag valuesTag = tag.getIntArrayTag("val");
|
||||
final IntTag sizeTag = tag.getUnchecked("size");
|
||||
final int[] changesAt = tag.getIntArrayTag("at").getValue();
|
||||
final int[] values = tag.getIntArrayTag("val").getValue();
|
||||
final int size = tag.getIntTag("size").asInt();
|
||||
final boolean fillBetween = tag.get("nofill") == null;
|
||||
final int[] changesAt = changesAtTag.getValue();
|
||||
final int[] values = valuesTag.getValue();
|
||||
mappings = holderSupplier.get(sizeTag.asInt());
|
||||
mappings = holderSupplier.get(size);
|
||||
|
||||
int nextUnhandledId = 0;
|
||||
for (int i = 0; i < changesAt.length; i++) {
|
||||
final int id = changesAt[i];
|
||||
final int changedId = changesAt[i];
|
||||
if (fillBetween) {
|
||||
// Fill from after the last change to before this change with unchanged ids
|
||||
final int previousId = i != 0 ? changesAt[i - 1] + 1 : 0;
|
||||
for (int identity = previousId; identity < id; identity++) {
|
||||
addConsumer.addTo(mappings, identity, identity);
|
||||
for (int id = nextUnhandledId; id < changedId; id++) {
|
||||
addConsumer.addTo(mappings, id, id);
|
||||
}
|
||||
nextUnhandledId = changedId + 1;
|
||||
}
|
||||
|
||||
// Assign the changed value
|
||||
addConsumer.addTo(mappings, id, values[i]);
|
||||
addConsumer.addTo(mappings, changedId, values[i]);
|
||||
}
|
||||
} else if (strategy == IDENTITY_ID) {
|
||||
final IntTag sizeTag = tag.getUnchecked("size");
|
||||
return new IdentityMappings(sizeTag.asInt(), mappedSizeTag.asInt());
|
||||
final IntTag sizeTag = tag.getIntTag("size");
|
||||
return new IdentityMappings(sizeTag.asInt(), mappedSize);
|
||||
} else {
|
||||
throw new IllegalArgumentException("Unknown serialization strategy: " + strategy);
|
||||
}
|
||||
return mappingsSupplier.create(mappings, mappedSizeTag.asInt());
|
||||
return mappingsSupplier.create(mappings, mappedSize);
|
||||
}
|
||||
|
||||
public @Nullable List<String> identifiersFromGlobalIds(final CompoundTag mappingsTag, final String key) {
|
||||
@@ -295,7 +290,7 @@ public class MappingDataLoader {
|
||||
* @return map with indexes hashed by their id value
|
||||
*/
|
||||
public Object2IntMap<String> indexedObjectToMap(final JsonObject object) {
|
||||
final Object2IntMap<String> map = new Object2IntOpenHashMap<>(object.size(), .99F);
|
||||
final Object2IntMap<String> map = new Object2IntOpenHashMap<>(object.size());
|
||||
map.defaultReturnValue(-1);
|
||||
for (final Map.Entry<String, JsonElement> entry : object.entrySet()) {
|
||||
map.put(entry.getValue().getAsString(), Integer.parseInt(entry.getKey()));
|
||||
@@ -310,7 +305,7 @@ public class MappingDataLoader {
|
||||
* @return map with indexes hashed by their id value
|
||||
*/
|
||||
public Object2IntMap<String> arrayToMap(final JsonArray array) {
|
||||
final Object2IntMap<String> map = new Object2IntOpenHashMap<>(array.size(), .99F);
|
||||
final Object2IntMap<String> map = new Object2IntOpenHashMap<>(array.size());
|
||||
map.defaultReturnValue(-1);
|
||||
for (int i = 0; i < array.size(); i++) {
|
||||
map.put(array.get(i).getAsString(), i);
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
/*
|
||||
* This file is part of ViaVersion - https://github.com/ViaVersion/ViaVersion
|
||||
* Copyright (C) 2016-2024 ViaVersion and contributors
|
||||
* Copyright (C) 2016-2025 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
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
/*
|
||||
* This file is part of ViaVersion - https://github.com/ViaVersion/ViaVersion
|
||||
* Copyright (C) 2016-2024 ViaVersion and contributors
|
||||
* Copyright (C) 2016-2025 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
|
||||
@@ -36,6 +36,7 @@ public class ParticleMappings extends FullMappingsBase {
|
||||
addBlockParticle("falling_dust");
|
||||
addBlockParticle("block_marker");
|
||||
addBlockParticle("dust_pillar");
|
||||
addBlockParticle("block_crumble");
|
||||
addItemParticle("item");
|
||||
}
|
||||
|
||||
|
||||
+1
-1
@@ -1,6 +1,6 @@
|
||||
/*
|
||||
* This file is part of ViaVersion - https://github.com/ViaVersion/ViaVersion
|
||||
* Copyright (C) 2016-2024 ViaVersion and contributors
|
||||
* Copyright (C) 2016-2025 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
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
/*
|
||||
* This file is part of ViaVersion - https://github.com/ViaVersion/ViaVersion
|
||||
* Copyright (C) 2016-2024 ViaVersion and contributors
|
||||
* Copyright (C) 2016-2025 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
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
/*
|
||||
* This file is part of ViaVersion - https://github.com/ViaVersion/ViaVersion
|
||||
* Copyright (C) 2016-2024 ViaVersion and contributors
|
||||
* Copyright (C) 2016-2025 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
|
||||
@@ -78,7 +78,7 @@ public interface EntityTracker {
|
||||
void removeEntity(int id);
|
||||
|
||||
/**
|
||||
* Clears stored entity types and data.
|
||||
* Clears stored entity types and data, only leaving behind the client entity.
|
||||
*/
|
||||
void clearEntities();
|
||||
|
||||
@@ -102,11 +102,19 @@ public interface EntityTracker {
|
||||
@Nullable StoredEntityData entityDataIfPresent(int id);
|
||||
|
||||
/**
|
||||
* Returns the client entity id or -1 if unset.
|
||||
* Returns whether the client entity id has been set.
|
||||
*
|
||||
* @return client entity id or -1 if unset
|
||||
* @return whether the client entity id has been set
|
||||
*/
|
||||
int clientEntityId();
|
||||
boolean hasClientEntityId();
|
||||
|
||||
/**
|
||||
* Returns the client entity id. Should be wrapped around {@link #hasClientEntityId()}.
|
||||
*
|
||||
* @return client entity id
|
||||
* @throws IllegalStateException if the client entity id has not been set
|
||||
*/
|
||||
int clientEntityId() throws IllegalStateException;
|
||||
|
||||
/**
|
||||
* Sets the client entity id.
|
||||
@@ -115,6 +123,20 @@ public interface EntityTracker {
|
||||
*/
|
||||
void setClientEntityId(int clientEntityId);
|
||||
|
||||
/**
|
||||
* Returns whether the client player has the "insta build" ability, usually from creative mode.
|
||||
*
|
||||
* @return whether the client player can insta build
|
||||
*/
|
||||
boolean canInstaBuild();
|
||||
|
||||
/**
|
||||
* Sets whether the client player has the "insta build" ability, usually from creative mode.
|
||||
*
|
||||
* @param instaBuild whether the client player can insta build
|
||||
*/
|
||||
void setInstaBuild(boolean instaBuild);
|
||||
|
||||
/**
|
||||
* Returns the current world section height (block height / 16).
|
||||
* This is always 16 for sub 1.17 worlds.
|
||||
@@ -169,12 +191,4 @@ public interface EntityTracker {
|
||||
@Nullable DimensionData dimensionData(int dimensionId);
|
||||
|
||||
void setDimensions(Map<String, DimensionData> dimensions);
|
||||
|
||||
/**
|
||||
* Adds the client player entity to the tracker.
|
||||
* If the client entity has not been set yet, this will return false.
|
||||
*
|
||||
* @return whether the client has been tracked
|
||||
*/
|
||||
boolean trackClientEntity();
|
||||
}
|
||||
@@ -1,6 +1,6 @@
|
||||
/*
|
||||
* This file is part of ViaVersion - https://github.com/ViaVersion/ViaVersion
|
||||
* Copyright (C) 2016-2024 ViaVersion and contributors
|
||||
* Copyright (C) 2016-2025 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,4 +66,4 @@ public interface StoredEntityData {
|
||||
* @param object object to store
|
||||
*/
|
||||
void put(Object object);
|
||||
}
|
||||
}
|
||||
@@ -1,6 +1,6 @@
|
||||
/*
|
||||
* This file is part of ViaVersion - https://github.com/ViaVersion/ViaVersion
|
||||
* Copyright (C) 2016-2024 ViaVersion and contributors
|
||||
* Copyright (C) 2016-2025 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
|
||||
@@ -55,4 +55,4 @@ public interface TrackedEntity {
|
||||
boolean hasSentEntityData();
|
||||
|
||||
void sentEntityData(boolean sentEntityData);
|
||||
}
|
||||
}
|
||||
@@ -1,6 +1,6 @@
|
||||
/*
|
||||
* This file is part of ViaVersion - https://github.com/ViaVersion/ViaVersion
|
||||
* Copyright (C) 2016-2024 ViaVersion and contributors
|
||||
* Copyright (C) 2016-2025 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,7 +22,6 @@
|
||||
*/
|
||||
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;
|
||||
@@ -50,7 +49,6 @@ public interface DebugHandler {
|
||||
*
|
||||
* @param packetTypeName packet type name
|
||||
*/
|
||||
@Beta
|
||||
void addPacketTypeNameToLog(String packetTypeName);
|
||||
|
||||
/**
|
||||
@@ -59,7 +57,6 @@ public interface DebugHandler {
|
||||
*
|
||||
* @param packetType packet type
|
||||
*/
|
||||
@Beta
|
||||
void addPacketTypeToLog(PacketType packetType);
|
||||
|
||||
/**
|
||||
@@ -67,22 +64,44 @@ public interface DebugHandler {
|
||||
*
|
||||
* @param packetTypeName packet type name
|
||||
*/
|
||||
@Beta
|
||||
boolean removePacketTypeNameToLog(String packetTypeName);
|
||||
|
||||
/**
|
||||
* Resets packet type filters.
|
||||
*/
|
||||
@Beta
|
||||
void clearPacketTypesToLog();
|
||||
|
||||
/**
|
||||
* Returns whether packets should be logged after being transformed.
|
||||
* Sets whether packets should be logged before and after being transformed.
|
||||
*
|
||||
* @param logPacketTransform whether packets should be logged
|
||||
*/
|
||||
default void setLogPacketTransform(boolean logPacketTransform) {
|
||||
setLogPrePacketTransform(logPacketTransform);
|
||||
setLogPostPacketTransform(logPacketTransform);
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns whether packets should be logged before being transformed.
|
||||
* Set to true by default.
|
||||
*
|
||||
* @return whether packets should be logged before being transformed
|
||||
*/
|
||||
boolean logPrePacketTransform();
|
||||
|
||||
/**
|
||||
* Sets whether packets should be logged before being transformed.
|
||||
*
|
||||
* @param logPrePacketTransform whether packets should be logged before being transformed
|
||||
*/
|
||||
void setLogPrePacketTransform(boolean logPrePacketTransform);
|
||||
|
||||
/**
|
||||
* Returns whether packets should be logged after being transformed.
|
||||
* Set to false by default.
|
||||
*
|
||||
* @return whether packets should be logged after being transformed
|
||||
*/
|
||||
@Beta
|
||||
boolean logPostPacketTransform();
|
||||
|
||||
/**
|
||||
@@ -90,7 +109,6 @@ public interface DebugHandler {
|
||||
*
|
||||
* @param logPostPacketTransform whether packets should be logged after being transformed
|
||||
*/
|
||||
@Beta
|
||||
void setLogPostPacketTransform(boolean logPostPacketTransform);
|
||||
|
||||
/**
|
||||
@@ -103,7 +121,6 @@ public interface DebugHandler {
|
||||
*/
|
||||
boolean shouldLog(PacketWrapper wrapper, Direction direction);
|
||||
|
||||
@Beta
|
||||
default void enableAndLogIds(final PacketType... packetTypes) {
|
||||
setEnabled(true);
|
||||
for (final PacketType packetType : packetTypes) {
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
/*
|
||||
* This file is part of ViaVersion - https://github.com/ViaVersion/ViaVersion
|
||||
* Copyright (C) 2016-2024 ViaVersion and contributors
|
||||
* Copyright (C) 2016-2025 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
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
/*
|
||||
* This file is part of ViaVersion - https://github.com/ViaVersion/ViaVersion
|
||||
* Copyright (C) 2016-2024 ViaVersion and contributors
|
||||
* Copyright (C) 2016-2025 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
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
/*
|
||||
* This file is part of ViaVersion - https://github.com/ViaVersion/ViaVersion
|
||||
* Copyright (C) 2016-2024 ViaVersion and contributors
|
||||
* Copyright (C) 2016-2025 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
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
/*
|
||||
* This file is part of ViaVersion - https://github.com/ViaVersion/ViaVersion
|
||||
* Copyright (C) 2016-2024 ViaVersion and contributors
|
||||
* Copyright (C) 2016-2025 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
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
/*
|
||||
* This file is part of ViaVersion - https://github.com/ViaVersion/ViaVersion
|
||||
* Copyright (C) 2016-2024 ViaVersion and contributors
|
||||
* Copyright (C) 2016-2025 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
|
||||
|
||||
@@ -0,0 +1,55 @@
|
||||
/*
|
||||
* This file is part of ViaVersion - https://github.com/ViaVersion/ViaVersion
|
||||
* Copyright (C) 2016-2025 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.type.Types;
|
||||
import com.viaversion.viaversion.api.type.types.misc.HolderType;
|
||||
import io.netty.buffer.ByteBuf;
|
||||
import org.checkerframework.checker.nullness.qual.Nullable;
|
||||
|
||||
/**
|
||||
* Represents an animal variant (e.g. for cows, pigs, chickens).
|
||||
*
|
||||
* @param modelType model type id
|
||||
* @param texture texture path
|
||||
* @param biomes biomes this variant can spawn in, if limited to specific biomes
|
||||
*/
|
||||
public record AnimalVariant(int modelType, String texture, @Nullable HolderSet biomes) {
|
||||
|
||||
public static HolderType<AnimalVariant> TYPE = new HolderType<>() {
|
||||
@Override
|
||||
public AnimalVariant readDirect(final ByteBuf buffer) {
|
||||
final int modelType = Types.VAR_INT.readPrimitive(buffer);
|
||||
final String texture = Types.STRING.read(buffer);
|
||||
final HolderSet biomes = Types.OPTIONAL_HOLDER_SET.read(buffer);
|
||||
return new AnimalVariant(modelType, texture, biomes);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void writeDirect(final ByteBuf buffer, final AnimalVariant variant) {
|
||||
Types.VAR_INT.writePrimitive(buffer, variant.modelType());
|
||||
Types.STRING.write(buffer, variant.texture());
|
||||
Types.OPTIONAL_HOLDER_SET.write(buffer, variant.biomes());
|
||||
}
|
||||
};
|
||||
}
|
||||
@@ -1,6 +1,6 @@
|
||||
/*
|
||||
* This file is part of ViaVersion - https://github.com/ViaVersion/ViaVersion
|
||||
* Copyright (C) 2016-2024 ViaVersion and contributors
|
||||
* Copyright (C) 2016-2025 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,4 +65,4 @@ public interface BlockChangeRecord {
|
||||
int getBlockId();
|
||||
|
||||
void setBlockId(int blockId);
|
||||
}
|
||||
}
|
||||
+1
-1
@@ -1,6 +1,6 @@
|
||||
/*
|
||||
* This file is part of ViaVersion - https://github.com/ViaVersion/ViaVersion
|
||||
* Copyright (C) 2016-2024 ViaVersion and contributors
|
||||
* Copyright (C) 2016-2025 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
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
/*
|
||||
* This file is part of ViaVersion - https://github.com/ViaVersion/ViaVersion
|
||||
* Copyright (C) 2016-2024 ViaVersion and contributors
|
||||
* Copyright (C) 2016-2025 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
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
/*
|
||||
* This file is part of ViaVersion - https://github.com/ViaVersion/ViaVersion
|
||||
* Copyright (C) 2016-2024 ViaVersion and contributors
|
||||
* Copyright (C) 2016-2025 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
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
/*
|
||||
* This file is part of ViaVersion - https://github.com/ViaVersion/ViaVersion
|
||||
* Copyright (C) 2016-2024 ViaVersion and contributors
|
||||
* Copyright (C) 2016-2025 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,6 +37,13 @@ public class BlockPosition {
|
||||
return new BlockPosition(x + face.modX(), y + face.modY(), z + face.modZ());
|
||||
}
|
||||
|
||||
public double distanceFromCenterSquared(final double x, final double y, final double z) {
|
||||
final double dx = this.x + 0.5 - x;
|
||||
final double dy = this.y + 0.5 - y;
|
||||
final double dz = this.z + 0.5 - z;
|
||||
return dx * dx + dy * dy + dz * dz;
|
||||
}
|
||||
|
||||
public int x() {
|
||||
return x;
|
||||
}
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
/*
|
||||
* This file is part of ViaVersion - https://github.com/ViaVersion/ViaVersion
|
||||
* Copyright (C) 2016-2024 ViaVersion and contributors
|
||||
* Copyright (C) 2016-2025 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,6 +66,17 @@ public final class ChunkPosition {
|
||||
return (long) chunkX & 0xffffffffL | ((long) chunkZ & 0xffffffffL) << 32;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns a long key for the given block coordinates.
|
||||
*
|
||||
* @param x the block X coordinate
|
||||
* @param z the block Z coordinate
|
||||
* @return the chunk key
|
||||
*/
|
||||
public static long chunkKeyForBlock(final int x, final int z) {
|
||||
return chunkKey(x >> 4, z >> 4);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean equals(final Object o) {
|
||||
if (this == o) return true;
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
/*
|
||||
* This file is part of ViaVersion - https://github.com/ViaVersion/ViaVersion
|
||||
* Copyright (C) 2016-2024 ViaVersion and contributors
|
||||
* Copyright (C) 2016-2025 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,13 +23,12 @@
|
||||
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;
|
||||
private Environment environment = Environment.NORMAL;
|
||||
|
||||
public ClientWorld() {
|
||||
}
|
||||
@@ -38,11 +37,20 @@ public class ClientWorld implements StorableObject {
|
||||
this.environment = environment;
|
||||
}
|
||||
|
||||
public @Nullable Environment getEnvironment() {
|
||||
public Environment getEnvironment() {
|
||||
return environment;
|
||||
}
|
||||
|
||||
public void setEnvironment(final int environmentId) {
|
||||
/**
|
||||
* Sets the environment of the world and returns whether the environment was changed.
|
||||
*
|
||||
* @param environmentId the id of the environment to set
|
||||
* @return whether the environment was changed
|
||||
*/
|
||||
public boolean setEnvironment(final int environmentId) {
|
||||
final int previousEnvironmentId = environment.id();
|
||||
this.environment = Environment.getEnvironmentById(environmentId);
|
||||
|
||||
return previousEnvironmentId != environmentId;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,82 @@
|
||||
/*
|
||||
* This file is part of ViaVersion - https://github.com/ViaVersion/ViaVersion
|
||||
* Copyright (C) 2016-2025 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 EitherHolder<T> {
|
||||
|
||||
/**
|
||||
* Returns a direct or indirect value holder.
|
||||
*
|
||||
* @param value the value
|
||||
* @param <T> the type of the value
|
||||
* @return a new direct holder
|
||||
*/
|
||||
static <T> EitherHolder<T> of(final Holder<T> value) {
|
||||
return new EitherHolderImpl<>(value, null);
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns an indirect holder via the resource key.
|
||||
*
|
||||
* @param key the resource key
|
||||
* @param <T> the type of the value
|
||||
* @return a new holder with the given resource key
|
||||
*/
|
||||
static <T> EitherHolder<T> of(final String key) {
|
||||
return new EitherHolderImpl<>(null, key);
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns true if this holder is backed by a direct value.
|
||||
*
|
||||
* @return true if the holder is direct
|
||||
* @see #hasKey()
|
||||
*/
|
||||
boolean hasHolder();
|
||||
|
||||
/**
|
||||
* Returns true if this holder has a resource key.
|
||||
*
|
||||
* @return true if this holder has a resource key
|
||||
* @see #hasHolder()
|
||||
*/
|
||||
boolean hasKey();
|
||||
|
||||
/**
|
||||
* Returns the value of this holder.
|
||||
*
|
||||
* @return the value of this holder
|
||||
* @throws IllegalArgumentException if this contains a resource key instead of a holder
|
||||
* @see #hasHolder()
|
||||
*/
|
||||
Holder<T> holder();
|
||||
|
||||
/**
|
||||
* Returns the resource key.
|
||||
*
|
||||
* @return the resource key
|
||||
* @throws IllegalArgumentException if this contains a holder instead of a resource key
|
||||
* @see #hasKey()
|
||||
*/
|
||||
String key();
|
||||
}
|
||||
@@ -0,0 +1,55 @@
|
||||
/*
|
||||
* This file is part of ViaVersion - https://github.com/ViaVersion/ViaVersion
|
||||
* Copyright (C) 2016-2025 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;
|
||||
import com.viaversion.viaversion.util.EitherImpl;
|
||||
|
||||
final class EitherHolderImpl<T> extends EitherImpl<Holder<T>, String> implements EitherHolder<T> {
|
||||
|
||||
EitherHolderImpl(final Holder<T> left, final String value) {
|
||||
super(left, value);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean hasHolder() {
|
||||
return isLeft();
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean hasKey() {
|
||||
return isRight();
|
||||
}
|
||||
|
||||
@Override
|
||||
public Holder<T> holder() {
|
||||
Preconditions.checkArgument(hasHolder(), "Either does not have a holder");
|
||||
return left();
|
||||
}
|
||||
|
||||
@Override
|
||||
public String key() {
|
||||
Preconditions.checkArgument(hasKey(), "Either does not have a key");
|
||||
return right();
|
||||
}
|
||||
}
|
||||
@@ -1,6 +1,6 @@
|
||||
/*
|
||||
* This file is part of ViaVersion - https://github.com/ViaVersion/ViaVersion
|
||||
* Copyright (C) 2016-2024 ViaVersion and contributors
|
||||
* Copyright (C) 2016-2025 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
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
/*
|
||||
* This file is part of ViaVersion - https://github.com/ViaVersion/ViaVersion
|
||||
* Copyright (C) 2016-2024 ViaVersion and contributors
|
||||
* Copyright (C) 2016-2025 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
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
/*
|
||||
* This file is part of ViaVersion - https://github.com/ViaVersion/ViaVersion
|
||||
* Copyright (C) 2016-2024 ViaVersion and contributors
|
||||
* Copyright (C) 2016-2025 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,28 +24,35 @@ package com.viaversion.viaversion.api.minecraft;
|
||||
|
||||
public enum GameMode {
|
||||
|
||||
SURVIVAL("Survival Mode"),
|
||||
CREATIVE("Creative Mode"),
|
||||
ADVENTURE("Adventure Mode"),
|
||||
SPECTATOR("Spectator Mode");
|
||||
NOT_SET("", -1),
|
||||
SURVIVAL("Survival Mode", 0),
|
||||
CREATIVE("Creative Mode", 1),
|
||||
ADVENTURE("Adventure Mode", 2),
|
||||
SPECTATOR("Spectator Mode", 3);
|
||||
|
||||
private final String text;
|
||||
private final int id;
|
||||
|
||||
GameMode(String text) {
|
||||
GameMode(String text, final int id) {
|
||||
this.text = text;
|
||||
this.id = id;
|
||||
}
|
||||
|
||||
public String text() {
|
||||
return text;
|
||||
}
|
||||
|
||||
public int id() {
|
||||
return id;
|
||||
}
|
||||
|
||||
public static GameMode getById(int id) {
|
||||
return switch (id) {
|
||||
case 0 -> SURVIVAL;
|
||||
case -1 -> NOT_SET;
|
||||
case 1 -> CREATIVE;
|
||||
case 2 -> ADVENTURE;
|
||||
case 3 -> SPECTATOR;
|
||||
default -> throw new IllegalArgumentException("Unknown gamemode id: " + id);
|
||||
default /*0*/ -> SURVIVAL;
|
||||
};
|
||||
}
|
||||
}
|
||||
@@ -1,6 +1,6 @@
|
||||
/*
|
||||
* This file is part of ViaVersion - https://github.com/ViaVersion/ViaVersion
|
||||
* Copyright (C) 2016-2024 ViaVersion and contributors
|
||||
* Copyright (C) 2016-2025 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
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
/*
|
||||
* This file is part of ViaVersion - https://github.com/ViaVersion/ViaVersion
|
||||
* Copyright (C) 2016-2024 ViaVersion and contributors
|
||||
* Copyright (C) 2016-2025 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
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
/*
|
||||
* This file is part of ViaVersion - https://github.com/ViaVersion/ViaVersion
|
||||
* Copyright (C) 2016-2024 ViaVersion and contributors
|
||||
* Copyright (C) 2016-2025 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 it.unimi.dsi.fastutil.ints.Int2IntFunction;
|
||||
|
||||
public interface Holder<T> {
|
||||
|
||||
/**
|
||||
@@ -33,7 +35,7 @@ public interface Holder<T> {
|
||||
* @throws IllegalArgumentException if the id is negative
|
||||
*/
|
||||
static <T> Holder<T> of(final int id) {
|
||||
return new HolderImpl<>(id);
|
||||
return new IdHolder<>(id);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -44,7 +46,7 @@ public interface Holder<T> {
|
||||
* @return a new direct holder
|
||||
*/
|
||||
static <T> Holder<T> of(final T value) {
|
||||
return new HolderImpl<>(value);
|
||||
return new ValueHolder<>(value);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -79,4 +81,12 @@ public interface Holder<T> {
|
||||
* @see #hasId()
|
||||
*/
|
||||
int id();
|
||||
|
||||
/**
|
||||
* Returns a new holder with the id rewritten using the given function, or self if this is a direct holder or the id did not change.
|
||||
*
|
||||
* @param rewriteFunction the function to rewrite the id
|
||||
* @return a new holder with the id rewritten, or self
|
||||
*/
|
||||
Holder<T> updateId(final Int2IntFunction rewriteFunction);
|
||||
}
|
||||
@@ -1,6 +1,6 @@
|
||||
/*
|
||||
* This file is part of ViaVersion - https://github.com/ViaVersion/ViaVersion
|
||||
* Copyright (C) 2016-2024 ViaVersion and contributors
|
||||
* Copyright (C) 2016-2025 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
|
||||
@@ -36,7 +36,7 @@ public interface HolderSet {
|
||||
* @return a new holder set
|
||||
*/
|
||||
static HolderSet of(final String tagKey) {
|
||||
return new HolderSetImpl(tagKey);
|
||||
return new HolderSetImpl.Tag(tagKey);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -46,7 +46,7 @@ public interface HolderSet {
|
||||
* @return a new holder set
|
||||
*/
|
||||
static HolderSet of(final int[] ids) {
|
||||
return new HolderSetImpl(ids);
|
||||
return new HolderSetImpl.Ids(ids);
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
/*
|
||||
* This file is part of ViaVersion - https://github.com/ViaVersion/ViaVersion
|
||||
* Copyright (C) 2016-2024 ViaVersion and contributors
|
||||
* Copyright (C) 2016-2025 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,50 +22,63 @@
|
||||
*/
|
||||
package com.viaversion.viaversion.api.minecraft;
|
||||
|
||||
import com.viaversion.viaversion.util.EitherImpl;
|
||||
import it.unimi.dsi.fastutil.ints.Int2IntFunction;
|
||||
import java.util.Arrays;
|
||||
|
||||
final class HolderSetImpl extends EitherImpl<String, int[]> implements HolderSet {
|
||||
final class HolderSetImpl {
|
||||
|
||||
HolderSetImpl(final String tagKey) {
|
||||
super(tagKey, null);
|
||||
}
|
||||
record Tag(String tagKey) implements HolderSet {
|
||||
@Override
|
||||
public boolean hasTagKey() {
|
||||
return true;
|
||||
}
|
||||
|
||||
HolderSetImpl(final int[] ids) {
|
||||
super(null, ids);
|
||||
}
|
||||
@Override
|
||||
public int[] ids() {
|
||||
throw new IllegalArgumentException("This holder set has a tag key");
|
||||
}
|
||||
|
||||
@Override
|
||||
public String tagKey() {
|
||||
return left();
|
||||
}
|
||||
@Override
|
||||
public boolean hasIds() {
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean hasTagKey() {
|
||||
return isLeft();
|
||||
}
|
||||
|
||||
@Override
|
||||
public int[] ids() {
|
||||
return right();
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean hasIds() {
|
||||
return isRight();
|
||||
}
|
||||
|
||||
@Override
|
||||
public HolderSet rewrite(final Int2IntFunction idRewriter) {
|
||||
if (hasTagKey()) {
|
||||
@Override
|
||||
public HolderSet rewrite(final Int2IntFunction idRewriter) {
|
||||
return this;
|
||||
}
|
||||
}
|
||||
|
||||
final int[] ids = ids();
|
||||
final int[] mappedIds = new int[ids.length];
|
||||
for (int i = 0; i < mappedIds.length; i++) {
|
||||
mappedIds[i] = idRewriter.apply(ids[i]);
|
||||
record Ids(int[] ids) implements HolderSet {
|
||||
@Override
|
||||
public boolean hasTagKey() {
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String tagKey() {
|
||||
throw new IllegalArgumentException("This holder set has direct ids");
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean hasIds() {
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public HolderSet rewrite(final Int2IntFunction idRewriter) {
|
||||
final int[] mappedIds = new int[ids.length];
|
||||
for (int i = 0; i < mappedIds.length; i++) {
|
||||
mappedIds[i] = idRewriter.applyAsInt(ids[i]);
|
||||
}
|
||||
return new Ids(mappedIds);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return "Ids{" +
|
||||
"ids=" + Arrays.toString(ids) +
|
||||
'}';
|
||||
}
|
||||
return new HolderSetImpl(mappedIds);
|
||||
}
|
||||
}
|
||||
+16
-27
@@ -1,6 +1,6 @@
|
||||
/*
|
||||
* This file is part of ViaVersion - https://github.com/ViaVersion/ViaVersion
|
||||
* Copyright (C) 2016-2024 ViaVersion and contributors
|
||||
* Copyright (C) 2016-2025 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,49 +23,38 @@
|
||||
package com.viaversion.viaversion.api.minecraft;
|
||||
|
||||
import com.google.common.base.Preconditions;
|
||||
import it.unimi.dsi.fastutil.ints.Int2IntFunction;
|
||||
|
||||
final class HolderImpl<T> implements Holder<T> {
|
||||
record IdHolder<T>(int id) implements Holder<T> {
|
||||
|
||||
private final T value;
|
||||
private final int id;
|
||||
|
||||
HolderImpl(final int id) {
|
||||
IdHolder {
|
||||
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;
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean hasId() {
|
||||
return id != -1;
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public T value() {
|
||||
Preconditions.checkArgument(isDirect(), "Holder is not direct");
|
||||
return value;
|
||||
throw new IllegalArgumentException("Holder is not direct");
|
||||
}
|
||||
|
||||
@Override
|
||||
public int id() {
|
||||
return id;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return "HolderImpl{" +
|
||||
"value=" + value +
|
||||
", id=" + id +
|
||||
'}';
|
||||
public Holder<T> updateId(final Int2IntFunction rewriteFunction) {
|
||||
final int rewrittenId = rewriteFunction.applyAsInt(id);
|
||||
if (rewrittenId == id) {
|
||||
return this;
|
||||
}
|
||||
if (rewrittenId == -1) {
|
||||
throw new IllegalArgumentException("Received invalid id in updateId");
|
||||
}
|
||||
return Holder.of(rewrittenId);
|
||||
}
|
||||
}
|
||||
@@ -1,6 +1,6 @@
|
||||
/*
|
||||
* This file is part of ViaVersion - https://github.com/ViaVersion/ViaVersion
|
||||
* Copyright (C) 2016-2024 ViaVersion and contributors
|
||||
* Copyright (C) 2016-2025 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,13 +22,19 @@
|
||||
*/
|
||||
package com.viaversion.viaversion.api.minecraft;
|
||||
|
||||
import com.viaversion.nbt.tag.Tag;
|
||||
import com.viaversion.viaversion.api.type.Types;
|
||||
import com.viaversion.viaversion.api.type.types.misc.HolderType;
|
||||
import io.netty.buffer.ByteBuf;
|
||||
import org.checkerframework.checker.nullness.qual.Nullable;
|
||||
|
||||
public record PaintingVariant(int width, int height, String assetId) {
|
||||
public record PaintingVariant(int width, int height, String assetId, @Nullable Tag title, @Nullable Tag author) {
|
||||
|
||||
public static HolderType<PaintingVariant> TYPE = new HolderType<>() {
|
||||
public PaintingVariant(final int width, final int height, final String assetId) {
|
||||
this(width, height, assetId, null, null);
|
||||
}
|
||||
|
||||
public static HolderType<PaintingVariant> TYPE1_21 = new HolderType<>() {
|
||||
@Override
|
||||
public PaintingVariant readDirect(final ByteBuf buffer) {
|
||||
final int width = Types.VAR_INT.readPrimitive(buffer);
|
||||
@@ -44,4 +50,24 @@ public record PaintingVariant(int width, int height, String assetId) {
|
||||
Types.STRING.write(buffer, variant.assetId());
|
||||
}
|
||||
};
|
||||
public static HolderType<PaintingVariant> TYPE1_21_2 = new HolderType<>() {
|
||||
@Override
|
||||
public PaintingVariant readDirect(final ByteBuf buffer) {
|
||||
final int width = Types.VAR_INT.readPrimitive(buffer);
|
||||
final int height = Types.VAR_INT.readPrimitive(buffer);
|
||||
final String assetId = Types.STRING.read(buffer);
|
||||
final Tag title = Types.OPTIONAL_TAG.read(buffer);
|
||||
final Tag author = Types.OPTIONAL_TAG.read(buffer);
|
||||
return new PaintingVariant(width, height, assetId, title, author);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void writeDirect(final ByteBuf buffer, final PaintingVariant variant) {
|
||||
Types.VAR_INT.writePrimitive(buffer, variant.width());
|
||||
Types.VAR_INT.writePrimitive(buffer, variant.height());
|
||||
Types.STRING.write(buffer, variant.assetId());
|
||||
Types.OPTIONAL_TAG.write(buffer, variant.title());
|
||||
Types.OPTIONAL_TAG.write(buffer, variant.author());
|
||||
}
|
||||
};
|
||||
}
|
||||
@@ -1,6 +1,6 @@
|
||||
/*
|
||||
* This file is part of ViaVersion - https://github.com/ViaVersion/ViaVersion
|
||||
* Copyright (C) 2016-2024 ViaVersion and contributors
|
||||
* Copyright (C) 2016-2025 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,12 +24,13 @@ 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.Copyable;
|
||||
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 {
|
||||
public final class Particle implements IdHolder, Copyable {
|
||||
private final List<ParticleData<?>> arguments = new ArrayList<>(4);
|
||||
private int id;
|
||||
|
||||
@@ -72,6 +73,15 @@ public final class Particle implements IdHolder {
|
||||
arguments.set(index, new ParticleData<>(type, value));
|
||||
}
|
||||
|
||||
@Override
|
||||
public Particle copy() {
|
||||
final Particle particle = new Particle(id);
|
||||
for (ParticleData<?> argument : arguments) {
|
||||
particle.arguments.add(argument.copy());
|
||||
}
|
||||
return particle;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return "Particle{" +
|
||||
@@ -80,7 +90,7 @@ public final class Particle implements IdHolder {
|
||||
'}';
|
||||
}
|
||||
|
||||
public static final class ParticleData<T> {
|
||||
public static final class ParticleData<T> implements Copyable {
|
||||
private final Type<T> type;
|
||||
private T value;
|
||||
|
||||
@@ -109,6 +119,11 @@ public final class Particle implements IdHolder {
|
||||
wrapper.write(type, value);
|
||||
}
|
||||
|
||||
@Override
|
||||
public ParticleData<T> copy() {
|
||||
return new ParticleData<>(type, copy(value));
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return "ParticleData{" +
|
||||
|
||||
+1
-1
@@ -1,6 +1,6 @@
|
||||
/*
|
||||
* This file is part of ViaVersion - https://github.com/ViaVersion/ViaVersion
|
||||
* Copyright (C) 2016-2024 ViaVersion and contributors
|
||||
* Copyright (C) 2016-2025 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
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
/*
|
||||
* This file is part of ViaVersion - https://github.com/ViaVersion/ViaVersion
|
||||
* Copyright (C) 2016-2024 ViaVersion and contributors
|
||||
* Copyright (C) 2016-2025 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
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
/*
|
||||
* This file is part of ViaVersion - https://github.com/ViaVersion/ViaVersion
|
||||
* Copyright (C) 2016-2024 ViaVersion and contributors
|
||||
* Copyright (C) 2016-2025 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
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
/*
|
||||
* This file is part of ViaVersion - https://github.com/ViaVersion/ViaVersion
|
||||
* Copyright (C) 2016-2024 ViaVersion and contributors
|
||||
* Copyright (C) 2016-2025 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,11 +23,23 @@
|
||||
package com.viaversion.viaversion.api.minecraft;
|
||||
|
||||
import com.viaversion.nbt.tag.Tag;
|
||||
import com.viaversion.viaversion.util.Copyable;
|
||||
import org.checkerframework.checker.nullness.qual.Nullable;
|
||||
|
||||
public record RegistryEntry(String key, @Nullable Tag tag) {
|
||||
/**
|
||||
* Represents an entry in a registry.
|
||||
*
|
||||
* @param key key of the registry entry
|
||||
* @param tag data of the registry entry, or null if the client should use its default
|
||||
*/
|
||||
public record RegistryEntry(String key, @Nullable Tag tag) implements Copyable {
|
||||
|
||||
public RegistryEntry withKey(final String key) {
|
||||
return new RegistryEntry(key, tag != null ? tag.copy() : null);
|
||||
}
|
||||
|
||||
@Override
|
||||
public RegistryEntry copy() {
|
||||
return new RegistryEntry(key, tag != null ? tag.copy() : null);
|
||||
}
|
||||
}
|
||||
@@ -1,6 +1,6 @@
|
||||
/*
|
||||
* This file is part of ViaVersion - https://github.com/ViaVersion/ViaVersion
|
||||
* Copyright (C) 2016-2024 ViaVersion and contributors
|
||||
* Copyright (C) 2016-2025 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
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
/*
|
||||
* This file is part of ViaVersion - https://github.com/ViaVersion/ViaVersion
|
||||
* Copyright (C) 2016-2024 ViaVersion and contributors
|
||||
* Copyright (C) 2016-2025 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
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
/*
|
||||
* This file is part of ViaVersion - https://github.com/ViaVersion/ViaVersion
|
||||
* Copyright (C) 2016-2024 ViaVersion and contributors
|
||||
* Copyright (C) 2016-2025 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
|
||||
|
||||
@@ -0,0 +1,48 @@
|
||||
/*
|
||||
* This file is part of ViaVersion - https://github.com/ViaVersion/ViaVersion
|
||||
* Copyright (C) 2016-2025 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 it.unimi.dsi.fastutil.ints.Int2IntFunction;
|
||||
|
||||
record ValueHolder<T>(T value) implements Holder<T> {
|
||||
|
||||
@Override
|
||||
public boolean isDirect() {
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean hasId() {
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int id() {
|
||||
return -1;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Holder<T> updateId(final Int2IntFunction rewriteFunction) {
|
||||
return this;
|
||||
}
|
||||
}
|
||||
@@ -1,6 +1,6 @@
|
||||
/*
|
||||
* This file is part of ViaVersion - https://github.com/ViaVersion/ViaVersion
|
||||
* Copyright (C) 2016-2024 ViaVersion and contributors
|
||||
* Copyright (C) 2016-2025 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
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
/*
|
||||
* This file is part of ViaVersion - https://github.com/ViaVersion/ViaVersion
|
||||
* Copyright (C) 2016-2024 ViaVersion and contributors
|
||||
* Copyright (C) 2016-2025 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
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
/*
|
||||
* This file is part of ViaVersion - https://github.com/ViaVersion/ViaVersion
|
||||
* Copyright (C) 2016-2024 ViaVersion and contributors
|
||||
* Copyright (C) 2016-2025 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
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
/*
|
||||
* This file is part of ViaVersion - https://github.com/ViaVersion/ViaVersion
|
||||
* Copyright (C) 2016-2024 ViaVersion and contributors
|
||||
* Copyright (C) 2016-2025 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
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
/*
|
||||
* This file is part of ViaVersion - https://github.com/ViaVersion/ViaVersion
|
||||
* Copyright (C) 2016-2024 ViaVersion and contributors
|
||||
* Copyright (C) 2016-2025 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
|
||||
|
||||
+1
-1
@@ -1,6 +1,6 @@
|
||||
/*
|
||||
* This file is part of ViaVersion - https://github.com/ViaVersion/ViaVersion
|
||||
* Copyright (C) 2016-2024 ViaVersion and contributors
|
||||
* Copyright (C) 2016-2025 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
|
||||
|
||||
+1
-1
@@ -1,6 +1,6 @@
|
||||
/*
|
||||
* This file is part of ViaVersion - https://github.com/ViaVersion/ViaVersion
|
||||
* Copyright (C) 2016-2024 ViaVersion and contributors
|
||||
* Copyright (C) 2016-2025 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
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
/*
|
||||
* This file is part of ViaVersion - https://github.com/ViaVersion/ViaVersion
|
||||
* Copyright (C) 2016-2024 ViaVersion and contributors
|
||||
* Copyright (C) 2016-2025 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
|
||||
@@ -143,6 +143,16 @@ public class BaseChunk implements Chunk {
|
||||
this.heightMap = heightMap;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Heightmap[] heightmaps() {
|
||||
throw new UnsupportedOperationException();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setHeightmaps(final Heightmap[] heightmaps) {
|
||||
throw new UnsupportedOperationException();
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<CompoundTag> getBlockEntities() {
|
||||
return blockEntities;
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
/*
|
||||
* This file is part of ViaVersion - https://github.com/ViaVersion/ViaVersion
|
||||
* Copyright (C) 2016-2024 ViaVersion and contributors
|
||||
* Copyright (C) 2016-2025 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,7 +79,8 @@ public interface Chunk {
|
||||
* @return chunk section bit mask, only non-null for 1.17+ chunks
|
||||
* @see #getBitmask()
|
||||
*/
|
||||
@Nullable BitSet getChunkMask();
|
||||
@Nullable
|
||||
BitSet getChunkMask();
|
||||
|
||||
void setChunkMask(BitSet chunkSectionMask);
|
||||
|
||||
@@ -88,7 +89,8 @@ public interface Chunk {
|
||||
*
|
||||
* @return array of nullable chunk sections
|
||||
*/
|
||||
@Nullable ChunkSection[] getSections();
|
||||
@Nullable
|
||||
ChunkSection[] getSections();
|
||||
|
||||
void setSections(ChunkSection[] sections);
|
||||
|
||||
@@ -106,10 +108,15 @@ public interface Chunk {
|
||||
*
|
||||
* @return compoundtag containing heightmaps if present
|
||||
*/
|
||||
@Nullable CompoundTag getHeightMap();
|
||||
@Nullable
|
||||
CompoundTag getHeightMap();
|
||||
|
||||
void setHeightMap(@Nullable CompoundTag heightMap);
|
||||
|
||||
Heightmap[] heightmaps();
|
||||
|
||||
void setHeightmaps(Heightmap[] heightmaps);
|
||||
|
||||
/**
|
||||
* Returns a list of block entities.
|
||||
*
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
/*
|
||||
* This file is part of ViaVersion - https://github.com/ViaVersion/ViaVersion
|
||||
* Copyright (C) 2016-2024 ViaVersion and contributors
|
||||
* Copyright (C) 2016-2025 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
|
||||
@@ -123,6 +123,16 @@ public class Chunk1_18 implements Chunk {
|
||||
this.heightMap = heightMap;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Heightmap[] heightmaps() {
|
||||
throw new UnsupportedOperationException();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setHeightmaps(final Heightmap[] heightmaps) {
|
||||
throw new UnsupportedOperationException();
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<CompoundTag> getBlockEntities() {
|
||||
throw new UnsupportedOperationException();
|
||||
|
||||
@@ -0,0 +1,145 @@
|
||||
/*
|
||||
* This file is part of ViaVersion - https://github.com/ViaVersion/ViaVersion
|
||||
* Copyright (C) 2016-2025 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.chunks;
|
||||
|
||||
import com.viaversion.nbt.tag.CompoundTag;
|
||||
import com.viaversion.viaversion.api.minecraft.blockentity.BlockEntity;
|
||||
import java.util.BitSet;
|
||||
import java.util.List;
|
||||
import org.checkerframework.checker.nullness.qual.Nullable;
|
||||
|
||||
public class Chunk1_21_5 implements Chunk {
|
||||
protected final int x;
|
||||
protected final int z;
|
||||
protected ChunkSection[] sections;
|
||||
protected Heightmap[] heightmaps;
|
||||
protected final List<BlockEntity> blockEntities;
|
||||
|
||||
public Chunk1_21_5(int x, int z, ChunkSection[] sections, Heightmap[] heightmaps, List<BlockEntity> blockEntities) {
|
||||
this.x = x;
|
||||
this.z = z;
|
||||
this.sections = sections;
|
||||
this.heightmaps = heightmaps;
|
||||
this.blockEntities = blockEntities;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isBiomeData() {
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getX() {
|
||||
return x;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getZ() {
|
||||
return z;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isFullChunk() {
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isIgnoreOldLightData() {
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setIgnoreOldLightData(boolean ignoreOldLightData) {
|
||||
throw new UnsupportedOperationException();
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getBitmask() {
|
||||
return -1;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setBitmask(int bitmask) {
|
||||
throw new UnsupportedOperationException();
|
||||
}
|
||||
|
||||
@Override
|
||||
public @Nullable BitSet getChunkMask() {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setChunkMask(BitSet chunkSectionMask) {
|
||||
throw new UnsupportedOperationException();
|
||||
}
|
||||
|
||||
@Override
|
||||
public ChunkSection[] getSections() {
|
||||
return sections;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setSections(ChunkSection[] sections) {
|
||||
this.sections = sections;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int @Nullable [] getBiomeData() {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setBiomeData(int @Nullable [] biomeData) {
|
||||
throw new UnsupportedOperationException();
|
||||
}
|
||||
|
||||
@Override
|
||||
public @Nullable CompoundTag getHeightMap() {
|
||||
throw new UnsupportedOperationException();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setHeightMap(final CompoundTag heightMap) {
|
||||
throw new UnsupportedOperationException();
|
||||
}
|
||||
|
||||
@Override
|
||||
public Heightmap[] heightmaps() {
|
||||
return heightmaps;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setHeightmaps(final Heightmap[] heightmaps) {
|
||||
this.heightmaps = heightmaps;
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<CompoundTag> getBlockEntities() {
|
||||
throw new UnsupportedOperationException();
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<BlockEntity> blockEntities() {
|
||||
return blockEntities;
|
||||
}
|
||||
}
|
||||
@@ -1,6 +1,6 @@
|
||||
/*
|
||||
* This file is part of ViaVersion - https://github.com/ViaVersion/ViaVersion
|
||||
* Copyright (C) 2016-2024 ViaVersion and contributors
|
||||
* Copyright (C) 2016-2025 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
|
||||
|
||||
+3
-3
@@ -1,6 +1,6 @@
|
||||
/*
|
||||
* This file is part of ViaVersion - https://github.com/ViaVersion/ViaVersion
|
||||
* Copyright (C) 2016-2024 ViaVersion and contributors
|
||||
* Copyright (C) 2016-2025 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,14 +37,14 @@ public class ChunkSectionImpl implements ChunkSection {
|
||||
public ChunkSectionImpl(final boolean holdsLight) {
|
||||
addPalette(PaletteType.BLOCKS, new DataPaletteImpl(ChunkSection.SIZE));
|
||||
if (holdsLight) {
|
||||
this.light = new ChunkSectionLightImpl();
|
||||
this.light = ChunkSectionLightImpl.createWithBlockLight();
|
||||
}
|
||||
}
|
||||
|
||||
public ChunkSectionImpl(final boolean holdsLight, final int expectedPaletteLength) {
|
||||
addPalette(PaletteType.BLOCKS, new DataPaletteImpl(ChunkSection.SIZE, expectedPaletteLength));
|
||||
if (holdsLight) {
|
||||
this.light = new ChunkSectionLightImpl();
|
||||
this.light = ChunkSectionLightImpl.createWithBlockLight();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
+3
-3
@@ -1,6 +1,6 @@
|
||||
/*
|
||||
* This file is part of ViaVersion - https://github.com/ViaVersion/ViaVersion
|
||||
* Copyright (C) 2016-2024 ViaVersion and contributors
|
||||
* Copyright (C) 2016-2025 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,7 +35,7 @@ public interface ChunkSectionLight {
|
||||
/**
|
||||
* Returns whether the section has sky light.
|
||||
*
|
||||
* @return true if skylight is present
|
||||
* @return true if sky light is present
|
||||
*/
|
||||
boolean hasSkyLight();
|
||||
|
||||
@@ -43,7 +43,7 @@ public interface ChunkSectionLight {
|
||||
* Returns whether the section has block light.
|
||||
* This returns true unless specifically set to null.
|
||||
*
|
||||
* @return true if skylight is present
|
||||
* @return true if block light is present
|
||||
*/
|
||||
boolean hasBlockLight();
|
||||
|
||||
|
||||
+12
-4
@@ -1,6 +1,6 @@
|
||||
/*
|
||||
* This file is part of ViaVersion - https://github.com/ViaVersion/ViaVersion
|
||||
* Copyright (C) 2016-2024 ViaVersion and contributors
|
||||
* Copyright (C) 2016-2025 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
|
||||
@@ -30,9 +30,17 @@ public class ChunkSectionLightImpl implements ChunkSectionLight {
|
||||
private NibbleArray blockLight;
|
||||
private NibbleArray skyLight;
|
||||
|
||||
public ChunkSectionLightImpl() {
|
||||
// Block light is always written
|
||||
this.blockLight = new NibbleArray(ChunkSection.SIZE);
|
||||
protected ChunkSectionLightImpl() {
|
||||
}
|
||||
|
||||
public static ChunkSectionLight createWithBlockLight() {
|
||||
final ChunkSectionLightImpl light = new ChunkSectionLightImpl();
|
||||
light.blockLight = new NibbleArray(ChunkSection.SIZE);
|
||||
return light;
|
||||
}
|
||||
|
||||
public static ChunkSectionLight createEmpty() {
|
||||
return new ChunkSectionLightImpl();
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
/*
|
||||
* This file is part of ViaVersion - https://github.com/ViaVersion/ViaVersion
|
||||
* Copyright (C) 2016-2024 ViaVersion and contributors
|
||||
* Copyright (C) 2016-2025 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
|
||||
|
||||
+1
-1
@@ -1,6 +1,6 @@
|
||||
/*
|
||||
* This file is part of ViaVersion - https://github.com/ViaVersion/ViaVersion
|
||||
* Copyright (C) 2016-2024 ViaVersion and contributors
|
||||
* Copyright (C) 2016-2025 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
|
||||
|
||||
@@ -0,0 +1,26 @@
|
||||
/*
|
||||
* This file is part of ViaVersion - https://github.com/ViaVersion/ViaVersion
|
||||
* Copyright (C) 2016-2025 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.chunks;
|
||||
|
||||
public record Heightmap(int type, long[] data) {
|
||||
}
|
||||
@@ -1,6 +1,6 @@
|
||||
/*
|
||||
* This file is part of ViaVersion - https://github.com/ViaVersion/ViaVersion
|
||||
* Copyright (C) 2016-2024 ViaVersion and contributors
|
||||
* Copyright (C) 2016-2025 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
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
/*
|
||||
* This file is part of ViaVersion - https://github.com/ViaVersion/ViaVersion
|
||||
* Copyright (C) 2016-2024 ViaVersion and contributors
|
||||
* Copyright (C) 2016-2025 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
|
||||
@@ -41,4 +41,4 @@ public enum PaletteType {
|
||||
public int highestBitsPerValue() {
|
||||
return highestBitsPerValue;
|
||||
}
|
||||
}
|
||||
}
|
||||
+6
-1
@@ -1,6 +1,6 @@
|
||||
/*
|
||||
* This file is part of ViaVersion - https://github.com/ViaVersion/ViaVersion
|
||||
* Copyright (C) 2016-2024 ViaVersion and contributors
|
||||
* Copyright (C) 2016-2025 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
|
||||
@@ -53,6 +53,11 @@ final class EmptyStructuredData<T> implements StructuredData<T> {
|
||||
return this.key;
|
||||
}
|
||||
|
||||
@Override
|
||||
public StructuredData<T> copy() {
|
||||
return new EmptyStructuredData<>(this.key, this.id);
|
||||
}
|
||||
|
||||
@Override
|
||||
public T value() {
|
||||
return null;
|
||||
|
||||
+6
-1
@@ -1,6 +1,6 @@
|
||||
/*
|
||||
* This file is part of ViaVersion - https://github.com/ViaVersion/ViaVersion
|
||||
* Copyright (C) 2016-2024 ViaVersion and contributors
|
||||
* Copyright (C) 2016-2025 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
|
||||
@@ -59,6 +59,11 @@ final class FilledStructuredData<T> implements StructuredData<T> {
|
||||
return key;
|
||||
}
|
||||
|
||||
@Override
|
||||
public StructuredData<T> copy() {
|
||||
return new FilledStructuredData<>(this.key, this.copy(this.value), this.id);
|
||||
}
|
||||
|
||||
@Override
|
||||
public T value() {
|
||||
return value;
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
/*
|
||||
* This file is part of ViaVersion - https://github.com/ViaVersion/ViaVersion
|
||||
* Copyright (C) 2016-2024 ViaVersion and contributors
|
||||
* Copyright (C) 2016-2025 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,12 @@
|
||||
*/
|
||||
package com.viaversion.viaversion.api.minecraft.data;
|
||||
|
||||
import com.viaversion.viaversion.util.Copyable;
|
||||
import com.viaversion.viaversion.util.IdHolder;
|
||||
import io.netty.buffer.ByteBuf;
|
||||
import org.checkerframework.checker.nullness.qual.Nullable;
|
||||
|
||||
public interface StructuredData<T> extends IdHolder {
|
||||
public interface StructuredData<T> extends IdHolder, Copyable {
|
||||
|
||||
/**
|
||||
* Returns filled structured data, equivalent to an Optional with a value in vanilla.
|
||||
@@ -52,15 +53,17 @@ public interface StructuredData<T> extends IdHolder {
|
||||
return new EmptyStructuredData<>(key, id);
|
||||
}
|
||||
|
||||
void setValue(final T value);
|
||||
@Nullable
|
||||
T value();
|
||||
|
||||
void write(final ByteBuf buffer);
|
||||
void setValue(final T value);
|
||||
|
||||
void setId(final int id);
|
||||
|
||||
StructuredDataKey<T> key();
|
||||
|
||||
@Nullable T value();
|
||||
@Override
|
||||
StructuredData<T> copy();
|
||||
|
||||
/**
|
||||
* Returns whether the structured data is present. Even if true, the value may be null.
|
||||
@@ -77,4 +80,6 @@ public interface StructuredData<T> extends IdHolder {
|
||||
* @return true if the structured data is empty
|
||||
*/
|
||||
boolean isEmpty();
|
||||
|
||||
void write(final ByteBuf buffer);
|
||||
}
|
||||
Loaded 100 of 965 files, more files were not shown because too many files have changed in this diff.
Show more
Reference in new issue
Block a user