mirror of
https://github.com/ViaVersion/ViaFabric.git
synced 2024-09-28 04:07:30 +02:00
Compare commits
548 Commits
build-721.
...
main
Author | SHA1 | Date | |
---|---|---|---|
|
a568b87028 | ||
|
e0e579eccf | ||
|
d7df0df496 | ||
|
5e59b9d947 | ||
|
c5dcc31c37 | ||
|
5fbebdc9f0 | ||
|
a5c47ec762 | ||
|
4998a11460 | ||
|
4ce1dbea3a | ||
|
66d021a470 | ||
|
4ee45457fa | ||
|
e3e692aa5f | ||
|
ac72bd111c | ||
|
822e9b59c0 | ||
|
a81234df80 | ||
|
616697e16e | ||
|
4add943a60 | ||
|
bd8ceb2ad6 | ||
|
40acc7416a | ||
|
820d2d40e3 | ||
|
1af501e6ff | ||
|
b70c1a195c | ||
|
ea8ba38f70 | ||
|
9f8f92ee3b | ||
|
9a7129a86b | ||
|
8fd423c059 | ||
|
d7780d0178 | ||
|
d726406097 | ||
|
6a94d9e73e | ||
|
bb4a34e777 | ||
|
09470a8341 | ||
|
327123a9be | ||
|
67d33c6985 | ||
|
9871d1f745 | ||
|
b0a68be851 | ||
|
127e7ed9e2 | ||
|
a29320acf2 | ||
|
113a6e354a | ||
|
b0de2d8a0b | ||
|
880a64c6c1 | ||
|
7ebc4f4cb5 | ||
|
cb0d2aea88 | ||
|
2c47fabcd5 | ||
|
00c4899f3c | ||
|
617675302c | ||
|
64b9d6cdd6 | ||
|
3fb4d18b7e | ||
|
0d1c553ee1 | ||
|
057e892729 | ||
|
54dad0f36a | ||
|
50f78eea5e | ||
|
c455ccbc98 | ||
|
e18cac5842 | ||
|
608c5cbb58 | ||
|
9909c282fb | ||
|
9065c5260c | ||
|
bab35223bb | ||
|
9454942af6 | ||
|
a7d5601d7b | ||
|
982145d5cb | ||
|
60d96777b0 | ||
|
045187975f | ||
|
2c2c654387 | ||
|
808f60a96e | ||
|
3d0980953b | ||
|
35642a468b | ||
|
f2541bcca9 | ||
|
d973079821 | ||
|
fdcb845a4a | ||
|
75fd16de9d | ||
|
56b3e56c9f | ||
|
fc1bd8a1cc | ||
|
80dc92e177 | ||
|
40689b6400 | ||
|
16dd9002b3 | ||
|
057bdc925f | ||
|
5651643360 | ||
|
2aced1f5f5 | ||
|
644d592561 | ||
|
6ea86f3f70 | ||
|
e4d1951c51 | ||
|
6b98d22ee4 | ||
|
5c1b71eba2 | ||
|
5fa1677332 | ||
|
5eb3fd204c | ||
|
2a0028cb0c | ||
|
cf999c38ab | ||
|
9c898756f0 | ||
|
de9e6bb204 | ||
|
8939886e1f | ||
|
0023b789e2 | ||
|
9cd0ac3abf | ||
|
a1f1c7abe7 | ||
|
139eb681b4 | ||
|
5ddaaf61d0 | ||
|
fbd46800c0 | ||
|
2971cdedeb | ||
|
ea875acac9 | ||
|
49a01fe81b | ||
|
6c8e0c5a89 | ||
|
2ab66b0d21 | ||
|
cc78074c22 | ||
|
1429bebf80 | ||
|
1aa6903a96 | ||
|
266ab67253 | ||
|
6f67cbdea4 | ||
|
d83ed61e8e | ||
|
6dd9ad9361 | ||
|
4a4b4a3cf1 | ||
|
6c8250a995 | ||
|
f88f73d395 | ||
|
e9887d8f45 | ||
|
33429ee6ce | ||
|
4959dceffc | ||
|
b4295d17ff | ||
|
6645435c2c | ||
|
24cfacbd70 | ||
|
7426e648a6 | ||
|
132bad3de9 | ||
|
2635f15469 | ||
|
81e6a158f6 | ||
|
f0d771d2e3 | ||
|
ff68b7af26 | ||
|
c675d34296 | ||
|
68ecd55d8c | ||
|
08f153f434 | ||
|
1f9cbd2853 | ||
|
67c977009b | ||
|
051e944693 | ||
|
db5a12bbcd | ||
|
0c6fcbd383 | ||
|
8a3e961550 | ||
|
8a1be75f27 | ||
|
ad47afb6e0 | ||
|
55dab979ec | ||
|
7e12d8024f | ||
|
dac4b4a771 | ||
|
f946c609e4 | ||
|
d2cd87c35b | ||
|
d6386bf679 | ||
|
4baeaea176 | ||
|
acb9c5e519 | ||
|
9bc6fb90c9 | ||
|
8fdc3cd902 | ||
|
b2e8af0b25 | ||
|
510d0fe993 | ||
|
b5974553da | ||
|
679de94c18 | ||
|
660f3690dc | ||
|
e0d19dbe8c | ||
|
6c0184d1a2 | ||
|
47afaf1043 | ||
|
91a0a1809d | ||
|
f233b4b6d3 | ||
|
a433afb317 | ||
|
b86ab4ac5c | ||
|
4d40e852aa | ||
|
7831f9fd16 | ||
|
d0ed185ec1 | ||
|
a2ff858685 | ||
|
f36f63d4a8 | ||
|
08546bbbd8 | ||
|
c36106c1fc | ||
|
d1860be2ad | ||
|
1e3f80d046 | ||
|
d5e06f67e0 | ||
|
36a41fd9b4 | ||
|
f3151e820c | ||
|
bf2a1abde4 | ||
|
1ed87db152 | ||
|
573fc8e2b4 | ||
|
158ba3ee93 | ||
|
e18f886111 | ||
|
ccf25b41e1 | ||
|
a20bb5033c | ||
|
43b89472d3 | ||
|
399dd9003f | ||
|
0e538ee6e8 | ||
|
bec1c76415 | ||
|
0259407fc2 | ||
|
957b62620c | ||
|
ffd7e0bc23 | ||
|
613a1c8b3e | ||
|
d2f0fe9d46 | ||
|
ae316e81be | ||
|
df04490b5d | ||
|
b69dc9baf3 | ||
|
407bc3722b | ||
|
12e89ad5c2 | ||
|
4593e04b26 | ||
|
d1fe3f8f6e | ||
|
ebdd4a71c6 | ||
|
cc6c2f56af | ||
|
a71737827a | ||
|
3ad5d718a0 | ||
|
bfc295e5b8 | ||
|
c55cd801ec | ||
|
b7ea59e954 | ||
|
73bb621462 | ||
|
aa797eff1c | ||
|
f474efdc5f | ||
|
d0f3f0b345 | ||
|
9c1673fb52 | ||
|
8195adaadf | ||
|
01aa8fd17e | ||
|
35287e4c29 | ||
|
6c0739b4ab | ||
|
97b8623f29 | ||
|
0c0cfdcfda | ||
|
9d77da9912 | ||
|
4cdceacb94 | ||
|
685efbcddc | ||
|
a2c103c6a1 | ||
|
e3fb5db561 | ||
|
afb0797f06 | ||
|
1570501acc | ||
|
fda8d39147 | ||
|
8161c3f97c | ||
|
8bcf67092b | ||
|
a3cf49e786 | ||
|
c0dce2e425 | ||
|
89b178dbd2 | ||
|
647092f299 | ||
|
8100a1f463 | ||
|
7b40f03369 | ||
|
f69e1ef2d3 | ||
|
cd3af46b7a | ||
|
3398251281 | ||
|
084c7bc8bb | ||
|
3203ef13e0 | ||
|
afc689a7cc | ||
|
7265dcffb7 | ||
|
c8e9132e68 | ||
|
13a50efff0 | ||
|
396695aea7 | ||
|
683a7128b7 | ||
|
7622f73a74 | ||
|
8e61509140 | ||
|
21603a0e5c | ||
|
ba5f0c175c | ||
|
846a8c6d72 | ||
|
71c376b101 | ||
|
d49d7f05e7 | ||
|
084421c942 | ||
|
60b59b8c2d | ||
|
04b1e5a5b0 | ||
|
237ef309e1 | ||
|
dccbefbea0 | ||
|
0ba0736b68 | ||
|
c21985cc24 | ||
|
1786c73219 | ||
|
d75974bb08 | ||
|
3cedc30260 | ||
|
c1cbf7dacd | ||
|
c41aeef961 | ||
|
e9aaf03974 | ||
|
bb614fb9aa | ||
|
b397a85e77 | ||
|
d2b3507822 | ||
|
4caf071049 | ||
|
c60755a8c6 | ||
|
989a2be326 | ||
|
295bbfa24a | ||
|
26aea3e9a3 | ||
|
87c7452dd0 | ||
|
491559c0e2 | ||
|
503fa81aff | ||
|
086942e267 | ||
|
1b4b940469 | ||
|
f2ee6af689 | ||
|
213873ca42 | ||
|
8a61dcbaf4 | ||
|
710bae8ff5 | ||
|
45f1400328 | ||
|
69695c86de | ||
|
960d9cf372 | ||
|
6cb0da6682 | ||
|
f109df3523 | ||
|
b0fb3c0399 | ||
|
b18697c15e | ||
|
f6fefb7245 | ||
|
4d17e38218 | ||
|
d1571ea360 | ||
|
59aaeca4c5 | ||
|
bd2a7ea9db | ||
|
f8547729d3 | ||
|
b463b48312 | ||
|
0381c595b8 | ||
|
c0180acd71 | ||
|
e9bdee41e3 | ||
|
af11cd38b9 | ||
|
ef7062d1eb | ||
|
7c88d64676 | ||
|
43379d2369 | ||
|
db57ced2bb | ||
|
0035c47d2a | ||
|
cce6a3e0b8 | ||
|
49dbbf0ccf | ||
|
33a07403d2 | ||
|
8f317b0318 | ||
|
f2ee3bc413 | ||
|
8a5982434e | ||
|
1abd584d95 | ||
|
51ac0be637 | ||
|
7436b2c6da | ||
|
c88d67eb8b | ||
|
a2ac407bad | ||
|
2f80e9a67e | ||
|
6122d7faa0 | ||
|
2a5ba15209 | ||
|
a2693aafce | ||
|
e2fe610288 | ||
|
acb3623570 | ||
|
344010a9ed | ||
|
a5b8676172 | ||
|
a93d08e549 | ||
|
0a21312bc2 | ||
|
703c6d0e8c | ||
|
217b7bc0d7 | ||
|
c1ca789ee5 | ||
|
d13b86fa03 | ||
|
b7128059d2 | ||
|
8b47d493de | ||
|
32252e57f7 | ||
|
47ed47126f | ||
|
e476a36695 | ||
|
1d6363bbb9 | ||
|
9e337d45c1 | ||
|
dd28200b0f | ||
|
e3b0db878d | ||
|
84c3421d38 | ||
|
b1e5645a2c | ||
|
28958d9491 | ||
|
078bd82644 | ||
|
3a5da20c4d | ||
|
5ff1667655 | ||
|
04b4f4a0e1 | ||
|
8935183fc6 | ||
|
c35f2ff970 | ||
|
a9b06c2b72 | ||
|
1a52dad483 | ||
|
15f3db8ef8 | ||
|
aa300c0226 | ||
|
5bc033cf40 | ||
|
bf0cb84ac7 | ||
|
6e57ccdfee | ||
|
a44fc51dc0 | ||
|
bdd599e92e | ||
|
ffb668930c | ||
|
10cdc36606 | ||
|
37ad066aa3 | ||
|
27fbea0cad | ||
|
bce4b1456d | ||
|
9e6f174c17 | ||
|
6e0063630c | ||
|
a1d5916215 | ||
|
9f8d29ee40 | ||
|
ee14ca2bb7 | ||
|
c223e3cf28 | ||
|
4637ca3564 | ||
|
c5ff2053fe | ||
|
1664ec58b0 | ||
|
5242e75cd7 | ||
|
bbe70b3a7e | ||
|
36097d42da | ||
|
9b21962c30 | ||
|
96f3da8557 | ||
|
2ec65bb116 | ||
|
9f528c6e4e | ||
|
dfcf9cf354 | ||
|
c622e4af08 | ||
|
b3735fc9c6 | ||
|
042e6b1ed6 | ||
|
199296b2a6 | ||
|
108268e8a6 | ||
|
db97205169 | ||
|
105e64b11a | ||
|
4bbd683382 | ||
|
b4344e38a5 | ||
|
85a29989f5 | ||
|
745818e62b | ||
|
b38d518214 | ||
|
2e87eb5670 | ||
|
92295a83e1 | ||
|
7eddd53cd5 | ||
|
04631ddc18 | ||
|
4782c7e448 | ||
|
1948fdcd26 | ||
|
07b7b27f3a | ||
|
cae79c2b68 | ||
|
4fb5e9cfac | ||
|
8c2ff4562c | ||
|
c09d6f0a74 | ||
|
e49f1539ed | ||
|
974d3b34ab | ||
|
803555c1ae | ||
|
bc3677e27c | ||
|
7b7fb9177e | ||
|
4a431a9ed2 | ||
|
e9c97cff89 | ||
|
43162be6ff | ||
|
2621374519 | ||
|
a56223c418 | ||
|
c8876d1a5c | ||
|
f720b205be | ||
|
c433aa5b34 | ||
|
031ae68a7f | ||
|
bd7274d345 | ||
|
e683756ea2 | ||
|
2b843d24b9 | ||
|
cfa0c89178 | ||
|
16d3729f03 | ||
|
cc4cc7f265 | ||
|
6098ac90ec | ||
|
fb10c60e32 | ||
|
9460bd1a9f | ||
|
4b2d2e8586 | ||
|
670086c049 | ||
|
8fcb0cf97c | ||
|
64258b7742 | ||
|
e03a3d3aa6 | ||
|
aa322427e1 | ||
|
98edd5ac90 | ||
|
d29d8235db | ||
|
4356d2fbca | ||
|
333b2e0eab | ||
|
53801b03ec | ||
|
a52097ff1c | ||
|
63a1be763e | ||
|
885f881a83 | ||
|
41a7211715 | ||
|
0e3e6e27ea | ||
|
cdad3dbe3a | ||
|
d7276da2ea | ||
|
02c96d412e | ||
|
c59e902c87 | ||
|
7e2053d808 | ||
|
0db41aab10 | ||
|
8df4c9d4d5 | ||
|
416e5c42a8 | ||
|
4af1506648 | ||
|
1b759733a7 | ||
|
bc86bff22b | ||
|
412637442f | ||
|
bf7d4a5045 | ||
|
db57b474d9 | ||
|
98d9052aaf | ||
|
2c3937f1e2 | ||
|
8c4a37ef9a | ||
|
d90bb4640a | ||
|
ea21c68147 | ||
|
7149b5d630 | ||
|
99da63d7b2 | ||
|
396db40877 | ||
|
b33b58af61 | ||
|
75f8661ac9 | ||
|
ab316ad2e1 | ||
|
daa291b2b8 | ||
|
bac7e86217 | ||
|
00aed06518 | ||
|
18bd30cdbc | ||
|
8ecb679ac3 | ||
|
e463c2bfb8 | ||
|
7a74f411a4 | ||
|
6112767ad3 | ||
|
84a3079378 | ||
|
d277fc4fde | ||
|
61938c9430 | ||
|
4b49a3deab | ||
|
ec195a15f4 | ||
|
d55b076737 | ||
|
c25b09355c | ||
|
bec45c4dbd | ||
|
c6a9cef362 | ||
|
754bdd855d | ||
|
748085f8aa | ||
|
3fead84f59 | ||
|
43c62a5d9c | ||
|
98311a6b8d | ||
|
9ba05e0fbe | ||
|
326310d5c9 | ||
|
20cfd8af73 | ||
|
86eb3d54f1 | ||
|
d7c0e2fece | ||
|
4c52cdc097 | ||
|
9b1051b6d6 | ||
|
3a39c4cf7f | ||
|
9f3e0d2ff3 | ||
|
46cc0b729f | ||
|
24908febbc | ||
|
fad8151ca1 | ||
|
d207d9a7ef | ||
|
8577eeb96a | ||
|
8f9d637d62 | ||
|
b029905968 | ||
|
2969605ad7 | ||
|
94e8eee976 | ||
|
606dca4864 | ||
|
a25603fc99 | ||
|
3c0d44c8a2 | ||
|
8653889fea | ||
|
cac25115ab | ||
|
3388885b1b | ||
|
d049a80010 | ||
|
071ed15947 | ||
|
b1245bffc0 | ||
|
70a19739e1 | ||
|
262e5ffd9d | ||
|
7c183177bd | ||
|
771887c01a | ||
|
dccf63bb86 | ||
|
398d180652 | ||
|
aef11c660f | ||
|
e8c857e05a | ||
|
c8775600f2 | ||
|
6a80862f8a | ||
|
df6430a127 | ||
|
12daf60f95 | ||
|
61e655b212 | ||
|
76a22655cc | ||
|
77fc8bd16b | ||
|
2a35f37d8e | ||
|
9709bd6449 | ||
|
d879d57baf | ||
|
bd70a8365b | ||
|
c9b6313a72 | ||
|
c8b991d5df | ||
|
cfa2e8b69e | ||
|
c56e69fd1a | ||
|
c15f247b61 | ||
|
7e4a526e3d | ||
|
7114988372 | ||
|
f1aa2728ca | ||
|
010b91d618 | ||
|
9b9ebf0533 | ||
|
1e1d11e217 | ||
|
212a7aea17 | ||
|
4d7bcf92ea | ||
|
3051b32d07 | ||
|
14ccf796d5 | ||
|
35b9d8b07c | ||
|
253a4452c6 | ||
|
0973ddadec | ||
|
83abb49752 | ||
|
e7b8e573e2 | ||
|
392ea470b2 | ||
|
988a6b5202 | ||
|
a3b080d49a |
4
.editorconfig
Normal file
4
.editorconfig
Normal file
@ -0,0 +1,4 @@
|
||||
root = true
|
||||
|
||||
[*.java]
|
||||
indent_style = space
|
2
.github/FUNDING.yml
vendored
Normal file
2
.github/FUNDING.yml
vendored
Normal file
@ -0,0 +1,2 @@
|
||||
github: [creeper123123321, FlorianMichael]
|
||||
custom: ['https://creeper123123321.github.io/#donate', 'https://florianmichael.de/donate']
|
26
.github/ISSUE_TEMPLATE/bug_report.md
vendored
26
.github/ISSUE_TEMPLATE/bug_report.md
vendored
@ -1,26 +0,0 @@
|
||||
---
|
||||
name: Bug report
|
||||
about: Create a bug report so we can fix it
|
||||
|
||||
---
|
||||
|
||||
**Describe the bug, provide any errors**
|
||||
A clear and concise description of what the bug is. Can you https://hastebin.com the error?
|
||||
|
||||
**How can we reproduce it?**
|
||||
Steps to reproduce the behavior:
|
||||
1. Login on 1.12'
|
||||
2. Click on '....'
|
||||
3. The '....' is displayed wrong
|
||||
|
||||
**Expected behaviour**
|
||||
A clear and concise description of what you expected to happen.
|
||||
|
||||
**Screenshots**
|
||||
If applicable, add screenshots to help explain your problem.
|
||||
|
||||
**ViaVersion Dump:**
|
||||
- Type /viaversion dump, and put the link here.
|
||||
|
||||
**Additional server info**
|
||||
Do you use a proxy (eg. BungeeCord)? What software do you use and what plugins?
|
92
.github/ISSUE_TEMPLATE/bug_report.yml
vendored
Normal file
92
.github/ISSUE_TEMPLATE/bug_report.yml
vendored
Normal file
@ -0,0 +1,92 @@
|
||||
name: Bug Report
|
||||
description: Report a bug or console error
|
||||
labels: [bug]
|
||||
|
||||
body:
|
||||
- type: markdown
|
||||
attributes:
|
||||
value: |
|
||||
**Before reporting a bug, please see if using master/dev builds from https://ci.viaversion.com/ fixes your issue.**
|
||||
Whenever you see fit, you can upload images or videos to any of the text fields.
|
||||
|
||||
- type: input
|
||||
attributes:
|
||||
label: "`/viaversion dump` Output"
|
||||
description: |
|
||||
Run `/viaversion dump` in the console or in the chat, then copy and paste the given link here. If you're using client-side mode, run it on singleplayer mode.
|
||||
placeholder: |
|
||||
https://dump.viaversion.com/...
|
||||
validations:
|
||||
required: true
|
||||
|
||||
- type: textarea
|
||||
attributes:
|
||||
label: Console 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.
|
||||
value: |
|
||||
```
|
||||
Put the mclo.gs link or text here.
|
||||
```
|
||||
placeholder: Please do not remove the grave accents; simply replace the line of text in the middle.
|
||||
validations:
|
||||
required: false
|
||||
|
||||
- type: textarea
|
||||
attributes:
|
||||
label: Bug Description
|
||||
description: |
|
||||
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."
|
||||
validations:
|
||||
required: true
|
||||
|
||||
- type: textarea
|
||||
attributes:
|
||||
label: Steps to Reproduce
|
||||
description: |
|
||||
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
|
||||
2. Place a sign
|
||||
3. The sign text is displayed wrong
|
||||
validations:
|
||||
required: true
|
||||
|
||||
- type: textarea
|
||||
attributes:
|
||||
label: Expected Behavior
|
||||
description: |
|
||||
Describe what exactly you expected to happen.
|
||||
placeholder: |
|
||||
Example: "Placed sign text should not disappear."
|
||||
validations:
|
||||
required: true
|
||||
|
||||
- type: textarea
|
||||
attributes:
|
||||
label: Additional Server Info
|
||||
description: |
|
||||
Does the server use a proxy (eg. Velocity)? What software are used and what plugins/mods (Check with F3 debug menu)? Are you using client-side mode?
|
||||
placeholder: |
|
||||
Example: "I also use Velocity with the following plugins: x, y, z"
|
||||
validations:
|
||||
required: false
|
||||
|
||||
- type: checkboxes
|
||||
attributes:
|
||||
label: Checklist
|
||||
description: Make sure you have followed each of the steps outlined here.
|
||||
options:
|
||||
- label: I have checked if this is specific to ViaFabric platform, and doesn't happen when running it on other platforms (Paper/Sponge/Velocity/Waterfall).
|
||||
required: false
|
||||
- label: I have included a ViaVersion dump.
|
||||
required: true
|
||||
- label: If applicable, I have included a paste (**not a screenshot**) of the error.
|
||||
required: true
|
||||
- label: I have tried the latest build(s) from https://ci.viaversion.com/ and the issue still persists.
|
||||
required: true
|
9
.github/ISSUE_TEMPLATE/feature_request.md
vendored
9
.github/ISSUE_TEMPLATE/feature_request.md
vendored
@ -1,12 +1,19 @@
|
||||
---
|
||||
name: Feature request
|
||||
about: Suggest an idea for ViaVersion
|
||||
about: Suggest an idea for ViaFabric
|
||||
title: ''
|
||||
labels: enhancement
|
||||
assignees: ''
|
||||
|
||||
---
|
||||
|
||||
**Is your feature request related to a problem? Please describe.**
|
||||
A clear and concise description of what the problem is. Ex. I'm always frustrated when [...]
|
||||
|
||||
**Is this related specifically to ViaFabric?**
|
||||
(Optional)
|
||||
- [ ] It seems to not apply for ViaVersion/ViaBackwards/ViaRewind installed on Bukkit/BungeeCord/Sponge/Velocity servers.
|
||||
|
||||
**Describe the solution you'd like**
|
||||
A clear and concise description of what you want to happen.
|
||||
|
||||
|
6
.github/dependabot.yml
vendored
Normal file
6
.github/dependabot.yml
vendored
Normal file
@ -0,0 +1,6 @@
|
||||
version: 2
|
||||
updates:
|
||||
- package-ecosystem: "github-actions"
|
||||
directory: "/"
|
||||
schedule:
|
||||
interval: "weekly"
|
33
.github/workflows/build.yml
vendored
Normal file
33
.github/workflows/build.yml
vendored
Normal file
@ -0,0 +1,33 @@
|
||||
name: Build
|
||||
on: [ pull_request, push, workflow_dispatch ]
|
||||
|
||||
jobs:
|
||||
build:
|
||||
runs-on: ubuntu-24.04
|
||||
steps:
|
||||
- name: Checkout Repository
|
||||
uses: actions/checkout@v4
|
||||
- name: Validate Gradle Wrapper
|
||||
uses: gradle/actions/wrapper-validation@v4
|
||||
- name: Set up JDK 21
|
||||
uses: actions/setup-java@v4
|
||||
with:
|
||||
distribution: 'temurin'
|
||||
java-version: 21
|
||||
check-latest: true
|
||||
- name: Cache Dependencies
|
||||
uses: actions/cache@v4
|
||||
with:
|
||||
path: |
|
||||
~/.gradle/caches
|
||||
~/.gradle/wrapper
|
||||
key: ${{ runner.os }}-gradle-${{ hashFiles('**/*.gradle*', '**/gradle-wrapper.properties') }}
|
||||
restore-keys: |
|
||||
${{ runner.os }}-gradle-
|
||||
- name: Build with Gradle
|
||||
run: ./gradlew build
|
||||
- name: Upload Artifacts
|
||||
uses: actions/upload-artifact@v4
|
||||
with:
|
||||
name: Artifacts
|
||||
path: build/libs/
|
23
.github/workflows/publish.yml
vendored
Normal file
23
.github/workflows/publish.yml
vendored
Normal file
@ -0,0 +1,23 @@
|
||||
name: Publish to CurseForge and Modrinth
|
||||
on: [workflow_dispatch] # Manual trigger
|
||||
|
||||
jobs:
|
||||
publish:
|
||||
if: github.repository_owner == 'ViaVersion'
|
||||
runs-on: ubuntu-24.04
|
||||
steps:
|
||||
- name: Checkout Repository
|
||||
uses: actions/checkout@v4
|
||||
- name: Validate Gradle Wrapper
|
||||
uses: gradle/actions/wrapper-validation@v4
|
||||
- name: Set up JDK 21
|
||||
uses: actions/setup-java@v4
|
||||
with:
|
||||
distribution: 'temurin'
|
||||
java-version: 21
|
||||
check-latest: true
|
||||
- name: Build and Publish
|
||||
env:
|
||||
CURSEFORGE_API_KEY: ${{ secrets.CREEPER_CF }}
|
||||
MODRINTH_TOKEN: ${{ secrets.MODRINTH_TOKEN }}
|
||||
run: ./gradlew curseforge modrinth
|
20
.github/workflows/update-gradle-wrapper.yml
vendored
Normal file
20
.github/workflows/update-gradle-wrapper.yml
vendored
Normal file
@ -0,0 +1,20 @@
|
||||
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
|
||||
- name: Set up JDK 21
|
||||
uses: actions/setup-java@v4
|
||||
with:
|
||||
distribution: 'temurin'
|
||||
java-version: 21
|
||||
check-latest: true
|
||||
- name: Update Gradle Wrapper
|
||||
uses: gradle-update/update-gradle-wrapper-action@v2
|
10
.idea/copyright/profiles_settings.xml
Normal file
10
.idea/copyright/profiles_settings.xml
Normal file
@ -0,0 +1,10 @@
|
||||
<component name="CopyrightManager">
|
||||
<settings default="viafabric-gpl">
|
||||
<module2copyright>
|
||||
<element module="Project Files" copyright="viafabric-gpl" />
|
||||
</module2copyright>
|
||||
<LanguageOptions name="__TEMPLATE__">
|
||||
<option name="addBlankAfter" value="false" />
|
||||
</LanguageOptions>
|
||||
</settings>
|
||||
</component>
|
6
.idea/copyright/viafabric_gpl.xml
Normal file
6
.idea/copyright/viafabric_gpl.xml
Normal file
@ -0,0 +1,6 @@
|
||||
<component name="CopyrightManager">
|
||||
<copyright>
|
||||
<option name="notice" value="This file is part of ViaFabric - https://github.com/ViaVersion/ViaFabric Copyright (C) 2018-&#36;today.year ViaVersion and contributors This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program. If not, see <http://www.gnu.org/licenses/>." />
|
||||
<option name="myName" value="viafabric-gpl" />
|
||||
</copyright>
|
||||
</component>
|
23
.travis.yml
23
.travis.yml
@ -1,23 +0,0 @@
|
||||
|
||||
language: java
|
||||
#before_cache:
|
||||
#- rm -f $HOME/.gradle/caches/modules-2/modules-2.lock
|
||||
#- rm -fr $HOME/.gradle/caches/*/plugin-resolution/
|
||||
#cache:
|
||||
# directories:
|
||||
# - "$HOME/.gradle/caches/"
|
||||
# - "$HOME/.gradle/wrapper/"
|
||||
deploy:
|
||||
provider: releases
|
||||
api_key:
|
||||
secure: B+xrpk79kvRF5AhNqHKlsUd1vloo4xe1oZjzsmsm67rrd2RS9iBgpRBC5YfCeYmxj5HviBjQx3Qzdu/zzaYP9ry5IT17t5g3OcPpP9GynyinIlfAN6TUlk9u0D7ojSYV6JJjD7Go8K9+U5E+jEn4cSIVQ4kFWH62lDyjjNQqZitd4p+/J9M4p5sQ9BiC2oUIFVMrOXZs5v0tqVSCWGp/s2OkX+ie/RYm1ULW4vvpwTlK2+fklOfq2qyityPtV1v6DQoOMJ4GdouBVGtva7hdnuHtCCqVvwTnpgmItLE68uCczgR4gQ5SIeCo7Vppda6jSseA5DDku1YwUUTRm1VOENhmv3iln9sDRiZbX17d86689FslMAltSggmg4urEPmjzlP55NCebvEsQoKp8x3XuViUOUqkQS+e/IGkK1F4oeh4YB7Mz6LyGM3TOv2gfE+nbQ4xU7s1nELoqdwUp2HshN4SFxurLtKDfC2/ZHRwtwXhGbEQgK0TSRSohxoE8a1XZvXLJ+ddc8ZZX8LqBiKgXkkEyvpAehAqK+lWsqIBJp+828CMeUet9sYNJ9QkAy3Lz8ecwuzCXEuacTW+f6XW1rBr2wPSXOJQt45xt4IfW1so7G1V5QSmcExU3uKKxkgekOnhZjT8LTmUpaSBW1Nu2a5kKuHnHvs0uDexhoJ/cEs=
|
||||
file_glob: true
|
||||
file: build/libs/*
|
||||
skip_cleanup: true
|
||||
on:
|
||||
repo: ViaVersion/ViaFabric
|
||||
install: true
|
||||
script:
|
||||
# Set up git user name and tag this commit
|
||||
- if [ -z $TRAVIS_TAG ] && [ -z $(git tag -l --points-at HEAD) ]; then git config --local user.name "creeper12313321"; git config --local user.email "7974274+creeper123123321@users.noreply.github.com"; export TRAVIS_TAG=build-$TRAVIS_JOB_NUMBER; git tag $TRAVIS_TAG; fi
|
||||
- ./gradlew clean build
|
17
CONTRIBUTING.md
Normal file
17
CONTRIBUTING.md
Normal file
@ -0,0 +1,17 @@
|
||||
# Contributing
|
||||
|
||||
## Language Files
|
||||
|
||||
Language files are under ``src/main/resources/assets/viafabric/lang/``. Please edit ``.json`` files. Create a ``.lang``
|
||||
with ``${nameofjson}``, so the build script can convert automatically to the old format.
|
||||
|
||||
Use capitalization rules from your language. Try to be consistent with Minecraft language files.
|
||||
|
||||
Please check in-game string length. Note that abbreviations may cause issues with the screen reader.
|
||||
|
||||
Take a look at UN's guidelines for Gender-inclusive
|
||||
language: https://www.un.org/en/gender-inclusive-language/guidelines.shtml
|
||||
|
||||
## Source Code
|
||||
|
||||
Use 4 spaces, run code cleanup and ``optipng`` on new png files.
|
687
LICENSE
687
LICENSE
@ -1,21 +1,674 @@
|
||||
MIT License
|
||||
GNU GENERAL PUBLIC LICENSE
|
||||
Version 3, 29 June 2007
|
||||
|
||||
Copyright (c) 2018 creeper123123321 and contributors
|
||||
Copyright (C) 2007 Free Software Foundation, Inc. <https://fsf.org/>
|
||||
Everyone is permitted to copy and distribute verbatim copies
|
||||
of this license document, but changing it is not allowed.
|
||||
|
||||
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:
|
||||
Preamble
|
||||
|
||||
The above copyright notice and this permission notice shall be included in all
|
||||
copies or substantial portions of the Software.
|
||||
The GNU General Public License is a free, copyleft license for
|
||||
software and other kinds of works.
|
||||
|
||||
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.
|
||||
The licenses for most software and other practical works are designed
|
||||
to take away your freedom to share and change the works. By contrast,
|
||||
the GNU General Public License is intended to guarantee your freedom to
|
||||
share and change all versions of a program--to make sure it remains free
|
||||
software for all its users. We, the Free Software Foundation, use the
|
||||
GNU General Public License for most of our software; it applies also to
|
||||
any other work released this way by its authors. You can apply it to
|
||||
your programs, too.
|
||||
|
||||
When we speak of free software, we are referring to freedom, not
|
||||
price. Our General Public Licenses are designed to make sure that you
|
||||
have the freedom to distribute copies of free software (and charge for
|
||||
them if you wish), that you receive source code or can get it if you
|
||||
want it, that you can change the software or use pieces of it in new
|
||||
free programs, and that you know you can do these things.
|
||||
|
||||
To protect your rights, we need to prevent others from denying you
|
||||
these rights or asking you to surrender the rights. Therefore, you have
|
||||
certain responsibilities if you distribute copies of the software, or if
|
||||
you modify it: responsibilities to respect the freedom of others.
|
||||
|
||||
For example, if you distribute copies of such a program, whether
|
||||
gratis or for a fee, you must pass on to the recipients the same
|
||||
freedoms that you received. You must make sure that they, too, receive
|
||||
or can get the source code. And you must show them these terms so they
|
||||
know their rights.
|
||||
|
||||
Developers that use the GNU GPL protect your rights with two steps:
|
||||
(1) assert copyright on the software, and (2) offer you this License
|
||||
giving you legal permission to copy, distribute and/or modify it.
|
||||
|
||||
For the developers' and authors' protection, the GPL clearly explains
|
||||
that there is no warranty for this free software. For both users' and
|
||||
authors' sake, the GPL requires that modified versions be marked as
|
||||
changed, so that their problems will not be attributed erroneously to
|
||||
authors of previous versions.
|
||||
|
||||
Some devices are designed to deny users access to install or run
|
||||
modified versions of the software inside them, although the manufacturer
|
||||
can do so. This is fundamentally incompatible with the aim of
|
||||
protecting users' freedom to change the software. The systematic
|
||||
pattern of such abuse occurs in the area of products for individuals to
|
||||
use, which is precisely where it is most unacceptable. Therefore, we
|
||||
have designed this version of the GPL to prohibit the practice for those
|
||||
products. If such problems arise substantially in other domains, we
|
||||
stand ready to extend this provision to those domains in future versions
|
||||
of the GPL, as needed to protect the freedom of users.
|
||||
|
||||
Finally, every program is threatened constantly by software patents.
|
||||
States should not allow patents to restrict development and use of
|
||||
software on general-purpose computers, but in those that do, we wish to
|
||||
avoid the special danger that patents applied to a free program could
|
||||
make it effectively proprietary. To prevent this, the GPL assures that
|
||||
patents cannot be used to render the program non-free.
|
||||
|
||||
The precise terms and conditions for copying, distribution and
|
||||
modification follow.
|
||||
|
||||
TERMS AND CONDITIONS
|
||||
|
||||
0. Definitions.
|
||||
|
||||
"This License" refers to version 3 of the GNU General Public License.
|
||||
|
||||
"Copyright" also means copyright-like laws that apply to other kinds of
|
||||
works, such as semiconductor masks.
|
||||
|
||||
"The Program" refers to any copyrightable work licensed under this
|
||||
License. Each licensee is addressed as "you". "Licensees" and
|
||||
"recipients" may be individuals or organizations.
|
||||
|
||||
To "modify" a work means to copy from or adapt all or part of the work
|
||||
in a fashion requiring copyright permission, other than the making of an
|
||||
exact copy. The resulting work is called a "modified version" of the
|
||||
earlier work or a work "based on" the earlier work.
|
||||
|
||||
A "covered work" means either the unmodified Program or a work based
|
||||
on the Program.
|
||||
|
||||
To "propagate" a work means to do anything with it that, without
|
||||
permission, would make you directly or secondarily liable for
|
||||
infringement under applicable copyright law, except executing it on a
|
||||
computer or modifying a private copy. Propagation includes copying,
|
||||
distribution (with or without modification), making available to the
|
||||
public, and in some countries other activities as well.
|
||||
|
||||
To "convey" a work means any kind of propagation that enables other
|
||||
parties to make or receive copies. Mere interaction with a user through
|
||||
a computer network, with no transfer of a copy, is not conveying.
|
||||
|
||||
An interactive user interface displays "Appropriate Legal Notices"
|
||||
to the extent that it includes a convenient and prominently visible
|
||||
feature that (1) displays an appropriate copyright notice, and (2)
|
||||
tells the user that there is no warranty for the work (except to the
|
||||
extent that warranties are provided), that licensees may convey the
|
||||
work under this License, and how to view a copy of this License. If
|
||||
the interface presents a list of user commands or options, such as a
|
||||
menu, a prominent item in the list meets this criterion.
|
||||
|
||||
1. Source Code.
|
||||
|
||||
The "source code" for a work means the preferred form of the work
|
||||
for making modifications to it. "Object code" means any non-source
|
||||
form of a work.
|
||||
|
||||
A "Standard Interface" means an interface that either is an official
|
||||
standard defined by a recognized standards body, or, in the case of
|
||||
interfaces specified for a particular programming language, one that
|
||||
is widely used among developers working in that language.
|
||||
|
||||
The "System Libraries" of an executable work include anything, other
|
||||
than the work as a whole, that (a) is included in the normal form of
|
||||
packaging a Major Component, but which is not part of that Major
|
||||
Component, and (b) serves only to enable use of the work with that
|
||||
Major Component, or to implement a Standard Interface for which an
|
||||
implementation is available to the public in source code form. A
|
||||
"Major Component", in this context, means a major essential component
|
||||
(kernel, window system, and so on) of the specific operating system
|
||||
(if any) on which the executable work runs, or a compiler used to
|
||||
produce the work, or an object code interpreter used to run it.
|
||||
|
||||
The "Corresponding Source" for a work in object code form means all
|
||||
the source code needed to generate, install, and (for an executable
|
||||
work) run the object code and to modify the work, including scripts to
|
||||
control those activities. However, it does not include the work's
|
||||
System Libraries, or general-purpose tools or generally available free
|
||||
programs which are used unmodified in performing those activities but
|
||||
which are not part of the work. For example, Corresponding Source
|
||||
includes interface definition files associated with source files for
|
||||
the work, and the source code for shared libraries and dynamically
|
||||
linked subprograms that the work is specifically designed to require,
|
||||
such as by intimate data communication or control flow between those
|
||||
subprograms and other parts of the work.
|
||||
|
||||
The Corresponding Source need not include anything that users
|
||||
can regenerate automatically from other parts of the Corresponding
|
||||
Source.
|
||||
|
||||
The Corresponding Source for a work in source code form is that
|
||||
same work.
|
||||
|
||||
2. Basic Permissions.
|
||||
|
||||
All rights granted under this License are granted for the term of
|
||||
copyright on the Program, and are irrevocable provided the stated
|
||||
conditions are met. This License explicitly affirms your unlimited
|
||||
permission to run the unmodified Program. The output from running a
|
||||
covered work is covered by this License only if the output, given its
|
||||
content, constitutes a covered work. This License acknowledges your
|
||||
rights of fair use or other equivalent, as provided by copyright law.
|
||||
|
||||
You may make, run and propagate covered works that you do not
|
||||
convey, without conditions so long as your license otherwise remains
|
||||
in force. You may convey covered works to others for the sole purpose
|
||||
of having them make modifications exclusively for you, or provide you
|
||||
with facilities for running those works, provided that you comply with
|
||||
the terms of this License in conveying all material for which you do
|
||||
not control copyright. Those thus making or running the covered works
|
||||
for you must do so exclusively on your behalf, under your direction
|
||||
and control, on terms that prohibit them from making any copies of
|
||||
your copyrighted material outside their relationship with you.
|
||||
|
||||
Conveying under any other circumstances is permitted solely under
|
||||
the conditions stated below. Sublicensing is not allowed; section 10
|
||||
makes it unnecessary.
|
||||
|
||||
3. Protecting Users' Legal Rights From Anti-Circumvention Law.
|
||||
|
||||
No covered work shall be deemed part of an effective technological
|
||||
measure under any applicable law fulfilling obligations under article
|
||||
11 of the WIPO copyright treaty adopted on 20 December 1996, or
|
||||
similar laws prohibiting or restricting circumvention of such
|
||||
measures.
|
||||
|
||||
When you convey a covered work, you waive any legal power to forbid
|
||||
circumvention of technological measures to the extent such circumvention
|
||||
is effected by exercising rights under this License with respect to
|
||||
the covered work, and you disclaim any intention to limit operation or
|
||||
modification of the work as a means of enforcing, against the work's
|
||||
users, your or third parties' legal rights to forbid circumvention of
|
||||
technological measures.
|
||||
|
||||
4. Conveying Verbatim Copies.
|
||||
|
||||
You may convey verbatim copies of the Program's source code as you
|
||||
receive it, in any medium, provided that you conspicuously and
|
||||
appropriately publish on each copy an appropriate copyright notice;
|
||||
keep intact all notices stating that this License and any
|
||||
non-permissive terms added in accord with section 7 apply to the code;
|
||||
keep intact all notices of the absence of any warranty; and give all
|
||||
recipients a copy of this License along with the Program.
|
||||
|
||||
You may charge any price or no price for each copy that you convey,
|
||||
and you may offer support or warranty protection for a fee.
|
||||
|
||||
5. Conveying Modified Source Versions.
|
||||
|
||||
You may convey a work based on the Program, or the modifications to
|
||||
produce it from the Program, in the form of source code under the
|
||||
terms of section 4, provided that you also meet all of these conditions:
|
||||
|
||||
a) The work must carry prominent notices stating that you modified
|
||||
it, and giving a relevant date.
|
||||
|
||||
b) The work must carry prominent notices stating that it is
|
||||
released under this License and any conditions added under section
|
||||
7. This requirement modifies the requirement in section 4 to
|
||||
"keep intact all notices".
|
||||
|
||||
c) You must license the entire work, as a whole, under this
|
||||
License to anyone who comes into possession of a copy. This
|
||||
License will therefore apply, along with any applicable section 7
|
||||
additional terms, to the whole of the work, and all its parts,
|
||||
regardless of how they are packaged. This License gives no
|
||||
permission to license the work in any other way, but it does not
|
||||
invalidate such permission if you have separately received it.
|
||||
|
||||
d) If the work has interactive user interfaces, each must display
|
||||
Appropriate Legal Notices; however, if the Program has interactive
|
||||
interfaces that do not display Appropriate Legal Notices, your
|
||||
work need not make them do so.
|
||||
|
||||
A compilation of a covered work with other separate and independent
|
||||
works, which are not by their nature extensions of the covered work,
|
||||
and which are not combined with it such as to form a larger program,
|
||||
in or on a volume of a storage or distribution medium, is called an
|
||||
"aggregate" if the compilation and its resulting copyright are not
|
||||
used to limit the access or legal rights of the compilation's users
|
||||
beyond what the individual works permit. Inclusion of a covered work
|
||||
in an aggregate does not cause this License to apply to the other
|
||||
parts of the aggregate.
|
||||
|
||||
6. Conveying Non-Source Forms.
|
||||
|
||||
You may convey a covered work in object code form under the terms
|
||||
of sections 4 and 5, provided that you also convey the
|
||||
machine-readable Corresponding Source under the terms of this License,
|
||||
in one of these ways:
|
||||
|
||||
a) Convey the object code in, or embodied in, a physical product
|
||||
(including a physical distribution medium), accompanied by the
|
||||
Corresponding Source fixed on a durable physical medium
|
||||
customarily used for software interchange.
|
||||
|
||||
b) Convey the object code in, or embodied in, a physical product
|
||||
(including a physical distribution medium), accompanied by a
|
||||
written offer, valid for at least three years and valid for as
|
||||
long as you offer spare parts or customer support for that product
|
||||
model, to give anyone who possesses the object code either (1) a
|
||||
copy of the Corresponding Source for all the software in the
|
||||
product that is covered by this License, on a durable physical
|
||||
medium customarily used for software interchange, for a price no
|
||||
more than your reasonable cost of physically performing this
|
||||
conveying of source, or (2) access to copy the
|
||||
Corresponding Source from a network server at no charge.
|
||||
|
||||
c) Convey individual copies of the object code with a copy of the
|
||||
written offer to provide the Corresponding Source. This
|
||||
alternative is allowed only occasionally and noncommercially, and
|
||||
only if you received the object code with such an offer, in accord
|
||||
with subsection 6b.
|
||||
|
||||
d) Convey the object code by offering access from a designated
|
||||
place (gratis or for a charge), and offer equivalent access to the
|
||||
Corresponding Source in the same way through the same place at no
|
||||
further charge. You need not require recipients to copy the
|
||||
Corresponding Source along with the object code. If the place to
|
||||
copy the object code is a network server, the Corresponding Source
|
||||
may be on a different server (operated by you or a third party)
|
||||
that supports equivalent copying facilities, provided you maintain
|
||||
clear directions next to the object code saying where to find the
|
||||
Corresponding Source. Regardless of what server hosts the
|
||||
Corresponding Source, you remain obligated to ensure that it is
|
||||
available for as long as needed to satisfy these requirements.
|
||||
|
||||
e) Convey the object code using peer-to-peer transmission, provided
|
||||
you inform other peers where the object code and Corresponding
|
||||
Source of the work are being offered to the general public at no
|
||||
charge under subsection 6d.
|
||||
|
||||
A separable portion of the object code, whose source code is excluded
|
||||
from the Corresponding Source as a System Library, need not be
|
||||
included in conveying the object code work.
|
||||
|
||||
A "User Product" is either (1) a "consumer product", which means any
|
||||
tangible personal property which is normally used for personal, family,
|
||||
or household purposes, or (2) anything designed or sold for incorporation
|
||||
into a dwelling. In determining whether a product is a consumer product,
|
||||
doubtful cases shall be resolved in favor of coverage. For a particular
|
||||
product received by a particular user, "normally used" refers to a
|
||||
typical or common use of that class of product, regardless of the status
|
||||
of the particular user or of the way in which the particular user
|
||||
actually uses, or expects or is expected to use, the product. A product
|
||||
is a consumer product regardless of whether the product has substantial
|
||||
commercial, industrial or non-consumer uses, unless such uses represent
|
||||
the only significant mode of use of the product.
|
||||
|
||||
"Installation Information" for a User Product means any methods,
|
||||
procedures, authorization keys, or other information required to install
|
||||
and execute modified versions of a covered work in that User Product from
|
||||
a modified version of its Corresponding Source. The information must
|
||||
suffice to ensure that the continued functioning of the modified object
|
||||
code is in no case prevented or interfered with solely because
|
||||
modification has been made.
|
||||
|
||||
If you convey an object code work under this section in, or with, or
|
||||
specifically for use in, a User Product, and the conveying occurs as
|
||||
part of a transaction in which the right of possession and use of the
|
||||
User Product is transferred to the recipient in perpetuity or for a
|
||||
fixed term (regardless of how the transaction is characterized), the
|
||||
Corresponding Source conveyed under this section must be accompanied
|
||||
by the Installation Information. But this requirement does not apply
|
||||
if neither you nor any third party retains the ability to install
|
||||
modified object code on the User Product (for example, the work has
|
||||
been installed in ROM).
|
||||
|
||||
The requirement to provide Installation Information does not include a
|
||||
requirement to continue to provide support service, warranty, or updates
|
||||
for a work that has been modified or installed by the recipient, or for
|
||||
the User Product in which it has been modified or installed. Access to a
|
||||
network may be denied when the modification itself materially and
|
||||
adversely affects the operation of the network or violates the rules and
|
||||
protocols for communication across the network.
|
||||
|
||||
Corresponding Source conveyed, and Installation Information provided,
|
||||
in accord with this section must be in a format that is publicly
|
||||
documented (and with an implementation available to the public in
|
||||
source code form), and must require no special password or key for
|
||||
unpacking, reading or copying.
|
||||
|
||||
7. Additional Terms.
|
||||
|
||||
"Additional permissions" are terms that supplement the terms of this
|
||||
License by making exceptions from one or more of its conditions.
|
||||
Additional permissions that are applicable to the entire Program shall
|
||||
be treated as though they were included in this License, to the extent
|
||||
that they are valid under applicable law. If additional permissions
|
||||
apply only to part of the Program, that part may be used separately
|
||||
under those permissions, but the entire Program remains governed by
|
||||
this License without regard to the additional permissions.
|
||||
|
||||
When you convey a copy of a covered work, you may at your option
|
||||
remove any additional permissions from that copy, or from any part of
|
||||
it. (Additional permissions may be written to require their own
|
||||
removal in certain cases when you modify the work.) You may place
|
||||
additional permissions on material, added by you to a covered work,
|
||||
for which you have or can give appropriate copyright permission.
|
||||
|
||||
Notwithstanding any other provision of this License, for material you
|
||||
add to a covered work, you may (if authorized by the copyright holders of
|
||||
that material) supplement the terms of this License with terms:
|
||||
|
||||
a) Disclaiming warranty or limiting liability differently from the
|
||||
terms of sections 15 and 16 of this License; or
|
||||
|
||||
b) Requiring preservation of specified reasonable legal notices or
|
||||
author attributions in that material or in the Appropriate Legal
|
||||
Notices displayed by works containing it; or
|
||||
|
||||
c) Prohibiting misrepresentation of the origin of that material, or
|
||||
requiring that modified versions of such material be marked in
|
||||
reasonable ways as different from the original version; or
|
||||
|
||||
d) Limiting the use for publicity purposes of names of licensors or
|
||||
authors of the material; or
|
||||
|
||||
e) Declining to grant rights under trademark law for use of some
|
||||
trade names, trademarks, or service marks; or
|
||||
|
||||
f) Requiring indemnification of licensors and authors of that
|
||||
material by anyone who conveys the material (or modified versions of
|
||||
it) with contractual assumptions of liability to the recipient, for
|
||||
any liability that these contractual assumptions directly impose on
|
||||
those licensors and authors.
|
||||
|
||||
All other non-permissive additional terms are considered "further
|
||||
restrictions" within the meaning of section 10. If the Program as you
|
||||
received it, or any part of it, contains a notice stating that it is
|
||||
governed by this License along with a term that is a further
|
||||
restriction, you may remove that term. If a license document contains
|
||||
a further restriction but permits relicensing or conveying under this
|
||||
License, you may add to a covered work material governed by the terms
|
||||
of that license document, provided that the further restriction does
|
||||
not survive such relicensing or conveying.
|
||||
|
||||
If you add terms to a covered work in accord with this section, you
|
||||
must place, in the relevant source files, a statement of the
|
||||
additional terms that apply to those files, or a notice indicating
|
||||
where to find the applicable terms.
|
||||
|
||||
Additional terms, permissive or non-permissive, may be stated in the
|
||||
form of a separately written license, or stated as exceptions;
|
||||
the above requirements apply either way.
|
||||
|
||||
8. Termination.
|
||||
|
||||
You may not propagate or modify a covered work except as expressly
|
||||
provided under this License. Any attempt otherwise to propagate or
|
||||
modify it is void, and will automatically terminate your rights under
|
||||
this License (including any patent licenses granted under the third
|
||||
paragraph of section 11).
|
||||
|
||||
However, if you cease all violation of this License, then your
|
||||
license from a particular copyright holder is reinstated (a)
|
||||
provisionally, unless and until the copyright holder explicitly and
|
||||
finally terminates your license, and (b) permanently, if the copyright
|
||||
holder fails to notify you of the violation by some reasonable means
|
||||
prior to 60 days after the cessation.
|
||||
|
||||
Moreover, your license from a particular copyright holder is
|
||||
reinstated permanently if the copyright holder notifies you of the
|
||||
violation by some reasonable means, this is the first time you have
|
||||
received notice of violation of this License (for any work) from that
|
||||
copyright holder, and you cure the violation prior to 30 days after
|
||||
your receipt of the notice.
|
||||
|
||||
Termination of your rights under this section does not terminate the
|
||||
licenses of parties who have received copies or rights from you under
|
||||
this License. If your rights have been terminated and not permanently
|
||||
reinstated, you do not qualify to receive new licenses for the same
|
||||
material under section 10.
|
||||
|
||||
9. Acceptance Not Required for Having Copies.
|
||||
|
||||
You are not required to accept this License in order to receive or
|
||||
run a copy of the Program. Ancillary propagation of a covered work
|
||||
occurring solely as a consequence of using peer-to-peer transmission
|
||||
to receive a copy likewise does not require acceptance. However,
|
||||
nothing other than this License grants you permission to propagate or
|
||||
modify any covered work. These actions infringe copyright if you do
|
||||
not accept this License. Therefore, by modifying or propagating a
|
||||
covered work, you indicate your acceptance of this License to do so.
|
||||
|
||||
10. Automatic Licensing of Downstream Recipients.
|
||||
|
||||
Each time you convey a covered work, the recipient automatically
|
||||
receives a license from the original licensors, to run, modify and
|
||||
propagate that work, subject to this License. You are not responsible
|
||||
for enforcing compliance by third parties with this License.
|
||||
|
||||
An "entity transaction" is a transaction transferring control of an
|
||||
organization, or substantially all assets of one, or subdividing an
|
||||
organization, or merging organizations. If propagation of a covered
|
||||
work results from an entity transaction, each party to that
|
||||
transaction who receives a copy of the work also receives whatever
|
||||
licenses to the work the party's predecessor in interest had or could
|
||||
give under the previous paragraph, plus a right to possession of the
|
||||
Corresponding Source of the work from the predecessor in interest, if
|
||||
the predecessor has it or can get it with reasonable efforts.
|
||||
|
||||
You may not impose any further restrictions on the exercise of the
|
||||
rights granted or affirmed under this License. For example, you may
|
||||
not impose a license fee, royalty, or other charge for exercise of
|
||||
rights granted under this License, and you may not initiate litigation
|
||||
(including a cross-claim or counterclaim in a lawsuit) alleging that
|
||||
any patent claim is infringed by making, using, selling, offering for
|
||||
sale, or importing the Program or any portion of it.
|
||||
|
||||
11. Patents.
|
||||
|
||||
A "contributor" is a copyright holder who authorizes use under this
|
||||
License of the Program or a work on which the Program is based. The
|
||||
work thus licensed is called the contributor's "contributor version".
|
||||
|
||||
A contributor's "essential patent claims" are all patent claims
|
||||
owned or controlled by the contributor, whether already acquired or
|
||||
hereafter acquired, that would be infringed by some manner, permitted
|
||||
by this License, of making, using, or selling its contributor version,
|
||||
but do not include claims that would be infringed only as a
|
||||
consequence of further modification of the contributor version. For
|
||||
purposes of this definition, "control" includes the right to grant
|
||||
patent sublicenses in a manner consistent with the requirements of
|
||||
this License.
|
||||
|
||||
Each contributor grants you a non-exclusive, worldwide, royalty-free
|
||||
patent license under the contributor's essential patent claims, to
|
||||
make, use, sell, offer for sale, import and otherwise run, modify and
|
||||
propagate the contents of its contributor version.
|
||||
|
||||
In the following three paragraphs, a "patent license" is any express
|
||||
agreement or commitment, however denominated, not to enforce a patent
|
||||
(such as an express permission to practice a patent or covenant not to
|
||||
sue for patent infringement). To "grant" such a patent license to a
|
||||
party means to make such an agreement or commitment not to enforce a
|
||||
patent against the party.
|
||||
|
||||
If you convey a covered work, knowingly relying on a patent license,
|
||||
and the Corresponding Source of the work is not available for anyone
|
||||
to copy, free of charge and under the terms of this License, through a
|
||||
publicly available network server or other readily accessible means,
|
||||
then you must either (1) cause the Corresponding Source to be so
|
||||
available, or (2) arrange to deprive yourself of the benefit of the
|
||||
patent license for this particular work, or (3) arrange, in a manner
|
||||
consistent with the requirements of this License, to extend the patent
|
||||
license to downstream recipients. "Knowingly relying" means you have
|
||||
actual knowledge that, but for the patent license, your conveying the
|
||||
covered work in a country, or your recipient's use of the covered work
|
||||
in a country, would infringe one or more identifiable patents in that
|
||||
country that you have reason to believe are valid.
|
||||
|
||||
If, pursuant to or in connection with a single transaction or
|
||||
arrangement, you convey, or propagate by procuring conveyance of, a
|
||||
covered work, and grant a patent license to some of the parties
|
||||
receiving the covered work authorizing them to use, propagate, modify
|
||||
or convey a specific copy of the covered work, then the patent license
|
||||
you grant is automatically extended to all recipients of the covered
|
||||
work and works based on it.
|
||||
|
||||
A patent license is "discriminatory" if it does not include within
|
||||
the scope of its coverage, prohibits the exercise of, or is
|
||||
conditioned on the non-exercise of one or more of the rights that are
|
||||
specifically granted under this License. You may not convey a covered
|
||||
work if you are a party to an arrangement with a third party that is
|
||||
in the business of distributing software, under which you make payment
|
||||
to the third party based on the extent of your activity of conveying
|
||||
the work, and under which the third party grants, to any of the
|
||||
parties who would receive the covered work from you, a discriminatory
|
||||
patent license (a) in connection with copies of the covered work
|
||||
conveyed by you (or copies made from those copies), or (b) primarily
|
||||
for and in connection with specific products or compilations that
|
||||
contain the covered work, unless you entered into that arrangement,
|
||||
or that patent license was granted, prior to 28 March 2007.
|
||||
|
||||
Nothing in this License shall be construed as excluding or limiting
|
||||
any implied license or other defenses to infringement that may
|
||||
otherwise be available to you under applicable patent law.
|
||||
|
||||
12. No Surrender of Others' Freedom.
|
||||
|
||||
If conditions are imposed on you (whether by court order, agreement or
|
||||
otherwise) that contradict the conditions of this License, they do not
|
||||
excuse you from the conditions of this License. If you cannot convey a
|
||||
covered work so as to satisfy simultaneously your obligations under this
|
||||
License and any other pertinent obligations, then as a consequence you may
|
||||
not convey it at all. For example, if you agree to terms that obligate you
|
||||
to collect a royalty for further conveying from those to whom you convey
|
||||
the Program, the only way you could satisfy both those terms and this
|
||||
License would be to refrain entirely from conveying the Program.
|
||||
|
||||
13. Use with the GNU Affero General Public License.
|
||||
|
||||
Notwithstanding any other provision of this License, you have
|
||||
permission to link or combine any covered work with a work licensed
|
||||
under version 3 of the GNU Affero General Public License into a single
|
||||
combined work, and to convey the resulting work. The terms of this
|
||||
License will continue to apply to the part which is the covered work,
|
||||
but the special requirements of the GNU Affero General Public License,
|
||||
section 13, concerning interaction through a network will apply to the
|
||||
combination as such.
|
||||
|
||||
14. Revised Versions of this License.
|
||||
|
||||
The Free Software Foundation may publish revised and/or new versions of
|
||||
the GNU General Public License from time to time. Such new versions will
|
||||
be similar in spirit to the present version, but may differ in detail to
|
||||
address new problems or concerns.
|
||||
|
||||
Each version is given a distinguishing version number. If the
|
||||
Program specifies that a certain numbered version of the GNU General
|
||||
Public License "or any later version" applies to it, you have the
|
||||
option of following the terms and conditions either of that numbered
|
||||
version or of any later version published by the Free Software
|
||||
Foundation. If the Program does not specify a version number of the
|
||||
GNU General Public License, you may choose any version ever published
|
||||
by the Free Software Foundation.
|
||||
|
||||
If the Program specifies that a proxy can decide which future
|
||||
versions of the GNU General Public License can be used, that proxy's
|
||||
public statement of acceptance of a version permanently authorizes you
|
||||
to choose that version for the Program.
|
||||
|
||||
Later license versions may give you additional or different
|
||||
permissions. However, no additional obligations are imposed on any
|
||||
author or copyright holder as a result of your choosing to follow a
|
||||
later version.
|
||||
|
||||
15. Disclaimer of Warranty.
|
||||
|
||||
THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY
|
||||
APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT
|
||||
HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY
|
||||
OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO,
|
||||
THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
|
||||
PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM
|
||||
IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF
|
||||
ALL NECESSARY SERVICING, REPAIR OR CORRECTION.
|
||||
|
||||
16. Limitation of Liability.
|
||||
|
||||
IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING
|
||||
WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MODIFIES AND/OR CONVEYS
|
||||
THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY
|
||||
GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE
|
||||
USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF
|
||||
DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD
|
||||
PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS),
|
||||
EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF
|
||||
SUCH DAMAGES.
|
||||
|
||||
17. Interpretation of Sections 15 and 16.
|
||||
|
||||
If the disclaimer of warranty and limitation of liability provided
|
||||
above cannot be given local legal effect according to their terms,
|
||||
reviewing courts shall apply local law that most closely approximates
|
||||
an absolute waiver of all civil liability in connection with the
|
||||
Program, unless a warranty or assumption of liability accompanies a
|
||||
copy of the Program in return for a fee.
|
||||
|
||||
END OF TERMS AND CONDITIONS
|
||||
|
||||
How to Apply These Terms to Your New Programs
|
||||
|
||||
If you develop a new program, and you want it to be of the greatest
|
||||
possible use to the public, the best way to achieve this is to make it
|
||||
free software which everyone can redistribute and change under these terms.
|
||||
|
||||
To do so, attach the following notices to the program. It is safest
|
||||
to attach them to the start of each source file to most effectively
|
||||
state the exclusion of warranty; and each file should have at least
|
||||
the "copyright" line and a pointer to where the full notice is found.
|
||||
|
||||
<one line to give the program's name and a brief idea of what it does.>
|
||||
Copyright (C) <year> <name of author>
|
||||
|
||||
This program is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation, either version 3 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
|
||||
Also add information on how to contact you by electronic and paper mail.
|
||||
|
||||
If the program does terminal interaction, make it output a short
|
||||
notice like this when it starts in an interactive mode:
|
||||
|
||||
<program> Copyright (C) <year> <name of author>
|
||||
This program comes with ABSOLUTELY NO WARRANTY; for details type `show w'.
|
||||
This is free software, and you are welcome to redistribute it
|
||||
under certain conditions; type `show c' for details.
|
||||
|
||||
The hypothetical commands `show w' and `show c' should show the appropriate
|
||||
parts of the General Public License. Of course, your program's commands
|
||||
might be different; for a GUI interface, you would use an "about box".
|
||||
|
||||
You should also get your employer (if you work as a programmer) or school,
|
||||
if any, to sign a "copyright disclaimer" for the program, if necessary.
|
||||
For more information on this, and how to apply and follow the GNU GPL, see
|
||||
<https://www.gnu.org/licenses/>.
|
||||
|
||||
The GNU General Public License does not permit incorporating your program
|
||||
into proprietary programs. If your program is a subroutine library, you
|
||||
may consider it more useful to permit linking proprietary applications with
|
||||
the library. If this is what you want to do, use the GNU Lesser General
|
||||
Public License instead of this License. But first, please read
|
||||
<https://www.gnu.org/licenses/why-not-lgpl.html>.
|
159
README.md
159
README.md
@ -1,35 +1,152 @@
|
||||
# ViaFabric
|
||||
[![Travis Build Status](https://travis-ci.com/ViaVersion/ViaFabric.svg?branch=master)](https://travis-ci.com/ViaVersion/ViaFabric)
|
||||
[![ViaVersion Discord](https://img.shields.io/badge/chat-on%20discord-blue.svg)](https://viaversion.com/discord)
|
||||
[![GitHub Releases](https://img.shields.io/github/downloads/ViaVersion/ViaFabric/total)](https://github.com/ViaVersion/ViaFabric/releases)
|
||||
|
||||
**Client-side and server-side ViaVersion implementation for Fabric**
|
||||
[![ViaVersion Discord](https://img.shields.io/badge/chat-on%20discord-blue.svg)](https://viaversion.com/discord)
|
||||
[![CurseForge Downloads](http://cf.way2muchnoise.eu/full_viafabric_downloads.svg)](https://www.curseforge.com/minecraft/mc-mods/viafabric)
|
||||
[![Modrinth Downloads](https://img.shields.io/modrinth/dt/ViaFabric?label=Modrinth&logo=Modrinth&style=flat-square)](https://viaversion.com/fabric)
|
||||
[![CurseForge Versions](http://cf.way2muchnoise.eu/versions/viafabric.svg)](https://www.curseforge.com/minecraft/mc-mods/viafabric)
|
||||
<!-- ^ GitHub seems to not like this https -->
|
||||
|
||||
### Client-side and server-side ViaVersion implementation for Fabric
|
||||
|
||||
Allows the connection to/from different Minecraft versions on your Minecraft client/server (LAN worlds too)
|
||||
|
||||
This mod supports 1.14.4/1.15.x with Fabric Loader
|
||||
This mod can be installed on 1.14.4, 1.15.2, 1.16.5, 1.17.1, 1.18.2, 1.19.4, 1.20.1, 1.20.4, 1.20.6, 1.21.1 with Fabric Loader.
|
||||
|
||||
Note: ViaVersion is not designed for modded Minecraft with modified registries
|
||||
The `legacy` branch also supports Legacy Fabric 1.8.9 and 1.12.2 versions.
|
||||
|
||||
If you are using the latest Minecraft version and care about the gameplay being more enjoyable/functional, you may want to
|
||||
check [ViaFabricPlus](https://modrinth.com/mod/viafabricplus) out. See the [differences](#viafabricplus) between ViaFabric and ViaFabricPlus.
|
||||
|
||||
## Dependencies
|
||||
|
||||
**Dependencies:**
|
||||
| Dependency | Download |
|
||||
| --- | --- |
|
||||
| ViaVersion 3.0.0+ | dev builds at https://ci.viaversion.com/job/ViaVersion-Abstraction/ |
|
||||
| Fabric Textures v0 | https://www.curseforge.com/minecraft/mc-mods/fabric-api |
|
||||
| Fabric Resource Loader v0 | https://www.curseforge.com/minecraft/mc-mods/fabric-api |
|
||||
| Fabric Commands v0 | https://www.curseforge.com/minecraft/mc-mods/fabric-api |
|
||||
| (Optional) Cotton Client Commands | https://www.curseforge.com/minecraft/mc-mods/cotton-client-commands |
|
||||
|-----------------------------------------------|----------------------------------------------------------------|
|
||||
| (Bundled) ViaVersion | https://viaversion.com/ |
|
||||
| (Bundled) Cotton Client Commands (MC 1.14-15) | https://jitpack.io/#TinfoilMC/ClientCommands |
|
||||
| Fabric API | https://modrinth.com/mod/fabric-api |
|
||||
|
||||
Note: ViaVersion is designed for Vanilla Minecraft servers. It probably will not work with modded registry entries or
|
||||
registry synchronization (fabric-registry-sync mod).
|
||||
|
||||
With ViaVersion:
|
||||
- your server can accept newer versions
|
||||
- your client can connect to older versions
|
||||
## ViaVersion
|
||||
|
||||
### How can I install ViaBackwards/ViaRewind/ViaAprilFools?:
|
||||
|
||||
Adding ViaBackwards (and optionally ViaRewind):
|
||||
- your server can accept older versions
|
||||
- your client can connect to newer versions
|
||||
- Just drop them into mods folder. Make sure you are using versions compatible with the ViaVersion version you are
|
||||
using.
|
||||
|
||||
## WARNING
|
||||
**I can not guarantee that this mod is allowed on every (or even any) server. This mod may cause problems with anti cheat plugins. USE AT OWN RISK**
|
||||
### What versions can ViaVersion, ViaBackwards, ViaRewind and ViaAprilFools translate?:
|
||||
|
||||
- **With [ViaVersion](https://viaversion.com)**:
|
||||
Your server can accept newer versions. Your client can connect to older versions.
|
||||
|
||||
- **Adding [ViaBackwards](https://viaversion.com/backwards) (and
|
||||
optionally [ViaRewind](https://viaversion.com/rewind))**:
|
||||
Your server can accept older versions. Your client can connect to newer versions.
|
||||
|
||||
- **Adding [ViaAprilFools](https://viaversion.com/aprilfools)**: Your server can accept April Fools versions.
|
||||
|
||||
Note: When using ViaFabric for versions older than 1.17, you need [Java 8 builds](https://ci.viaversion.com/)
|
||||
|
||||
- Server-side: See https://viaversion.com/
|
||||
|
||||
- Client-side:
|
||||
|
||||
| | 1.8.x | 1.9.x | 1.10-1.20.x | 1.21.x |
|
||||
|-----------------------|-------|-------|-------------|--------|
|
||||
| 1.14.4-1.20.6 clients | ✓ | ✓ | ✓ | ⟲ | ⟲ ⟲ | ⟲ | ⟲ | ⟲ | ⟲ |
|
||||
| 1.21.1 client | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ |
|
||||
|
||||
✓ = [ViaVersion](https://viaversion.com) ⟲ = [ViaBackwards](https://viaversion.com/backwards) ⏪
|
||||
= [ViaRewind](https://viaversion.com/rewind)
|
||||
|
||||
*Note: 1.7.x is not supported in ViaFabric - 1.9.x, 1.10.x, 1.11.x, and 1.13.x may cause problems when visiting such servers in client-side mode.*
|
||||
|
||||
### Can ViaVersion, ViaBackwards and ViaRewind support snapshots?:
|
||||
|
||||
- Check https://viaversion.com/donate for getting early access to snapshots. You can use the preview ViaVersion builds with ViaFabric by
|
||||
putting them in the mods' folder. During Minecraft updates there will be usual a branch on this repository with the updated ViaFabric.
|
||||
|
||||
## Alternatives
|
||||
|
||||
### Client-side:
|
||||
|
||||
- [ViaForge](https://modrinth.com/mod/viaforge): Clientside Implementation of ViaVersion for Forge.
|
||||
- [ViaFabricPlus](https://modrinth.com/mod/viafabricplus): Fabric mod for the latest Minecraft version with QoL fixes and enhancements to the gameplay.
|
||||
- [ClientViaVersion](https://github.com/Gerrygames/ClientViaVersion): Discontinued 5zig plugin.
|
||||
- [multiconnect](https://www.curseforge.com/minecraft/mc-mods/multiconnect): Discontinued Fabric mod for connecting to older
|
||||
versions: down to 1.11 (stable) and 1.8 (experimental).
|
||||
|
||||
### Server-side:
|
||||
|
||||
- [ViaVersion](https://viaversion.com): Plugin for Velocity and Paper/Bukkit (and optionally also Sponge/BungeeCord).
|
||||
- [ProtocolSupport](https://github.com/ProtocolSupport/ProtocolSupport): Discontinued Bukkit plugin for older client versions (down to 1.4.7).
|
||||
|
||||
### Standalone proxy:
|
||||
|
||||
- [ViaProxy](https://github.com/ViaVersion/ViaProxy): Standalone ViaVersion proxy with ViaBackwards, ViaRewind and ViaLegacy,
|
||||
allowing you to connect to a wide range of versions (down to classic versions) with your modern client (1.7.2+). Supports online mode.
|
||||
- [VIAaaS](https://github.com/ViaVersion/VIAaaS): Standalone ViaVersion proxy with ViaBackwards and ViaRewind, allowing
|
||||
you to connect without a mod installed on your client. Supports online mode.
|
||||
- [DirtMultiversion](https://github.com/DirtPowered/DirtMultiversion): Discontinued Proxy allowing to connect down to Beta 1.3 with
|
||||
newer Minecraft client versions.
|
||||
|
||||
### Cool things to try:
|
||||
|
||||
- [Geyser](https://geysermc.org/): Plugins, Fabric mod and a standalone proxy for allowing Bedrock Edition on Java
|
||||
Edition servers.
|
||||
- [PolyMc](https://github.com/TheEpicBlock/PolyMc): Fabric mods which translates modded items and blocks, allowing
|
||||
vanilla to connect using resource packs.
|
||||
|
||||
## Commands
|
||||
|
||||
### Commands:
|
||||
|
||||
- There're 3 server-side alias ``/viaversion``, ``/vvfabric`` and ``/viaver``, and a client-side command
|
||||
``/viafabricclient`` for Minecraft 1.14+ (OP permission level 3 is required for these commands, received
|
||||
by [Entity Status Packet](https://wiki.vg/Entity_statuses#Player))
|
||||
|
||||
## Configs
|
||||
|
||||
### Configuration:
|
||||
|
||||
- ViaVersion configuration is available at ``.minecraft/config/viafabric/viaversion.yml``
|
||||
- ViaFabric configuration is at ``.minecraft/config/viafabric/viafabric.yml``
|
||||
|
||||
### How can I disable client-side ViaFabric?:
|
||||
|
||||
- You can disable it in the menu or by setting global protocol version to -1 (this will keep per-server translations
|
||||
still enabled)
|
||||
|
||||
### How to use protocol detection?:
|
||||
|
||||
- For using globally, set the protocol to AUTO or -2. For using in a specific
|
||||
server: ``ddns.example.com._v-2.viafabric``
|
||||
- The protocol detector will try to ping with the client native protocol version, differently than multiconnect which
|
||||
uses -1 version, which may detect the native server version.
|
||||
|
||||
### How can I set the version for specific servers?:
|
||||
|
||||
- Append ._v(VERSION).viafabric.
|
||||
- Examples: ``minigame.example.com._v1_8.viafabric``, ``native.example.com._v-1.viafabric``
|
||||
, ``auto.example.com._v-2.viafabric``
|
||||
|
||||
## ViaFabricPlus
|
||||
|
||||
### Does it work with ViaFabric:
|
||||
|
||||
- No, ViaFabric cannot be used with ViaFabricPlus.
|
||||
|
||||
### Differences with ViaFabricPlus:
|
||||
|
||||
| | ViaFabric | ViaFabricPlus |
|
||||
|----------------------------------|-------------------------------------------------|-----------------------------------------------------------------|
|
||||
| Can be installed on | Multiple client/server versions with fabric | Latest client-side version with fabric |
|
||||
| Objectives | Simply implement ViaVersion | Implements ViaVersion with client-side fixes to version changes |
|
||||
| How does it work? | Modifying packets at network code | Modifying client code more deeply |
|
||||
| Triggering anti-cheats | Very likely | Mostly not |
|
||||
|
||||
## Disclaimer
|
||||
|
||||
It cannot be guaranteed that this mod is allowed on specific servers as it can possibly cause problems with anti-cheat plugins.\
|
||||
***(USE ONLY WITH CAUTION!)***
|
||||
|
250
build.gradle
Normal file
250
build.gradle
Normal file
@ -0,0 +1,250 @@
|
||||
// todo migrate this code to kotlin
|
||||
import com.google.gson.JsonParser
|
||||
|
||||
import java.nio.file.Files
|
||||
import java.util.stream.Collectors
|
||||
import java.util.stream.IntStream
|
||||
|
||||
// Stolen https://github.com/FabricMC/fabric/blob/1.17/build.gradle
|
||||
plugins {
|
||||
id "java"
|
||||
id "maven-publish"
|
||||
id "org.ajoberstar.grgit" version "5.2.2"
|
||||
id "com.matthewprenger.cursegradle" version "1.4.0" // This repository is archived on GH
|
||||
id "com.modrinth.minotaur" version "2.8.7"
|
||||
id "fabric-loom" version "1.6-SNAPSHOT" apply false
|
||||
id "com.github.ben-manes.versions" version "0.51.0"
|
||||
id "xyz.wagyourtail.jvmdowngrader" version "0.7.1"
|
||||
}
|
||||
|
||||
def ENV = System.getenv()
|
||||
|
||||
group = "com.viaversion.fabric"
|
||||
description = "Client-side and server-side ViaVersion implementation for Fabric"
|
||||
version = "0.4.15+" + ENV.GITHUB_RUN_NUMBER + "-" + getBranch()
|
||||
logger.lifecycle("Building ViaFabric: $version")
|
||||
|
||||
def getBranch() {
|
||||
def ENV = System.getenv()
|
||||
def branch = "unknown"
|
||||
|
||||
if (ENV.GITHUB_REF) {
|
||||
branch = ENV.GITHUB_REF
|
||||
} else if (grgit != null) {
|
||||
branch = grgit.branch.current().name
|
||||
}
|
||||
|
||||
return branch.substring(branch.lastIndexOf("/") + 1)
|
||||
}
|
||||
|
||||
allprojects {
|
||||
apply plugin: "maven-publish"
|
||||
apply plugin: "fabric-loom"
|
||||
|
||||
java {
|
||||
toolchain {
|
||||
// lwjgl2 works with Adoptium
|
||||
languageVersion = JavaLanguageVersion.of(21)
|
||||
vendor = JvmVendorSpec.ADOPTIUM
|
||||
}
|
||||
withSourcesJar()
|
||||
}
|
||||
|
||||
tasks.withType(JavaCompile).configureEach {
|
||||
it.options.release.set(8)
|
||||
}
|
||||
tasks.withType(JavaExec).configureEach {
|
||||
it.javaLauncher.set(javaToolchains.launcherFor(java.toolchain))
|
||||
}
|
||||
|
||||
version = rootProject.version
|
||||
group = rootProject.group
|
||||
|
||||
repositories {
|
||||
mavenCentral()
|
||||
maven { url = "https://repo.viaversion.com/" }
|
||||
maven { url = "https://maven.fabricmc.net/" }
|
||||
maven { url = "https://maven.legacyfabric.net/" }
|
||||
maven { url = "https://maven.terraformersmc.com/releases/" }
|
||||
maven { url = "https://jitpack.io/" }
|
||||
}
|
||||
|
||||
dependencies {
|
||||
// transitive = false because Guava is conflicting on runClient
|
||||
implementation("com.viaversion:viaversion:${rootProject.viaver_version}") { transitive = false }
|
||||
|
||||
modImplementation("net.fabricmc:fabric-loader:${rootProject.loader_version}")
|
||||
}
|
||||
|
||||
processResources {
|
||||
filesMatching("fabric.mod.json") {
|
||||
it.expand(rootProject.properties)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
subprojects {
|
||||
loom {
|
||||
runs {
|
||||
named("client") {
|
||||
client()
|
||||
ideConfigGenerated(true)
|
||||
runDir("run")
|
||||
}
|
||||
named("server") {
|
||||
server()
|
||||
ideConfigGenerated(true)
|
||||
runDir("run")
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
dependencies {
|
||||
implementation(project(path: ":", configuration: "namedElements")) {
|
||||
exclude group: "net.fabricmc", module: "fabric-loader" // prevent duplicate fabric-loader on run
|
||||
}
|
||||
}
|
||||
|
||||
publishing {
|
||||
publications {
|
||||
mavenJava(MavenPublication) {
|
||||
from components.java
|
||||
}
|
||||
}
|
||||
|
||||
setupRepositories(repositories)
|
||||
}
|
||||
}
|
||||
|
||||
publishing {
|
||||
publications {
|
||||
mavenJava(MavenPublication) {
|
||||
from components.java
|
||||
}
|
||||
}
|
||||
|
||||
setupRepositories(repositories)
|
||||
}
|
||||
|
||||
static void setupRepositories(RepositoryHandler repositories) {
|
||||
//repositories.mavenLocal() // uncomment for testing
|
||||
def ENV = System.getenv()
|
||||
if (ENV.MAVEN_URL) {
|
||||
repositories.maven {
|
||||
url ENV.MAVEN_URL
|
||||
credentials {
|
||||
username ENV.MAVEN_USERNAME
|
||||
password ENV.MAVEN_PASSWORD
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
subprojects.each {
|
||||
rootProject.remapJar.dependsOn("${it.path}:remapJar")
|
||||
}
|
||||
|
||||
configurations {
|
||||
includeJ8
|
||||
}
|
||||
|
||||
jvmdg.dg(configurations.includeJ8)
|
||||
|
||||
dependencies {
|
||||
// dummy version
|
||||
minecraft("com.mojang:minecraft:1.14.4")
|
||||
mappings("net.fabricmc:yarn:1.14.4+build.18:v2")
|
||||
|
||||
includeJ8("com.viaversion:viaversion:${rootProject.viaver_version}")
|
||||
include("com.github.TinfoilMC:ClientCommands:1.1.0")
|
||||
}
|
||||
|
||||
remapJar {
|
||||
nestedJars.from configurations.includeJ8
|
||||
afterEvaluate {
|
||||
subprojects.each {
|
||||
nestedJars.from project("${it.path}").tasks.named("remapJar")
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
processResources {
|
||||
filesMatching("assets/*/lang/*.lang") {
|
||||
HashMap<String, String> langMap = new HashMap<>()
|
||||
Files.list(rootProject.file("src/main/resources/assets/viafabric/lang").toPath())
|
||||
.filter(path -> path.toString().endsWith(".json"))
|
||||
.forEach(path -> {
|
||||
String legacyFile = "\n" + String.join("\n", JsonParser
|
||||
.parseReader(Files.newBufferedReader(path)).asJsonObject.entrySet().stream()
|
||||
.map(entry -> entry.key + "=" + entry.value.asString)
|
||||
.toArray(String[]::new))
|
||||
langMap.put(path.getFileName().toString().replace(".json", ""), legacyFile)
|
||||
})
|
||||
it.expand(langMap)
|
||||
}
|
||||
}
|
||||
|
||||
List<String> mcReleases = Arrays.stream(rootProject.publish_mc_versions.toString().split(","))
|
||||
.map({ it -> it.trim() })
|
||||
.collect(Collectors.toList())
|
||||
List<String> javaVersions = IntStream.rangeClosed(8, 22)
|
||||
.mapToObj { n -> (String) "Java $n" }
|
||||
.collect(Collectors.toList())
|
||||
String changelogMsg = "A changelog can be found at https://github.com/ViaVersion/ViaFabric/commits"
|
||||
String versionNameMsg = "[${getBranch()}] ViaFabric " + rootProject.version
|
||||
|
||||
curseforge {
|
||||
if (ENV.CURSEFORGE_API_KEY) {
|
||||
apiKey = ENV.CURSEFORGE_API_KEY
|
||||
}
|
||||
|
||||
project {
|
||||
id = "391298"
|
||||
changelog = changelogMsg
|
||||
releaseType = "beta" // alpha is hidden by default
|
||||
|
||||
mcReleases.forEach { ver -> addGameVersion(ver) }
|
||||
if (!rootProject.curseforge_mc_snapshot.isEmpty()) addGameVersion(rootProject.curseforge_mc_snapshot)
|
||||
javaVersions.forEach(v -> addGameVersion(v))
|
||||
addGameVersion("Fabric")
|
||||
|
||||
mainArtifact(remapJar) {
|
||||
displayName = versionNameMsg
|
||||
relations {
|
||||
optionalDependency("fabric-api")
|
||||
embeddedLibrary("cotton-client-commands")
|
||||
}
|
||||
}
|
||||
|
||||
afterEvaluate {
|
||||
uploadTask.dependsOn("remapJar")
|
||||
}
|
||||
}
|
||||
|
||||
options {
|
||||
forgeGradleIntegration = false
|
||||
}
|
||||
}
|
||||
|
||||
modrinth {
|
||||
token.set(ENV.MODRINTH_TOKEN)
|
||||
projectId.set("YlKdE5VK")
|
||||
versionType.set("alpha")
|
||||
versionNumber.set(rootProject.version)
|
||||
versionName.set(versionNameMsg)
|
||||
changelog.set(changelogMsg)
|
||||
|
||||
uploadFile.set(remapJar)
|
||||
|
||||
List<String> mcs = new ArrayList<>(mcReleases)
|
||||
if (!rootProject.modrinth_mc_snapshot.isEmpty()) mcs.add(rootProject.modrinth_mc_snapshot.toString())
|
||||
gameVersions.set(mcs)
|
||||
loaders.set(["fabric"])
|
||||
|
||||
dependencies {
|
||||
optional.project "P7dR8mSH" // fabric api
|
||||
embedded.project "P1OZGk5p" // viaversion
|
||||
}
|
||||
}
|
||||
|
||||
defaultTasks("clean", "build")
|
@ -1,69 +0,0 @@
|
||||
import org.apache.tools.ant.filters.ReplaceTokens
|
||||
|
||||
plugins {
|
||||
id("java")
|
||||
id("net.minecrell.licenser") version "0.4.1"
|
||||
id("fabric-loom") version "0.2.7-SNAPSHOT"
|
||||
id("com.palantir.git-version") version "0.12.0-rc2"
|
||||
}
|
||||
|
||||
group = "com.github.creeper123123321.viafabric"
|
||||
val gitVersion: groovy.lang.Closure<Any> by extra
|
||||
version = "0.2.1-SNAPSHOT+" + try {
|
||||
gitVersion()
|
||||
} catch (e: Exception) {
|
||||
"unknown"
|
||||
} + "+1.14-1.15"
|
||||
extra.set("archivesBaseName", "ViaFabric")
|
||||
description = "Client-side and server-side ViaVersion implementation for Fabric"
|
||||
|
||||
java {
|
||||
sourceCompatibility = JavaVersion.VERSION_1_8
|
||||
targetCompatibility = JavaVersion.VERSION_1_8
|
||||
}
|
||||
extra.set("sourceCompatibility", 1.8)
|
||||
extra.set("targetCompatibility", 1.8)
|
||||
|
||||
repositories {
|
||||
mavenLocal()
|
||||
mavenCentral()
|
||||
jcenter()
|
||||
maven(url = "https://repo.viaversion.com/")
|
||||
maven(url = "https://oss.sonatype.org/content/repositories/snapshots")
|
||||
maven(url = "https://maven.fabricmc.net/")
|
||||
maven(url = "https://server.bbkr.space/artifactory/libs-snapshot")
|
||||
maven(url = "https://server.bbkr.space/artifactory/libs-release")
|
||||
}
|
||||
|
||||
|
||||
tasks.named<ProcessResources>("processResources") {
|
||||
filesMatching("fabric.mod.json") {
|
||||
filter<ReplaceTokens>("tokens" to mapOf(
|
||||
"version" to project.property("version"),
|
||||
"description" to project.property("description")
|
||||
))
|
||||
}
|
||||
}
|
||||
|
||||
dependencies {
|
||||
// transitive = false because Guava is conflicting on runClient
|
||||
implementation("us.myles:viaversion:3.0.0-SNAPSHOT") { isTransitive = false }
|
||||
|
||||
// Use 1.14.4 release, probably intermediary will make it work on snapshots
|
||||
// https://modmuss50.me/fabric.html?&version=1.14.4
|
||||
minecraft("com.mojang:minecraft:1.14.4")
|
||||
mappings("net.fabricmc:yarn:1.14.4+build.16:v2")
|
||||
modImplementation("net.fabricmc:fabric-loader:0.8.2+build.194")
|
||||
|
||||
modImplementation("net.fabricmc.fabric-api:fabric-api:0.4.3+build.247-1.14")
|
||||
|
||||
modImplementation("io.github.cottonmc:cotton-client-commands:1.0.0+1.15.2")
|
||||
include("io.github.cottonmc:cotton-client-commands:1.0.0+1.15.2")
|
||||
}
|
||||
|
||||
minecraft {
|
||||
}
|
||||
|
||||
license {
|
||||
include("**/*.java")
|
||||
}
|
@ -1 +1,11 @@
|
||||
org.gradle.jvmargs=-Xmx1G -XX:+UseG1GC
|
||||
# suppress inspection "UnusedProperty" for whole file
|
||||
org.gradle.jvmargs=-Xms32M -Xmx4G -XX:+UseG1GC -XX:+UseStringDeduplication
|
||||
|
||||
loader_version=0.16.0
|
||||
viaver_version=5.0.4-SNAPSHOT
|
||||
|
||||
publish_mc_versions=1.21, 1.20.6, 1.20.4, 1.20.1, 1.19.4, 1.18.2, 1.17.1, 1.16.5, 1.15.2, 1.14.4
|
||||
# example: 1.19.1-rc1. Can be a blank value
|
||||
modrinth_mc_snapshot=
|
||||
# example: 1.19-Snapshot. Can be a blank value
|
||||
curseforge_mc_snapshot=
|
||||
|
BIN
gradle/wrapper/gradle-wrapper.jar
vendored
BIN
gradle/wrapper/gradle-wrapper.jar
vendored
Binary file not shown.
5
gradle/wrapper/gradle-wrapper.properties
vendored
5
gradle/wrapper/gradle-wrapper.properties
vendored
@ -1,5 +1,8 @@
|
||||
distributionBase=GRADLE_USER_HOME
|
||||
distributionPath=wrapper/dists
|
||||
distributionUrl=https\://services.gradle.org/distributions/gradle-6.3-bin.zip
|
||||
distributionSha256Sum=1541fa36599e12857140465f3c91a97409b4512501c26f9631fb113e392c5bd1
|
||||
distributionUrl=https\://services.gradle.org/distributions/gradle-8.10.1-bin.zip
|
||||
networkTimeout=10000
|
||||
validateDistributionUrl=true
|
||||
zipStoreBase=GRADLE_USER_HOME
|
||||
zipStorePath=wrapper/dists
|
||||
|
297
gradlew
vendored
297
gradlew
vendored
@ -1,7 +1,7 @@
|
||||
#!/usr/bin/env sh
|
||||
#!/bin/sh
|
||||
|
||||
#
|
||||
# Copyright 2015 the original author or authors.
|
||||
# Copyright © 2015-2021 the original authors.
|
||||
#
|
||||
# Licensed under the Apache License, Version 2.0 (the "License");
|
||||
# you may not use this file except in compliance with the License.
|
||||
@ -15,80 +15,116 @@
|
||||
# See the License for the specific language governing permissions and
|
||||
# limitations under the License.
|
||||
#
|
||||
# SPDX-License-Identifier: Apache-2.0
|
||||
#
|
||||
|
||||
##############################################################################
|
||||
##
|
||||
## Gradle start up script for UN*X
|
||||
##
|
||||
#
|
||||
# Gradle start up script for POSIX generated by Gradle.
|
||||
#
|
||||
# Important for running:
|
||||
#
|
||||
# (1) You need a POSIX-compliant shell to run this script. If your /bin/sh is
|
||||
# noncompliant, but you have some other compliant shell such as ksh or
|
||||
# bash, then to run this script, type that shell name before the whole
|
||||
# command line, like:
|
||||
#
|
||||
# ksh Gradle
|
||||
#
|
||||
# Busybox and similar reduced shells will NOT work, because this script
|
||||
# requires all of these POSIX shell features:
|
||||
# * functions;
|
||||
# * expansions «$var», «${var}», «${var:-default}», «${var+SET}»,
|
||||
# «${var#prefix}», «${var%suffix}», and «$( cmd )»;
|
||||
# * compound commands having a testable exit status, especially «case»;
|
||||
# * various built-in commands including «command», «set», and «ulimit».
|
||||
#
|
||||
# Important for patching:
|
||||
#
|
||||
# (2) This script targets any POSIX shell, so it avoids extensions provided
|
||||
# by Bash, Ksh, etc; in particular arrays are avoided.
|
||||
#
|
||||
# The "traditional" practice of packing multiple parameters into a
|
||||
# space-separated string is a well documented source of bugs and security
|
||||
# problems, so this is (mostly) avoided, by progressively accumulating
|
||||
# options in "$@", and eventually passing that to Java.
|
||||
#
|
||||
# Where the inherited environment variables (DEFAULT_JVM_OPTS, JAVA_OPTS,
|
||||
# and GRADLE_OPTS) rely on word-splitting, this is performed explicitly;
|
||||
# see the in-line comments for details.
|
||||
#
|
||||
# There are tweaks for specific operating systems such as AIX, CygWin,
|
||||
# Darwin, MinGW, and NonStop.
|
||||
#
|
||||
# (3) This script is generated from the Groovy template
|
||||
# https://github.com/gradle/gradle/blob/HEAD/platforms/jvm/plugins-application/src/main/resources/org/gradle/api/internal/plugins/unixStartScript.txt
|
||||
# within the Gradle project.
|
||||
#
|
||||
# You can find Gradle at https://github.com/gradle/gradle/.
|
||||
#
|
||||
##############################################################################
|
||||
|
||||
# Attempt to set APP_HOME
|
||||
|
||||
# Resolve links: $0 may be a link
|
||||
PRG="$0"
|
||||
# Need this for relative symlinks.
|
||||
while [ -h "$PRG" ] ; do
|
||||
ls=`ls -ld "$PRG"`
|
||||
link=`expr "$ls" : '.*-> \(.*\)$'`
|
||||
if expr "$link" : '/.*' > /dev/null; then
|
||||
PRG="$link"
|
||||
else
|
||||
PRG=`dirname "$PRG"`"/$link"
|
||||
fi
|
||||
app_path=$0
|
||||
|
||||
# Need this for daisy-chained symlinks.
|
||||
while
|
||||
APP_HOME=${app_path%"${app_path##*/}"} # leaves a trailing /; empty if no leading path
|
||||
[ -h "$app_path" ]
|
||||
do
|
||||
ls=$( ls -ld "$app_path" )
|
||||
link=${ls#*' -> '}
|
||||
case $link in #(
|
||||
/*) app_path=$link ;; #(
|
||||
*) app_path=$APP_HOME$link ;;
|
||||
esac
|
||||
done
|
||||
SAVED="`pwd`"
|
||||
cd "`dirname \"$PRG\"`/" >/dev/null
|
||||
APP_HOME="`pwd -P`"
|
||||
cd "$SAVED" >/dev/null
|
||||
|
||||
APP_NAME="Gradle"
|
||||
APP_BASE_NAME=`basename "$0"`
|
||||
|
||||
# Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
|
||||
DEFAULT_JVM_OPTS='"-Xmx64m" "-Xms64m"'
|
||||
# This is normally unused
|
||||
# shellcheck disable=SC2034
|
||||
APP_BASE_NAME=${0##*/}
|
||||
# Discard cd standard output in case $CDPATH is set (https://github.com/gradle/gradle/issues/25036)
|
||||
APP_HOME=$( cd -P "${APP_HOME:-./}" > /dev/null && printf '%s
|
||||
' "$PWD" ) || exit
|
||||
|
||||
# Use the maximum available, or set MAX_FD != -1 to use that value.
|
||||
MAX_FD="maximum"
|
||||
MAX_FD=maximum
|
||||
|
||||
warn () {
|
||||
echo "$*"
|
||||
}
|
||||
} >&2
|
||||
|
||||
die () {
|
||||
echo
|
||||
echo "$*"
|
||||
echo
|
||||
exit 1
|
||||
}
|
||||
} >&2
|
||||
|
||||
# OS specific support (must be 'true' or 'false').
|
||||
cygwin=false
|
||||
msys=false
|
||||
darwin=false
|
||||
nonstop=false
|
||||
case "`uname`" in
|
||||
CYGWIN* )
|
||||
cygwin=true
|
||||
;;
|
||||
Darwin* )
|
||||
darwin=true
|
||||
;;
|
||||
MINGW* )
|
||||
msys=true
|
||||
;;
|
||||
NONSTOP* )
|
||||
nonstop=true
|
||||
;;
|
||||
case "$( uname )" in #(
|
||||
CYGWIN* ) cygwin=true ;; #(
|
||||
Darwin* ) darwin=true ;; #(
|
||||
MSYS* | MINGW* ) msys=true ;; #(
|
||||
NONSTOP* ) nonstop=true ;;
|
||||
esac
|
||||
|
||||
CLASSPATH=$APP_HOME/gradle/wrapper/gradle-wrapper.jar
|
||||
|
||||
|
||||
# Determine the Java command to use to start the JVM.
|
||||
if [ -n "$JAVA_HOME" ] ; then
|
||||
if [ -x "$JAVA_HOME/jre/sh/java" ] ; then
|
||||
# IBM's JDK on AIX uses strange locations for the executables
|
||||
JAVACMD="$JAVA_HOME/jre/sh/java"
|
||||
JAVACMD=$JAVA_HOME/jre/sh/java
|
||||
else
|
||||
JAVACMD="$JAVA_HOME/bin/java"
|
||||
JAVACMD=$JAVA_HOME/bin/java
|
||||
fi
|
||||
if [ ! -x "$JAVACMD" ] ; then
|
||||
die "ERROR: JAVA_HOME is set to an invalid directory: $JAVA_HOME
|
||||
@ -97,87 +133,120 @@ Please set the JAVA_HOME variable in your environment to match the
|
||||
location of your Java installation."
|
||||
fi
|
||||
else
|
||||
JAVACMD="java"
|
||||
which java >/dev/null 2>&1 || die "ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
|
||||
JAVACMD=java
|
||||
if ! command -v java >/dev/null 2>&1
|
||||
then
|
||||
die "ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
|
||||
|
||||
Please set the JAVA_HOME variable in your environment to match the
|
||||
location of your Java installation."
|
||||
fi
|
||||
fi
|
||||
|
||||
# Increase the maximum file descriptors if we can.
|
||||
if [ "$cygwin" = "false" -a "$darwin" = "false" -a "$nonstop" = "false" ] ; then
|
||||
MAX_FD_LIMIT=`ulimit -H -n`
|
||||
if [ $? -eq 0 ] ; then
|
||||
if [ "$MAX_FD" = "maximum" -o "$MAX_FD" = "max" ] ; then
|
||||
MAX_FD="$MAX_FD_LIMIT"
|
||||
fi
|
||||
ulimit -n $MAX_FD
|
||||
if [ $? -ne 0 ] ; then
|
||||
warn "Could not set maximum file descriptor limit: $MAX_FD"
|
||||
fi
|
||||
else
|
||||
warn "Could not query maximum file descriptor limit: $MAX_FD_LIMIT"
|
||||
fi
|
||||
fi
|
||||
|
||||
# For Darwin, add options to specify how the application appears in the dock
|
||||
if $darwin; then
|
||||
GRADLE_OPTS="$GRADLE_OPTS \"-Xdock:name=$APP_NAME\" \"-Xdock:icon=$APP_HOME/media/gradle.icns\""
|
||||
fi
|
||||
|
||||
# For Cygwin or MSYS, switch paths to Windows format before running java
|
||||
if [ "$cygwin" = "true" -o "$msys" = "true" ] ; then
|
||||
APP_HOME=`cygpath --path --mixed "$APP_HOME"`
|
||||
CLASSPATH=`cygpath --path --mixed "$CLASSPATH"`
|
||||
JAVACMD=`cygpath --unix "$JAVACMD"`
|
||||
|
||||
# We build the pattern for arguments to be converted via cygpath
|
||||
ROOTDIRSRAW=`find -L / -maxdepth 1 -mindepth 1 -type d 2>/dev/null`
|
||||
SEP=""
|
||||
for dir in $ROOTDIRSRAW ; do
|
||||
ROOTDIRS="$ROOTDIRS$SEP$dir"
|
||||
SEP="|"
|
||||
done
|
||||
OURCYGPATTERN="(^($ROOTDIRS))"
|
||||
# Add a user-defined pattern to the cygpath arguments
|
||||
if [ "$GRADLE_CYGPATTERN" != "" ] ; then
|
||||
OURCYGPATTERN="$OURCYGPATTERN|($GRADLE_CYGPATTERN)"
|
||||
fi
|
||||
# Now convert the arguments - kludge to limit ourselves to /bin/sh
|
||||
i=0
|
||||
for arg in "$@" ; do
|
||||
CHECK=`echo "$arg"|egrep -c "$OURCYGPATTERN" -`
|
||||
CHECK2=`echo "$arg"|egrep -c "^-"` ### Determine if an option
|
||||
|
||||
if [ $CHECK -ne 0 ] && [ $CHECK2 -eq 0 ] ; then ### Added a condition
|
||||
eval `echo args$i`=`cygpath --path --ignore --mixed "$arg"`
|
||||
else
|
||||
eval `echo args$i`="\"$arg\""
|
||||
fi
|
||||
i=`expr $i + 1`
|
||||
done
|
||||
case $i in
|
||||
0) set -- ;;
|
||||
1) set -- "$args0" ;;
|
||||
2) set -- "$args0" "$args1" ;;
|
||||
3) set -- "$args0" "$args1" "$args2" ;;
|
||||
4) set -- "$args0" "$args1" "$args2" "$args3" ;;
|
||||
5) set -- "$args0" "$args1" "$args2" "$args3" "$args4" ;;
|
||||
6) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" ;;
|
||||
7) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" ;;
|
||||
8) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" ;;
|
||||
9) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" "$args8" ;;
|
||||
if ! "$cygwin" && ! "$darwin" && ! "$nonstop" ; then
|
||||
case $MAX_FD in #(
|
||||
max*)
|
||||
# In POSIX sh, ulimit -H is undefined. That's why the result is checked to see if it worked.
|
||||
# shellcheck disable=SC2039,SC3045
|
||||
MAX_FD=$( ulimit -H -n ) ||
|
||||
warn "Could not query maximum file descriptor limit"
|
||||
esac
|
||||
case $MAX_FD in #(
|
||||
'' | soft) :;; #(
|
||||
*)
|
||||
# In POSIX sh, ulimit -n is undefined. That's why the result is checked to see if it worked.
|
||||
# shellcheck disable=SC2039,SC3045
|
||||
ulimit -n "$MAX_FD" ||
|
||||
warn "Could not set maximum file descriptor limit to $MAX_FD"
|
||||
esac
|
||||
fi
|
||||
|
||||
# Escape application args
|
||||
save () {
|
||||
for i do printf %s\\n "$i" | sed "s/'/'\\\\''/g;1s/^/'/;\$s/\$/' \\\\/" ; done
|
||||
echo " "
|
||||
}
|
||||
APP_ARGS=`save "$@"`
|
||||
# Collect all arguments for the java command, stacking in reverse order:
|
||||
# * args from the command line
|
||||
# * the main class name
|
||||
# * -classpath
|
||||
# * -D...appname settings
|
||||
# * --module-path (only if needed)
|
||||
# * DEFAULT_JVM_OPTS, JAVA_OPTS, and GRADLE_OPTS environment variables.
|
||||
|
||||
# Collect all arguments for the java command, following the shell quoting and substitution rules
|
||||
eval set -- $DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS "\"-Dorg.gradle.appname=$APP_BASE_NAME\"" -classpath "\"$CLASSPATH\"" org.gradle.wrapper.GradleWrapperMain "$APP_ARGS"
|
||||
# For Cygwin or MSYS, switch paths to Windows format before running java
|
||||
if "$cygwin" || "$msys" ; then
|
||||
APP_HOME=$( cygpath --path --mixed "$APP_HOME" )
|
||||
CLASSPATH=$( cygpath --path --mixed "$CLASSPATH" )
|
||||
|
||||
JAVACMD=$( cygpath --unix "$JAVACMD" )
|
||||
|
||||
# Now convert the arguments - kludge to limit ourselves to /bin/sh
|
||||
for arg do
|
||||
if
|
||||
case $arg in #(
|
||||
-*) false ;; # don't mess with options #(
|
||||
/?*) t=${arg#/} t=/${t%%/*} # looks like a POSIX filepath
|
||||
[ -e "$t" ] ;; #(
|
||||
*) false ;;
|
||||
esac
|
||||
then
|
||||
arg=$( cygpath --path --ignore --mixed "$arg" )
|
||||
fi
|
||||
# Roll the args list around exactly as many times as the number of
|
||||
# args, so each arg winds up back in the position where it started, but
|
||||
# possibly modified.
|
||||
#
|
||||
# NB: a `for` loop captures its iteration list before it begins, so
|
||||
# changing the positional parameters here affects neither the number of
|
||||
# iterations, nor the values presented in `arg`.
|
||||
shift # remove old arg
|
||||
set -- "$@" "$arg" # push replacement arg
|
||||
done
|
||||
fi
|
||||
|
||||
|
||||
# Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
|
||||
DEFAULT_JVM_OPTS='"-Xmx64m" "-Xms64m"'
|
||||
|
||||
# Collect all arguments for the java command:
|
||||
# * DEFAULT_JVM_OPTS, JAVA_OPTS, JAVA_OPTS, and optsEnvironmentVar are not allowed to contain shell fragments,
|
||||
# and any embedded shellness will be escaped.
|
||||
# * For example: A user cannot expect ${Hostname} to be expanded, as it is an environment variable and will be
|
||||
# treated as '${Hostname}' itself on the command line.
|
||||
|
||||
set -- \
|
||||
"-Dorg.gradle.appname=$APP_BASE_NAME" \
|
||||
-classpath "$CLASSPATH" \
|
||||
org.gradle.wrapper.GradleWrapperMain \
|
||||
"$@"
|
||||
|
||||
# Stop when "xargs" is not available.
|
||||
if ! command -v xargs >/dev/null 2>&1
|
||||
then
|
||||
die "xargs is not available"
|
||||
fi
|
||||
|
||||
# Use "xargs" to parse quoted args.
|
||||
#
|
||||
# With -n1 it outputs one arg per line, with the quotes and backslashes removed.
|
||||
#
|
||||
# In Bash we could simply go:
|
||||
#
|
||||
# readarray ARGS < <( xargs -n1 <<<"$var" ) &&
|
||||
# set -- "${ARGS[@]}" "$@"
|
||||
#
|
||||
# but POSIX shell has neither arrays nor command substitution, so instead we
|
||||
# post-process each arg (as a line of input to sed) to backslash-escape any
|
||||
# character that might be a shell metacharacter, then use eval to reverse
|
||||
# that process (while maintaining the separation between arguments), and wrap
|
||||
# the whole thing up as a single "set" statement.
|
||||
#
|
||||
# This will of course break if any of these variables contains a newline or
|
||||
# an unmatched quote.
|
||||
#
|
||||
|
||||
eval "set -- $(
|
||||
printf '%s\n' "$DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS" |
|
||||
xargs -n1 |
|
||||
sed ' s~[^-[:alnum:]+,./:=@_]~\\&~g; ' |
|
||||
tr '\n' ' '
|
||||
)" '"$@"'
|
||||
|
||||
exec "$JAVACMD" "$@"
|
||||
|
56
gradlew.bat
vendored
56
gradlew.bat
vendored
@ -13,6 +13,8 @@
|
||||
@rem See the License for the specific language governing permissions and
|
||||
@rem limitations under the License.
|
||||
@rem
|
||||
@rem SPDX-License-Identifier: Apache-2.0
|
||||
@rem
|
||||
|
||||
@if "%DEBUG%"=="" @echo off
|
||||
@rem ##########################################################################
|
||||
@ -26,9 +28,13 @@ if "%OS%"=="Windows_NT" setlocal
|
||||
|
||||
set DIRNAME=%~dp0
|
||||
if "%DIRNAME%"=="" set DIRNAME=.
|
||||
@rem This is normally unused
|
||||
set APP_BASE_NAME=%~n0
|
||||
set APP_HOME=%DIRNAME%
|
||||
|
||||
@rem Resolve any "." and ".." in APP_HOME to make it shorter.
|
||||
for %%i in ("%APP_HOME%") do set APP_HOME=%%~fi
|
||||
|
||||
@rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
|
||||
set DEFAULT_JVM_OPTS="-Xmx64m" "-Xms64m"
|
||||
|
||||
@ -37,13 +43,13 @@ if defined JAVA_HOME goto findJavaFromJavaHome
|
||||
|
||||
set JAVA_EXE=java.exe
|
||||
%JAVA_EXE% -version >NUL 2>&1
|
||||
if "%ERRORLEVEL%" == "0" goto init
|
||||
if %ERRORLEVEL% equ 0 goto execute
|
||||
|
||||
echo.
|
||||
echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
|
||||
echo.
|
||||
echo Please set the JAVA_HOME variable in your environment to match the
|
||||
echo location of your Java installation.
|
||||
echo. 1>&2
|
||||
echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. 1>&2
|
||||
echo. 1>&2
|
||||
echo Please set the JAVA_HOME variable in your environment to match the 1>&2
|
||||
echo location of your Java installation. 1>&2
|
||||
|
||||
goto fail
|
||||
|
||||
@ -51,48 +57,36 @@ goto fail
|
||||
set JAVA_HOME=%JAVA_HOME:"=%
|
||||
set JAVA_EXE=%JAVA_HOME%/bin/java.exe
|
||||
|
||||
if exist "%JAVA_EXE%" goto init
|
||||
if exist "%JAVA_EXE%" goto execute
|
||||
|
||||
echo.
|
||||
echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME%
|
||||
echo.
|
||||
echo Please set the JAVA_HOME variable in your environment to match the
|
||||
echo location of your Java installation.
|
||||
echo. 1>&2
|
||||
echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME% 1>&2
|
||||
echo. 1>&2
|
||||
echo Please set the JAVA_HOME variable in your environment to match the 1>&2
|
||||
echo location of your Java installation. 1>&2
|
||||
|
||||
goto fail
|
||||
|
||||
:init
|
||||
@rem Get command-line arguments, handling Windows variants
|
||||
|
||||
if not "%OS%" == "Windows_NT" goto win9xME_args
|
||||
|
||||
:win9xME_args
|
||||
@rem Slurp the command line arguments.
|
||||
set CMD_LINE_ARGS=
|
||||
set _SKIP=2
|
||||
|
||||
:win9xME_args_slurp
|
||||
if "x%~1" == "x" goto execute
|
||||
|
||||
set CMD_LINE_ARGS=%*
|
||||
|
||||
:execute
|
||||
@rem Setup the command line
|
||||
|
||||
set CLASSPATH=%APP_HOME%\gradle\wrapper\gradle-wrapper.jar
|
||||
|
||||
|
||||
@rem Execute Gradle
|
||||
"%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" org.gradle.wrapper.GradleWrapperMain %CMD_LINE_ARGS%
|
||||
"%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" org.gradle.wrapper.GradleWrapperMain %*
|
||||
|
||||
:end
|
||||
@rem End local scope for the variables with windows NT shell
|
||||
if "%ERRORLEVEL%"=="0" goto mainEnd
|
||||
if %ERRORLEVEL% equ 0 goto mainEnd
|
||||
|
||||
:fail
|
||||
rem Set variable GRADLE_EXIT_CONSOLE if you need the _script_ return code instead of
|
||||
rem the _cmd.exe /c_ return code!
|
||||
if not "" == "%GRADLE_EXIT_CONSOLE%" exit 1
|
||||
exit /b 1
|
||||
set EXIT_CODE=%ERRORLEVEL%
|
||||
if %EXIT_CODE% equ 0 set EXIT_CODE=1
|
||||
if not ""=="%GRADLE_EXIT_CONSOLE%" exit %EXIT_CODE%
|
||||
exit /b %EXIT_CODE%
|
||||
|
||||
:mainEnd
|
||||
if "%OS%"=="Windows_NT" endlocal
|
||||
|
7
jitpack.yml
Normal file
7
jitpack.yml
Normal file
@ -0,0 +1,7 @@
|
||||
# Deploys the latest stable JDK 21 available and sets it to default without having to manually specify it here,
|
||||
# Which includes using temurin as the distribution.
|
||||
before_install:
|
||||
- curl -s "https://get.sdkman.io" | bash
|
||||
- source ~/.sdkman/bin/sdkman-init.sh
|
||||
- sdk install java 21.0.3-tem
|
||||
- sdk use java 21.0.3-tem
|
@ -1,10 +0,0 @@
|
||||
pluginManagement {
|
||||
repositories {
|
||||
jcenter()
|
||||
maven {
|
||||
name = 'Fabric'
|
||||
url = 'https://maven.fabricmc.net/'
|
||||
}
|
||||
gradlePluginPortal()
|
||||
}
|
||||
}
|
24
settings.gradle.kts
Normal file
24
settings.gradle.kts
Normal file
@ -0,0 +1,24 @@
|
||||
pluginManagement {
|
||||
repositories {
|
||||
gradlePluginPortal()
|
||||
mavenCentral()
|
||||
maven ("https://maven.fabricmc.net/")
|
||||
}
|
||||
}
|
||||
|
||||
rootProject.name = "ViaFabric"
|
||||
|
||||
include("viafabric-mc1144")
|
||||
include("viafabric-mc1152")
|
||||
include("viafabric-mc1165")
|
||||
include("viafabric-mc1171")
|
||||
include("viafabric-mc1182")
|
||||
include("viafabric-mc1194")
|
||||
include("viafabric-mc1201")
|
||||
include("viafabric-mc1204")
|
||||
include("viafabric-mc1206")
|
||||
include("viafabric-mc1211")
|
||||
|
||||
plugins {
|
||||
id("org.gradle.toolchains.foojay-resolver-convention") version "0.8.0"
|
||||
}
|
@ -1,102 +0,0 @@
|
||||
/*
|
||||
* MIT License
|
||||
*
|
||||
* Copyright (c) 2018 creeper123123321 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.github.creeper123123321.viafabric;
|
||||
|
||||
import com.github.creeper123123321.viafabric.commands.VRCommandHandler;
|
||||
import com.github.creeper123123321.viafabric.config.VRConfig;
|
||||
import com.github.creeper123123321.viafabric.platform.VRInjector;
|
||||
import com.github.creeper123123321.viafabric.platform.VRLoader;
|
||||
import com.github.creeper123123321.viafabric.platform.VRPlatform;
|
||||
import com.github.creeper123123321.viafabric.util.JLoggerToLog4j;
|
||||
import com.google.common.util.concurrent.ThreadFactoryBuilder;
|
||||
import com.mojang.brigadier.arguments.StringArgumentType;
|
||||
import com.mojang.brigadier.builder.LiteralArgumentBuilder;
|
||||
import com.mojang.brigadier.builder.RequiredArgumentBuilder;
|
||||
import io.netty.channel.DefaultEventLoop;
|
||||
import io.netty.channel.EventLoop;
|
||||
import net.fabricmc.api.ModInitializer;
|
||||
import net.fabricmc.fabric.api.registry.CommandRegistry;
|
||||
import net.fabricmc.loader.api.FabricLoader;
|
||||
import net.minecraft.server.command.CommandSource;
|
||||
import org.apache.logging.log4j.LogManager;
|
||||
import us.myles.ViaVersion.ViaManager;
|
||||
import us.myles.ViaVersion.api.Via;
|
||||
import us.myles.ViaVersion.api.data.MappingDataLoader;
|
||||
|
||||
import java.util.concurrent.ExecutorService;
|
||||
import java.util.concurrent.Executors;
|
||||
import java.util.concurrent.ThreadFactory;
|
||||
import java.util.logging.Logger;
|
||||
|
||||
public class ViaFabric implements ModInitializer {
|
||||
public static final Logger JLOGGER = new JLoggerToLog4j(LogManager.getLogger("ViaFabric"));
|
||||
public static final ExecutorService ASYNC_EXECUTOR;
|
||||
public static final EventLoop EVENT_LOOP;
|
||||
public static VRConfig config;
|
||||
|
||||
static {
|
||||
ThreadFactory factory = new ThreadFactoryBuilder().setNameFormat("ViaFabric-%d").build();
|
||||
ASYNC_EXECUTOR = Executors.newFixedThreadPool(8, factory);
|
||||
EVENT_LOOP = new DefaultEventLoop(factory);
|
||||
}
|
||||
|
||||
public static String getVersion() {
|
||||
return FabricLoader.getInstance().getModContainer("viafabric")
|
||||
.get().getMetadata().getVersion().getFriendlyString();
|
||||
}
|
||||
|
||||
public static <S extends CommandSource> LiteralArgumentBuilder<S> command(String commandName) {
|
||||
return LiteralArgumentBuilder.<S>literal(commandName)
|
||||
.then(
|
||||
RequiredArgumentBuilder
|
||||
.<S, String>argument("args", StringArgumentType.greedyString())
|
||||
.executes(((VRCommandHandler) Via.getManager().getCommandHandler())::execute)
|
||||
.suggests(((VRCommandHandler) Via.getManager().getCommandHandler())::suggestion)
|
||||
)
|
||||
.executes(((VRCommandHandler) Via.getManager().getCommandHandler())::execute);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onInitialize() {
|
||||
Via.init(ViaManager.builder()
|
||||
.injector(new VRInjector())
|
||||
.loader(new VRLoader())
|
||||
.commandHandler(new VRCommandHandler())
|
||||
.platform(new VRPlatform()).build());
|
||||
|
||||
FabricLoader.getInstance().getModContainer("viabackwards").ifPresent(mod -> MappingDataLoader.enableMappingsCache());
|
||||
|
||||
Via.getManager().init();
|
||||
|
||||
FabricLoader.getInstance().getEntrypoints("viafabric:via_api_initialized", Runnable.class).forEach(Runnable::run);
|
||||
|
||||
CommandRegistry.INSTANCE.register(false, c -> c.register(command("viaversion")));
|
||||
CommandRegistry.INSTANCE.register(false, c -> c.register(command("viaver")));
|
||||
CommandRegistry.INSTANCE.register(false, c -> c.register(command("vvfabric")));
|
||||
|
||||
config = new VRConfig(FabricLoader.getInstance().getConfigDirectory().toPath().resolve("ViaFabric")
|
||||
.resolve("viafabric.yml").toFile());
|
||||
}
|
||||
}
|
@ -1,60 +0,0 @@
|
||||
/*
|
||||
* MIT License
|
||||
*
|
||||
* Copyright (c) 2018 creeper123123321 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.github.creeper123123321.viafabric.commands;
|
||||
|
||||
import us.myles.ViaVersion.api.Via;
|
||||
import us.myles.ViaVersion.api.command.ViaCommandSender;
|
||||
import us.myles.ViaVersion.api.data.UserConnection;
|
||||
import us.myles.ViaVersion.protocols.base.ProtocolInfo;
|
||||
|
||||
import java.util.UUID;
|
||||
|
||||
public class UserCommandSender implements ViaCommandSender {
|
||||
private UserConnection con;
|
||||
|
||||
public UserCommandSender(UserConnection con) {
|
||||
this.con = con;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean hasPermission(String s) {
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void sendMessage(String s) {
|
||||
Via.getPlatform().sendMessage(getUUID(), s);
|
||||
}
|
||||
|
||||
@Override
|
||||
public UUID getUUID() {
|
||||
return con.get(ProtocolInfo.class).getUuid();
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getName() {
|
||||
return con.get(ProtocolInfo.class).getUsername();
|
||||
}
|
||||
}
|
@ -1,37 +0,0 @@
|
||||
/*
|
||||
* MIT License
|
||||
*
|
||||
* Copyright (c) 2018 creeper123123321 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.github.creeper123123321.viafabric.commands;
|
||||
|
||||
import com.github.creeper123123321.viafabric.ViaFabric;
|
||||
import com.mojang.brigadier.CommandDispatcher;
|
||||
import io.github.cottonmc.clientcommands.ClientCommandPlugin;
|
||||
import io.github.cottonmc.clientcommands.CottonClientCommandSource;
|
||||
|
||||
public class VRClientCommands implements ClientCommandPlugin {
|
||||
@Override
|
||||
public void registerCommands(CommandDispatcher<CottonClientCommandSource> commandDispatcher) {
|
||||
commandDispatcher.register(ViaFabric.command("viafabricclient"));
|
||||
}
|
||||
}
|
@ -1,75 +0,0 @@
|
||||
/*
|
||||
* MIT License
|
||||
*
|
||||
* Copyright (c) 2018 creeper123123321 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.github.creeper123123321.viafabric.config;
|
||||
|
||||
import net.minecraft.SharedConstants;
|
||||
import us.myles.ViaVersion.util.Config;
|
||||
|
||||
import java.io.File;
|
||||
import java.net.URL;
|
||||
import java.util.Collections;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
public class VRConfig extends Config {
|
||||
public static final String ENABLE_CLIENT_SIDE = "enable-client-side";
|
||||
public static final String CLIENT_SIDE_VERSION = "client-side-version";
|
||||
|
||||
public VRConfig(File configFile) {
|
||||
super(configFile);
|
||||
reloadConfig();
|
||||
}
|
||||
|
||||
@Override
|
||||
public URL getDefaultConfigURL() {
|
||||
return getClass().getClassLoader().getResource("assets/viafabric/config.yml");
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void handleConfig(Map<String, Object> map) {
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<String> getUnsupportedOptions() {
|
||||
return Collections.emptyList();
|
||||
}
|
||||
|
||||
public boolean isClientSideEnabled() {
|
||||
return getBoolean(ENABLE_CLIENT_SIDE, false);
|
||||
}
|
||||
|
||||
public int getClientSideVersion() {
|
||||
int nat = SharedConstants.getGameVersion().getProtocolVersion();
|
||||
return !isClientSideEnabled() ? nat : getInt(CLIENT_SIDE_VERSION, -1);
|
||||
}
|
||||
|
||||
public void setClientSideEnabled(boolean val) {
|
||||
set(ENABLE_CLIENT_SIDE, val);
|
||||
}
|
||||
|
||||
public void setClientSideVersion(int val) {
|
||||
set(CLIENT_SIDE_VERSION, val);
|
||||
}
|
||||
}
|
@ -1,85 +0,0 @@
|
||||
/*
|
||||
* MIT License
|
||||
*
|
||||
* Copyright (c) 2018 creeper123123321 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.github.creeper123123321.viafabric.handler;
|
||||
|
||||
import io.netty.buffer.ByteBuf;
|
||||
import us.myles.ViaVersion.api.PacketWrapper;
|
||||
import us.myles.ViaVersion.api.data.UserConnection;
|
||||
import us.myles.ViaVersion.api.type.Type;
|
||||
import us.myles.ViaVersion.exception.CancelException;
|
||||
import us.myles.ViaVersion.packets.Direction;
|
||||
import us.myles.ViaVersion.protocols.base.ProtocolInfo;
|
||||
|
||||
import java.util.function.Function;
|
||||
|
||||
// TODO delete this when https://github.com/ViaVersion/ViaVersion/pull/1505 is merged
|
||||
public class CommonTransformer {
|
||||
public static final String HANDLER_DECODER_NAME = "via-decoder";
|
||||
public static final String HANDLER_ENCODER_NAME = "via-encoder";
|
||||
|
||||
public static boolean preServerboundCheck(UserConnection user) {
|
||||
// Ignore if pending disconnect
|
||||
if (user.isPendingDisconnect()) return true;
|
||||
// Increment received + Check PPS
|
||||
return user.incrementReceived() && user.handlePPS();
|
||||
}
|
||||
|
||||
public static void preClientbound(UserConnection user) {
|
||||
user.incrementSent();
|
||||
}
|
||||
|
||||
public static boolean willTransformPacket(UserConnection user) {
|
||||
return user.isActive();
|
||||
}
|
||||
|
||||
public static void transformClientbound(ByteBuf draft, UserConnection user, Function<Throwable, Exception> cancelSupplier) throws Exception {
|
||||
if (!draft.isReadable()) return;
|
||||
transform(draft, user, Direction.OUTGOING, cancelSupplier);
|
||||
}
|
||||
|
||||
public static void transformServerbound(ByteBuf draft, UserConnection user, Function<Throwable, Exception> cancelSupplier) throws Exception {
|
||||
if (!draft.isReadable()) return;
|
||||
transform(draft, user, Direction.INCOMING, cancelSupplier);
|
||||
}
|
||||
|
||||
private static void transform(ByteBuf draft, UserConnection user, Direction direction, Function<Throwable, Exception> cancelSupplier) throws Exception {
|
||||
int id = Type.VAR_INT.read(draft);
|
||||
if (id == PacketWrapper.PASSTHROUGH_ID) return;
|
||||
PacketWrapper wrapper = new PacketWrapper(id, draft, user);
|
||||
ProtocolInfo protInfo = user.get(ProtocolInfo.class);
|
||||
try {
|
||||
protInfo.getPipeline().transform(direction, protInfo.getState(), wrapper);
|
||||
} catch (CancelException ex) {
|
||||
throw cancelSupplier.apply(ex);
|
||||
}
|
||||
ByteBuf transformed = draft.alloc().buffer();
|
||||
try {
|
||||
wrapper.writeToBuffer(transformed);
|
||||
draft.clear().writeBytes(transformed);
|
||||
} finally {
|
||||
transformed.release();
|
||||
}
|
||||
}
|
||||
}
|
@ -1,76 +0,0 @@
|
||||
/*
|
||||
* MIT License
|
||||
*
|
||||
* Copyright (c) 2018 creeper123123321 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.github.creeper123123321.viafabric.handler.clientside;
|
||||
|
||||
import com.github.creeper123123321.viafabric.handler.CommonTransformer;
|
||||
import io.netty.buffer.ByteBuf;
|
||||
import io.netty.channel.ChannelHandlerContext;
|
||||
import io.netty.handler.codec.MessageToMessageDecoder;
|
||||
import us.myles.ViaVersion.api.Via;
|
||||
import us.myles.ViaVersion.api.data.UserConnection;
|
||||
import us.myles.ViaVersion.exception.CancelException;
|
||||
import us.myles.ViaVersion.protocols.base.ProtocolInfo;
|
||||
import us.myles.ViaVersion.util.PipelineUtil;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
public class VRDecodeHandler extends MessageToMessageDecoder<ByteBuf> {
|
||||
private UserConnection user;
|
||||
|
||||
public VRDecodeHandler(UserConnection user) {
|
||||
this.user = user;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void decode(ChannelHandlerContext ctx, ByteBuf msg, List<Object> out) throws Exception {
|
||||
CommonTransformer.preClientbound(user);
|
||||
if (!CommonTransformer.willTransformPacket(user)) {
|
||||
out.add(msg.retain());
|
||||
return;
|
||||
}
|
||||
ByteBuf draft = msg.alloc().buffer().writeBytes(msg);
|
||||
try {
|
||||
CommonTransformer.transformClientbound(draft, user, ignored -> CancelException.CACHED);
|
||||
out.add(draft.retain());
|
||||
} finally {
|
||||
draft.release();
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void exceptionCaught(ChannelHandlerContext ctx, Throwable cause) throws Exception {
|
||||
if (PipelineUtil.containsCause(cause, CancelException.class)) return;
|
||||
super.exceptionCaught(ctx, cause);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void channelInactive(ChannelHandlerContext ctx) throws Exception {
|
||||
super.channelInactive(ctx);
|
||||
ProtocolInfo info = user.get(ProtocolInfo.class);
|
||||
if (info.getUuid() != null) {
|
||||
Via.getManager().removePortedClient(info.getUuid());
|
||||
}
|
||||
}
|
||||
}
|
@ -1,67 +0,0 @@
|
||||
/*
|
||||
* MIT License
|
||||
*
|
||||
* Copyright (c) 2018 creeper123123321 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.github.creeper123123321.viafabric.handler.clientside;
|
||||
|
||||
import com.github.creeper123123321.viafabric.handler.CommonTransformer;
|
||||
import io.netty.buffer.ByteBuf;
|
||||
import io.netty.channel.ChannelHandlerContext;
|
||||
import io.netty.handler.codec.MessageToMessageEncoder;
|
||||
import us.myles.ViaVersion.api.data.UserConnection;
|
||||
import us.myles.ViaVersion.exception.CancelException;
|
||||
import us.myles.ViaVersion.util.PipelineUtil;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
public class VREncodeHandler extends MessageToMessageEncoder<ByteBuf> {
|
||||
private UserConnection user;
|
||||
|
||||
public VREncodeHandler(UserConnection user) {
|
||||
this.user = user;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void encode(ChannelHandlerContext ctx, ByteBuf msg, List<Object> out) throws Exception {
|
||||
if (CommonTransformer.preServerboundCheck(user)) {
|
||||
throw CancelException.CACHED; // M2ME expects at least one message
|
||||
}
|
||||
if (!CommonTransformer.willTransformPacket(user)) {
|
||||
out.add(msg.retain());
|
||||
return;
|
||||
}
|
||||
ByteBuf draft = ctx.alloc().buffer().writeBytes(msg);
|
||||
try {
|
||||
CommonTransformer.transformServerbound(draft, user, ignored -> CancelException.CACHED);
|
||||
out.add(draft.retain());
|
||||
} finally {
|
||||
draft.release();
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void exceptionCaught(ChannelHandlerContext ctx, Throwable cause) throws Exception {
|
||||
if (PipelineUtil.containsCause(cause, CancelException.class)) return;
|
||||
super.exceptionCaught(ctx, cause);
|
||||
}
|
||||
}
|
@ -1,78 +0,0 @@
|
||||
/*
|
||||
* MIT License
|
||||
*
|
||||
* Copyright (c) 2018 creeper123123321 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.github.creeper123123321.viafabric.handler.serverside;
|
||||
|
||||
import com.github.creeper123123321.viafabric.handler.CommonTransformer;
|
||||
import io.netty.buffer.ByteBuf;
|
||||
import io.netty.channel.ChannelHandlerContext;
|
||||
import io.netty.handler.codec.MessageToMessageDecoder;
|
||||
import us.myles.ViaVersion.api.Via;
|
||||
import us.myles.ViaVersion.api.data.UserConnection;
|
||||
import us.myles.ViaVersion.exception.CancelException;
|
||||
import us.myles.ViaVersion.protocols.base.ProtocolInfo;
|
||||
import us.myles.ViaVersion.util.PipelineUtil;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
public class FabricDecodeHandler extends MessageToMessageDecoder<ByteBuf> {
|
||||
private final UserConnection user;
|
||||
|
||||
public FabricDecodeHandler(UserConnection user) {
|
||||
this.user = user;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void decode(ChannelHandlerContext ctx, ByteBuf msg, List<Object> out) throws Exception {
|
||||
if (CommonTransformer.preServerboundCheck(user)) {
|
||||
throw CancelException.CACHED;
|
||||
}
|
||||
if (!CommonTransformer.willTransformPacket(user)) {
|
||||
out.add(msg.retain());
|
||||
return;
|
||||
}
|
||||
ByteBuf draft = ctx.alloc().buffer().writeBytes(msg);
|
||||
try {
|
||||
CommonTransformer.transformServerbound(draft, user, ignored -> CancelException.CACHED);
|
||||
out.add(draft.retain());
|
||||
} finally {
|
||||
draft.release();
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void exceptionCaught(ChannelHandlerContext ctx, Throwable cause) throws Exception {
|
||||
if (PipelineUtil.containsCause(cause, CancelException.class)) return;
|
||||
super.exceptionCaught(ctx, cause);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void channelInactive(ChannelHandlerContext ctx) throws Exception {
|
||||
super.channelInactive(ctx); // May call decode
|
||||
ProtocolInfo pi = user.get(ProtocolInfo.class);
|
||||
if (pi.getUuid() != null) {
|
||||
Via.getManager().removePortedClient(pi.getUuid());
|
||||
}
|
||||
}
|
||||
}
|
@ -1,65 +0,0 @@
|
||||
/*
|
||||
* MIT License
|
||||
*
|
||||
* Copyright (c) 2018 creeper123123321 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.github.creeper123123321.viafabric.handler.serverside;
|
||||
|
||||
import com.github.creeper123123321.viafabric.handler.CommonTransformer;
|
||||
import io.netty.buffer.ByteBuf;
|
||||
import io.netty.channel.ChannelHandlerContext;
|
||||
import io.netty.handler.codec.MessageToMessageEncoder;
|
||||
import us.myles.ViaVersion.api.data.UserConnection;
|
||||
import us.myles.ViaVersion.exception.CancelException;
|
||||
import us.myles.ViaVersion.util.PipelineUtil;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
public class FabricEncodeHandler extends MessageToMessageEncoder<ByteBuf> {
|
||||
private final UserConnection user;
|
||||
|
||||
public FabricEncodeHandler(UserConnection user) {
|
||||
this.user = user;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void encode(final ChannelHandlerContext ctx, ByteBuf msg, final List<Object> out) throws Exception {
|
||||
CommonTransformer.preClientbound(user);
|
||||
if (!CommonTransformer.willTransformPacket(user)) {
|
||||
out.add(msg.readRetainedSlice(msg.readableBytes()));
|
||||
return;
|
||||
}
|
||||
ByteBuf draft = ctx.alloc().buffer().writeBytes(msg);
|
||||
try {
|
||||
CommonTransformer.transformClientbound(draft, user, ignored -> CancelException.CACHED);
|
||||
out.add(draft.retain());
|
||||
} finally {
|
||||
draft.release();
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void exceptionCaught(ChannelHandlerContext ctx, Throwable cause) throws Exception {
|
||||
if (PipelineUtil.containsCause(cause, CancelException.class)) return;
|
||||
super.exceptionCaught(ctx, cause);
|
||||
}
|
||||
}
|
@ -1,75 +0,0 @@
|
||||
/*
|
||||
* MIT License
|
||||
*
|
||||
* Copyright (c) 2018 creeper123123321 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.github.creeper123123321.viafabric.mixin;
|
||||
|
||||
import com.github.creeper123123321.viafabric.handler.CommonTransformer;
|
||||
import io.netty.channel.ChannelHandler;
|
||||
import io.netty.channel.ChannelPipeline;
|
||||
import net.minecraft.network.ClientConnection;
|
||||
import org.apache.logging.log4j.Logger;
|
||||
import org.spongepowered.asm.mixin.Mixin;
|
||||
import org.spongepowered.asm.mixin.injection.At;
|
||||
import org.spongepowered.asm.mixin.injection.Redirect;
|
||||
|
||||
|
||||
@Mixin(ClientConnection.class)
|
||||
public class MixinClientConnection {
|
||||
@Redirect(
|
||||
method = "exceptionCaught",
|
||||
remap = false,
|
||||
at = @At(
|
||||
value = "INVOKE",
|
||||
target = "Lorg/apache/logging/log4j/Logger;debug(Ljava/lang/String;Ljava/lang/Throwable;)V"
|
||||
))
|
||||
private void redirectDebug(Logger logger, String message, Throwable t) {
|
||||
if ("Failed to sent packet".equals(message)) {
|
||||
logger.info(message, t);
|
||||
} else {
|
||||
logger.debug(message, t);
|
||||
}
|
||||
}
|
||||
|
||||
@Redirect(method = "setCompressionThreshold", at = @At(
|
||||
value = "INVOKE",
|
||||
remap = false,
|
||||
target = "Lio/netty/channel/ChannelPipeline;addBefore(Ljava/lang/String;Ljava/lang/String;Lio/netty/channel/ChannelHandler;)Lio/netty/channel/ChannelPipeline;"
|
||||
))
|
||||
private ChannelPipeline decodeEncodePlacement(ChannelPipeline instance, String base, String newHandler, ChannelHandler handler) {
|
||||
// Fixes the handler order
|
||||
switch (base) {
|
||||
case "decoder": {
|
||||
if (instance.get(CommonTransformer.HANDLER_DECODER_NAME) != null)
|
||||
base = CommonTransformer.HANDLER_DECODER_NAME;
|
||||
break;
|
||||
}
|
||||
case "encoder": {
|
||||
if (instance.get(CommonTransformer.HANDLER_ENCODER_NAME) != null)
|
||||
base = CommonTransformer.HANDLER_ENCODER_NAME;
|
||||
break;
|
||||
}
|
||||
}
|
||||
return instance.addBefore(base, newHandler, handler);
|
||||
}
|
||||
}
|
@ -1,51 +0,0 @@
|
||||
/*
|
||||
* MIT License
|
||||
*
|
||||
* Copyright (c) 2018 creeper123123321 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.github.creeper123123321.viafabric.mixin;
|
||||
|
||||
import com.github.creeper123123321.viafabric.handler.CommonTransformer;
|
||||
import com.github.creeper123123321.viafabric.handler.serverside.FabricDecodeHandler;
|
||||
import com.github.creeper123123321.viafabric.handler.serverside.FabricEncodeHandler;
|
||||
import io.netty.channel.Channel;
|
||||
import io.netty.channel.socket.SocketChannel;
|
||||
import org.spongepowered.asm.mixin.Mixin;
|
||||
import org.spongepowered.asm.mixin.injection.At;
|
||||
import org.spongepowered.asm.mixin.injection.Inject;
|
||||
import org.spongepowered.asm.mixin.injection.callback.CallbackInfo;
|
||||
import us.myles.ViaVersion.api.data.UserConnection;
|
||||
import us.myles.ViaVersion.api.protocol.ProtocolPipeline;
|
||||
|
||||
@Mixin(targets = "net.minecraft.server.ServerNetworkIo$1")
|
||||
public class MixinServerNetworkIoChInit {
|
||||
@Inject(method = "initChannel(Lio/netty/channel/Channel;)V", at = @At(value = "TAIL"), remap = false)
|
||||
private void onInitChannel(Channel channel, CallbackInfo ci) {
|
||||
if (channel instanceof SocketChannel) {
|
||||
UserConnection user = new UserConnection(channel);
|
||||
new ProtocolPipeline(user);
|
||||
|
||||
channel.pipeline().addBefore("encoder", CommonTransformer.HANDLER_ENCODER_NAME, new FabricEncodeHandler(user));
|
||||
channel.pipeline().addBefore("decoder", CommonTransformer.HANDLER_DECODER_NAME, new FabricDecodeHandler(user));
|
||||
}
|
||||
}
|
||||
}
|
@ -1,52 +0,0 @@
|
||||
/*
|
||||
* MIT License
|
||||
*
|
||||
* Copyright (c) 2018 creeper123123321 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.github.creeper123123321.viafabric.mixin.client;
|
||||
|
||||
import com.github.creeper123123321.viafabric.handler.CommonTransformer;
|
||||
import com.github.creeper123123321.viafabric.handler.clientside.VRDecodeHandler;
|
||||
import com.github.creeper123123321.viafabric.handler.clientside.VREncodeHandler;
|
||||
import com.github.creeper123123321.viafabric.platform.VRClientSideUserConnection;
|
||||
import io.netty.channel.Channel;
|
||||
import io.netty.channel.socket.SocketChannel;
|
||||
import org.spongepowered.asm.mixin.Mixin;
|
||||
import org.spongepowered.asm.mixin.injection.At;
|
||||
import org.spongepowered.asm.mixin.injection.Inject;
|
||||
import org.spongepowered.asm.mixin.injection.callback.CallbackInfo;
|
||||
import us.myles.ViaVersion.api.data.UserConnection;
|
||||
import us.myles.ViaVersion.api.protocol.ProtocolPipeline;
|
||||
|
||||
@Mixin(targets = "net.minecraft.network.ClientConnection$1")
|
||||
public class MixinClientConnectionChInit {
|
||||
@Inject(method = "initChannel(Lio/netty/channel/Channel;)V", at = @At(value = "TAIL"), remap = false)
|
||||
private void onInitChannel(Channel channel, CallbackInfo ci) {
|
||||
if (channel instanceof SocketChannel) {
|
||||
UserConnection user = new VRClientSideUserConnection(channel);
|
||||
new ProtocolPipeline(user);
|
||||
|
||||
channel.pipeline().addBefore("encoder", CommonTransformer.HANDLER_ENCODER_NAME, new VREncodeHandler(user));
|
||||
channel.pipeline().addBefore("decoder", CommonTransformer.HANDLER_DECODER_NAME, new VRDecodeHandler(user));
|
||||
}
|
||||
}
|
||||
}
|
@ -1,174 +0,0 @@
|
||||
/*
|
||||
* MIT License
|
||||
*
|
||||
* Copyright (c) 2018 creeper123123321 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.github.creeper123123321.viafabric.mixin.client;
|
||||
|
||||
import com.github.creeper123123321.viafabric.ViaFabric;
|
||||
import com.github.creeper123123321.viafabric.util.VersionFormatFilter;
|
||||
import net.minecraft.client.MinecraftClient;
|
||||
import net.minecraft.client.gui.screen.ConfirmScreen;
|
||||
import net.minecraft.client.gui.screen.Screen;
|
||||
import net.minecraft.client.gui.screen.multiplayer.MultiplayerScreen;
|
||||
import net.minecraft.client.gui.widget.ButtonWidget;
|
||||
import net.minecraft.client.gui.widget.TextFieldWidget;
|
||||
import net.minecraft.client.gui.widget.TexturedButtonWidget;
|
||||
import net.minecraft.client.resource.language.I18n;
|
||||
import net.minecraft.text.Text;
|
||||
import net.minecraft.text.TranslatableText;
|
||||
import net.minecraft.util.Identifier;
|
||||
import org.spongepowered.asm.mixin.Mixin;
|
||||
import org.spongepowered.asm.mixin.Unique;
|
||||
import org.spongepowered.asm.mixin.injection.At;
|
||||
import org.spongepowered.asm.mixin.injection.Inject;
|
||||
import org.spongepowered.asm.mixin.injection.callback.CallbackInfo;
|
||||
import us.myles.ViaVersion.api.protocol.ProtocolRegistry;
|
||||
import us.myles.ViaVersion.api.protocol.ProtocolVersion;
|
||||
|
||||
import java.util.Arrays;
|
||||
import java.util.List;
|
||||
import java.util.concurrent.CompletableFuture;
|
||||
import java.util.stream.Collectors;
|
||||
import java.util.stream.Stream;
|
||||
|
||||
@Mixin(MultiplayerScreen.class)
|
||||
public abstract class MixinMultiplayerScreen extends Screen {
|
||||
@Unique
|
||||
private TextFieldWidget protocolVersion;
|
||||
@Unique
|
||||
private ButtonWidget enableClientSideViaVersion;
|
||||
@Unique
|
||||
private boolean validProtocol;
|
||||
@Unique
|
||||
private boolean supportedProtocol;
|
||||
@Unique
|
||||
private CompletableFuture<Void> latestProtocolSave;
|
||||
|
||||
protected MixinMultiplayerScreen(Text title, UnsupportedOperationException e) {
|
||||
super(title);
|
||||
throw e;
|
||||
}
|
||||
|
||||
@Inject(method = "init", at = @At("TAIL"), remap = false)
|
||||
private void onInit(CallbackInfo ci) {
|
||||
protocolVersion = new TextFieldWidget(font, this.width / 2 + 88, 13, 65, 15, I18n.translate("gui.protocol_version_field.name"));
|
||||
protocolVersion.setTextPredicate(new VersionFormatFilter());
|
||||
protocolVersion.setChangedListener((text) -> {
|
||||
protocolVersion.setSuggestion(null);
|
||||
int newVersion = ViaFabric.config.getClientSideVersion();
|
||||
validProtocol = true;
|
||||
try {
|
||||
newVersion = Integer.parseInt(text);
|
||||
} catch (NumberFormatException e) {
|
||||
ProtocolVersion closest = ProtocolVersion.getClosest(text);
|
||||
if (closest != null) {
|
||||
newVersion = closest.getId();
|
||||
} else {
|
||||
validProtocol = false;
|
||||
List<String> completions = ProtocolVersion.getProtocols().stream()
|
||||
.map(ProtocolVersion::getName)
|
||||
.flatMap(str -> Stream.concat(
|
||||
Arrays.stream(str.split("-")),
|
||||
Arrays.stream(new String[]{str})
|
||||
))
|
||||
.distinct()
|
||||
.filter(ver -> ver.startsWith(text))
|
||||
.collect(Collectors.toList());
|
||||
if (completions.size() == 1) {
|
||||
protocolVersion.setSuggestion(completions.get(0).substring(text.length()));
|
||||
}
|
||||
}
|
||||
}
|
||||
supportedProtocol = isSupported(newVersion);
|
||||
protocolVersion.setEditableColor(getTextColor());
|
||||
int finalNewVersion = newVersion;
|
||||
if (latestProtocolSave == null) latestProtocolSave = CompletableFuture.completedFuture(null);
|
||||
latestProtocolSave = latestProtocolSave.thenRunAsync(() -> {
|
||||
ViaFabric.config.setClientSideVersion(finalNewVersion);
|
||||
ViaFabric.config.saveConfig();
|
||||
}, ViaFabric.ASYNC_EXECUTOR);
|
||||
});
|
||||
int clientSideVersion = ViaFabric.config.getClientSideVersion();
|
||||
|
||||
protocolVersion.setVisible(ViaFabric.config.isClientSideEnabled());
|
||||
|
||||
protocolVersion.setText(ProtocolVersion.isRegistered(clientSideVersion)
|
||||
? ProtocolVersion.getProtocol(clientSideVersion).getName()
|
||||
: Integer.toString(clientSideVersion));
|
||||
this.children.add(protocolVersion);
|
||||
|
||||
enableClientSideViaVersion = new TexturedButtonWidget(this.width / 2 + 113, 10,
|
||||
40, 20, // Size
|
||||
0, 0, // Start pos of texture
|
||||
20, // v Hover offset
|
||||
new Identifier("viafabric:textures/gui/via_button.png"),
|
||||
64, 64, // Texture size
|
||||
button -> MinecraftClient.getInstance().openScreen(new ConfirmScreen(
|
||||
answer -> {
|
||||
MinecraftClient.getInstance().openScreen(this);
|
||||
if (answer) {
|
||||
ViaFabric.config.setClientSideEnabled(true);
|
||||
ViaFabric.config.saveConfig();
|
||||
protocolVersion.setVisible(true);
|
||||
enableClientSideViaVersion.visible = false;
|
||||
}
|
||||
},
|
||||
new TranslatableText("gui.enable_client_side.question"),
|
||||
new TranslatableText("gui.enable_client_side.warning"),
|
||||
I18n.translate("gui.enable_client_side.enable"),
|
||||
I18n.translate("gui.cancel")
|
||||
)),
|
||||
I18n.translate("gui.enable_client_side_button"));
|
||||
enableClientSideViaVersion.visible = !protocolVersion.isVisible();
|
||||
addButton(enableClientSideViaVersion);
|
||||
}
|
||||
|
||||
@Inject(method = "render", at = {
|
||||
@At(value = "INVOKE", target = "Lnet/minecraft/client/gui/Screen;render(IIF)V"),
|
||||
@At(value = "INVOKE", target = "Lnet/minecraft/class_437;render(IIF)V") // todo check if refmap was fixed
|
||||
}, remap = false)
|
||||
private void onRender(int int_1, int int_2, float float_1, CallbackInfo ci) {
|
||||
protocolVersion.render(int_1, int_2, float_1);
|
||||
}
|
||||
|
||||
@Inject(method = "tick", at = @At("TAIL"), remap = false)
|
||||
private void onTick(CallbackInfo ci) {
|
||||
protocolVersion.tick();
|
||||
}
|
||||
|
||||
@Unique
|
||||
private int getTextColor() {
|
||||
if (!validProtocol) {
|
||||
return 0xff0000; // Red
|
||||
} else if (!supportedProtocol) {
|
||||
return 0xFFA500; // Orange
|
||||
}
|
||||
return 0xE0E0E0; // Default
|
||||
}
|
||||
|
||||
@Unique
|
||||
private boolean isSupported(int protocol) {
|
||||
return ProtocolRegistry.getProtocolPath(ProtocolRegistry.SERVER_PROTOCOL, protocol) != null
|
||||
|| ProtocolRegistry.SERVER_PROTOCOL == protocol;
|
||||
}
|
||||
}
|
@ -1,35 +0,0 @@
|
||||
/*
|
||||
* MIT License
|
||||
*
|
||||
* Copyright (c) 2018 creeper123123321 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.github.creeper123123321.viafabric.platform;
|
||||
|
||||
import us.myles.ViaVersion.api.boss.BossColor;
|
||||
import us.myles.ViaVersion.api.boss.BossStyle;
|
||||
import us.myles.ViaVersion.boss.CommonBoss;
|
||||
|
||||
public class VRBossBar extends CommonBoss {
|
||||
public VRBossBar(String title, float health, BossColor color, BossStyle style) {
|
||||
super(title, health, color, style);
|
||||
}
|
||||
}
|
@ -1,66 +0,0 @@
|
||||
/*
|
||||
* MIT License
|
||||
*
|
||||
* Copyright (c) 2018 creeper123123321 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.github.creeper123123321.viafabric.platform;
|
||||
|
||||
import com.github.creeper123123321.viafabric.handler.CommonTransformer;
|
||||
import io.netty.buffer.ByteBuf;
|
||||
import io.netty.channel.Channel;
|
||||
import io.netty.channel.ChannelFuture;
|
||||
import us.myles.ViaVersion.api.data.UserConnection;
|
||||
|
||||
public class VRClientSideUserConnection extends UserConnection {
|
||||
public VRClientSideUserConnection(Channel socketChannel) {
|
||||
super(socketChannel);
|
||||
}
|
||||
// Based on https://github.com/Gerrygames/ClientViaVersion/blob/master/src/main/java/de/gerrygames/the5zig/clientviaversion/reflection/Injector.java
|
||||
|
||||
@Override
|
||||
public void sendRawPacket(final ByteBuf packet, boolean currentThread) {
|
||||
Runnable act = () -> getChannel().pipeline().context(CommonTransformer.HANDLER_DECODER_NAME)
|
||||
.fireChannelRead(packet);
|
||||
if (currentThread) {
|
||||
act.run();
|
||||
} else {
|
||||
getChannel().eventLoop().execute(act);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public ChannelFuture sendRawPacketFuture(ByteBuf packet) {
|
||||
getChannel().pipeline().context(CommonTransformer.HANDLER_DECODER_NAME).fireChannelRead(packet);
|
||||
return getChannel().newSucceededFuture();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void sendRawPacketToServer(ByteBuf packet, boolean currentThread) {
|
||||
if (currentThread) {
|
||||
getChannel().pipeline().context(CommonTransformer.HANDLER_ENCODER_NAME).writeAndFlush(packet);
|
||||
} else {
|
||||
getChannel().eventLoop().submit(() -> {
|
||||
getChannel().pipeline().context(CommonTransformer.HANDLER_ENCODER_NAME).writeAndFlush(packet);
|
||||
});
|
||||
}
|
||||
}
|
||||
}
|
@ -1,85 +0,0 @@
|
||||
/*
|
||||
* MIT License
|
||||
*
|
||||
* Copyright (c) 2018 creeper123123321 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.github.creeper123123321.viafabric.platform;
|
||||
|
||||
import com.github.creeper123123321.viafabric.handler.CommonTransformer;
|
||||
import net.fabricmc.api.EnvType;
|
||||
import net.fabricmc.loader.api.FabricLoader;
|
||||
import net.minecraft.SharedConstants;
|
||||
import us.myles.ViaVersion.api.platform.ViaInjector;
|
||||
import us.myles.ViaVersion.util.GsonUtil;
|
||||
import us.myles.viaversion.libs.gson.JsonObject;
|
||||
|
||||
import java.lang.reflect.Method;
|
||||
import java.util.Arrays;
|
||||
|
||||
public class VRInjector implements ViaInjector {
|
||||
@Override
|
||||
public void inject() {
|
||||
// *looks at Mixins*
|
||||
}
|
||||
|
||||
@Override
|
||||
public void uninject() {
|
||||
// not possible *plays sad violin*
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getServerProtocolVersion() {
|
||||
return SharedConstants.getGameVersion().getProtocolVersion();
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getEncoderName() {
|
||||
return CommonTransformer.HANDLER_ENCODER_NAME;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getDecoderName() {
|
||||
return CommonTransformer.HANDLER_DECODER_NAME;
|
||||
}
|
||||
|
||||
@Override
|
||||
public JsonObject getDump() {
|
||||
JsonObject obj = new JsonObject();
|
||||
try {
|
||||
obj.add("serverNetworkIOChInit", GsonUtil.getGson().toJsonTree(
|
||||
Arrays.stream(Class.forName("net.minecraft.class_3242$1").getDeclaredMethods())
|
||||
.map(Method::toString)
|
||||
.toArray(String[]::new)));
|
||||
} catch (ClassNotFoundException ignored) {
|
||||
}
|
||||
if (FabricLoader.getInstance().getEnvironmentType() == EnvType.CLIENT) {
|
||||
try {
|
||||
obj.add("clientConnectionChInit", GsonUtil.getGson().toJsonTree(
|
||||
Arrays.stream(Class.forName("net.minecraft.class_2535$1").getDeclaredMethods())
|
||||
.map(Method::toString)
|
||||
.toArray(String[]::new)));
|
||||
} catch (ClassNotFoundException ignored) {
|
||||
}
|
||||
}
|
||||
return obj;
|
||||
}
|
||||
}
|
@ -1,45 +0,0 @@
|
||||
/*
|
||||
* MIT License
|
||||
*
|
||||
* Copyright (c) 2018 creeper123123321 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.github.creeper123123321.viafabric.platform;
|
||||
|
||||
import com.github.creeper123123321.viafabric.providers.VRVersionProvider;
|
||||
import us.myles.ViaVersion.api.Via;
|
||||
import us.myles.ViaVersion.api.platform.ViaPlatformLoader;
|
||||
import us.myles.ViaVersion.bungee.providers.BungeeMovementTransmitter;
|
||||
import us.myles.ViaVersion.protocols.base.VersionProvider;
|
||||
import us.myles.ViaVersion.protocols.protocol1_9to1_8.providers.MovementTransmitterProvider;
|
||||
|
||||
public class VRLoader implements ViaPlatformLoader {
|
||||
@Override
|
||||
public void load() {
|
||||
Via.getManager().getProviders().use(MovementTransmitterProvider.class, new BungeeMovementTransmitter());
|
||||
Via.getManager().getProviders().use(VersionProvider.class, new VRVersionProvider());
|
||||
}
|
||||
|
||||
@Override
|
||||
public void unload() {
|
||||
// Nothing to do
|
||||
}
|
||||
}
|
@ -1,314 +0,0 @@
|
||||
/*
|
||||
* MIT License
|
||||
*
|
||||
* Copyright (c) 2018 creeper123123321 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.github.creeper123123321.viafabric.platform;
|
||||
|
||||
import com.github.creeper123123321.viafabric.ViaFabric;
|
||||
import com.github.creeper123123321.viafabric.commands.NMSCommandSender;
|
||||
import com.github.creeper123123321.viafabric.commands.UserCommandSender;
|
||||
import com.github.creeper123123321.viafabric.util.FutureTaskId;
|
||||
import net.fabricmc.api.EnvType;
|
||||
import net.fabricmc.api.Environment;
|
||||
import net.fabricmc.loader.api.FabricLoader;
|
||||
import net.fabricmc.loader.api.ModContainer;
|
||||
import net.minecraft.client.MinecraftClient;
|
||||
import net.minecraft.client.network.ClientPlayNetworkHandler;
|
||||
import net.minecraft.entity.Entity;
|
||||
import net.minecraft.network.MessageType;
|
||||
import net.minecraft.network.OffThreadException;
|
||||
import net.minecraft.network.packet.s2c.play.ChatMessageS2CPacket;
|
||||
import net.minecraft.network.packet.s2c.play.DisconnectS2CPacket;
|
||||
import net.minecraft.server.MinecraftServer;
|
||||
import net.minecraft.server.network.ServerPlayerEntity;
|
||||
import net.minecraft.text.Text;
|
||||
import us.myles.ViaVersion.api.Via;
|
||||
import us.myles.ViaVersion.api.ViaAPI;
|
||||
import us.myles.ViaVersion.api.ViaVersionConfig;
|
||||
import us.myles.ViaVersion.api.command.ViaCommandSender;
|
||||
import us.myles.ViaVersion.api.configuration.ConfigurationProvider;
|
||||
import us.myles.ViaVersion.api.data.UserConnection;
|
||||
import us.myles.ViaVersion.api.platform.TaskId;
|
||||
import us.myles.ViaVersion.api.platform.ViaPlatform;
|
||||
import us.myles.ViaVersion.dump.PluginInfo;
|
||||
import us.myles.ViaVersion.protocols.protocol1_13to1_12_2.ChatRewriter;
|
||||
import us.myles.ViaVersion.sponge.VersionInfo;
|
||||
import us.myles.ViaVersion.util.GsonUtil;
|
||||
import us.myles.viaversion.libs.gson.JsonObject;
|
||||
|
||||
import java.io.File;
|
||||
import java.nio.file.Path;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.UUID;
|
||||
import java.util.concurrent.CompletableFuture;
|
||||
import java.util.concurrent.Executor;
|
||||
import java.util.concurrent.TimeUnit;
|
||||
import java.util.logging.Logger;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
public class VRPlatform implements ViaPlatform {
|
||||
private VRViaConfig config;
|
||||
private File dataFolder;
|
||||
|
||||
public VRPlatform() {
|
||||
Path configDir = FabricLoader.getInstance().getConfigDirectory().toPath().resolve("ViaFabric");
|
||||
config = new VRViaConfig(configDir.resolve("viaversion.yml").toFile());
|
||||
dataFolder = configDir.toFile();
|
||||
}
|
||||
|
||||
public static MinecraftServer getServer() {
|
||||
if (FabricLoader.getInstance().getEnvironmentType() == EnvType.CLIENT) {
|
||||
return getIntegratedServer();
|
||||
}
|
||||
return (MinecraftServer) FabricLoader.getInstance().getGameInstance();
|
||||
}
|
||||
|
||||
@Environment(EnvType.CLIENT)
|
||||
private static MinecraftServer getIntegratedServer() {
|
||||
return MinecraftClient.getInstance().getServer();
|
||||
}
|
||||
|
||||
@Override
|
||||
public Logger getLogger() {
|
||||
return ViaFabric.JLOGGER;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getPlatformName() {
|
||||
return "ViaFabric";
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getPlatformVersion() {
|
||||
return ViaFabric.getVersion();
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getPluginVersion() {
|
||||
try {
|
||||
return VersionInfo.class.getField("VERSION").get(null).toString();
|
||||
} catch (IllegalAccessException | NoSuchFieldException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
return "?";
|
||||
}
|
||||
|
||||
@Override
|
||||
public TaskId runAsync(Runnable runnable) {
|
||||
return new FutureTaskId(CompletableFuture
|
||||
.runAsync(runnable, ViaFabric.ASYNC_EXECUTOR)
|
||||
.exceptionally(throwable -> {
|
||||
throwable.printStackTrace();
|
||||
return null;
|
||||
})
|
||||
);
|
||||
}
|
||||
|
||||
@Override
|
||||
public TaskId runSync(Runnable runnable) {
|
||||
// Kick task needs to be on main thread
|
||||
Executor executor = ViaFabric.EVENT_LOOP;
|
||||
boolean alreadyLogged;
|
||||
MinecraftServer server = getServer();
|
||||
if (server != null) {
|
||||
alreadyLogged = true;
|
||||
executor = server;
|
||||
} else {
|
||||
alreadyLogged = false;
|
||||
}
|
||||
return new FutureTaskId(
|
||||
CompletableFuture.runAsync(runnable, executor)
|
||||
.exceptionally(throwable -> {
|
||||
if (!alreadyLogged) {
|
||||
throwable.printStackTrace();
|
||||
}
|
||||
return null;
|
||||
})
|
||||
);
|
||||
}
|
||||
|
||||
@Override
|
||||
public TaskId runSync(Runnable runnable, Long ticks) {
|
||||
// ViaVersion seems to not need to run delayed tasks on main thread
|
||||
return new FutureTaskId(
|
||||
ViaFabric.EVENT_LOOP
|
||||
.schedule(runnable, ticks * 50, TimeUnit.MILLISECONDS)
|
||||
.addListener(future -> {
|
||||
if (!future.isSuccess()) {
|
||||
future.cause().printStackTrace();
|
||||
}
|
||||
})
|
||||
);
|
||||
}
|
||||
|
||||
@Override
|
||||
public TaskId runRepeatingSync(Runnable runnable, Long ticks) {
|
||||
// ViaVersion seems to not need to run repeating tasks on main thread
|
||||
return new FutureTaskId(
|
||||
ViaFabric.EVENT_LOOP
|
||||
.scheduleAtFixedRate(runnable, 0, ticks * 50, TimeUnit.MILLISECONDS)
|
||||
.addListener(future -> {
|
||||
if (!future.isSuccess()) {
|
||||
future.cause().printStackTrace();
|
||||
}
|
||||
})
|
||||
);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void cancelTask(TaskId taskId) {
|
||||
if (taskId instanceof FutureTaskId) {
|
||||
((FutureTaskId) taskId).getObject().cancel(false);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public ViaCommandSender[] getOnlinePlayers() {
|
||||
MinecraftServer server = getServer();
|
||||
if (server != null && server.isOnThread()) {
|
||||
// Not thread safe
|
||||
return server.getPlayerManager().getPlayerList().stream()
|
||||
.map(Entity::getCommandSource)
|
||||
.map(NMSCommandSender::new)
|
||||
.toArray(ViaCommandSender[]::new);
|
||||
}
|
||||
return Via.getManager().getPortedPlayers().values().stream()
|
||||
.map(UserCommandSender::new)
|
||||
.toArray(ViaCommandSender[]::new);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void sendMessage(UUID uuid, String s) {
|
||||
UserConnection user = Via.getManager().getPortedPlayers().get(uuid);
|
||||
if (user instanceof VRClientSideUserConnection) {
|
||||
sendMessageClient(s);
|
||||
} else {
|
||||
runSync(() -> {
|
||||
MinecraftServer server = getServer();
|
||||
if (server == null) return;
|
||||
ServerPlayerEntity player = server.getPlayerManager().getPlayer(uuid);
|
||||
if (player == null) return;
|
||||
player.sendChatMessage(Text.Serializer.fromJson(ChatRewriter.legacyTextToJson(s)), MessageType.SYSTEM);
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
@Environment(EnvType.CLIENT)
|
||||
private void sendMessageClient(String s) {
|
||||
ClientPlayNetworkHandler handler = MinecraftClient.getInstance().getNetworkHandler();
|
||||
if (handler != null) {
|
||||
try {
|
||||
handler.onChatMessage(new ChatMessageS2CPacket(
|
||||
Text.Serializer.fromJson(ChatRewriter.legacyTextToJson(s))
|
||||
));
|
||||
} catch (OffThreadException ignored) {
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean kickPlayer(UUID uuid, String s) {
|
||||
UserConnection user = Via.getManager().getPortedPlayers().get(uuid);
|
||||
if (user instanceof VRClientSideUserConnection) {
|
||||
return kickClient(s);
|
||||
} else {
|
||||
MinecraftServer server = getServer();
|
||||
if (server != null && server.isOnThread()) {
|
||||
ServerPlayerEntity player = server.getPlayerManager().getPlayer(uuid);
|
||||
if (player == null) return false;
|
||||
player.networkHandler.disconnect(Text.Serializer.fromJson(ChatRewriter.legacyTextToJson(s)));
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
@Environment(EnvType.CLIENT)
|
||||
private boolean kickClient(String msg) {
|
||||
ClientPlayNetworkHandler handler = MinecraftClient.getInstance().getNetworkHandler();
|
||||
if (handler != null) {
|
||||
try {
|
||||
handler.onDisconnect(new DisconnectS2CPacket(
|
||||
Text.Serializer.fromJson(ChatRewriter.legacyTextToJson(msg))
|
||||
));
|
||||
} catch (OffThreadException ignored) {
|
||||
}
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isPluginEnabled() {
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public ViaAPI getApi() {
|
||||
return new VRViaAPI();
|
||||
}
|
||||
|
||||
@Override
|
||||
public ViaVersionConfig getConf() {
|
||||
return config;
|
||||
}
|
||||
|
||||
@Override
|
||||
public ConfigurationProvider getConfigurationProvider() {
|
||||
return config;
|
||||
}
|
||||
|
||||
@Override
|
||||
public File getDataFolder() {
|
||||
return dataFolder;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onReload() {
|
||||
// Nothing to do
|
||||
}
|
||||
|
||||
@Override
|
||||
public JsonObject getDump() {
|
||||
JsonObject platformSpecific = new JsonObject();
|
||||
List<PluginInfo> mods = new ArrayList<>();
|
||||
for (ModContainer mod : FabricLoader.getInstance().getAllMods()) {
|
||||
mods.add(new PluginInfo(true,
|
||||
mod.getMetadata().getName(),
|
||||
mod.getMetadata().getVersion().getFriendlyString(),
|
||||
null,
|
||||
mod.getMetadata().getAuthors().stream()
|
||||
.map(info -> info.getName() + "(" + info.getContact().asMap() + ")")
|
||||
.collect(Collectors.toList())
|
||||
));
|
||||
}
|
||||
|
||||
platformSpecific.add("mods", GsonUtil.getGson().toJsonTree(mods));
|
||||
return platformSpecific;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isOldClientsAllowed() {
|
||||
return true;
|
||||
}
|
||||
}
|
@ -1,99 +0,0 @@
|
||||
/*
|
||||
* MIT License
|
||||
*
|
||||
* Copyright (c) 2018 creeper123123321 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.github.creeper123123321.viafabric.platform;
|
||||
|
||||
import io.netty.buffer.ByteBuf;
|
||||
import us.myles.ViaVersion.api.Via;
|
||||
import us.myles.ViaVersion.api.ViaAPI;
|
||||
import us.myles.ViaVersion.api.boss.BossBar;
|
||||
import us.myles.ViaVersion.api.boss.BossColor;
|
||||
import us.myles.ViaVersion.api.boss.BossStyle;
|
||||
import us.myles.ViaVersion.api.data.UserConnection;
|
||||
import us.myles.ViaVersion.api.protocol.ProtocolRegistry;
|
||||
import us.myles.ViaVersion.protocols.base.ProtocolInfo;
|
||||
|
||||
import java.util.SortedSet;
|
||||
import java.util.TreeSet;
|
||||
import java.util.UUID;
|
||||
|
||||
public class VRViaAPI implements ViaAPI<Void> {
|
||||
@Override
|
||||
public int getPlayerVersion(Void o) {
|
||||
throw new UnsupportedOperationException();
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getPlayerVersion(UUID uuid) {
|
||||
UserConnection con = Via.getManager().getPortedPlayers().get(uuid);
|
||||
if (con != null) {
|
||||
return con.get(ProtocolInfo.class).getProtocolVersion();
|
||||
}
|
||||
try {
|
||||
return Via.getManager().getInjector().getServerProtocolVersion();
|
||||
} catch (Exception e) {
|
||||
throw new AssertionError(e);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
@Deprecated
|
||||
public boolean isPorted(UUID uuid) {
|
||||
return Via.getManager().getPortedPlayers().containsKey(uuid);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getVersion() {
|
||||
return Via.getPlatform().getPluginVersion();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void sendRawPacket(Void o, ByteBuf byteBuf) throws IllegalArgumentException {
|
||||
throw new UnsupportedOperationException();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void sendRawPacket(UUID uuid, ByteBuf byteBuf) throws IllegalArgumentException {
|
||||
UserConnection ci = Via.getManager().getPortedPlayers().get(uuid);
|
||||
ci.sendRawPacket(byteBuf);
|
||||
}
|
||||
|
||||
@Override
|
||||
public BossBar createBossBar(String s, BossColor bossColor, BossStyle bossStyle) {
|
||||
return new VRBossBar(s, 1f, bossColor, bossStyle);
|
||||
}
|
||||
|
||||
@Override
|
||||
public BossBar createBossBar(String s, float v, BossColor bossColor, BossStyle bossStyle) {
|
||||
return new VRBossBar(s, v, bossColor, bossStyle);
|
||||
}
|
||||
|
||||
@Override
|
||||
public SortedSet<Integer> getSupportedVersions() {
|
||||
SortedSet<Integer> outputSet = new TreeSet<>(ProtocolRegistry.getSupportedVersions());
|
||||
outputSet.removeAll(Via.getPlatform().getConf().getBlockedProtocols());
|
||||
|
||||
return outputSet;
|
||||
}
|
||||
}
|
@ -1,97 +0,0 @@
|
||||
/*
|
||||
* MIT License
|
||||
*
|
||||
* Copyright (c) 2018 creeper123123321 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.github.creeper123123321.viafabric.platform;
|
||||
|
||||
import us.myles.ViaVersion.AbstractViaConfig;
|
||||
|
||||
import java.io.File;
|
||||
import java.net.URL;
|
||||
import java.util.Arrays;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
public class VRViaConfig extends AbstractViaConfig {
|
||||
// Based on Sponge ViaVersion
|
||||
private static List<String> UNSUPPORTED = Arrays.asList("anti-xray-patch", "bungee-ping-interval",
|
||||
"bungee-ping-save", "bungee-servers", "quick-move-action-fix", "nms-player-ticking",
|
||||
"item-cache", "velocity-ping-interval", "velocity-ping-save", "velocity-servers",
|
||||
"blockconnection-method", "change-1_9-hitbox", "change-1_14-hitbox");
|
||||
|
||||
public VRViaConfig(File configFile) {
|
||||
super(configFile);
|
||||
// Load config
|
||||
reloadConfig();
|
||||
}
|
||||
|
||||
@Override
|
||||
public URL getDefaultConfigURL() {
|
||||
return getClass().getClassLoader().getResource("assets/viaversion/config.yml");
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void handleConfig(Map<String, Object> config) {
|
||||
// Nothing Currently
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<String> getUnsupportedOptions() {
|
||||
return UNSUPPORTED;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isAntiXRay() {
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isItemCache() {
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isNMSPlayerTicking() {
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean is1_12QuickMoveActionFix() {
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getBlockConnectionMethod() {
|
||||
return "packet";
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean is1_9HitboxFix() {
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean is1_14HitboxFix() {
|
||||
return false;
|
||||
}
|
||||
}
|
@ -1,39 +0,0 @@
|
||||
/*
|
||||
* MIT License
|
||||
*
|
||||
* Copyright (c) 2018 creeper123123321 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.github.creeper123123321.viafabric.providers;
|
||||
|
||||
import com.github.creeper123123321.viafabric.ViaFabric;
|
||||
import com.github.creeper123123321.viafabric.platform.VRClientSideUserConnection;
|
||||
import us.myles.ViaVersion.api.data.UserConnection;
|
||||
import us.myles.ViaVersion.protocols.base.VersionProvider;
|
||||
|
||||
public class VRVersionProvider extends VersionProvider {
|
||||
@Override
|
||||
public int getServerProtocol(UserConnection connection) throws Exception {
|
||||
if (connection instanceof VRClientSideUserConnection)
|
||||
return ViaFabric.config.getClientSideVersion();
|
||||
return super.getServerProtocol(connection);
|
||||
}
|
||||
}
|
@ -1,42 +0,0 @@
|
||||
/*
|
||||
* MIT License
|
||||
*
|
||||
* Copyright (c) 2018 creeper123123321 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.github.creeper123123321.viafabric.util;
|
||||
|
||||
import us.myles.ViaVersion.api.platform.TaskId;
|
||||
|
||||
import java.util.concurrent.Future;
|
||||
|
||||
public class FutureTaskId implements TaskId {
|
||||
private Future<?> object;
|
||||
|
||||
public FutureTaskId(Future<?> object) {
|
||||
this.object = object;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Future<?> getObject() {
|
||||
return object;
|
||||
}
|
||||
}
|
@ -1,54 +0,0 @@
|
||||
/*
|
||||
* MIT License
|
||||
*
|
||||
* Copyright (c) 2018 creeper123123321 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.github.creeper123123321.viafabric.util;
|
||||
|
||||
import us.myles.ViaVersion.api.protocol.ProtocolVersion;
|
||||
|
||||
import java.util.Arrays;
|
||||
import java.util.function.Predicate;
|
||||
import java.util.stream.Stream;
|
||||
|
||||
public class VersionFormatFilter implements Predicate<String> {
|
||||
@Override
|
||||
public boolean test(String s) {
|
||||
try {
|
||||
Integer.parseInt(s);
|
||||
return true;
|
||||
} catch (NumberFormatException e) {
|
||||
try {
|
||||
Integer.parseInt(s + '0');
|
||||
return true;
|
||||
} catch (NumberFormatException e2) {
|
||||
return ProtocolVersion.getProtocols().stream()
|
||||
.map(ProtocolVersion::getName)
|
||||
.flatMap(str -> Stream.concat(
|
||||
Arrays.stream(str.split("-")),
|
||||
Arrays.stream(new String[]{str})
|
||||
))
|
||||
.anyMatch(ver -> ver.startsWith(s));
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
104
src/main/java/com/viaversion/fabric/common/AddressParser.java
Normal file
104
src/main/java/com/viaversion/fabric/common/AddressParser.java
Normal file
@ -0,0 +1,104 @@
|
||||
/*
|
||||
* This file is part of ViaFabric - https://github.com/ViaVersion/ViaFabric
|
||||
* Copyright (C) 2018-2024 ViaVersion and contributors
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
package com.viaversion.fabric.common;
|
||||
|
||||
import com.google.common.collect.Lists;
|
||||
import com.google.common.primitives.Ints;
|
||||
import com.viaversion.viaversion.api.protocol.version.ProtocolVersion;
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Arrays;
|
||||
import java.util.List;
|
||||
import java.util.regex.Pattern;
|
||||
|
||||
// Based on VIAaaS parser
|
||||
public class AddressParser {
|
||||
public Integer protocol;
|
||||
public String viaSuffix;
|
||||
public String serverAddress;
|
||||
public String viaOptions;
|
||||
|
||||
public AddressParser parse(String address) {
|
||||
return parse(address, "viafabric");
|
||||
}
|
||||
|
||||
public String getSuffixWithOptions() {
|
||||
if (viaOptions != null && !viaOptions.isEmpty()) {
|
||||
return viaOptions + "." + viaSuffix;
|
||||
}
|
||||
return viaSuffix;
|
||||
}
|
||||
|
||||
public AddressParser parse(String address, String viaHostName) {
|
||||
address = StringUtils.removeEnd(address, ".");
|
||||
String suffixRemoved = StringUtils.removeEnd(address, "." + viaHostName);
|
||||
|
||||
if (suffixRemoved.equals(address)) {
|
||||
serverAddress = address;
|
||||
return this;
|
||||
}
|
||||
|
||||
boolean stopOptions = false;
|
||||
List<String> optionsParts = new ArrayList<>();
|
||||
List<String> serverParts = new ArrayList<>();
|
||||
|
||||
for (String part : Lists.reverse(Arrays.asList(suffixRemoved.split(Pattern.quote("."))))) {
|
||||
if (!stopOptions && parseOption(part)) {
|
||||
optionsParts.add(part);
|
||||
continue;
|
||||
}
|
||||
stopOptions = true;
|
||||
serverParts.add(part);
|
||||
}
|
||||
|
||||
serverAddress = String.join(".", Lists.reverse(serverParts));
|
||||
viaOptions = String.join(".", Lists.reverse(optionsParts));
|
||||
viaSuffix = viaHostName;
|
||||
|
||||
return this;
|
||||
}
|
||||
|
||||
public boolean parseOption(String part) {
|
||||
String option;
|
||||
if (part.length() < 2) {
|
||||
return false;
|
||||
} else if (part.startsWith("_")) {
|
||||
option = String.valueOf(part.charAt(1));
|
||||
} else if (part.charAt(1) == '_') {
|
||||
option = String.valueOf(part.charAt(0));
|
||||
} else {
|
||||
return false;
|
||||
}
|
||||
|
||||
String arg = part.substring(2);
|
||||
if ("v".equals(option)) {
|
||||
parseProtocol(arg);
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
public void parseProtocol(String arg) {
|
||||
protocol = Ints.tryParse(arg);
|
||||
if (protocol == null) {
|
||||
ProtocolVersion ver = ProtocolVersion.getClosest(arg.replace("_", "."));
|
||||
if (ver != null) protocol = ver.getVersion();
|
||||
}
|
||||
}
|
||||
}
|
32
src/main/java/com/viaversion/fabric/common/ViaFabric.java
Normal file
32
src/main/java/com/viaversion/fabric/common/ViaFabric.java
Normal file
@ -0,0 +1,32 @@
|
||||
/*
|
||||
* This file is part of ViaFabric - https://github.com/ViaVersion/ViaFabric
|
||||
* Copyright (C) 2018-2024 ViaVersion and contributors
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
package com.viaversion.fabric.common;
|
||||
|
||||
import net.fabricmc.api.ModInitializer;
|
||||
import net.fabricmc.loader.api.FabricLoader;
|
||||
|
||||
public class ViaFabric implements ModInitializer {
|
||||
@Override
|
||||
public void onInitialize() {
|
||||
if (FabricLoader.getInstance().getAllMods()
|
||||
.stream()
|
||||
.noneMatch(it -> it.getMetadata().getId().startsWith("viafabric-mc"))) {
|
||||
throw new IllegalStateException("ViaFabric sub-mod didn't load correctly. Check if required dependencies are installed");
|
||||
}
|
||||
}
|
||||
}
|
@ -0,0 +1,52 @@
|
||||
/*
|
||||
* This file is part of ViaFabric - https://github.com/ViaVersion/ViaFabric
|
||||
* Copyright (C) 2018-2024 ViaVersion and contributors
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
package com.viaversion.fabric.common.commands;
|
||||
|
||||
import com.viaversion.viaversion.api.Via;
|
||||
import com.viaversion.viaversion.api.command.ViaCommandSender;
|
||||
import com.viaversion.viaversion.api.connection.UserConnection;
|
||||
|
||||
import java.util.UUID;
|
||||
|
||||
public class UserCommandSender implements ViaCommandSender {
|
||||
private final UserConnection con;
|
||||
|
||||
public UserCommandSender(UserConnection con) {
|
||||
this.con = con;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean hasPermission(String s) {
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void sendMessage(String s) {
|
||||
Via.getPlatform().sendMessage(getUUID(), s);
|
||||
}
|
||||
|
||||
@Override
|
||||
public UUID getUUID() {
|
||||
return con.getProtocolInfo().getUuid();
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getName() {
|
||||
return con.getProtocolInfo().getUsername();
|
||||
}
|
||||
}
|
@ -1,38 +1,31 @@
|
||||
/*
|
||||
* MIT License
|
||||
* This file is part of ViaFabric - https://github.com/ViaVersion/ViaFabric
|
||||
* Copyright (C) 2018-2024 ViaVersion and contributors
|
||||
*
|
||||
* Copyright (c) 2018 creeper123123321 and contributors
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* 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:
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* 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.
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
package com.github.creeper123123321.viafabric.commands.subs;
|
||||
package com.viaversion.fabric.common.commands.subs;
|
||||
|
||||
import io.netty.util.ResourceLeakDetector;
|
||||
import us.myles.ViaVersion.api.command.ViaCommandSender;
|
||||
import us.myles.ViaVersion.api.command.ViaSubCommand;
|
||||
import com.viaversion.viaversion.api.command.ViaCommandSender;
|
||||
import com.viaversion.viaversion.api.command.ViaSubCommand;
|
||||
|
||||
import java.util.Arrays;
|
||||
import java.util.List;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
public class LeakDetectSubCommand extends ViaSubCommand {
|
||||
public class LeakDetectSubCommand implements ViaSubCommand {
|
||||
@Override
|
||||
public String name() {
|
||||
return "leakdetect";
|
||||
@ -67,6 +60,6 @@ public class LeakDetectSubCommand extends ViaSubCommand {
|
||||
.filter(it -> it.startsWith(args[0]))
|
||||
.collect(Collectors.toList());
|
||||
}
|
||||
return super.onTabComplete(sender, args);
|
||||
return ViaSubCommand.super.onTabComplete(sender, args);
|
||||
}
|
||||
}
|
@ -0,0 +1,41 @@
|
||||
/*
|
||||
* This file is part of ViaFabric - https://github.com/ViaVersion/ViaFabric
|
||||
* Copyright (C) 2018-2024 ViaVersion and contributors
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
package com.viaversion.fabric.common.config;
|
||||
|
||||
import com.viaversion.fabric.common.util.ProtocolUtils;
|
||||
import com.viaversion.viaversion.api.protocol.version.ProtocolVersion;
|
||||
|
||||
public interface AbstractViaConfigScreen {
|
||||
String TITLE_TRANSLATE_ID = "gui.viafabric_config.title";
|
||||
String VERSION_TRANSLATE_ID = "gui.protocol_version_field.name";
|
||||
|
||||
default int getProtocolTextColor(ProtocolVersion version, boolean parsedValid) {
|
||||
if (!parsedValid) return 0xff0000; // Red
|
||||
if (!ProtocolUtils.isValid(version)) return 0x5555FF; // Blue
|
||||
if (!ProtocolUtils.isSupportedClientSide(version)) return 0xFFA500; // Orange
|
||||
return 0xE0E0E0; // Default
|
||||
}
|
||||
|
||||
default int calculatePosX(int width, int entryNumber) {
|
||||
return width / 2 - 155 + entryNumber % 2 * 160;
|
||||
}
|
||||
|
||||
default int calculatePosY(int height, int entryNumber) {
|
||||
return height / 6 + 24 * (entryNumber / 2);
|
||||
}
|
||||
}
|
@ -0,0 +1,91 @@
|
||||
/*
|
||||
* This file is part of ViaFabric - https://github.com/ViaVersion/ViaFabric
|
||||
* Copyright (C) 2018-2024 ViaVersion and contributors
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
package com.viaversion.fabric.common.config;
|
||||
|
||||
import com.viaversion.viaversion.util.Config;
|
||||
|
||||
import java.io.File;
|
||||
import java.net.URL;
|
||||
import java.util.Collection;
|
||||
import java.util.Collections;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.logging.Logger;
|
||||
|
||||
public class VFConfig extends Config {
|
||||
public static final String ENABLE_CLIENT_SIDE = "enable-client-side";
|
||||
public static final String CLIENT_SIDE_VERSION = "client-side-version";
|
||||
public static final String CLIENT_SIDE_FORCE_DISABLE = "client-side-force-disable";
|
||||
public static final String HIDE_BUTTON = "hide-button";
|
||||
public static final String IGNORE_REGISTRY_SYNC_ERRORS = "ignore-registry-sync-errors";
|
||||
|
||||
public VFConfig(File configFile, Logger logger) {
|
||||
super(configFile, logger);
|
||||
reload();
|
||||
}
|
||||
|
||||
@Override
|
||||
public URL getDefaultConfigURL() {
|
||||
return getClass().getClassLoader().getResource("assets/viafabric/config.yml");
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void handleConfig(Map<String, Object> map) {
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<String> getUnsupportedOptions() {
|
||||
return Collections.emptyList();
|
||||
}
|
||||
|
||||
public boolean isClientSideEnabled() {
|
||||
return getBoolean(ENABLE_CLIENT_SIDE, false);
|
||||
}
|
||||
|
||||
public void setClientSideEnabled(boolean val) {
|
||||
set(ENABLE_CLIENT_SIDE, val);
|
||||
}
|
||||
|
||||
public int getClientSideVersion() {
|
||||
return getInt(CLIENT_SIDE_VERSION, -1);
|
||||
}
|
||||
|
||||
public void setClientSideVersion(int val) {
|
||||
set(CLIENT_SIDE_VERSION, val);
|
||||
}
|
||||
|
||||
public Collection<?> getClientSideForceDisable() {
|
||||
return get(CLIENT_SIDE_FORCE_DISABLE, Collections.emptyList());
|
||||
}
|
||||
|
||||
public void setHideButton(boolean val) {
|
||||
set(HIDE_BUTTON, val);
|
||||
}
|
||||
|
||||
public boolean isHideButton() {
|
||||
return getBoolean(HIDE_BUTTON, false);
|
||||
}
|
||||
|
||||
public boolean isForcedDisable(String line) {
|
||||
return getClientSideForceDisable().contains(line);
|
||||
}
|
||||
|
||||
public boolean isIgnoreRegistrySyncErrors() {
|
||||
return getBoolean(IGNORE_REGISTRY_SYNC_ERRORS, false);
|
||||
}
|
||||
}
|
@ -0,0 +1,28 @@
|
||||
/*
|
||||
* This file is part of ViaFabric - https://github.com/ViaVersion/ViaFabric
|
||||
* Copyright (C) 2018-2024 ViaVersion and contributors
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
package com.viaversion.fabric.common.gui;
|
||||
|
||||
public interface ViaServerInfo {
|
||||
boolean viaFabric$translating();
|
||||
|
||||
void viaFabric$setTranslating(boolean via);
|
||||
|
||||
int viaFabric$getServerVer();
|
||||
|
||||
void viaFabric$setServerVer(int ver);
|
||||
}
|
@ -0,0 +1,23 @@
|
||||
/*
|
||||
* This file is part of ViaFabric - https://github.com/ViaVersion/ViaFabric
|
||||
* Copyright (C) 2018-2024 ViaVersion and contributors
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
package com.viaversion.fabric.common.handler;
|
||||
|
||||
public class CommonTransformer {
|
||||
public static final String HANDLER_DECODER_NAME = "via-decoder";
|
||||
public static final String HANDLER_ENCODER_NAME = "via-encoder";
|
||||
}
|
@ -0,0 +1,106 @@
|
||||
/*
|
||||
* This file is part of ViaFabric - https://github.com/ViaVersion/ViaFabric
|
||||
* Copyright (C) 2018-2024 ViaVersion and contributors
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
package com.viaversion.fabric.common.handler;
|
||||
|
||||
import com.viaversion.viaversion.api.Via;
|
||||
import com.viaversion.viaversion.api.connection.UserConnection;
|
||||
import com.viaversion.viaversion.api.protocol.packet.State;
|
||||
import com.viaversion.viaversion.exception.CancelCodecException;
|
||||
import com.viaversion.viaversion.exception.CancelDecoderException;
|
||||
import com.viaversion.viaversion.exception.InformativeException;
|
||||
import com.viaversion.viaversion.util.PipelineUtil;
|
||||
import io.netty.buffer.ByteBuf;
|
||||
import io.netty.channel.ChannelHandler;
|
||||
import io.netty.channel.ChannelHandlerContext;
|
||||
import io.netty.handler.codec.MessageToMessageDecoder;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
@ChannelHandler.Sharable
|
||||
public class FabricDecodeHandler extends MessageToMessageDecoder<ByteBuf> {
|
||||
private final UserConnection info;
|
||||
|
||||
public FabricDecodeHandler(UserConnection info) {
|
||||
this.info = info;
|
||||
}
|
||||
|
||||
public UserConnection getInfo() {
|
||||
return info;
|
||||
}
|
||||
|
||||
// https://github.com/ViaVersion/ViaVersion/blob/master/velocity/src/main/java/us/myles/ViaVersion/velocity/handlers/VelocityDecodeHandler.java
|
||||
@Override
|
||||
protected void decode(ChannelHandlerContext ctx, ByteBuf bytebuf, List<Object> out) throws Exception {
|
||||
if (!info.checkIncomingPacket()) throw CancelDecoderException.generate(null);
|
||||
if (!info.shouldTransformPacket()) {
|
||||
out.add(bytebuf.retain());
|
||||
return;
|
||||
}
|
||||
|
||||
ByteBuf transformedBuf = ctx.alloc().buffer().writeBytes(bytebuf);
|
||||
try {
|
||||
info.transformIncoming(transformedBuf, CancelDecoderException::generate);
|
||||
|
||||
out.add(transformedBuf.retain());
|
||||
} finally {
|
||||
transformedBuf.release();
|
||||
}
|
||||
}
|
||||
|
||||
private void reorder(ChannelHandlerContext ctx) {
|
||||
int decoderIndex = ctx.pipeline().names().indexOf("decompress");
|
||||
if (decoderIndex == -1) return;
|
||||
|
||||
if (decoderIndex > ctx.pipeline().names().indexOf(CommonTransformer.HANDLER_DECODER_NAME)) {
|
||||
ChannelHandler encoder = ctx.pipeline().get(CommonTransformer.HANDLER_ENCODER_NAME);
|
||||
ChannelHandler decoder = ctx.pipeline().get(CommonTransformer.HANDLER_DECODER_NAME);
|
||||
|
||||
ctx.pipeline().remove(encoder);
|
||||
ctx.pipeline().remove(decoder);
|
||||
|
||||
ctx.pipeline().addAfter("compress", CommonTransformer.HANDLER_ENCODER_NAME, encoder);
|
||||
ctx.pipeline().addAfter("decompress", CommonTransformer.HANDLER_DECODER_NAME, decoder);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void exceptionCaught(ChannelHandlerContext ctx, Throwable cause) throws Exception {
|
||||
if (PipelineUtil.containsCause(cause, CancelCodecException.class)) return;
|
||||
super.exceptionCaught(ctx, cause);
|
||||
|
||||
if ((PipelineUtil.containsCause(cause, InformativeException.class)
|
||||
&& info.getProtocolInfo().getServerState() != State.HANDSHAKE)
|
||||
|| Via.getManager().debugHandler().enabled()) {
|
||||
cause.printStackTrace();
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void userEventTriggered(ChannelHandlerContext ctx, Object evt) throws Exception {
|
||||
boolean kryptonReorder = false;
|
||||
switch (evt.toString()) {
|
||||
case "COMPRESSION_THRESHOLD_UPDATED":
|
||||
case "COMPRESSION_ENABLED":
|
||||
kryptonReorder = true;
|
||||
}
|
||||
if (evt instanceof PipelineReorderEvent || kryptonReorder) {
|
||||
reorder(ctx);
|
||||
}
|
||||
super.userEventTriggered(ctx, evt);
|
||||
}
|
||||
}
|
@ -0,0 +1,62 @@
|
||||
/*
|
||||
* This file is part of ViaFabric - https://github.com/ViaVersion/ViaFabric
|
||||
* Copyright (C) 2018-2024 ViaVersion and contributors
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
package com.viaversion.fabric.common.handler;
|
||||
|
||||
import com.viaversion.viaversion.api.connection.UserConnection;
|
||||
import com.viaversion.viaversion.exception.CancelCodecException;
|
||||
import com.viaversion.viaversion.exception.CancelEncoderException;
|
||||
import com.viaversion.viaversion.util.PipelineUtil;
|
||||
import io.netty.buffer.ByteBuf;
|
||||
import io.netty.channel.ChannelHandler;
|
||||
import io.netty.channel.ChannelHandlerContext;
|
||||
import io.netty.handler.codec.MessageToMessageEncoder;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
@ChannelHandler.Sharable
|
||||
public class FabricEncodeHandler extends MessageToMessageEncoder<ByteBuf> {
|
||||
private final UserConnection info;
|
||||
|
||||
public FabricEncodeHandler(UserConnection info) {
|
||||
this.info = info;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void encode(final ChannelHandlerContext ctx, ByteBuf bytebuf, List<Object> out) throws Exception {
|
||||
if (!info.checkOutgoingPacket()) throw CancelEncoderException.generate(null);
|
||||
if (!info.shouldTransformPacket()) {
|
||||
out.add(bytebuf.retain());
|
||||
return;
|
||||
}
|
||||
|
||||
ByteBuf transformedBuf = ctx.alloc().buffer().writeBytes(bytebuf);
|
||||
try {
|
||||
info.transformOutgoing(transformedBuf, CancelEncoderException::generate);
|
||||
|
||||
out.add(transformedBuf.retain());
|
||||
} finally {
|
||||
transformedBuf.release();
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void exceptionCaught(ChannelHandlerContext ctx, Throwable cause) throws Exception {
|
||||
if (PipelineUtil.containsCause(cause, CancelCodecException.class)) return;
|
||||
super.exceptionCaught(ctx, cause);
|
||||
}
|
||||
}
|
@ -0,0 +1,21 @@
|
||||
/*
|
||||
* This file is part of ViaFabric - https://github.com/ViaVersion/ViaFabric
|
||||
* Copyright (C) 2018-2024 ViaVersion and contributors
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
package com.viaversion.fabric.common.handler;
|
||||
|
||||
public class PipelineReorderEvent {
|
||||
}
|
@ -0,0 +1,77 @@
|
||||
/*
|
||||
* This file is part of ViaFabric - https://github.com/ViaVersion/ViaFabric
|
||||
* Copyright (C) 2018-2024 ViaVersion and contributors
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
package com.viaversion.fabric.common.platform;
|
||||
|
||||
import com.viaversion.fabric.common.handler.CommonTransformer;
|
||||
import com.viaversion.viaversion.api.Via;
|
||||
import com.viaversion.viaversion.api.platform.ViaInjector;
|
||||
import com.viaversion.viaversion.api.protocol.version.ProtocolVersion;
|
||||
import com.viaversion.viaversion.libs.gson.JsonObject;
|
||||
import it.unimi.dsi.fastutil.objects.ObjectLinkedOpenHashSet;
|
||||
import it.unimi.dsi.fastutil.objects.ObjectSortedSet;
|
||||
import it.unimi.dsi.fastutil.objects.ObjectSortedSets;
|
||||
import net.fabricmc.api.EnvType;
|
||||
import net.fabricmc.loader.api.FabricLoader;
|
||||
|
||||
import java.util.OptionalInt;
|
||||
|
||||
public class FabricInjector implements ViaInjector {
|
||||
@Override
|
||||
public void inject() {
|
||||
// *looks at Mixins*
|
||||
}
|
||||
|
||||
@Override
|
||||
public void uninject() {
|
||||
// not possible *plays sad violin*
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getEncoderName() {
|
||||
return CommonTransformer.HANDLER_ENCODER_NAME;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getDecoderName() {
|
||||
return CommonTransformer.HANDLER_DECODER_NAME;
|
||||
}
|
||||
|
||||
@Override
|
||||
public JsonObject getDump() {
|
||||
return new JsonObject();
|
||||
}
|
||||
|
||||
@Override
|
||||
public ObjectSortedSet<ProtocolVersion> getServerProtocolVersions() {
|
||||
if (FabricLoader.getInstance().getEnvironmentType() == EnvType.SERVER) {
|
||||
final ProtocolVersion version = Via.getManager().getProviders().get(NativeVersionProvider.class).getNativeServerProtocolVersion();
|
||||
return ObjectSortedSets.singleton(version);
|
||||
}
|
||||
// On client-side we can connect to any server version
|
||||
ObjectSortedSet<ProtocolVersion> versions = new ObjectLinkedOpenHashSet<>();
|
||||
versions.add(ProtocolVersion.v1_8);
|
||||
final OptionalInt highestSupportedVersion = ProtocolVersion.getProtocols().stream().mapToInt(ProtocolVersion::getOriginalVersion).max();
|
||||
versions.add(ProtocolVersion.getProtocol(highestSupportedVersion.getAsInt()));
|
||||
return versions;
|
||||
}
|
||||
|
||||
@Override
|
||||
public ProtocolVersion getServerProtocolVersion() {
|
||||
return getServerProtocolVersions().first();
|
||||
}
|
||||
}
|
@ -0,0 +1,37 @@
|
||||
/*
|
||||
* This file is part of ViaFabric - https://github.com/ViaVersion/ViaFabric
|
||||
* Copyright (C) 2018-2024 ViaVersion and contributors
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
package com.viaversion.fabric.common.platform;
|
||||
|
||||
import com.viaversion.viaversion.ViaAPIBase;
|
||||
import com.viaversion.viaversion.api.connection.UserConnection;
|
||||
import com.viaversion.viaversion.api.protocol.version.ProtocolVersion;
|
||||
import io.netty.buffer.ByteBuf;
|
||||
|
||||
import java.util.UUID;
|
||||
|
||||
public class FabricViaAPI extends ViaAPIBase<UserConnection> {
|
||||
@Override
|
||||
public ProtocolVersion getPlayerProtocolVersion(UserConnection player) {
|
||||
return player.getProtocolInfo().protocolVersion();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void sendRawPacket(UserConnection player, ByteBuf packet) {
|
||||
player.scheduleSendRawPacket(packet);
|
||||
}
|
||||
}
|
@ -0,0 +1,50 @@
|
||||
/*
|
||||
* This file is part of ViaFabric - https://github.com/ViaVersion/ViaFabric
|
||||
* Copyright (C) 2018-2024 ViaVersion and contributors
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
package com.viaversion.fabric.common.platform;
|
||||
|
||||
import com.viaversion.viaversion.configuration.AbstractViaConfig;
|
||||
|
||||
import java.io.File;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.logging.Logger;
|
||||
|
||||
public class FabricViaConfig extends AbstractViaConfig {
|
||||
|
||||
protected final List<String> UNSUPPORTED = new ArrayList<>();
|
||||
|
||||
public FabricViaConfig(File configFile, Logger logger) {
|
||||
super(configFile, logger);
|
||||
UNSUPPORTED.addAll(BUKKIT_ONLY_OPTIONS);
|
||||
UNSUPPORTED.addAll(VELOCITY_ONLY_OPTIONS);
|
||||
|
||||
// Load config
|
||||
reload();
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void handleConfig(Map<String, Object> config) {
|
||||
// Nothing Currently
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<String> getUnsupportedOptions() {
|
||||
return UNSUPPORTED;
|
||||
}
|
||||
}
|
@ -0,0 +1,30 @@
|
||||
/*
|
||||
* This file is part of ViaFabric - https://github.com/ViaVersion/ViaFabric
|
||||
* Copyright (C) 2018-2024 ViaVersion and contributors
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
package com.viaversion.fabric.common.platform;
|
||||
|
||||
import com.viaversion.viaversion.api.platform.providers.Provider;
|
||||
import com.viaversion.viaversion.api.protocol.version.ProtocolVersion;
|
||||
|
||||
public interface NativeVersionProvider extends Provider {
|
||||
|
||||
int getNativeServerVersion();
|
||||
|
||||
default ProtocolVersion getNativeServerProtocolVersion() {
|
||||
return ProtocolVersion.getProtocol(getNativeServerVersion());
|
||||
}
|
||||
}
|
@ -0,0 +1,52 @@
|
||||
/*
|
||||
* This file is part of ViaFabric - https://github.com/ViaVersion/ViaFabric
|
||||
* Copyright (C) 2018-2024 ViaVersion and contributors
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
package com.viaversion.fabric.common.protocol;
|
||||
|
||||
import com.viaversion.fabric.common.AddressParser;
|
||||
import com.viaversion.viaversion.api.protocol.AbstractSimpleProtocol;
|
||||
import com.viaversion.viaversion.api.protocol.packet.PacketWrapper;
|
||||
import com.viaversion.viaversion.api.protocol.remapper.PacketHandlers;
|
||||
import com.viaversion.viaversion.api.protocol.remapper.ValueTransformer;
|
||||
import com.viaversion.viaversion.api.protocol.packet.State;
|
||||
import com.viaversion.viaversion.api.type.Types;
|
||||
import com.viaversion.viaversion.protocols.base.ServerboundHandshakePackets;
|
||||
|
||||
public class HostnameParserProtocol extends AbstractSimpleProtocol {
|
||||
public static final HostnameParserProtocol INSTANCE = new HostnameParserProtocol();
|
||||
|
||||
@Override
|
||||
protected void registerPackets() {
|
||||
registerServerbound(State.HANDSHAKE, ServerboundHandshakePackets.CLIENT_INTENTION, new PacketHandlers() {
|
||||
@Override
|
||||
protected void register() {
|
||||
map(Types.VAR_INT); // Protocol version
|
||||
map(Types.STRING, new ValueTransformer<String, String>(Types.STRING) {
|
||||
@Override
|
||||
public String transform(PacketWrapper packetWrapper, String s) {
|
||||
return new AddressParser().parse(s).serverAddress;
|
||||
}
|
||||
});
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isBaseProtocol() {
|
||||
return true;
|
||||
}
|
||||
}
|
@ -0,0 +1,227 @@
|
||||
/*
|
||||
* This file is part of ViaFabric - https://github.com/ViaVersion/ViaFabric
|
||||
* Copyright (C) 2018-2024 ViaVersion and contributors
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
package com.viaversion.fabric.common.provider;
|
||||
|
||||
import com.viaversion.fabric.common.platform.FabricViaAPI;
|
||||
import com.viaversion.fabric.common.platform.FabricViaConfig;
|
||||
import com.viaversion.fabric.common.platform.NativeVersionProvider;
|
||||
import com.viaversion.fabric.common.util.FutureTaskId;
|
||||
import com.viaversion.fabric.common.util.JLoggerToLog4j;
|
||||
import com.viaversion.viaversion.api.Via;
|
||||
import com.viaversion.viaversion.api.ViaAPI;
|
||||
import com.viaversion.viaversion.api.configuration.ConfigurationProvider;
|
||||
import com.viaversion.viaversion.api.configuration.ViaVersionConfig;
|
||||
import com.viaversion.viaversion.api.connection.UserConnection;
|
||||
import com.viaversion.viaversion.api.platform.UnsupportedSoftware;
|
||||
import com.viaversion.viaversion.api.platform.ViaPlatform;
|
||||
import com.viaversion.viaversion.libs.gson.JsonArray;
|
||||
import com.viaversion.viaversion.libs.gson.JsonObject;
|
||||
import com.viaversion.viaversion.unsupported.UnsupportedPlugin;
|
||||
import io.netty.channel.EventLoop;
|
||||
import io.netty.util.concurrent.Future;
|
||||
import io.netty.util.concurrent.GenericFutureListener;
|
||||
import net.fabricmc.api.EnvType;
|
||||
import net.fabricmc.loader.api.FabricLoader;
|
||||
import net.fabricmc.loader.api.ModContainer;
|
||||
import net.fabricmc.loader.api.Version;
|
||||
import net.fabricmc.loader.api.metadata.ModMetadata;
|
||||
import org.apache.logging.log4j.LogManager;
|
||||
|
||||
import java.io.File;
|
||||
import java.nio.file.Path;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collection;
|
||||
import java.util.Collections;
|
||||
import java.util.List;
|
||||
import java.util.UUID;
|
||||
import java.util.concurrent.CancellationException;
|
||||
import java.util.concurrent.CompletableFuture;
|
||||
import java.util.concurrent.ExecutorService;
|
||||
import java.util.concurrent.TimeUnit;
|
||||
import java.util.logging.Logger;
|
||||
|
||||
public abstract class AbstractFabricPlatform implements ViaPlatform<UserConnection> {
|
||||
private final Logger logger = new JLoggerToLog4j(LogManager.getLogger("ViaVersion"));
|
||||
private FabricViaConfig config;
|
||||
private File dataFolder;
|
||||
private final ViaAPI<UserConnection> api;
|
||||
|
||||
{
|
||||
api = new FabricViaAPI();
|
||||
}
|
||||
|
||||
public void init() {
|
||||
// We'll use it early for ViaInjector
|
||||
installNativeVersionProvider();
|
||||
Path configDir = FabricLoader.getInstance().getConfigDir().resolve("ViaFabric");
|
||||
dataFolder = configDir.toFile();
|
||||
config = new FabricViaConfig(configDir.resolve("viaversion.yml").toFile(), logger);
|
||||
}
|
||||
|
||||
protected abstract void installNativeVersionProvider();
|
||||
|
||||
protected abstract ExecutorService asyncService();
|
||||
|
||||
protected abstract EventLoop eventLoop();
|
||||
|
||||
protected FutureTaskId runEventLoop(Runnable runnable) {
|
||||
return new FutureTaskId(eventLoop().submit(runnable).addListener(errorLogger()));
|
||||
}
|
||||
|
||||
@Override
|
||||
public FutureTaskId runAsync(Runnable runnable) {
|
||||
return new FutureTaskId(CompletableFuture.runAsync(runnable, asyncService())
|
||||
.exceptionally(throwable -> {
|
||||
if (!(throwable instanceof CancellationException)) {
|
||||
throwable.printStackTrace();
|
||||
}
|
||||
return null;
|
||||
}));
|
||||
}
|
||||
|
||||
@Override
|
||||
public FutureTaskId runRepeatingAsync(Runnable runnable, long ticks) {
|
||||
return new FutureTaskId(eventLoop()
|
||||
.scheduleAtFixedRate(() -> runAsync(runnable), 0, ticks * 50, TimeUnit.MILLISECONDS)
|
||||
.addListener(errorLogger())
|
||||
);
|
||||
}
|
||||
|
||||
@Override
|
||||
public FutureTaskId runSync(Runnable runnable, long ticks) {
|
||||
// ViaVersion seems to not need to run delayed tasks on main thread
|
||||
return new FutureTaskId(eventLoop()
|
||||
.schedule(() -> runSync(runnable), ticks * 50, TimeUnit.MILLISECONDS)
|
||||
.addListener(errorLogger())
|
||||
);
|
||||
}
|
||||
|
||||
@Override
|
||||
public FutureTaskId runRepeatingSync(Runnable runnable, long ticks) {
|
||||
// ViaVersion seems to not need to run repeating tasks on main thread
|
||||
return new FutureTaskId(eventLoop()
|
||||
.scheduleAtFixedRate(() -> runSync(runnable), 0, ticks * 50, TimeUnit.MILLISECONDS)
|
||||
.addListener(errorLogger())
|
||||
);
|
||||
}
|
||||
|
||||
protected <T extends Future<?>> GenericFutureListener<T> errorLogger() {
|
||||
return future -> {
|
||||
if (!future.isCancelled() && future.cause() != null) {
|
||||
future.cause().printStackTrace();
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isProxy() {
|
||||
// We kinda of have all server versions
|
||||
return FabricLoader.getInstance().getEnvironmentType() == EnvType.CLIENT;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onReload() {
|
||||
}
|
||||
|
||||
@Override
|
||||
public Logger getLogger() {
|
||||
return logger;
|
||||
}
|
||||
|
||||
@Override
|
||||
public ViaVersionConfig getConf() {
|
||||
return config;
|
||||
}
|
||||
|
||||
@Override
|
||||
public ViaAPI<UserConnection> getApi() {
|
||||
return api;
|
||||
}
|
||||
|
||||
@Override
|
||||
public File getDataFolder() {
|
||||
return dataFolder;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getPluginVersion() {
|
||||
return FabricLoader.getInstance().getModContainer("viaversion").map(ModContainer::getMetadata)
|
||||
.map(ModMetadata::getVersion).map(Version::getFriendlyString).orElse("UNKNOWN");
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getPlatformName() {
|
||||
return "ViaFabric";
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getPlatformVersion() {
|
||||
return FabricLoader.getInstance().getModContainer("viafabric")
|
||||
.get().getMetadata().getVersion().getFriendlyString();
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isPluginEnabled() {
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public JsonObject getDump() {
|
||||
JsonObject platformSpecific = new JsonObject();
|
||||
JsonArray mods = new JsonArray();
|
||||
FabricLoader.getInstance().getAllMods().stream().map((mod) -> {
|
||||
JsonObject jsonMod = new JsonObject();
|
||||
jsonMod.addProperty("id", mod.getMetadata().getId());
|
||||
jsonMod.addProperty("name", mod.getMetadata().getName());
|
||||
jsonMod.addProperty("version", mod.getMetadata().getVersion().getFriendlyString());
|
||||
JsonArray authors = new JsonArray();
|
||||
mod.getMetadata().getAuthors().stream().map(it -> {
|
||||
JsonObject info = new JsonObject();
|
||||
JsonObject contact = new JsonObject();
|
||||
it.getContact().asMap().entrySet()
|
||||
.forEach(c -> contact.addProperty(c.getKey(), c.getValue()));
|
||||
if (contact.size() != 0) {
|
||||
info.add("contact", contact);
|
||||
}
|
||||
info.addProperty("name", it.getName());
|
||||
|
||||
return info;
|
||||
}).forEach(authors::add);
|
||||
jsonMod.add("authors", authors);
|
||||
|
||||
return jsonMod;
|
||||
}).forEach(mods::add);
|
||||
|
||||
platformSpecific.add("mods", mods);
|
||||
NativeVersionProvider ver = Via.getManager().getProviders().get(NativeVersionProvider.class);
|
||||
if (ver != null) {
|
||||
platformSpecific.addProperty("native version", ver.getNativeServerProtocolVersion().getVersion());
|
||||
}
|
||||
return platformSpecific;
|
||||
}
|
||||
|
||||
@Override
|
||||
public final boolean hasPlugin(String name) {
|
||||
return FabricLoader.getInstance().isModLoaded(name);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean couldBeReloading() {
|
||||
return false;
|
||||
}
|
||||
}
|
@ -0,0 +1,207 @@
|
||||
/*
|
||||
* This file is part of ViaFabric - https://github.com/ViaVersion/ViaFabric
|
||||
* Copyright (C) 2018-2024 ViaVersion and contributors
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
package com.viaversion.fabric.common.provider;
|
||||
|
||||
import com.google.common.primitives.Ints;
|
||||
import com.viaversion.fabric.common.AddressParser;
|
||||
import com.viaversion.fabric.common.config.VFConfig;
|
||||
import com.viaversion.fabric.common.platform.NativeVersionProvider;
|
||||
import com.viaversion.fabric.common.util.ProtocolUtils;
|
||||
import com.viaversion.viaversion.api.Via;
|
||||
import com.viaversion.viaversion.api.connection.ProtocolInfo;
|
||||
import com.viaversion.viaversion.api.connection.UserConnection;
|
||||
import com.viaversion.viaversion.api.protocol.packet.PacketWrapper;
|
||||
import com.viaversion.viaversion.api.protocol.packet.State;
|
||||
import com.viaversion.viaversion.api.protocol.version.ProtocolVersion;
|
||||
import com.viaversion.viaversion.api.type.Types;
|
||||
import com.viaversion.viaversion.exception.CancelException;
|
||||
import com.viaversion.viaversion.protocol.version.BaseVersionProvider;
|
||||
import com.viaversion.viaversion.protocols.base.ClientboundStatusPackets;
|
||||
import com.viaversion.viaversion.protocols.base.v1_7.ClientboundBaseProtocol1_7;
|
||||
import io.netty.channel.ChannelPipeline;
|
||||
import net.fabricmc.loader.api.FabricLoader;
|
||||
|
||||
import java.lang.reflect.InvocationTargetException;
|
||||
import java.lang.reflect.Method;
|
||||
import java.net.InetSocketAddress;
|
||||
import java.net.SocketAddress;
|
||||
import java.util.*;
|
||||
import java.util.concurrent.CompletableFuture;
|
||||
import java.util.logging.Logger;
|
||||
import java.util.stream.IntStream;
|
||||
|
||||
public abstract class AbstractFabricVersionProvider extends BaseVersionProvider {
|
||||
private int[] multiconnectSupportedVersions = null;
|
||||
|
||||
{
|
||||
multiconnectIntegration();
|
||||
}
|
||||
|
||||
private void multiconnectIntegration() {
|
||||
if (!FabricLoader.getInstance().isModLoaded("multiconnect")) return;
|
||||
try {
|
||||
Class<?> mcApiClass = Class.forName("net.earthcomputer.multiconnect.api.MultiConnectAPI");
|
||||
Class<?> iProtocolClass = Class.forName("net.earthcomputer.multiconnect.api.IProtocol");
|
||||
Object mcApiInstance = mcApiClass.getMethod("instance").invoke(null);
|
||||
List<?> protocols = (List<?>) mcApiClass.getMethod("getSupportedProtocols").invoke(mcApiInstance);
|
||||
Method getValue = iProtocolClass.getMethod("getValue");
|
||||
Method isMulticonnectBeta;
|
||||
try {
|
||||
isMulticonnectBeta = iProtocolClass.getMethod("isMulticonnectBeta");
|
||||
} catch (NoSuchMethodException e) {
|
||||
isMulticonnectBeta = null;
|
||||
}
|
||||
Set<Integer> vers = new TreeSet<>();
|
||||
for (Object protocol : protocols) {
|
||||
// Do not use versions with beta multiconnect support, which may have stability issues
|
||||
if (isMulticonnectBeta == null || !(Boolean) isMulticonnectBeta.invoke(protocol)) {
|
||||
vers.add((Integer) getValue.invoke(protocol));
|
||||
}
|
||||
}
|
||||
multiconnectSupportedVersions = vers.stream().mapToInt(Integer::intValue).toArray();
|
||||
getLogger().info("ViaFabric will integrate with multiconnect");
|
||||
} catch (ClassNotFoundException | IllegalAccessException | InvocationTargetException | NoSuchMethodException
|
||||
| ClassCastException ignored) {
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public ProtocolVersion getClosestServerProtocol(UserConnection connection) throws Exception {
|
||||
if (connection.isClientSide()) {
|
||||
ProtocolInfo info = Objects.requireNonNull(connection.getProtocolInfo());
|
||||
|
||||
if (!getConfig().isClientSideEnabled()) return info.protocolVersion();
|
||||
|
||||
int serverVer = getConfig().getClientSideVersion();
|
||||
SocketAddress addr = connection.getChannel().remoteAddress();
|
||||
|
||||
if (addr instanceof InetSocketAddress) {
|
||||
AddressParser parser = new AddressParser();
|
||||
Integer addrVersion = parser.parse(((InetSocketAddress) addr).getHostName()).protocol;
|
||||
if (addrVersion != null) {
|
||||
serverVer = addrVersion;
|
||||
}
|
||||
|
||||
try {
|
||||
if (serverVer == -2) {
|
||||
// Hope protocol was autodetected
|
||||
ProtocolVersion autoVer =
|
||||
detectVersion((InetSocketAddress) addr).getNow(null);
|
||||
if (autoVer != null) {
|
||||
serverVer = autoVer.getVersion();
|
||||
}
|
||||
}
|
||||
} catch (Exception e) {
|
||||
getLogger().warning("Couldn't auto detect: " + e);
|
||||
}
|
||||
}
|
||||
|
||||
ProtocolVersion serverVersion = ProtocolVersion.getProtocol(serverVer);
|
||||
|
||||
boolean blocked = checkAddressBlocked(addr);
|
||||
boolean supported = ProtocolUtils.isSupported(serverVersion, info.protocolVersion());
|
||||
|
||||
handleMulticonnectPing(connection, info, blocked, serverVersion);
|
||||
|
||||
if (blocked || !supported) serverVer = info.getProtocolVersion();
|
||||
|
||||
return ProtocolVersion.getProtocol(serverVer);
|
||||
}
|
||||
NativeVersionProvider natProvider = Via.getManager().getProviders().get(NativeVersionProvider.class);
|
||||
if (natProvider != null) {
|
||||
return natProvider.getNativeServerProtocolVersion();
|
||||
}
|
||||
return super.getClosestServerProtocol(connection);
|
||||
}
|
||||
|
||||
private boolean checkAddressBlocked(SocketAddress addr) {
|
||||
return addr instanceof InetSocketAddress && (isDisabled(((InetSocketAddress) addr).getHostString())
|
||||
|| ((((InetSocketAddress) addr).getAddress() != null) &&
|
||||
(isDisabled(((InetSocketAddress) addr).getAddress().getHostAddress())
|
||||
|| isDisabled(((InetSocketAddress) addr).getAddress().getHostName()))));
|
||||
}
|
||||
|
||||
private void handleMulticonnectPing(UserConnection connection, ProtocolInfo info, boolean blocked, ProtocolVersion serverVer) throws Exception {
|
||||
if (info.getServerState() == State.STATUS
|
||||
&& info.getProtocolVersion() == -1
|
||||
&& isMulticonnectHandler(connection.getChannel().pipeline())
|
||||
&& (blocked || ProtocolUtils.isSupported(serverVer, getVersionForMulticonnect(serverVer)))) { // Intercept the connection
|
||||
ProtocolVersion multiconnectSuggestion = blocked ? ProtocolVersion.unknown : getVersionForMulticonnect(serverVer);
|
||||
getLogger().info("Sending " + multiconnectSuggestion + " for multiconnect version detector");
|
||||
PacketWrapper newAnswer = PacketWrapper.create(ClientboundStatusPackets.STATUS_RESPONSE, null, connection);
|
||||
newAnswer.write(Types.STRING, "{\"version\":{\"name\":\"viafabric integration\",\"protocol\":" + multiconnectSuggestion.getVersion() + "}}");
|
||||
newAnswer.send(ClientboundBaseProtocol1_7.class);
|
||||
throw CancelException.generate();
|
||||
}
|
||||
}
|
||||
|
||||
protected boolean isMulticonnectHandler(ChannelPipeline pipe) {
|
||||
return false;
|
||||
}
|
||||
|
||||
private ProtocolVersion getVersionForMulticonnect(ProtocolVersion clientSideVersion) {
|
||||
// https://github.com/ViaVersion/ViaVersion/blob/master/velocity/src/main/java/us/myles/ViaVersion/velocity/providers/VelocityVersionProvider.java
|
||||
int[] compatibleProtocols = multiconnectSupportedVersions;
|
||||
|
||||
if (Arrays.binarySearch(compatibleProtocols, clientSideVersion.getVersion()) >= 0) {
|
||||
return clientSideVersion;
|
||||
}
|
||||
|
||||
if (clientSideVersion.getVersion() < compatibleProtocols[0]) {
|
||||
return ProtocolVersion.getProtocol(compatibleProtocols[0]);
|
||||
}
|
||||
|
||||
// TODO: This needs a better fix, i.e checking ProtocolRegistry to see if it would work.
|
||||
for (int i = compatibleProtocols.length - 1; i >= 0; i--) {
|
||||
int protocol = compatibleProtocols[i];
|
||||
if (clientSideVersion.getVersion() > protocol && ProtocolVersion.isRegistered(protocol)) {
|
||||
return ProtocolVersion.getProtocol(protocol);
|
||||
}
|
||||
}
|
||||
|
||||
getLogger().severe("multiconnect integration: Panic, no protocol id found for " + clientSideVersion);
|
||||
return clientSideVersion;
|
||||
}
|
||||
|
||||
private boolean isDisabled(String addr) {
|
||||
String[] parts = addr.split("\\.");
|
||||
boolean isNumericIp = parts.length == 4 && Arrays.stream(parts).map(Ints::tryParse).allMatch(Objects::nonNull);
|
||||
return IntStream.range(0, parts.length).anyMatch(i -> {
|
||||
String query;
|
||||
if (isNumericIp) {
|
||||
query = String.join(".", Arrays.stream(parts, 0, i + 1)
|
||||
.toArray(String[]::new)) + ((i != 3) ? ".*" : "");
|
||||
} else {
|
||||
query = ((i != 0) ? "*." : "") + String.join(".", Arrays.stream(parts, i, parts.length)
|
||||
.toArray(String[]::new));
|
||||
}
|
||||
if (getConfig().isForcedDisable(query)) {
|
||||
getLogger().info(addr + " is force-disabled. (Matches " + query + ")");
|
||||
return true;
|
||||
} else {
|
||||
return false;
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
protected abstract Logger getLogger();
|
||||
|
||||
protected abstract VFConfig getConfig();
|
||||
|
||||
protected abstract CompletableFuture<ProtocolVersion> detectVersion(InetSocketAddress address);
|
||||
}
|
@ -0,0 +1,35 @@
|
||||
/*
|
||||
* This file is part of ViaFabric - https://github.com/ViaVersion/ViaFabric
|
||||
* Copyright (C) 2018-2024 ViaVersion and contributors
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
package com.viaversion.fabric.common.util;
|
||||
|
||||
import com.viaversion.viaversion.api.platform.PlatformTask;
|
||||
|
||||
import java.util.concurrent.Future;
|
||||
|
||||
public class FutureTaskId implements PlatformTask<Future<?>> {
|
||||
private final Future<?> object;
|
||||
|
||||
public FutureTaskId(Future<?> object) {
|
||||
this.object = object;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void cancel() {
|
||||
object.cancel(false);
|
||||
}
|
||||
}
|
@ -1,28 +1,21 @@
|
||||
/*
|
||||
* MIT License
|
||||
* This file is part of ViaFabric - https://github.com/ViaVersion/ViaFabric
|
||||
* Copyright (C) 2018-2024 ViaVersion and contributors
|
||||
*
|
||||
* Copyright (c) 2018 creeper123123321 and contributors
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* 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:
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* 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.
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
package com.github.creeper123123321.viafabric.util;
|
||||
package com.viaversion.fabric.common.util;
|
||||
|
||||
import java.text.MessageFormat;
|
||||
import java.util.logging.Level;
|
@ -0,0 +1,89 @@
|
||||
/*
|
||||
* This file is part of ViaFabric - https://github.com/ViaVersion/ViaFabric
|
||||
* Copyright (C) 2018-2024 ViaVersion and contributors
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
package com.viaversion.fabric.common.util;
|
||||
|
||||
import com.viaversion.fabric.common.platform.NativeVersionProvider;
|
||||
import com.viaversion.viaversion.api.Via;
|
||||
import com.viaversion.viaversion.api.protocol.version.ProtocolVersion;
|
||||
|
||||
import java.util.Arrays;
|
||||
import java.util.stream.Stream;
|
||||
|
||||
public class ProtocolUtils {
|
||||
public static boolean isSupportedClientSide(ProtocolVersion server) {
|
||||
return isSupported(server, Via.getManager().getProviders()
|
||||
.get(NativeVersionProvider.class)
|
||||
.getNativeServerProtocolVersion());
|
||||
}
|
||||
|
||||
public static boolean isSupported(ProtocolVersion server, ProtocolVersion client) {
|
||||
return server.equals(client) || Via.getManager().getProtocolManager().getProtocolPath(client, server) != null;
|
||||
}
|
||||
|
||||
public static String getProtocolName(int id) {
|
||||
if (!ProtocolVersion.isRegistered(id)) return Integer.toString(id);
|
||||
return ProtocolVersion.getProtocol(id).getName();
|
||||
}
|
||||
|
||||
public static boolean isValid(final ProtocolVersion version) {
|
||||
return version.isKnown() && version.getVersion() != -2;
|
||||
}
|
||||
|
||||
public static boolean isStartOfProtocolText(String s) {
|
||||
try {
|
||||
Integer.parseInt(s);
|
||||
return true;
|
||||
} catch (NumberFormatException e) {
|
||||
try {
|
||||
Integer.parseInt(s + '0');
|
||||
return true;
|
||||
} catch (NumberFormatException e2) {
|
||||
if (ProtocolVersion.getClosest(s) != null) return true;
|
||||
return ProtocolVersion.getProtocols().stream()
|
||||
.map(ProtocolVersion::getName)
|
||||
.flatMap(str -> Stream.concat(
|
||||
Arrays.stream(str.split("-")),
|
||||
Arrays.stream(new String[]{str})
|
||||
))
|
||||
.anyMatch(ver -> ver.startsWith(s));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public static Integer parseProtocolId(String s) {
|
||||
try {
|
||||
return Integer.parseInt(s);
|
||||
} catch (NumberFormatException ignored) {
|
||||
ProtocolVersion closest = ProtocolVersion.getClosest(s);
|
||||
if (closest == null) return null;
|
||||
return closest.getVersion();
|
||||
}
|
||||
}
|
||||
|
||||
public static String[] getProtocolSuggestions(String text) {
|
||||
return ProtocolVersion.getProtocols().stream()
|
||||
.map(ProtocolVersion::getName)
|
||||
.flatMap(str -> Stream.concat(
|
||||
Arrays.stream(str.split("-")),
|
||||
Arrays.stream(new String[]{str})
|
||||
))
|
||||
.distinct()
|
||||
.filter(ver -> ver.startsWith(text))
|
||||
.toArray(String[]::new);
|
||||
}
|
||||
}
|
@ -0,0 +1,38 @@
|
||||
/*
|
||||
* This file is part of ViaFabric - https://github.com/ViaVersion/ViaFabric
|
||||
* Copyright (C) 2018-2024 ViaVersion and contributors
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
package com.viaversion.fabric.common.util;
|
||||
|
||||
public class RemappingUtil {
|
||||
public static int swordId(String id) {
|
||||
// https://github.com/ViaVersion/ViaVersion/blob/8de26a0ad33f5b739f5394ed80f69d14197fddc7/common/src/main/java/us/myles/ViaVersion/protocols/protocol1_9to1_8/Protocol1_9To1_8.java#L86
|
||||
switch (id) {
|
||||
case "minecraft:iron_sword":
|
||||
return 267;
|
||||
case "minecraft:wooden_sword":
|
||||
return 268;
|
||||
case "minecraft:golden_sword":
|
||||
return 272;
|
||||
case "minecraft:diamond_sword":
|
||||
return 276;
|
||||
case "minecraft:stone_sword":
|
||||
return 283;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
}
|
@ -1,6 +1,17 @@
|
||||
# WARNING
|
||||
# I can not guarantee that this mod is allowed on every (or even any) server. This mod may cause problems with anti cheat plugins. USE AT OWN RISK
|
||||
# This option enables client-side transforming (can also be enabled in-game)
|
||||
# Disclaimer:
|
||||
#
|
||||
# It cannot be guaranteed that this mod is allowed on specific servers as it can possibly cause problems with anti-cheat plugins, (USE ONLY WITH CAUTION!)
|
||||
# This option enables client-side transforming. (can also be enabled in-game)
|
||||
enable-client-side: false
|
||||
# This option sets the protocol version to be used when connection to the server (can also be changed in-game)
|
||||
# This option sets the protocol version to be used when connecting to servers. (can also be changed in-game)
|
||||
client-side-version: -1
|
||||
# Hides VIA button from multiplayer menu.
|
||||
hide-button: false
|
||||
# List of servers which ViaFabric will force disable transforming on client-side. It can be overwritten by setting per-server version.
|
||||
#
|
||||
# This isn't always the address in multiplayer menu; It will use the SRV record pointer when present, Check the game log for the address.
|
||||
# Uses https://wiki.vg/Mojang_API#Blocked_Servers format (mc.example.com, *.example.com, 192.168.0.1, 192.168.*)
|
||||
client-side-force-disable: ["hypixel.net", "*.hypixel.net", "minemen.club", "*.minemen.club", "icantjoinlmfao.club"]
|
||||
# Fabric registry synchronization will be disabled when installed server-side and validation errors are ignored when installed on client-side.
|
||||
# Note: this setting only works on 1.20.4+ ViaFabric versions, and it might cause issues, use with caution.
|
||||
ignore-registry-sync-errors: false
|
1
src/main/resources/assets/viafabric/lang/de_DE.lang
Normal file
1
src/main/resources/assets/viafabric/lang/de_DE.lang
Normal file
@ -0,0 +1 @@
|
||||
# Autogenerated ${de_de}
|
@ -3,5 +3,12 @@
|
||||
"gui.enable_client_side_button": "ViaVersion aktivieren",
|
||||
"gui.enable_client_side.question": "Bist du dir sicher, dass du den clientseitigen Modus aktivieren möchtest?",
|
||||
"gui.enable_client_side.warning": "Ich kann nicht garantieren, dass diese Mod auf jedem (oder überhaupt einem) Server erlaubt ist. Diese Mod könnte eventuell Probleme mit Anti-Cheat Plugins hervorrufen. VERWENDUNG AUF EIGENE GEFAHR.",
|
||||
"gui.enable_client_side.enable": "Aktivieren"
|
||||
"gui.enable_client_side.enable": "Aktivieren",
|
||||
"gui.viafabric_config.title": "ViaFabric-Konfigurationen",
|
||||
"gui.client_side.enable": "Clientseitig aktivieren",
|
||||
"gui.client_side.disable": "Clientseitig deaktivieren",
|
||||
"gui.ping_version.translated": "VIA: %s",
|
||||
"gui.hide_via_button.enable": "VIA Button ausblenden",
|
||||
"gui.hide_via_button.disable": "VIA Button anzeigen",
|
||||
"gui.via_button": "VIA"
|
||||
}
|
1
src/main/resources/assets/viafabric/lang/en_US.lang
Normal file
1
src/main/resources/assets/viafabric/lang/en_US.lang
Normal file
@ -0,0 +1 @@
|
||||
# Autogenerated ${en_us}
|
@ -2,6 +2,13 @@
|
||||
"gui.protocol_version_field.name": "Protocol Version",
|
||||
"gui.enable_client_side_button": "Enable ViaVersion",
|
||||
"gui.enable_client_side.question": "Are you sure you want to enable client-side mode?",
|
||||
"gui.enable_client_side.warning": "I can not guarantee that this mod is allowed on every (or even any) server. This mod may cause problems with anti-cheat plugins. USE AT OWN RISK.",
|
||||
"gui.enable_client_side.enable": "Enable"
|
||||
"gui.enable_client_side.warning": "It cannot be guaranteed that this mod is allowed on specific servers as it can possibly cause problems with anti-cheat plugins. (USE ONLY WITH CAUTION!)",
|
||||
"gui.enable_client_side.enable": "Enable",
|
||||
"gui.viafabric_config.title": "ViaFabric Configurations",
|
||||
"gui.client_side.enable": "Enable client-side",
|
||||
"gui.client_side.disable": "Disable client-side",
|
||||
"gui.ping_version.translated": "VIA: %s (%s)",
|
||||
"gui.hide_via_button.enable": "Hide VIA button",
|
||||
"gui.hide_via_button.disable": "Show VIA button",
|
||||
"gui.via_button": "VIA"
|
||||
}
|
1
src/main/resources/assets/viafabric/lang/es_ES.lang
Normal file
1
src/main/resources/assets/viafabric/lang/es_ES.lang
Normal file
@ -0,0 +1 @@
|
||||
# Autogenerated ${es_es}
|
14
src/main/resources/assets/viafabric/lang/es_es.json
Normal file
14
src/main/resources/assets/viafabric/lang/es_es.json
Normal file
@ -0,0 +1,14 @@
|
||||
{
|
||||
"gui.protocol_version_field.name": "Versión del protocolo",
|
||||
"gui.enable_client_side_button": "Activar ViaVersion",
|
||||
"gui.enable_client_side.question": "¿Estás seguro de que quieres habilitar el modo de lado del cliente?",
|
||||
"gui.enable_client_side.warning": "No puedo garantizar que este mod esté permitido en todos (o incluso en cualquier) los servidores. Este mod puede causar problemas con los plugins anti-cheat. EL USO DE ESTE MOD ES BAJO SU PROPIO RIESGO.",
|
||||
"gui.enable_client_side.enable": "Activar",
|
||||
"gui.viafabric_config.title": "Configuraciones de ViaFabric",
|
||||
"gui.client_side.enable": "Activar el lado del cliente",
|
||||
"gui.client_side.disable": "Desactivar el lado del cliente",
|
||||
"gui.ping_version.translated": "VIA: %s",
|
||||
"gui.hide_via_button.enable": "Ocultar el botón VIA",
|
||||
"gui.hide_via_button.disable": "Mostrar el botón VIA",
|
||||
"gui.via_button": "VIA"
|
||||
}
|
1
src/main/resources/assets/viafabric/lang/et_EE.lang
Normal file
1
src/main/resources/assets/viafabric/lang/et_EE.lang
Normal file
@ -0,0 +1 @@
|
||||
# Autogenerated ${et_ee}
|
14
src/main/resources/assets/viafabric/lang/et_ee.json
Normal file
14
src/main/resources/assets/viafabric/lang/et_ee.json
Normal file
@ -0,0 +1,14 @@
|
||||
{
|
||||
"gui.protocol_version_field.name": "Protokolli versioon",
|
||||
"gui.enable_client_side_button": "Luba ViaVersion",
|
||||
"gui.enable_client_side.question": "Kas soovid kindlasti lubada kliendipoolse režiimi?",
|
||||
"gui.enable_client_side.warning": "Ma ei saa garanteerida selle modi lubamist igas (mistahes) serveris. See mod võib põhjustada sohivastaste pluginatega probleeme. KASUTA OMAL VASTUTUSEL.",
|
||||
"gui.enable_client_side.enable": "Luba",
|
||||
"gui.viafabric_config.title": "ViaFabricu seadistused",
|
||||
"gui.client_side.enable": "Luba kliendipoolne",
|
||||
"gui.client_side.disable": "Keela kliendipoolne",
|
||||
"gui.ping_version.translated": "VIA: %s",
|
||||
"gui.hide_via_button.enable": "Peida VIA nupp",
|
||||
"gui.hide_via_button.disable": "Kuva VIA nuppu",
|
||||
"gui.via_button": "VIA"
|
||||
}
|
1
src/main/resources/assets/viafabric/lang/fr_FR.lang
Normal file
1
src/main/resources/assets/viafabric/lang/fr_FR.lang
Normal file
@ -0,0 +1 @@
|
||||
# Autogenerated ${fr_fr}
|
14
src/main/resources/assets/viafabric/lang/fr_fr.json
Normal file
14
src/main/resources/assets/viafabric/lang/fr_fr.json
Normal file
@ -0,0 +1,14 @@
|
||||
{
|
||||
"gui.protocol_version_field.name": "Version du protocole",
|
||||
"gui.enable_client_side_button": "Activer ViaVersion",
|
||||
"gui.enable_client_side.question": "Êtes vous sûr de vouloir activer le mode coté client ?",
|
||||
"gui.enable_client_side.warning": "Je ne peux pas vous garantir que ce mod est autorisé dans tous (ou même aucun) serveur. Ce mod peut causer des problèmes avec les plugin anti-cheat. À UTILISEZ À VOS RISQUES ET PERILS.",
|
||||
"gui.enable_client_side.enable": "Activer",
|
||||
"gui.viafabric_config.title": "Configuration de ViaFabric",
|
||||
"gui.client_side.enable": "Activer coté client",
|
||||
"gui.client_side.disable": "Désactiver coté client",
|
||||
"gui.ping_version.translated": "VIA: %s",
|
||||
"gui.hide_via_button.enable": "Cacher le bouton VIA",
|
||||
"gui.hide_via_button.disable": "Montrer le bouton VIA",
|
||||
"gui.via_button": "VIA"
|
||||
}
|
1
src/main/resources/assets/viafabric/lang/hi_IN.lang
Normal file
1
src/main/resources/assets/viafabric/lang/hi_IN.lang
Normal file
@ -0,0 +1 @@
|
||||
# Autogenerated ${hi_in}
|
14
src/main/resources/assets/viafabric/lang/hi_in.json
Normal file
14
src/main/resources/assets/viafabric/lang/hi_in.json
Normal file
@ -0,0 +1,14 @@
|
||||
{
|
||||
"gui.protocol_version_field.name": "प्रोटोकॉल संस्करण",
|
||||
"gui.enable_client_side_button": "ViaVersion सक्षम करें",
|
||||
"gui.enable_client_side.question": "क्या आप वाकई में उपयोगकर्ता-मोड सक्षम करना चाहते हैं?",
|
||||
"gui.enable_client_side.warning": "यह गारंटी नहीं दी जा सकती है कि यह mod कुछ सर्वेरों पर अनुमत है क्योंकि यह छल विरोधी प्लगिन के साथ समस्या उत्पन्न कर सकता है। (सावधानी से इस्तेमाल करें!)",
|
||||
"gui.enable_client_side.enable": "सक्षम करें",
|
||||
"gui.viafabric_config.title": "ViaFabric कॉन्फ़िगरेशन",
|
||||
"gui.client_side.enable": "क्लाइंट साइड पर चालू करें",
|
||||
"gui.client_side.disable": "क्लाइंट साइड पर बंद करें",
|
||||
"gui.ping_version.translated": "VIA: %s",
|
||||
"gui.hide_via_button.enable": "VIA बटन छुपाएँ",
|
||||
"gui.hide_via_button.disable": "VIA बटन दिखाएँ",
|
||||
"gui.via_button": "VIA"
|
||||
}
|
1
src/main/resources/assets/viafabric/lang/it_IT.lang
Normal file
1
src/main/resources/assets/viafabric/lang/it_IT.lang
Normal file
@ -0,0 +1 @@
|
||||
# Autogenerated ${it_it}
|
14
src/main/resources/assets/viafabric/lang/it_it.json
Normal file
14
src/main/resources/assets/viafabric/lang/it_it.json
Normal file
@ -0,0 +1,14 @@
|
||||
{
|
||||
"gui.protocol_version_field.name": "Versione del protocollo",
|
||||
"gui.enable_client_side_button": "Attivare ViaVersion",
|
||||
"gui.enable_client_side.question": "Siete sicuri di voler attivare la modalità lato cliente?",
|
||||
"gui.enable_client_side.warning": "Non posso garantire che questo mod sia consentito su ogni server (o anche solo su uno qualsiasi). Questo mod può causare problemi con i plugin anti-cheat. USO A PROPRIO RISCHIO E PERICOLO.",
|
||||
"gui.enable_client_side.enable": "Attivare",
|
||||
"gui.viafabric_config.title": "Configurazioni ViaFabric",
|
||||
"gui.client_side.enable": "Attivare lato cliente",
|
||||
"gui.client_side.disable": "Disattivare lato cliente",
|
||||
"gui.ping_version.translated": "VIA: %s",
|
||||
"gui.hide_via_button.enable": "Nascondi il pulsante VIA",
|
||||
"gui.hide_via_button.disable": "Mostra il pulsante VIA",
|
||||
"gui.via_button": "VIA"
|
||||
}
|
1
src/main/resources/assets/viafabric/lang/ja_JP.lang
Normal file
1
src/main/resources/assets/viafabric/lang/ja_JP.lang
Normal file
@ -0,0 +1 @@
|
||||
# Autogenerated ${ja_jp}
|
14
src/main/resources/assets/viafabric/lang/ja_jp.json
Normal file
14
src/main/resources/assets/viafabric/lang/ja_jp.json
Normal file
@ -0,0 +1,14 @@
|
||||
{
|
||||
"gui.protocol_version_field.name": "プロトコルバージョン",
|
||||
"gui.enable_client_side_button": "ViaVersionを有効にする",
|
||||
"gui.enable_client_side.question": "本当にクライアントサイドモードを有効にしますか?",
|
||||
"gui.enable_client_side.warning": "私はこのMODがすべての(あるいはどのサーバーでも)許可されていることを保証することはできません。このMODはアンチチートプラグインの問題を引き起こす可能性があります。自己責任で使用してください。",
|
||||
"gui.enable_client_side.enable": "有効化",
|
||||
"gui.viafabric_config.title": "ViaFabricの構成",
|
||||
"gui.client_side.enable": "クライアント側を有効にする",
|
||||
"gui.client_side.disable": "クライアント側を無効にする",
|
||||
"gui.ping_version.translated": "VIA: %s",
|
||||
"gui.hide_via_button.enable": "VIAボタンを隠す",
|
||||
"gui.hide_via_button.disable": "VIAボタンを表示",
|
||||
"gui.via_button": "VIA"
|
||||
}
|
1
src/main/resources/assets/viafabric/lang/nl_NL.lang
Normal file
1
src/main/resources/assets/viafabric/lang/nl_NL.lang
Normal file
@ -0,0 +1 @@
|
||||
# Autogenerated ${nl_nl}
|
14
src/main/resources/assets/viafabric/lang/nl_nl.json
Normal file
14
src/main/resources/assets/viafabric/lang/nl_nl.json
Normal file
@ -0,0 +1,14 @@
|
||||
{
|
||||
"gui.protocol_version_field.name": "Protocolversie",
|
||||
"gui.enable_client_side_button": "Schakel ViaVersion in",
|
||||
"gui.enable_client_side.question": "Weet u zeker dat u de client-side modus wilt inschakelen?",
|
||||
"gui.enable_client_side.warning": "Ik kan niet garanderen dat deze mod op elke (of zelfs maar één) server is toegestaan. Deze mod kan problemen veroorzaken met anti-cheat plugins. GEBRUIK OP EIGEN RISICO.",
|
||||
"gui.enable_client_side.enable": "Schakel in",
|
||||
"gui.viafabric_config.title": "ViaFabric-configuraties",
|
||||
"gui.client_side.enable": "Klantenservice inschakelen",
|
||||
"gui.client_side.disable": "Cliëntenservice uitschakelen",
|
||||
"gui.ping_version.translated": "VIA: %s",
|
||||
"gui.hide_via_button.enable": "VIA-knop verbergen",
|
||||
"gui.hide_via_button.disable": "Toon VIA-knop",
|
||||
"gui.via_button": "VIA"
|
||||
}
|
1
src/main/resources/assets/viafabric/lang/pl_PL.lang
Normal file
1
src/main/resources/assets/viafabric/lang/pl_PL.lang
Normal file
@ -0,0 +1 @@
|
||||
# Autogenerated ${pl_pl}
|
@ -3,5 +3,12 @@
|
||||
"gui.enable_client_side_button": "Włącz ViaVersion",
|
||||
"gui.enable_client_side.question": "Jesteś pewien, że chcesz włączyć tryb client-side?",
|
||||
"gui.enable_client_side.warning": "Nie możemy zagwarantować, że ten mod jest dozwolony na każdym (lub jakimkolwiek) serwerze. Ten mod może powodować problemy z anty-cheatami. UŻYWASZ NA WŁASNE RYZYKO!.",
|
||||
"gui.enable_client_side.enable": "Włącz"
|
||||
"gui.enable_client_side.enable": "Włączyć",
|
||||
"gui.viafabric_config.title": "Konfiguracje ViaFabric",
|
||||
"gui.client_side.enable": "Włączenie po stronie klienta",
|
||||
"gui.client_side.disable": "Wyłączenie po stronie klienta",
|
||||
"gui.ping_version.translated": "VIA: %s",
|
||||
"gui.hide_via_button.enable": "Ukrycie przycisku VIA",
|
||||
"gui.hide_via_button.disable": "Pokaż przycisk VIA",
|
||||
"gui.via_button": "VIA"
|
||||
}
|
1
src/main/resources/assets/viafabric/lang/pt_BR.lang
Normal file
1
src/main/resources/assets/viafabric/lang/pt_BR.lang
Normal file
@ -0,0 +1 @@
|
||||
# Autogenerated ${pt_br}
|
@ -1,7 +1,14 @@
|
||||
{
|
||||
"gui.protocol_version_field.name": "Versão do protocolo",
|
||||
"gui.enable_client_side_button": "Habilitar ViaVersion",
|
||||
"gui.enable_client_side.question": "Você tem certeza de que deseja habilitar o modo client-side?",
|
||||
"gui.enable_client_side.question": "Você tem certeza de que deseja habilitar o modo cliente?",
|
||||
"gui.enable_client_side.warning": "Não posso garantir que este mod seja permitido em todos os (ou mesmo em quaisquer) servidores. Esse poderá causar problemas com plugins anti-trapaça. USE POR SUA PRÓPRIA CONTA E RISCO.",
|
||||
"gui.enable_client_side.enable": "Habilitar"
|
||||
"gui.enable_client_side.enable": "Habilitar",
|
||||
"gui.viafabric_config.title": "Configurações de ViaFabric",
|
||||
"gui.client_side.enable": "Habilitar modo cliente",
|
||||
"gui.client_side.disable": "Desativar modo cliente",
|
||||
"gui.ping_version.translated": "VIA: %s",
|
||||
"gui.hide_via_button.enable": "Esconder botão VIA",
|
||||
"gui.hide_via_button.disable": "Mostrar botão VIA",
|
||||
"gui.via_button": "VIA"
|
||||
}
|
1
src/main/resources/assets/viafabric/lang/ru_RU.lang
Normal file
1
src/main/resources/assets/viafabric/lang/ru_RU.lang
Normal file
@ -0,0 +1 @@
|
||||
# Autogenerated ${ru_ru}
|
14
src/main/resources/assets/viafabric/lang/ru_ru.json
Normal file
14
src/main/resources/assets/viafabric/lang/ru_ru.json
Normal file
@ -0,0 +1,14 @@
|
||||
{
|
||||
"gui.protocol_version_field.name": "Версия протокола",
|
||||
"gui.enable_client_side_button": "Включить ViaVersion",
|
||||
"gui.enable_client_side.question": "Вы уверены, что хотите включить режим: На стороне клиента?",
|
||||
"gui.enable_client_side.warning": "Я не могу гарантировать, что этот мод разрешён любом (или хотя бы) сервере. Этот мод может вызывать проблемы с Античит плагинами. ИСПОЛЬЗУЙТЕ НА СВОЙ СТРАХ И РИСК.",
|
||||
"gui.enable_client_side.enable": "Включить",
|
||||
"gui.viafabric_config.title": "Конфигурации ViaFabric",
|
||||
"gui.client_side.enable": "Включить на стороне клиента",
|
||||
"gui.client_side.disable": "Отключить на стороне клиента",
|
||||
"gui.ping_version.translated": "VIA: %s",
|
||||
"gui.hide_via_button.enable": "Скрыть кнопку VIA",
|
||||
"gui.hide_via_button.disable": "Показать кнопку VIA",
|
||||
"gui.via_button": "VIA"
|
||||
}
|
1
src/main/resources/assets/viafabric/lang/tr_TR.lang
Normal file
1
src/main/resources/assets/viafabric/lang/tr_TR.lang
Normal file
@ -0,0 +1 @@
|
||||
# Autogenerated ${tr_tr}
|
14
src/main/resources/assets/viafabric/lang/tr_tr.json
Normal file
14
src/main/resources/assets/viafabric/lang/tr_tr.json
Normal file
@ -0,0 +1,14 @@
|
||||
{
|
||||
"gui.protocol_version_field.name": "Protokol Versiyonu",
|
||||
"gui.enable_client_side_button": "ViaVersion'u aktive et",
|
||||
"gui.enable_client_side.question": "Alıcı-tarafı modunu aktive etmek istediğinize min misiniz?",
|
||||
"gui.enable_client_side.warning": "Bu modun her ( veya herhangi ) bir sunucuda izin verildiğine garanti veremem. Bu mod anti-cheat pluginleriyle sorunlara yol açabilir. KENDİ RİSKİNİZDE KULLANIN.",
|
||||
"gui.enable_client_side.enable": "Aktive et",
|
||||
"gui.viafabric_config.title": "ViaFabric Konfigürasyonu",
|
||||
"gui.client_side.enable": "Alıcı-tarafı aktive et",
|
||||
"gui.client_side.disable": "Alıcı-tarafı devre dışı bırak",
|
||||
"gui.ping_version.translated": "VIA: %s",
|
||||
"gui.hide_via_button.enable": "VIA tuşunu gizle",
|
||||
"gui.hide_via_button.disable": "VIA tuşunu göster",
|
||||
"gui.via_button": "VIA"
|
||||
}
|
15
src/main/resources/assets/viafabric/lang/tt_ru.json
Normal file
15
src/main/resources/assets/viafabric/lang/tt_ru.json
Normal file
@ -0,0 +1,15 @@
|
||||
{
|
||||
"modmenu.summaryTranslation.viafabric": "Fabric өчен клиентлы һәм серверлы ViaVersion тормышка ашыру.",
|
||||
"gui.protocol_version_field.name": "Протокол версиясе",
|
||||
"gui.enable_client_side_button": "ViaVersion кушу",
|
||||
"gui.enable_client_side.question": "Сез чыннан да «клиент тарафында» шартын кушырга телисезме?",
|
||||
"gui.enable_client_side.warning": "Бу мод билгеле бер серверларда рөхсәт ителгән дип гарантияләргә ярамый, чөнки ул античит-плагиннар белән проблемалар китереп чыгара ала. (САК БУЛЫГЫЗ!)",
|
||||
"gui.enable_client_side.enable": "Кушу",
|
||||
"gui.viafabric_config.title": "ViaFabric көйләүләре",
|
||||
"gui.client_side.enable": "Клиент тарафында кушу",
|
||||
"gui.client_side.disable": "Клиент тарафында сүндерү",
|
||||
"gui.ping_version.translated": "VIA: %s (%s)",
|
||||
"gui.hide_via_button.enable": "VIA төймәсен яшерү",
|
||||
"gui.hide_via_button.disable": "VIA төймәсен күрсәтү",
|
||||
"gui.via_button": "VIA"
|
||||
}
|
1
src/main/resources/assets/viafabric/lang/zh_CN.lang
Normal file
1
src/main/resources/assets/viafabric/lang/zh_CN.lang
Normal file
@ -0,0 +1 @@
|
||||
# Autogenerated ${zh_cn}
|
1
src/main/resources/assets/viafabric/lang/zh_HK.lang
Normal file
1
src/main/resources/assets/viafabric/lang/zh_HK.lang
Normal file
@ -0,0 +1 @@
|
||||
# Autogenerated ${zh_tw}
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue
Block a user