├── pages
├── CNAME
└── _config.yml
├── gradle
└── wrapper
│ ├── gradle-wrapper.jar
│ └── gradle-wrapper.properties
├── .idea
├── copyright
│ ├── profiles_settings.xml
│ └── protocol-gen.xml
├── codeStyles
│ ├── codeStyleConfig.xml
│ └── Project.xml
└── inspectionProfiles
│ ├── profiles_settings.xml
│ └── protocol-gen.xml
├── .editorconfig
├── renovate.json
├── license.txt
├── .gitattributes
├── license_header.txt
├── settings.gradle.kts
├── .gitignore
├── gradle.properties
├── src
└── main
│ ├── resources
│ └── logback.xml
│ └── java
│ └── dev
│ └── derklaro
│ └── protocolgenerator
│ ├── downloader
│ ├── FileDownloadValidator.java
│ ├── Sha1DownloadValidator.java
│ └── FileDownloader.java
│ ├── protocol
│ ├── McPacketFlow.java
│ ├── McClassNames.java
│ ├── McInit.java
│ ├── PacketClassFieldScanner.java
│ ├── McProtocolStates.java
│ ├── PacketClassInfo.java
│ ├── PacketVisitorImplGenerator.java
│ ├── ProtocolInfoCollector.java
│ └── McProtocolsDecoder.java
│ ├── manifest
│ ├── McManifestVersionType.java
│ ├── McVersionDumper.java
│ ├── McManifestVersion.java
│ ├── McManifestVersionData.java
│ └── McManifestVersionFetcher.java
│ ├── util
│ └── CatchingFunction.java
│ ├── jackson
│ └── JacksonSupport.java
│ ├── cli
│ └── CliArgParser.java
│ ├── http
│ ├── HttpClientProvider.java
│ └── BodyParser.java
│ ├── markdown
│ ├── MarkdownFormatter.java
│ └── MarkdownGenerator.java
│ ├── gameversion
│ ├── JarGameVersionParser.java
│ └── GameVersion.java
│ ├── GeneratorCLIArguments.java
│ ├── library
│ └── McLibraryLoader.java
│ ├── reflect
│ └── TypeHelper.java
│ └── GeneratorEntrypoint.java
├── .github
├── workflows
│ └── generate.yml
└── readme.md
├── gradlew.bat
├── gradlew
└── checkstyle.xml
/pages/CNAME:
--------------------------------------------------------------------------------
1 | protocol.derklaro.dev
2 |
--------------------------------------------------------------------------------
/pages/_config.yml:
--------------------------------------------------------------------------------
1 | theme: jekyll-theme-hacker
2 | markdown: GFM
3 |
--------------------------------------------------------------------------------
/gradle/wrapper/gradle-wrapper.jar:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/derklaro/mc-protocol/HEAD/gradle/wrapper/gradle-wrapper.jar
--------------------------------------------------------------------------------
/.idea/copyright/profiles_settings.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
--------------------------------------------------------------------------------
/.idea/codeStyles/codeStyleConfig.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
--------------------------------------------------------------------------------
/.idea/inspectionProfiles/profiles_settings.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
--------------------------------------------------------------------------------
/gradle/wrapper/gradle-wrapper.properties:
--------------------------------------------------------------------------------
1 | distributionBase=GRADLE_USER_HOME
2 | distributionPath=wrapper/dists
3 | distributionUrl=https\://services.gradle.org/distributions/gradle-9.2.1-bin.zip
4 | networkTimeout=10000
5 | validateDistributionUrl=true
6 | zipStoreBase=GRADLE_USER_HOME
7 | zipStorePath=wrapper/dists
8 |
--------------------------------------------------------------------------------
/.editorconfig:
--------------------------------------------------------------------------------
1 | # EditorConfig is awesome: https://editorconfig.org/
2 |
3 | # top-most EditorConfig file
4 | root = true
5 |
6 | # Unix-style newlines with a newline ending every file
7 | [*]
8 | charset = utf-8
9 | end_of_line = lf
10 | indent_size = 2
11 | indent_style = space
12 | max_line_length = 120
13 | insert_final_newline = true
--------------------------------------------------------------------------------
/renovate.json:
--------------------------------------------------------------------------------
1 | {
2 | "extends": [
3 | "config:base",
4 | ":rebaseStalePrs"
5 | ],
6 | "labels": [
7 | "t: dependencies"
8 | ],
9 | "packageRules": [
10 | {
11 | "description": "Correct Guava version handling",
12 | "matchPackagePrefixes": [
13 | "com.google.guava:"
14 | ],
15 | "versioning": "regex:^(?\\d+)(\\.(?\\d+))?(\\.(?\\d+))?(-(?.*))?$"
16 | }
17 | ],
18 | "vulnerabilityAlerts": {
19 | "addLabels": [
20 | "t: security"
21 | ],
22 | "assignees": [
23 | "@derklaro"
24 | ]
25 | },
26 | "timezone": "Europe/Berlin",
27 | "schedule": [
28 | "before 6:00am"
29 | ],
30 | "prHourlyLimit": 10,
31 | "commitMessagePrefix": "chore: ",
32 | "commitMessageAction": "update"
33 | }
34 |
--------------------------------------------------------------------------------
/license.txt:
--------------------------------------------------------------------------------
1 | MIT License
2 |
3 | Copyright (c) 2023-2024 Pasqual Koschmieder and contributors
4 |
5 | Permission is hereby granted, free of charge, to any person obtaining a copy
6 | of this software and associated documentation files (the "Software"), to deal
7 | in the Software without restriction, including without limitation the rights
8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9 | copies of the Software, and to permit persons to whom the Software is
10 | furnished to do so, subject to the following conditions:
11 |
12 | The above copyright notice and this permission notice shall be included in all
13 | copies or substantial portions of the Software.
14 |
15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21 | SOFTWARE.
22 |
--------------------------------------------------------------------------------
/.gitattributes:
--------------------------------------------------------------------------------
1 | # Normalize as LF in the repository, OS native locally
2 | * text eol=lf
3 |
4 | # These are explicitly windows files and should use crlf
5 | *.bat text eol=crlf
6 |
7 | # These files are text and should be normalized (Convert crlf => lf)
8 | *.bash text eol=lf
9 | *.css text diff=css
10 | *.htm text diff=html
11 | *.html text diff=html
12 | *.java text diff=java
13 | *.sh text eol=lf
14 |
15 | # These files are binary and should be left untouched
16 | # (binary is a macro for -text -diff)
17 | *.a binary
18 | *.lib binary
19 | *.icns binary
20 | *.png binary
21 | *.jpg binary
22 | *.jpeg binary
23 | *.gif binary
24 | *.ico binary
25 | *.mov binary
26 | *.mp4 binary
27 | *.mp3 binary
28 | *.flv binary
29 | *.fla binary
30 | *.swf binary
31 | *.gz binary
32 | *.zip binary
33 | *.jar binary
34 | *.tar binary
35 | *.tar.gz binary
36 | *.7z binary
37 | *.ttf binary
38 | *.pyc binary
39 | *.gpg binary
40 | *.bin binary
41 |
--------------------------------------------------------------------------------
/license_header.txt:
--------------------------------------------------------------------------------
1 | /*
2 | * This file is part of mc-protocol-generator, licensed under the MIT License (MIT).
3 | *
4 | * Copyright (c) 2023 - 2024 Pasqual K. and contributors
5 | *
6 | * Permission is hereby granted, free of charge, to any person obtaining a copy
7 | * of this software and associated documentation files (the "Software"), to deal
8 | * in the Software without restriction, including without limitation the rights
9 | * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
10 | * copies of the Software, and to permit persons to whom the Software is
11 | * furnished to do so, subject to the following conditions:
12 | *
13 | * The above copyright notice and this permission notice shall be included in
14 | * all copies or substantial portions of the Software.
15 | *
16 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
17 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
18 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
19 | * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
20 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
21 | * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
22 | * THE SOFTWARE.
23 | */
24 |
25 |
--------------------------------------------------------------------------------
/settings.gradle.kts:
--------------------------------------------------------------------------------
1 | /*
2 | * This file is part of mc-protocol-generator, licensed under the MIT License (MIT).
3 | *
4 | * Copyright (c) 2023 - 2024 Pasqual K. and contributors
5 | *
6 | * Permission is hereby granted, free of charge, to any person obtaining a copy
7 | * of this software and associated documentation files (the "Software"), to deal
8 | * in the Software without restriction, including without limitation the rights
9 | * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
10 | * copies of the Software, and to permit persons to whom the Software is
11 | * furnished to do so, subject to the following conditions:
12 | *
13 | * The above copyright notice and this permission notice shall be included in
14 | * all copies or substantial portions of the Software.
15 | *
16 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
17 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
18 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
19 | * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
20 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
21 | * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
22 | * THE SOFTWARE.
23 | */
24 |
25 | rootProject.name = "mc-protocol-generator"
26 |
--------------------------------------------------------------------------------
/.gitignore:
--------------------------------------------------------------------------------
1 | # include specific folders in .idea/
2 | !.idea
3 | .idea/*
4 | # copyright settings
5 | !/.idea/copyright
6 | .idea/copyright/*
7 | !/.idea/copyright/protocol-gen.xml
8 | !/.idea/copyright/profiles_settings.xml
9 | # Code Style settings
10 | !/.idea/codeStyles
11 | .idea/codeStyles/*
12 | !/.idea/codeStyles/Project.xml
13 | !/.idea/codeStyles/codeStyleConfig.xml
14 | # Inspection profiles
15 | !/.idea/inspectionProfiles
16 | .idea/inspectionProfiles/*
17 | !/.idea/inspectionProfiles/protocol-gen.xml
18 | !/.idea/inspectionProfiles/profiles_settings.xml
19 |
20 | # gradle
21 | .gradle/
22 | build/
23 |
24 | # fleet
25 | .fleet/
26 |
27 | # eclipse
28 | *.classpath
29 | *.project
30 | *.settings
31 | /bin/
32 | /subprojects/*/bin/
33 | .metadata/
34 | atlassian-ide-plugin.xml
35 |
36 | # NetBeans
37 | .nb-gradle
38 | .nb-gradle-properties
39 |
40 | # Vim
41 | *.sw[nop]
42 |
43 | # Emacs
44 | *~
45 | \#*\#
46 | .\#*
47 |
48 | # Textmate
49 | .textmate
50 |
51 | # Sublime Text
52 | *.sublime-*
53 |
54 | # jEnv
55 | .java-version
56 |
57 | # macOS
58 | .DS_Store
59 |
60 | # HPROF
61 | *.hprof
62 |
63 | # Work dirs
64 | /incoming-distributions
65 | /intTestHomeDir
66 |
67 | # Logs
68 | /*.log
69 |
70 | # delombok
71 | */src/main/lombok
72 |
73 | # stuff for generation only
74 | *.tmp
75 | client_libs/
76 |
77 | # final protocol output
78 | *.md
79 | !.github/readme.md
80 |
--------------------------------------------------------------------------------
/.idea/copyright/protocol-gen.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
--------------------------------------------------------------------------------
/gradle.properties:
--------------------------------------------------------------------------------
1 | #
2 | # This file is part of mc-protocol-generator, licensed under the MIT License (MIT).
3 | #
4 | # Copyright (c) 2023 - 2024 Pasqual K. and contributors
5 | #
6 | # Permission is hereby granted, free of charge, to any person obtaining a copy
7 | # of this software and associated documentation files (the "Software"), to deal
8 | # in the Software without restriction, including without limitation the rights
9 | # to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
10 | # copies of the Software, and to permit persons to whom the Software is
11 | # furnished to do so, subject to the following conditions:
12 | #
13 | # The above copyright notice and this permission notice shall be included in
14 | # all copies or substantial portions of the Software.
15 | #
16 | # THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
17 | # IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
18 | # FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
19 | # AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
20 | # LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
21 | # OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
22 | # THE SOFTWARE.
23 | #
24 | org.gradle.caching=true
25 | org.gradle.parallel=true
26 | org.gradle.warning.mode=all
27 | org.gradle.logging.level=info
28 | org.gradle.jvmargs=-Xmx2G -XX:MaxMetaspaceSize=512m -Dfile.encoding=UTF-8
29 |
--------------------------------------------------------------------------------
/src/main/resources/logback.xml:
--------------------------------------------------------------------------------
1 |
24 |
25 |
26 |
27 |
28 | %d{HH:mm:ss.SSS} [%thread] %-5level: %msg%n
29 |
30 |
31 |
32 |
33 |
34 |
35 |
36 |
--------------------------------------------------------------------------------
/src/main/java/dev/derklaro/protocolgenerator/downloader/FileDownloadValidator.java:
--------------------------------------------------------------------------------
1 | /*
2 | * This file is part of mc-protocol-generator, licensed under the MIT License (MIT).
3 | *
4 | * Copyright (c) 2023 - 2024 Pasqual K. and contributors
5 | *
6 | * Permission is hereby granted, free of charge, to any person obtaining a copy
7 | * of this software and associated documentation files (the "Software"), to deal
8 | * in the Software without restriction, including without limitation the rights
9 | * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
10 | * copies of the Software, and to permit persons to whom the Software is
11 | * furnished to do so, subject to the following conditions:
12 | *
13 | * The above copyright notice and this permission notice shall be included in
14 | * all copies or substantial portions of the Software.
15 | *
16 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
17 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
18 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
19 | * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
20 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
21 | * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
22 | * THE SOFTWARE.
23 | */
24 |
25 | package dev.derklaro.protocolgenerator.downloader;
26 |
27 | import java.nio.file.Path;
28 | import lombok.NonNull;
29 |
30 | @FunctionalInterface
31 | public interface FileDownloadValidator {
32 |
33 | static @NonNull FileDownloadValidator ofSha1(@NonNull String sha1) {
34 | return new Sha1DownloadValidator(sha1);
35 | }
36 |
37 | boolean validate(@NonNull Path downloadPath) throws Exception;
38 | }
39 |
--------------------------------------------------------------------------------
/src/main/java/dev/derklaro/protocolgenerator/protocol/McPacketFlow.java:
--------------------------------------------------------------------------------
1 | /*
2 | * This file is part of mc-protocol-generator, licensed under the MIT License (MIT).
3 | *
4 | * Copyright (c) 2023 - 2024 Pasqual K. and contributors
5 | *
6 | * Permission is hereby granted, free of charge, to any person obtaining a copy
7 | * of this software and associated documentation files (the "Software"), to deal
8 | * in the Software without restriction, including without limitation the rights
9 | * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
10 | * copies of the Software, and to permit persons to whom the Software is
11 | * furnished to do so, subject to the following conditions:
12 | *
13 | * The above copyright notice and this permission notice shall be included in
14 | * all copies or substantial portions of the Software.
15 | *
16 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
17 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
18 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
19 | * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
20 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
21 | * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
22 | * THE SOFTWARE.
23 | */
24 |
25 | package dev.derklaro.protocolgenerator.protocol;
26 |
27 | import lombok.NonNull;
28 |
29 | enum McPacketFlow {
30 |
31 | /* packets from server to client */
32 | CLIENTBOUND,
33 | /* packets from client to server */
34 | SERVERBOUND;
35 |
36 | public @NonNull McPacketFlow sender() {
37 | return switch (this) {
38 | case CLIENTBOUND -> SERVERBOUND;
39 | case SERVERBOUND -> CLIENTBOUND;
40 | };
41 | }
42 | }
43 |
--------------------------------------------------------------------------------
/.github/workflows/generate.yml:
--------------------------------------------------------------------------------
1 | name: "Generate Protocol Specification"
2 | on:
3 | push:
4 | branches: [ "main" ]
5 | tags-ignore: [ "**" ]
6 | workflow_dispatch:
7 | schedule:
8 | - cron: '0 0 * * *'
9 |
10 | jobs:
11 | generate:
12 | name: "Generate Protocol Specification"
13 | runs-on: ubuntu-latest
14 |
15 | steps:
16 | - name: Checkout repository
17 | uses: actions/checkout@v6
18 |
19 | - name: Setup java
20 | uses: actions/setup-java@v5
21 | with:
22 | java-version: 25
23 | check-latest: true
24 | distribution: 'zulu'
25 |
26 | - name: Build Generator
27 | run: ./gradlew clean build shadowJar
28 |
29 | - name: Prepare execute directory
30 | run: |
31 | mkdir -p generation/;
32 | mkdir -p generation/result/;
33 |
34 | cp -r pages/* generation/result/;
35 | cp build/libs/protocol-generator.jar generation/generator.jar;
36 |
37 | - name: Run generator
38 | run: |
39 | cd generation;
40 | java --add-opens=java.base/java.lang.invoke=ALL-UNNAMED -Djoml.nounsafe=true -jar generator.jar --output-file=result/readme.md --version-file=version.txt;
41 |
42 | - name: Export processed version to env
43 | run: |
44 | cd generation;
45 | echo "VERSION=$(cat version.txt)" >> $GITHUB_ENV;
46 |
47 | - name: Push and Tag generated specification
48 | uses: s0/git-publish-subdir-action@develop
49 | env:
50 | REPO: self
51 | BRANCH: gh-pages
52 | FOLDER: generation/result
53 | GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
54 | SKIP_EMPTY_COMMITS: true
55 | MESSAGE: Update protocol for ${{ env.VERSION }}
56 | TAG: ${{ env.VERSION }}
57 |
--------------------------------------------------------------------------------
/src/main/java/dev/derklaro/protocolgenerator/protocol/McClassNames.java:
--------------------------------------------------------------------------------
1 | /*
2 | * This file is part of mc-protocol-generator, licensed under the MIT License (MIT).
3 | *
4 | * Copyright (c) 2023 - 2024 Pasqual K. and contributors
5 | *
6 | * Permission is hereby granted, free of charge, to any person obtaining a copy
7 | * of this software and associated documentation files (the "Software"), to deal
8 | * in the Software without restriction, including without limitation the rights
9 | * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
10 | * copies of the Software, and to permit persons to whom the Software is
11 | * furnished to do so, subject to the following conditions:
12 | *
13 | * The above copyright notice and this permission notice shall be included in
14 | * all copies or substantial portions of the Software.
15 | *
16 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
17 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
18 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
19 | * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
20 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
21 | * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
22 | * THE SOFTWARE.
23 | */
24 |
25 | package dev.derklaro.protocolgenerator.protocol;
26 |
27 | final class McClassNames {
28 |
29 | public static final String BOOTSTRAP = "net.minecraft.server.Bootstrap";
30 | public static final String SHARED_CONSTANTS = "net.minecraft.SharedConstants";
31 |
32 | public static final String PACKET_VISITOR = "net.minecraft.network.ProtocolInfo$Details$PacketVisitor";
33 |
34 | private McClassNames() {
35 | throw new UnsupportedOperationException();
36 | }
37 | }
38 |
--------------------------------------------------------------------------------
/src/main/java/dev/derklaro/protocolgenerator/manifest/McManifestVersionType.java:
--------------------------------------------------------------------------------
1 | /*
2 | * This file is part of mc-protocol-generator, licensed under the MIT License (MIT).
3 | *
4 | * Copyright (c) 2023 - 2024 Pasqual K. and contributors
5 | *
6 | * Permission is hereby granted, free of charge, to any person obtaining a copy
7 | * of this software and associated documentation files (the "Software"), to deal
8 | * in the Software without restriction, including without limitation the rights
9 | * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
10 | * copies of the Software, and to permit persons to whom the Software is
11 | * furnished to do so, subject to the following conditions:
12 | *
13 | * The above copyright notice and this permission notice shall be included in
14 | * all copies or substantial portions of the Software.
15 | *
16 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
17 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
18 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
19 | * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
20 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
21 | * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
22 | * THE SOFTWARE.
23 | */
24 |
25 | package dev.derklaro.protocolgenerator.manifest;
26 |
27 | import com.fasterxml.jackson.annotation.JsonIgnore;
28 | import com.fasterxml.jackson.annotation.JsonProperty;
29 |
30 | public enum McManifestVersionType {
31 | /* internally used, not actually supplied by minecraft manifest */
32 | @JsonIgnore
33 | LATEST,
34 |
35 | @JsonProperty("release")
36 | RELEASE,
37 | @JsonProperty("snapshot")
38 | SNAPSHOT,
39 | @JsonProperty("old_beta")
40 | OLD_BETA,
41 | @JsonProperty("old_alpha")
42 | OLD_ALPHA
43 | }
44 |
--------------------------------------------------------------------------------
/src/main/java/dev/derklaro/protocolgenerator/manifest/McVersionDumper.java:
--------------------------------------------------------------------------------
1 | /*
2 | * This file is part of mc-protocol-generator, licensed under the MIT License (MIT).
3 | *
4 | * Copyright (c) 2023 - 2024 Pasqual K. and contributors
5 | *
6 | * Permission is hereby granted, free of charge, to any person obtaining a copy
7 | * of this software and associated documentation files (the "Software"), to deal
8 | * in the Software without restriction, including without limitation the rights
9 | * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
10 | * copies of the Software, and to permit persons to whom the Software is
11 | * furnished to do so, subject to the following conditions:
12 | *
13 | * The above copyright notice and this permission notice shall be included in
14 | * all copies or substantial portions of the Software.
15 | *
16 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
17 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
18 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
19 | * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
20 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
21 | * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
22 | * THE SOFTWARE.
23 | */
24 |
25 | package dev.derklaro.protocolgenerator.manifest;
26 |
27 | import java.io.IOException;
28 | import java.nio.charset.StandardCharsets;
29 | import java.nio.file.Files;
30 | import java.nio.file.Path;
31 | import lombok.NonNull;
32 |
33 | public final class McVersionDumper {
34 |
35 | private final McManifestVersion version;
36 |
37 | public McVersionDumper(@NonNull McManifestVersion version) {
38 | this.version = version;
39 | }
40 |
41 | public void writeTo(@NonNull Path targetFile) throws IOException {
42 | Files.writeString(targetFile, this.version.id(), StandardCharsets.UTF_8);
43 | }
44 | }
45 |
--------------------------------------------------------------------------------
/src/main/java/dev/derklaro/protocolgenerator/manifest/McManifestVersion.java:
--------------------------------------------------------------------------------
1 | /*
2 | * This file is part of mc-protocol-generator, licensed under the MIT License (MIT).
3 | *
4 | * Copyright (c) 2023 - 2024 Pasqual K. and contributors
5 | *
6 | * Permission is hereby granted, free of charge, to any person obtaining a copy
7 | * of this software and associated documentation files (the "Software"), to deal
8 | * in the Software without restriction, including without limitation the rights
9 | * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
10 | * copies of the Software, and to permit persons to whom the Software is
11 | * furnished to do so, subject to the following conditions:
12 | *
13 | * The above copyright notice and this permission notice shall be included in
14 | * all copies or substantial portions of the Software.
15 | *
16 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
17 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
18 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
19 | * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
20 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
21 | * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
22 | * THE SOFTWARE.
23 | */
24 |
25 | package dev.derklaro.protocolgenerator.manifest;
26 |
27 | import java.net.URI;
28 | import java.time.OffsetDateTime;
29 | import lombok.NonNull;
30 |
31 | public record McManifestVersion(
32 | @NonNull String id,
33 | @NonNull McManifestVersionType type,
34 | @NonNull String url,
35 | @NonNull OffsetDateTime releaseTime,
36 | @NonNull String sha1
37 | ) implements Comparable {
38 |
39 | public @NonNull URI uri() {
40 | return URI.create(this.url);
41 | }
42 |
43 | @Override
44 | public int compareTo(@NonNull McManifestVersion other) {
45 | return other.releaseTime().compareTo(this.releaseTime());
46 | }
47 | }
48 |
--------------------------------------------------------------------------------
/src/main/java/dev/derklaro/protocolgenerator/util/CatchingFunction.java:
--------------------------------------------------------------------------------
1 | /*
2 | * This file is part of mc-protocol-generator, licensed under the MIT License (MIT).
3 | *
4 | * Copyright (c) 2023 - 2024 Pasqual K. and contributors
5 | *
6 | * Permission is hereby granted, free of charge, to any person obtaining a copy
7 | * of this software and associated documentation files (the "Software"), to deal
8 | * in the Software without restriction, including without limitation the rights
9 | * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
10 | * copies of the Software, and to permit persons to whom the Software is
11 | * furnished to do so, subject to the following conditions:
12 | *
13 | * The above copyright notice and this permission notice shall be included in
14 | * all copies or substantial portions of the Software.
15 | *
16 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
17 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
18 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
19 | * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
20 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
21 | * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
22 | * THE SOFTWARE.
23 | */
24 |
25 | package dev.derklaro.protocolgenerator.util;
26 |
27 | import java.util.function.Function;
28 | import lombok.NonNull;
29 | import org.jetbrains.annotations.Nullable;
30 |
31 | @FunctionalInterface
32 | public interface CatchingFunction {
33 |
34 | static @NonNull Function asJavaUtil(
35 | @NonNull CatchingFunction function,
36 | @NonNull String exceptionMessage
37 | ) {
38 | return input -> {
39 | try {
40 | return function.apply(input);
41 | } catch (Exception exception) {
42 | throw new IllegalStateException(exceptionMessage, exception);
43 | }
44 | };
45 | }
46 |
47 | @Nullable
48 | V apply(T input) throws Exception;
49 | }
50 |
--------------------------------------------------------------------------------
/src/main/java/dev/derklaro/protocolgenerator/jackson/JacksonSupport.java:
--------------------------------------------------------------------------------
1 | /*
2 | * This file is part of mc-protocol-generator, licensed under the MIT License (MIT).
3 | *
4 | * Copyright (c) 2023 - 2024 Pasqual K. and contributors
5 | *
6 | * Permission is hereby granted, free of charge, to any person obtaining a copy
7 | * of this software and associated documentation files (the "Software"), to deal
8 | * in the Software without restriction, including without limitation the rights
9 | * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
10 | * copies of the Software, and to permit persons to whom the Software is
11 | * furnished to do so, subject to the following conditions:
12 | *
13 | * The above copyright notice and this permission notice shall be included in
14 | * all copies or substantial portions of the Software.
15 | *
16 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
17 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
18 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
19 | * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
20 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
21 | * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
22 | * THE SOFTWARE.
23 | */
24 |
25 | package dev.derklaro.protocolgenerator.jackson;
26 |
27 | import com.fasterxml.jackson.annotation.JsonAutoDetect;
28 | import tools.jackson.databind.DeserializationFeature;
29 | import tools.jackson.databind.json.JsonMapper;
30 |
31 | public final class JacksonSupport {
32 |
33 | public static final JsonMapper OBJECT_MAPPER = JsonMapper.builder()
34 | .findAndAddModules()
35 | .enable(DeserializationFeature.FAIL_ON_NULL_FOR_PRIMITIVES)
36 | .disable(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES)
37 | .changeDefaultVisibility(checker -> checker.withFieldVisibility(JsonAutoDetect.Visibility.ANY))
38 | .build();
39 |
40 | private JacksonSupport() {
41 | throw new UnsupportedOperationException();
42 | }
43 | }
44 |
--------------------------------------------------------------------------------
/src/main/java/dev/derklaro/protocolgenerator/protocol/McInit.java:
--------------------------------------------------------------------------------
1 | /*
2 | * This file is part of mc-protocol-generator, licensed under the MIT License (MIT).
3 | *
4 | * Copyright (c) 2023 - 2024 Pasqual K. and contributors
5 | *
6 | * Permission is hereby granted, free of charge, to any person obtaining a copy
7 | * of this software and associated documentation files (the "Software"), to deal
8 | * in the Software without restriction, including without limitation the rights
9 | * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
10 | * copies of the Software, and to permit persons to whom the Software is
11 | * furnished to do so, subject to the following conditions:
12 | *
13 | * The above copyright notice and this permission notice shall be included in
14 | * all copies or substantial portions of the Software.
15 | *
16 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
17 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
18 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
19 | * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
20 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
21 | * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
22 | * THE SOFTWARE.
23 | */
24 |
25 | package dev.derklaro.protocolgenerator.protocol;
26 |
27 | import lombok.NonNull;
28 |
29 | final class McInit {
30 |
31 | private final ClassLoader classLoader;
32 |
33 | public McInit(@NonNull ClassLoader classLoader) {
34 | this.classLoader = classLoader;
35 | }
36 |
37 | public void init() throws Exception {
38 | // detect running version
39 | var sharedConstantsClass = Class.forName(McClassNames.SHARED_CONSTANTS, true, this.classLoader);
40 | var tryDetectVersionMethod = sharedConstantsClass.getMethod("tryDetectVersion");
41 | tryDetectVersionMethod.invoke(null);
42 |
43 | // bootstrap registries
44 | var bootstrapClass = Class.forName(McClassNames.BOOTSTRAP, true, this.classLoader);
45 | var bootStrapMethod = bootstrapClass.getMethod("bootStrap");
46 | bootStrapMethod.invoke(null);
47 | }
48 | }
49 |
--------------------------------------------------------------------------------
/src/main/java/dev/derklaro/protocolgenerator/cli/CliArgParser.java:
--------------------------------------------------------------------------------
1 | /*
2 | * This file is part of mc-protocol-generator, licensed under the MIT License (MIT).
3 | *
4 | * Copyright (c) 2023 - 2024 Pasqual K. and contributors
5 | *
6 | * Permission is hereby granted, free of charge, to any person obtaining a copy
7 | * of this software and associated documentation files (the "Software"), to deal
8 | * in the Software without restriction, including without limitation the rights
9 | * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
10 | * copies of the Software, and to permit persons to whom the Software is
11 | * furnished to do so, subject to the following conditions:
12 | *
13 | * The above copyright notice and this permission notice shall be included in
14 | * all copies or substantial portions of the Software.
15 | *
16 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
17 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
18 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
19 | * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
20 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
21 | * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
22 | * THE SOFTWARE.
23 | */
24 |
25 | package dev.derklaro.protocolgenerator.cli;
26 |
27 | import lombok.NonNull;
28 | import net.sourceforge.argparse4j.ArgumentParsers;
29 | import net.sourceforge.argparse4j.inf.Argument;
30 | import net.sourceforge.argparse4j.inf.ArgumentParser;
31 | import net.sourceforge.argparse4j.inf.Namespace;
32 |
33 | public final class CliArgParser {
34 |
35 | private final ArgumentParser argumentParser;
36 |
37 | public CliArgParser(@NonNull String toolName) {
38 | this.argumentParser = ArgumentParsers.newFor(toolName).build().defaultHelp(true);
39 | }
40 |
41 | public @NonNull Argument registerArgument(@NonNull String... names) {
42 | return this.argumentParser.addArgument(names);
43 | }
44 |
45 | public @NonNull Namespace parseCommandLine(@NonNull String[] commandLineArgs) {
46 | return this.argumentParser.parseArgsOrFail(commandLineArgs);
47 | }
48 | }
49 |
--------------------------------------------------------------------------------
/src/main/java/dev/derklaro/protocolgenerator/protocol/PacketClassFieldScanner.java:
--------------------------------------------------------------------------------
1 | /*
2 | * This file is part of mc-protocol-generator, licensed under the MIT License (MIT).
3 | *
4 | * Copyright (c) 2023 - 2024 Pasqual K. and contributors
5 | *
6 | * Permission is hereby granted, free of charge, to any person obtaining a copy
7 | * of this software and associated documentation files (the "Software"), to deal
8 | * in the Software without restriction, including without limitation the rights
9 | * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
10 | * copies of the Software, and to permit persons to whom the Software is
11 | * furnished to do so, subject to the following conditions:
12 | *
13 | * The above copyright notice and this permission notice shall be included in
14 | * all copies or substantial portions of the Software.
15 | *
16 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
17 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
18 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
19 | * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
20 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
21 | * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
22 | * THE SOFTWARE.
23 | */
24 |
25 | package dev.derklaro.protocolgenerator.protocol;
26 |
27 | import java.lang.reflect.Modifier;
28 | import lombok.NonNull;
29 |
30 | final class PacketClassFieldScanner {
31 |
32 | private final Class> packetClass;
33 | private final PacketClassInfo baseInfo;
34 |
35 | public PacketClassFieldScanner(@NonNull Class> packetClass, @NonNull PacketClassInfo baseInfo) {
36 | this.packetClass = packetClass;
37 | this.baseInfo = baseInfo;
38 | }
39 |
40 | public void scanAndRegisterClassFields() {
41 | // walk up the class tree
42 | var currentClass = this.packetClass;
43 | do {
44 | var fields = currentClass.getDeclaredFields();
45 | for (var field : fields) {
46 | var fieldModifiers = field.getModifiers();
47 | if (!Modifier.isStatic(fieldModifiers)) {
48 | var fieldInfo = PacketClassInfo.FieldInfo.ofReflectField(field);
49 | this.baseInfo.registerField(fieldInfo);
50 | }
51 | }
52 |
53 | } while ((currentClass = currentClass.getSuperclass()) != Object.class);
54 | }
55 | }
56 |
--------------------------------------------------------------------------------
/src/main/java/dev/derklaro/protocolgenerator/protocol/McProtocolStates.java:
--------------------------------------------------------------------------------
1 | /*
2 | * This file is part of mc-protocol-generator, licensed under the MIT License (MIT).
3 | *
4 | * Copyright (c) 2023 - 2024 Pasqual K. and contributors
5 | *
6 | * Permission is hereby granted, free of charge, to any person obtaining a copy
7 | * of this software and associated documentation files (the "Software"), to deal
8 | * in the Software without restriction, including without limitation the rights
9 | * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
10 | * copies of the Software, and to permit persons to whom the Software is
11 | * furnished to do so, subject to the following conditions:
12 | *
13 | * The above copyright notice and this permission notice shall be included in
14 | * all copies or substantial portions of the Software.
15 | *
16 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
17 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
18 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
19 | * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
20 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
21 | * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
22 | * THE SOFTWARE.
23 | */
24 |
25 | package dev.derklaro.protocolgenerator.protocol;
26 |
27 | import lombok.NonNull;
28 |
29 | enum McProtocolStates {
30 |
31 | /* state order here reflects into the field order of the final output */
32 |
33 | HANDSHAKING("handshake"),
34 | STATUS("status"),
35 | LOGIN("login"),
36 | CONFIGURATION("configuration"),
37 | PLAY("game");
38 |
39 | private static final String PKG_PREFIX_BASE = "net.minecraft.network.protocol.%s";
40 |
41 | private final String pkg;
42 | private final String displayName;
43 |
44 | McProtocolStates(@NonNull String name) {
45 | this(name, String.format(PKG_PREFIX_BASE, name));
46 | }
47 |
48 | McProtocolStates(@NonNull String name, @NonNull String pkg) {
49 | this.pkg = pkg;
50 |
51 | var firstChar = Character.toUpperCase(name.charAt(0));
52 | this.displayName = String.format("%c%s", firstChar, name.substring(1));
53 | }
54 |
55 | public @NonNull String displayName() {
56 | return this.displayName;
57 | }
58 |
59 | public @NonNull String protocolsClass() {
60 | return String.format("%s.%sProtocols", this.pkg, this.displayName);
61 | }
62 | }
63 |
--------------------------------------------------------------------------------
/.idea/inspectionProfiles/protocol-gen.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
20 |
21 |
22 |
23 |
24 |
25 |
26 |
27 |
28 |
29 |
30 |
31 |
38 |
39 |
40 |
41 |
--------------------------------------------------------------------------------
/src/main/java/dev/derklaro/protocolgenerator/manifest/McManifestVersionData.java:
--------------------------------------------------------------------------------
1 | /*
2 | * This file is part of mc-protocol-generator, licensed under the MIT License (MIT).
3 | *
4 | * Copyright (c) 2023 - 2024 Pasqual K. and contributors
5 | *
6 | * Permission is hereby granted, free of charge, to any person obtaining a copy
7 | * of this software and associated documentation files (the "Software"), to deal
8 | * in the Software without restriction, including without limitation the rights
9 | * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
10 | * copies of the Software, and to permit persons to whom the Software is
11 | * furnished to do so, subject to the following conditions:
12 | *
13 | * The above copyright notice and this permission notice shall be included in
14 | * all copies or substantial portions of the Software.
15 | *
16 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
17 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
18 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
19 | * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
20 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
21 | * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
22 | * THE SOFTWARE.
23 | */
24 |
25 | package dev.derklaro.protocolgenerator.manifest;
26 |
27 | import com.fasterxml.jackson.annotation.JsonProperty;
28 | import java.time.OffsetDateTime;
29 | import java.util.List;
30 | import java.util.Map;
31 |
32 | public record McManifestVersionData(
33 | @JsonProperty("id") String id,
34 | @JsonProperty("type") McManifestVersionType type,
35 | @JsonProperty("libraries") List libraries,
36 | @JsonProperty("releaseTime") OffsetDateTime releaseTime,
37 | @JsonProperty("minimumLauncherVersion") int minLauncherVersion,
38 | @JsonProperty("downloads") Map fileDownloads
39 | ) {
40 |
41 | public record Library(
42 | @JsonProperty("name") String id,
43 | @JsonProperty("downloads") Map downloads
44 | ) {
45 |
46 | }
47 |
48 | public record LibraryDownload(
49 | @JsonProperty("path") String pathName,
50 | @JsonProperty("sha1") String sha1,
51 | @JsonProperty("url") String downloadUrl
52 | ) {
53 |
54 | }
55 |
56 | public record FileDownload(
57 | @JsonProperty("sha1") String sha1,
58 | @JsonProperty("url") String downloadUrl
59 | ) {
60 |
61 | }
62 | }
63 |
--------------------------------------------------------------------------------
/src/main/java/dev/derklaro/protocolgenerator/http/HttpClientProvider.java:
--------------------------------------------------------------------------------
1 | /*
2 | * This file is part of mc-protocol-generator, licensed under the MIT License (MIT).
3 | *
4 | * Copyright (c) 2023 - 2024 Pasqual K. and contributors
5 | *
6 | * Permission is hereby granted, free of charge, to any person obtaining a copy
7 | * of this software and associated documentation files (the "Software"), to deal
8 | * in the Software without restriction, including without limitation the rights
9 | * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
10 | * copies of the Software, and to permit persons to whom the Software is
11 | * furnished to do so, subject to the following conditions:
12 | *
13 | * The above copyright notice and this permission notice shall be included in
14 | * all copies or substantial portions of the Software.
15 | *
16 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
17 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
18 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
19 | * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
20 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
21 | * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
22 | * THE SOFTWARE.
23 | */
24 |
25 | package dev.derklaro.protocolgenerator.http;
26 |
27 | import com.google.common.util.concurrent.ThreadFactoryBuilder;
28 | import java.net.http.HttpClient;
29 | import java.time.Duration;
30 | import java.util.concurrent.Executor;
31 | import java.util.concurrent.Executors;
32 | import lombok.NonNull;
33 |
34 | public final class HttpClientProvider {
35 |
36 | private static final Duration DEFAULT_CONNECT_TIMEOUT = Duration.ofSeconds(15);
37 | private static final HttpClient.Redirect REDIRECT_POLICY = HttpClient.Redirect.NORMAL;
38 |
39 | private static final Executor REQUEST_EXECUTOR = Executors.newCachedThreadPool(new ThreadFactoryBuilder()
40 | .setDaemon(true)
41 | .setNameFormat("http-request-executor-%d")
42 | .setThreadFactory(Executors.defaultThreadFactory())
43 | .build());
44 |
45 | private HttpClientProvider() {
46 | throw new UnsupportedOperationException();
47 | }
48 |
49 | public static @NonNull HttpClient provideClient() {
50 | return HttpClient.newBuilder()
51 | .executor(REQUEST_EXECUTOR)
52 | .followRedirects(REDIRECT_POLICY)
53 | .connectTimeout(DEFAULT_CONNECT_TIMEOUT)
54 | .build();
55 | }
56 | }
57 |
--------------------------------------------------------------------------------
/src/main/java/dev/derklaro/protocolgenerator/markdown/MarkdownFormatter.java:
--------------------------------------------------------------------------------
1 | /*
2 | * This file is part of mc-protocol-generator, licensed under the MIT License (MIT).
3 | *
4 | * Copyright (c) 2023 - 2024 Pasqual K. and contributors
5 | *
6 | * Permission is hereby granted, free of charge, to any person obtaining a copy
7 | * of this software and associated documentation files (the "Software"), to deal
8 | * in the Software without restriction, including without limitation the rights
9 | * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
10 | * copies of the Software, and to permit persons to whom the Software is
11 | * furnished to do so, subject to the following conditions:
12 | *
13 | * The above copyright notice and this permission notice shall be included in
14 | * all copies or substantial portions of the Software.
15 | *
16 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
17 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
18 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
19 | * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
20 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
21 | * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
22 | * THE SOFTWARE.
23 | */
24 |
25 | package dev.derklaro.protocolgenerator.markdown;
26 |
27 | import com.google.common.html.HtmlEscapers;
28 | import fun.mingshan.markdown4j.Markdown;
29 | import fun.mingshan.markdown4j.constant.FlagConstants;
30 | import java.io.IOException;
31 | import java.nio.charset.StandardCharsets;
32 | import java.nio.file.Files;
33 | import java.nio.file.Path;
34 | import lombok.NonNull;
35 |
36 | public final class MarkdownFormatter {
37 |
38 | private final Markdown markdown;
39 |
40 | public MarkdownFormatter(@NonNull Markdown markdown) {
41 | this.markdown = markdown;
42 | }
43 |
44 | public void writeTo(@NonNull Path targetFile) throws IOException {
45 | StringBuilder builder = new StringBuilder();
46 | this.markdown.getBlocks().forEach(block -> {
47 | // join the block lines & escape html chars
48 | var fullRawText = String.join("\n", block.toMd().split(FlagConstants.LINE_BREAK));
49 | var fullEscapedText = HtmlEscapers.htmlEscaper().escape(fullRawText);
50 |
51 | // append the full text to the builder
52 | builder.append(fullEscapedText).append('\n');
53 | });
54 |
55 | Files.writeString(targetFile, builder.toString(), StandardCharsets.UTF_8);
56 | }
57 | }
58 |
--------------------------------------------------------------------------------
/src/main/java/dev/derklaro/protocolgenerator/gameversion/JarGameVersionParser.java:
--------------------------------------------------------------------------------
1 | /*
2 | * This file is part of mc-protocol-generator, licensed under the MIT License (MIT).
3 | *
4 | * Copyright (c) 2023 - 2024 Pasqual K. and contributors
5 | *
6 | * Permission is hereby granted, free of charge, to any person obtaining a copy
7 | * of this software and associated documentation files (the "Software"), to deal
8 | * in the Software without restriction, including without limitation the rights
9 | * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
10 | * copies of the Software, and to permit persons to whom the Software is
11 | * furnished to do so, subject to the following conditions:
12 | *
13 | * The above copyright notice and this permission notice shall be included in
14 | * all copies or substantial portions of the Software.
15 | *
16 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
17 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
18 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
19 | * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
20 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
21 | * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
22 | * THE SOFTWARE.
23 | */
24 |
25 | package dev.derklaro.protocolgenerator.gameversion;
26 |
27 | import dev.derklaro.protocolgenerator.jackson.JacksonSupport;
28 | import java.io.IOException;
29 | import java.io.InputStreamReader;
30 | import java.nio.charset.StandardCharsets;
31 | import java.nio.file.Path;
32 | import java.util.jar.JarFile;
33 | import lombok.NonNull;
34 |
35 | public final class JarGameVersionParser {
36 |
37 | private static final String VERSION_JSON_FILE_NAME = "version.json";
38 |
39 | private final Path gameJarPath;
40 |
41 | public JarGameVersionParser(@NonNull Path gameJarPath) {
42 | this.gameJarPath = gameJarPath;
43 | }
44 |
45 | public @NonNull GameVersion readGameVersion() throws IOException {
46 | try (var jarFile = new JarFile(this.gameJarPath.toFile())) {
47 | // get the version json entry
48 | var versionJsonEntry = jarFile.getEntry(VERSION_JSON_FILE_NAME);
49 | var versionJsonStream = jarFile.getInputStream(versionJsonEntry);
50 |
51 | // read the file
52 | try (var reader = new InputStreamReader(versionJsonStream, StandardCharsets.UTF_8)) {
53 | return JacksonSupport.OBJECT_MAPPER.readValue(reader, GameVersion.class);
54 | }
55 | }
56 | }
57 | }
58 |
--------------------------------------------------------------------------------
/src/main/java/dev/derklaro/protocolgenerator/protocol/PacketClassInfo.java:
--------------------------------------------------------------------------------
1 | /*
2 | * This file is part of mc-protocol-generator, licensed under the MIT License (MIT).
3 | *
4 | * Copyright (c) 2023 - 2024 Pasqual K. and contributors
5 | *
6 | * Permission is hereby granted, free of charge, to any person obtaining a copy
7 | * of this software and associated documentation files (the "Software"), to deal
8 | * in the Software without restriction, including without limitation the rights
9 | * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
10 | * copies of the Software, and to permit persons to whom the Software is
11 | * furnished to do so, subject to the following conditions:
12 | *
13 | * The above copyright notice and this permission notice shall be included in
14 | * all copies or substantial portions of the Software.
15 | *
16 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
17 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
18 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
19 | * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
20 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
21 | * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
22 | * THE SOFTWARE.
23 | */
24 |
25 | package dev.derklaro.protocolgenerator.protocol;
26 |
27 | import java.lang.reflect.Field;
28 | import java.lang.reflect.Type;
29 | import java.util.LinkedList;
30 | import java.util.List;
31 | import lombok.NonNull;
32 |
33 | public record PacketClassInfo(
34 | int packetId,
35 | @NonNull String name,
36 | @NonNull String source,
37 | @NonNull String target,
38 | @NonNull List fields
39 | ) implements Comparable {
40 |
41 | public PacketClassInfo(int packetId, @NonNull String name, @NonNull String source, @NonNull String target) {
42 | this(packetId, name, source, target, new LinkedList<>());
43 | }
44 |
45 | public void registerField(@NonNull FieldInfo fieldInfo) {
46 | this.fields.add(fieldInfo);
47 | }
48 |
49 | @Override
50 | public int compareTo(@NonNull PacketClassInfo other) {
51 | return Integer.compare(this.packetId(), other.packetId());
52 | }
53 |
54 | public record FieldInfo(@NonNull String name, @NonNull Class> rawType, @NonNull Type genericType) {
55 |
56 | public static @NonNull FieldInfo ofReflectField(@NonNull Field field) {
57 | return new FieldInfo(field.getName(), field.getType(), field.getGenericType());
58 | }
59 | }
60 | }
61 |
--------------------------------------------------------------------------------
/src/main/java/dev/derklaro/protocolgenerator/downloader/Sha1DownloadValidator.java:
--------------------------------------------------------------------------------
1 | /*
2 | * This file is part of mc-protocol-generator, licensed under the MIT License (MIT).
3 | *
4 | * Copyright (c) 2023 - 2024 Pasqual K. and contributors
5 | *
6 | * Permission is hereby granted, free of charge, to any person obtaining a copy
7 | * of this software and associated documentation files (the "Software"), to deal
8 | * in the Software without restriction, including without limitation the rights
9 | * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
10 | * copies of the Software, and to permit persons to whom the Software is
11 | * furnished to do so, subject to the following conditions:
12 | *
13 | * The above copyright notice and this permission notice shall be included in
14 | * all copies or substantial portions of the Software.
15 | *
16 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
17 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
18 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
19 | * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
20 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
21 | * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
22 | * THE SOFTWARE.
23 | */
24 |
25 | package dev.derklaro.protocolgenerator.downloader;
26 |
27 | import java.io.OutputStream;
28 | import java.nio.file.Files;
29 | import java.nio.file.Path;
30 | import java.security.DigestInputStream;
31 | import java.security.MessageDigest;
32 | import java.util.HexFormat;
33 | import lombok.NonNull;
34 |
35 | final class Sha1DownloadValidator implements FileDownloadValidator {
36 |
37 | private final String sha1Hex;
38 |
39 | public Sha1DownloadValidator(@NonNull String sha1Hex) {
40 | this.sha1Hex = sha1Hex;
41 | }
42 |
43 | @Override
44 | public boolean validate(@NonNull Path downloadPath) throws Exception {
45 | var sha1Digest = MessageDigest.getInstance("SHA-1");
46 | try (
47 | var fileStream = Files.newInputStream(downloadPath);
48 | var digestStream = new DigestInputStream(fileStream, sha1Digest)
49 | ) {
50 | // read all bytes provided by the stream
51 | digestStream.transferTo(OutputStream.nullOutputStream());
52 |
53 | // compute the hex of the stream & validate it against the provided hex
54 | var digest = sha1Digest.digest();
55 | var hexDigest = HexFormat.of().formatHex(digest);
56 | return this.sha1Hex.equals(hexDigest);
57 | }
58 | }
59 | }
60 |
--------------------------------------------------------------------------------
/src/main/java/dev/derklaro/protocolgenerator/GeneratorCLIArguments.java:
--------------------------------------------------------------------------------
1 | /*
2 | * This file is part of mc-protocol-generator, licensed under the MIT License (MIT).
3 | *
4 | * Copyright (c) 2023 - 2024 Pasqual K. and contributors
5 | *
6 | * Permission is hereby granted, free of charge, to any person obtaining a copy
7 | * of this software and associated documentation files (the "Software"), to deal
8 | * in the Software without restriction, including without limitation the rights
9 | * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
10 | * copies of the Software, and to permit persons to whom the Software is
11 | * furnished to do so, subject to the following conditions:
12 | *
13 | * The above copyright notice and this permission notice shall be included in
14 | * all copies or substantial portions of the Software.
15 | *
16 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
17 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
18 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
19 | * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
20 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
21 | * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
22 | * THE SOFTWARE.
23 | */
24 |
25 | package dev.derklaro.protocolgenerator;
26 |
27 | import dev.derklaro.protocolgenerator.cli.CliArgParser;
28 | import dev.derklaro.protocolgenerator.manifest.McManifestVersionType;
29 | import lombok.NonNull;
30 | import net.sourceforge.argparse4j.impl.Arguments;
31 |
32 | final class GeneratorCLIArguments {
33 |
34 | private GeneratorCLIArguments() {
35 | throw new UnsupportedOperationException();
36 | }
37 |
38 | public static void registerDefaultArguments(@NonNull CliArgParser argParser) {
39 | // argument to set the version type to fetch
40 | argParser.registerArgument("-vt", "--version-type")
41 | .setDefault(McManifestVersionType.LATEST)
42 | .help("Sets the argument type to download and parse the protocol of")
43 | .type(Arguments.caseInsensitiveEnumType(McManifestVersionType.class));
44 |
45 | // the final output file name
46 | argParser.registerArgument("-of", "--output-file")
47 | .setDefault("readme.md")
48 | .help("The name of the output file to export to (the parent directory need to exist)");
49 |
50 | // if a file with the generated version should be created
51 | argParser.registerArgument("-vf", "--version-file")
52 | .help("Sets an optional file path to dump the target Minecraft version version to");
53 | }
54 | }
55 |
--------------------------------------------------------------------------------
/src/main/java/dev/derklaro/protocolgenerator/gameversion/GameVersion.java:
--------------------------------------------------------------------------------
1 | /*
2 | * This file is part of mc-protocol-generator, licensed under the MIT License (MIT).
3 | *
4 | * Copyright (c) 2023 - 2024 Pasqual K. and contributors
5 | *
6 | * Permission is hereby granted, free of charge, to any person obtaining a copy
7 | * of this software and associated documentation files (the "Software"), to deal
8 | * in the Software without restriction, including without limitation the rights
9 | * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
10 | * copies of the Software, and to permit persons to whom the Software is
11 | * furnished to do so, subject to the following conditions:
12 | *
13 | * The above copyright notice and this permission notice shall be included in
14 | * all copies or substantial portions of the Software.
15 | *
16 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
17 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
18 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
19 | * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
20 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
21 | * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
22 | * THE SOFTWARE.
23 | */
24 |
25 | package dev.derklaro.protocolgenerator.gameversion;
26 |
27 | import com.fasterxml.jackson.annotation.JsonProperty;
28 | import java.time.OffsetDateTime;
29 | import lombok.NonNull;
30 |
31 | public record GameVersion(
32 | @NonNull String id,
33 | @NonNull String name,
34 | @NonNull @JsonProperty("series_id") String series,
35 | @NonNull @JsonProperty("build_time") OffsetDateTime buildTime,
36 | @NonNull @JsonProperty("pack_version") PackVersion packVersion,
37 | @NonNull @JsonProperty("java_component") String javaComponent,
38 | @JsonProperty("java_version") int javaVersion,
39 | @JsonProperty("protocol_version") int protocolVersion,
40 | @JsonProperty("world_version") int worldVersion,
41 | boolean stable
42 | ) {
43 |
44 | public record PackVersion(
45 | @JsonProperty("resource_major") int resourcePackMajor,
46 | @JsonProperty("resource_minor") int resourcePackMinor,
47 | @JsonProperty("data_major") int dataPackMajor,
48 | @JsonProperty("data_minor") int dataPackMinor
49 | ) {
50 |
51 | public @NonNull String formattedResourcePackVersion() {
52 | return String.format("%d.%d", this.resourcePackMajor, this.resourcePackMinor);
53 | }
54 |
55 | public @NonNull String formattedDataPackVersion() {
56 | return String.format("%d.%d", this.dataPackMajor, this.dataPackMinor);
57 | }
58 | }
59 | }
60 |
--------------------------------------------------------------------------------
/src/main/java/dev/derklaro/protocolgenerator/protocol/PacketVisitorImplGenerator.java:
--------------------------------------------------------------------------------
1 | /*
2 | * This file is part of mc-protocol-generator, licensed under the MIT License (MIT).
3 | *
4 | * Copyright (c) 2023 - 2024 Pasqual K. and contributors
5 | *
6 | * Permission is hereby granted, free of charge, to any person obtaining a copy
7 | * of this software and associated documentation files (the "Software"), to deal
8 | * in the Software without restriction, including without limitation the rights
9 | * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
10 | * copies of the Software, and to permit persons to whom the Software is
11 | * furnished to do so, subject to the following conditions:
12 | *
13 | * The above copyright notice and this permission notice shall be included in
14 | * all copies or substantial portions of the Software.
15 | *
16 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
17 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
18 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
19 | * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
20 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
21 | * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
22 | * THE SOFTWARE.
23 | */
24 |
25 | package dev.derklaro.protocolgenerator.protocol;
26 |
27 | import java.lang.reflect.InvocationHandler;
28 | import java.lang.reflect.Proxy;
29 | import java.util.Map;
30 | import lombok.NonNull;
31 |
32 | final class PacketVisitorImplGenerator {
33 |
34 | private final Class> packetVisitorClass;
35 | private final Map