├── .editorconfig
├── .github
├── FUNDING.yml
├── ISSUE_TEMPLATE
│ ├── bug_report.yml
│ └── config.yml
├── dependabot.yml
├── images
│ └── ViaVersion.png
└── workflows
│ └── build.yml
├── .gitignore
├── .idea
└── copyright
│ ├── GPL_3_0.xml
│ └── profiles_settings.xml
├── CHANGELOG
├── CONTRIBUTING.md
├── LICENSE
├── README.md
├── build.gradle
├── gradle.properties
├── gradle
└── wrapper
│ ├── gradle-wrapper.jar
│ └── gradle-wrapper.properties
├── gradlew
├── gradlew.bat
├── settings.gradle
├── src
└── main
│ ├── java
│ └── de
│ │ └── florianmichael
│ │ └── viaforge
│ │ └── common
│ │ ├── ViaForgeCommon.java
│ │ ├── gui
│ │ └── ExtendedServerData.java
│ │ ├── platform
│ │ ├── VFPlatform.java
│ │ ├── VersionTracker.java
│ │ └── ViaForgeConfig.java
│ │ └── protocoltranslator
│ │ ├── ViaForgeVLInjector.java
│ │ ├── ViaForgeVLLoader.java
│ │ ├── netty
│ │ ├── VFNetworkManager.java
│ │ └── ViaForgeVLLegacyPipeline.java
│ │ ├── platform
│ │ └── ViaForgeViaVersionPlatformImpl.java
│ │ └── provider
│ │ ├── ViaForgeClassicMPPassProvider.java
│ │ ├── ViaForgeEncryptionProvider.java
│ │ ├── ViaForgeMovementTransmitterProvider.java
│ │ ├── ViaForgeOldAuthProvider.java
│ │ └── ViaForgeVersionProvider.java
│ └── resources
│ ├── assets
│ └── viaforge
│ │ └── config.yml
│ ├── icon.png
│ └── pack.mcmeta
├── viaforge-mc1122
├── build.gradle
├── gradle.properties
└── src
│ └── main
│ ├── java
│ └── de
│ │ └── florianmichael
│ │ └── viaforge
│ │ ├── ViaForge1122.java
│ │ ├── gui
│ │ └── GuiProtocolSelector.java
│ │ ├── mixin
│ │ ├── MixinLoader.java
│ │ └── impl
│ │ │ ├── MixinGuiMainMenu.java
│ │ │ ├── MixinGuiMultiplayer.java
│ │ │ ├── MixinGuiOverlayDebug.java
│ │ │ ├── MixinGuiScreenAddServer.java
│ │ │ ├── MixinGuiScreenServerList.java
│ │ │ ├── MixinNetHandlerPlayClient.java
│ │ │ ├── MixinServerData.java
│ │ │ └── connect
│ │ │ ├── MixinGuiConnecting_1.java
│ │ │ ├── MixinNetHandlerLoginClient.java
│ │ │ ├── MixinNetworkManager.java
│ │ │ ├── MixinNetworkManager_5.java
│ │ │ └── MixinServerPinger.java
│ │ └── provider
│ │ └── ViaForgeGameProfileFetcher.java
│ └── resources
│ ├── mcmod.info
│ └── mixins.viaforge-mc1122.json
├── viaforge-mc1165
├── gradle.properties
└── src
│ └── main
│ ├── java
│ └── de
│ │ └── florianmichael
│ │ └── viaforge
│ │ ├── ViaForge1165.java
│ │ ├── gui
│ │ └── GuiProtocolSelector.java
│ │ ├── mixin
│ │ ├── MixinAddServerScreen.java
│ │ ├── MixinClientPlayNetHandler.java
│ │ ├── MixinDebugOverlayGui.java
│ │ ├── MixinMainMenuScreen.java
│ │ ├── MixinMultiplayerScreen.java
│ │ ├── MixinServerData.java
│ │ ├── MixinServerListScreen.java
│ │ └── connect
│ │ │ ├── MixinClientLoginNetHandler.java
│ │ │ ├── MixinConnectingScreen_1.java
│ │ │ ├── MixinNetworkManager.java
│ │ │ ├── MixinNetworkManager_1.java
│ │ │ └── MixinServerPinger.java
│ │ └── provider
│ │ └── ViaForgeGameProfileFetcher.java
│ └── resources
│ ├── META-INF
│ └── mods.toml
│ └── mixins.viaforge-mc1165.json
├── viaforge-mc1171
├── gradle.properties
└── src
│ └── main
│ ├── java
│ └── de
│ │ └── florianmichael
│ │ └── viaforge
│ │ ├── ViaForge1171.java
│ │ ├── gui
│ │ └── GuiProtocolSelector.java
│ │ ├── mixin
│ │ ├── MixinClientPacketListener.java
│ │ ├── MixinDebugScreenOverlay.java
│ │ ├── MixinDirectJoinServerScreen.java
│ │ ├── MixinEditServerScreen.java
│ │ ├── MixinJoinMultiplayerScreen.java
│ │ ├── MixinServerData.java
│ │ ├── MixinTitleScreen.java
│ │ └── connect
│ │ │ ├── MixinClientHandshakePacketListenerImpl.java
│ │ │ ├── MixinConnectScreen_1.java
│ │ │ ├── MixinConnection.java
│ │ │ ├── MixinConnection_1.java
│ │ │ └── MixinServerStatusPinger.java
│ │ └── provider
│ │ └── ViaForgeGameProfileFetcher.java
│ └── resources
│ ├── META-INF
│ └── mods.toml
│ └── mixins.viaforge-mc1171.json
├── viaforge-mc1182
├── gradle.properties
└── src
│ └── main
│ ├── java
│ └── de
│ │ └── florianmichael
│ │ └── viaforge
│ │ ├── ViaForge1182.java
│ │ ├── gui
│ │ └── GuiProtocolSelector.java
│ │ ├── mixin
│ │ ├── MixinClientPacketListener.java
│ │ ├── MixinDebugScreenOverlay.java
│ │ ├── MixinDirectJoinServerScreen.java
│ │ ├── MixinEditServerScreen.java
│ │ ├── MixinJoinMultiplayerScreen.java
│ │ ├── MixinServerData.java
│ │ ├── MixinTitleScreen.java
│ │ └── connect
│ │ │ ├── MixinClientHandshakePacketListenerImpl.java
│ │ │ ├── MixinConnectScreen_1.java
│ │ │ ├── MixinConnection.java
│ │ │ ├── MixinConnection_1.java
│ │ │ └── MixinServerStatusPinger.java
│ │ └── provider
│ │ └── ViaForgeGameProfileFetcher.java
│ └── resources
│ ├── META-INF
│ └── mods.toml
│ └── mixins.viaforge-mc1182.json
├── viaforge-mc1192
├── gradle.properties
└── src
│ └── main
│ ├── java
│ └── de
│ │ └── florianmichael
│ │ └── viaforge
│ │ ├── ViaForge1192.java
│ │ ├── gui
│ │ └── GuiProtocolSelector.java
│ │ ├── mixin
│ │ ├── MixinClientPacketListener.java
│ │ ├── MixinDebugScreenOverlay.java
│ │ ├── MixinDirectJoinServerScreen.java
│ │ ├── MixinEditServerScreen.java
│ │ ├── MixinJoinMultiplayerScreen.java
│ │ ├── MixinServerData.java
│ │ ├── MixinTitleScreen.java
│ │ └── connect
│ │ │ ├── MixinClientHandshakePacketListenerImpl.java
│ │ │ ├── MixinConnectScreen_1.java
│ │ │ ├── MixinConnection.java
│ │ │ ├── MixinConnection_1.java
│ │ │ └── MixinServerStatusPinger.java
│ │ └── provider
│ │ └── ViaForgeGameProfileFetcher.java
│ └── resources
│ ├── META-INF
│ └── mods.toml
│ └── mixins.viaforge-mc1192.json
├── viaforge-mc1194
├── gradle.properties
└── src
│ └── main
│ ├── java
│ └── de
│ │ └── florianmichael
│ │ └── viaforge
│ │ ├── ViaForge1194.java
│ │ ├── gui
│ │ └── GuiProtocolSelector.java
│ │ ├── mixin
│ │ ├── MixinClientPacketListener.java
│ │ ├── MixinDebugScreenOverlay.java
│ │ ├── MixinDirectJoinServerScreen.java
│ │ ├── MixinEditServerScreen.java
│ │ ├── MixinJoinMultiplayerScreen.java
│ │ ├── MixinServerData.java
│ │ ├── MixinTitleScreen.java
│ │ └── connect
│ │ │ ├── MixinClientHandshakePacketListenerImpl.java
│ │ │ ├── MixinConnectScreen_1.java
│ │ │ ├── MixinConnection.java
│ │ │ ├── MixinConnection_1.java
│ │ │ └── MixinServerStatusPinger.java
│ │ └── provider
│ │ └── ViaForgeGameProfileFetcher.java
│ └── resources
│ ├── META-INF
│ └── mods.toml
│ └── mixins.viaforge-mc1194.json
├── viaforge-mc1201
├── gradle.properties
└── src
│ └── main
│ ├── java
│ └── de
│ │ └── florianmichael
│ │ └── viaforge
│ │ ├── ViaForge1201.java
│ │ ├── gui
│ │ └── GuiProtocolSelector.java
│ │ ├── mixin
│ │ ├── MixinClientPacketListener.java
│ │ ├── MixinDebugScreenOverlay.java
│ │ ├── MixinDirectJoinServerScreen.java
│ │ ├── MixinEditServerScreen.java
│ │ ├── MixinJoinMultiplayerScreen.java
│ │ ├── MixinServerData.java
│ │ ├── MixinTitleScreen.java
│ │ └── connect
│ │ │ ├── MixinClientHandshakePacketListenerImpl.java
│ │ │ ├── MixinConnectScreen_1.java
│ │ │ ├── MixinConnection.java
│ │ │ ├── MixinConnection_1.java
│ │ │ └── MixinServerStatusPinger.java
│ │ └── provider
│ │ └── ViaForgeGameProfileFetcher.java
│ └── resources
│ ├── META-INF
│ └── mods.toml
│ └── mixins.viaforge-mc1201.json
├── viaforge-mc1204
├── gradle.properties
└── src
│ └── main
│ ├── java
│ └── de
│ │ └── florianmichael
│ │ └── viaforge
│ │ ├── ViaForge1204.java
│ │ ├── gui
│ │ └── GuiProtocolSelector.java
│ │ ├── mixin
│ │ ├── MixinClientPacketListener.java
│ │ ├── MixinDebugScreenOverlay.java
│ │ ├── MixinDirectJoinServerScreen.java
│ │ ├── MixinEditServerScreen.java
│ │ ├── MixinJoinMultiplayerScreen.java
│ │ ├── MixinServerData.java
│ │ ├── MixinTitleScreen.java
│ │ └── connect
│ │ │ ├── MixinClientHandshakePacketListenerImpl.java
│ │ │ ├── MixinConnectScreen_1.java
│ │ │ ├── MixinConnection.java
│ │ │ ├── MixinConnection_1.java
│ │ │ └── MixinServerStatusPinger.java
│ │ └── provider
│ │ └── ViaForgeGameProfileFetcher.java
│ └── resources
│ ├── META-INF
│ └── mods.toml
│ └── mixins.viaforge-mc1204.json
├── viaforge-mc1206
├── build.gradle
├── gradle.properties
└── src
│ └── main
│ ├── java
│ └── de
│ │ └── florianmichael
│ │ └── viaforge
│ │ ├── ViaForge1206.java
│ │ ├── ViaNeoForge1206.java
│ │ ├── gui
│ │ └── GuiProtocolSelector.java
│ │ ├── mixin
│ │ ├── MixinClientPacketListener.java
│ │ ├── MixinDebugScreenOverlay.java
│ │ ├── MixinDirectJoinServerScreen.java
│ │ ├── MixinEditServerScreen.java
│ │ ├── MixinJoinMultiplayerScreen.java
│ │ ├── MixinServerData.java
│ │ ├── MixinTitleScreen.java
│ │ └── connect
│ │ │ ├── MixinClientHandshakePacketListenerImpl.java
│ │ │ ├── MixinConnectScreen_1.java
│ │ │ ├── MixinConnection.java
│ │ │ ├── MixinConnection_1.java
│ │ │ └── MixinServerStatusPinger.java
│ │ └── provider
│ │ └── ViaForgeGameProfileFetcher.java
│ └── resources
│ ├── META-INF
│ ├── mods.toml
│ └── neoforge.mods.toml
│ └── mixins.viaforge-mc1206.json
├── viaforge-mc1215
├── build.gradle
├── gradle.properties
└── src
│ └── main
│ ├── java
│ └── de
│ │ └── florianmichael
│ │ └── viaforge
│ │ ├── ViaForge1215.java
│ │ ├── ViaNeoForge1215.java
│ │ ├── gui
│ │ └── GuiProtocolSelector.java
│ │ ├── mixin
│ │ ├── MixinClientPacketListener.java
│ │ ├── MixinDebugScreenOverlay.java
│ │ ├── MixinDirectJoinServerScreen.java
│ │ ├── MixinEditServerScreen.java
│ │ ├── MixinJoinMultiplayerScreen.java
│ │ ├── MixinServerData.java
│ │ ├── MixinTitleScreen.java
│ │ └── connect
│ │ │ ├── MixinClientHandshakePacketListenerImpl.java
│ │ │ ├── MixinConnectScreen_1.java
│ │ │ ├── MixinConnection.java
│ │ │ ├── MixinConnection_1.java
│ │ │ └── MixinServerStatusPinger.java
│ │ └── provider
│ │ └── ViaForgeGameProfileFetcher.java
│ └── resources
│ ├── META-INF
│ ├── mods.toml
│ └── neoforge.mods.toml
│ └── mixins.viaforge-mc1215.json
└── viaforge-mc189
├── build.gradle
├── gradle.properties
└── src
└── main
├── java
└── de
│ └── florianmichael
│ └── viaforge
│ ├── ViaForge189.java
│ ├── gui
│ └── GuiProtocolSelector.java
│ ├── mixin
│ ├── MixinLoader.java
│ └── impl
│ │ ├── MixinGuiMainMenu.java
│ │ ├── MixinGuiMultiplayer.java
│ │ ├── MixinGuiOverlayDebug.java
│ │ ├── MixinGuiScreenAddServer.java
│ │ ├── MixinGuiScreenServerList.java
│ │ ├── MixinNetHandlerPlayClient.java
│ │ ├── MixinServerData.java
│ │ ├── compatibility
│ │ └── patcher
│ │ │ └── MixinProtocolVersionDetector.java
│ │ ├── connect
│ │ ├── MixinGuiConnecting_1.java
│ │ ├── MixinNetHandlerLoginClient.java
│ │ ├── MixinNetworkManager.java
│ │ ├── MixinNetworkManager_5.java
│ │ └── MixinServerPinger.java
│ │ └── javadowngrader
│ │ ├── MixinBulkChunkType.java
│ │ └── MixinChunkType.java
│ └── provider
│ └── ViaForgeGameProfileFetcher.java
└── resources
├── assets
└── viaforge
│ └── config.yml
├── mcmod.info
└── mixins.viaforge-mc189.json
/.editorconfig:
--------------------------------------------------------------------------------
1 | [*]
2 | charset = utf-8
3 | indent_size = 4
4 | indent_style = space
5 | insert_final_newline = true
6 | tab_width = 4
7 |
8 | [*.java]
9 | ij_java_class_count_to_use_import_on_demand = 999999
10 | ij_java_names_count_to_use_import_on_demand = 999999
11 | ij_java_imports_layout = *, |, $*
12 | ij_java_generate_final_locals = true
13 | ij_java_generate_final_parameters = true
14 |
15 | [{*.json,*.yml}]
16 | indent_size = 2
17 |
--------------------------------------------------------------------------------
/.github/FUNDING.yml:
--------------------------------------------------------------------------------
1 | github: FlorianMichael
2 | custom: ["https://florianmichael.de/donate"]
--------------------------------------------------------------------------------
/.github/ISSUE_TEMPLATE/bug_report.yml:
--------------------------------------------------------------------------------
1 | name: Bug Report
2 | description: Report a bug in ViaForge
3 | labels: [ bug ]
4 |
5 | body:
6 | - type: markdown
7 | attributes:
8 | value: |
9 | **Before reporting a bug, please see if using latest build from https://github.com/ViaVersion/ViaForge/actions fixes your issue.**
10 | Whenever you see fit, you can upload images or videos to any of the text fields.
11 |
12 | - type: textarea
13 | attributes:
14 | label: General Information
15 | description: |
16 | Please provide a list of all installed mods
17 | placeholder: |
18 | Example: "ViaForge, Optifine, Xaeros Minimap, WorldEdit, WorldGuard, etc."
19 | validations:
20 | required: true
21 |
22 | - type: textarea
23 | attributes:
24 | label: Bug Description
25 | description: |
26 | Describe the unexpected behavior.
27 | If you want to attach screenshots, use the comment field at the bottom of the page.
28 | placeholder: |
29 | Example: "Joining server xy causes my game to crash."
30 | validations:
31 | required: true
32 |
33 | - type: textarea
34 | attributes:
35 | label: Steps to Reproduce
36 | description: |
37 | List the steps on how we can reproduce the issue. Make sure I can easily understand what you mean with each step.
38 | placeholder: |
39 | Example:
40 | 1. Joining server xy with version 1.14.4
41 | 2. Game crashes
42 | validations:
43 | required: true
44 |
45 | - type: textarea
46 | attributes:
47 | label: Expected Behavior
48 | description: |
49 | Describe what exactly you expected to happen.
50 | placeholder: |
51 | Example: "the game should not crash when I join server xy."
52 | validations:
53 | required: true
54 |
--------------------------------------------------------------------------------
/.github/ISSUE_TEMPLATE/config.yml:
--------------------------------------------------------------------------------
1 | blank_issues_enabled: false
2 | contact_links:
3 | - name: Dev builds
4 | url: https://ci.viaversion.com/
5 | about: Before reporting a bug, please check if using main builds from our ci fixes your issue.
6 | - name: ViaVersion Discord
7 | url: https://discord.gg/viaversion
8 | about: For smaller issues or questions, you can also join our Discord server.
9 |
--------------------------------------------------------------------------------
/.github/dependabot.yml:
--------------------------------------------------------------------------------
1 | version: 2
2 | updates:
3 | - package-ecosystem: "gradle"
4 | directory: "/"
5 | schedule:
6 | interval: "daily"
7 | groups:
8 | via-libraries:
9 | patterns:
10 | - "com.viaversion:viaversion-common"
11 | - "com.viaversion:viabackwards-common"
12 | - "com.viaversion:viarewind-common"
13 | - "com.viaversion:viaaprilfools-common"
14 | - "com.viaversion:vialoader"
15 | - "net.raphimc:ViaLegacy"
16 | - package-ecosystem: "github-actions"
17 | directory: "/"
18 | schedule:
19 | interval: "weekly"
20 |
--------------------------------------------------------------------------------
/.github/images/ViaVersion.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/ViaVersion/ViaForge/cb398bce900c93b14dd9911802695a9a2aa2812d/.github/images/ViaVersion.png
--------------------------------------------------------------------------------
/.github/workflows/build.yml:
--------------------------------------------------------------------------------
1 | name: Build
2 | on: [pull_request, push, workflow_dispatch]
3 |
4 | jobs:
5 | build:
6 | runs-on: ubuntu-22.04
7 | steps:
8 | - name: Checkout Repository
9 | uses: actions/checkout@v4
10 | with:
11 | persist-credentials: false
12 | - name: Set up Gradle
13 | uses: gradle/actions/setup-gradle@v4
14 | - name: Set up JDK 21
15 | uses: actions/setup-java@v4
16 | with:
17 | java-version: 21
18 | distribution: 'temurin'
19 | check-latest: true
20 | - name: Build with Gradle
21 | run: ./gradlew build
22 | - name: Upload Build Artifacts
23 | uses: actions/upload-artifact@v4
24 | with:
25 | name: ViaForge All-in-One
26 | path: viaforge-mc*/build/libs/
27 |
--------------------------------------------------------------------------------
/.gitignore:
--------------------------------------------------------------------------------
1 | # Eclipse
2 |
3 | bin
4 | *.launch
5 | .settings
6 | .metadata
7 | .classpath
8 | .project
9 |
10 | # Idea
11 | out
12 | *.ipr
13 | *.iws
14 | *.iml
15 | .idea
16 |
17 | # Gradle
18 | build
19 | .gradle
20 |
21 | # Others
22 | eclipse
23 | run
24 |
25 | viaforge-mc189/publishMods/*
26 |
27 | # Files from Forge MDK
28 | forge*changelog.txt
29 |
--------------------------------------------------------------------------------
/.idea/copyright/GPL_3_0.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
--------------------------------------------------------------------------------
/.idea/copyright/profiles_settings.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
--------------------------------------------------------------------------------
/CHANGELOG:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/ViaVersion/ViaForge/cb398bce900c93b14dd9911802695a9a2aa2812d/CHANGELOG
--------------------------------------------------------------------------------
/CONTRIBUTING.md:
--------------------------------------------------------------------------------
1 | # Contributing guidelines for the project
2 |
3 | ## Setting up a Workspace
4 | ViaFabricPlus uses Gradle, to make sure that it is installed properly you can check [Gradle's website](https://gradle.org/install/).
5 | 1. Clone the repository using `git clone https://github.com/ViaVersion/ViaForge`.
6 | 2. CD into the local repository.
7 | 3. Run `./gradlew build`.
8 | 4. Open the folder as a Gradle project in your preferred IDE.
9 | 5. Run the mod.
10 |
11 | ## Add a new feature or fix a bug
12 | 1. Create a new branch for your feature/bugfix (e.g. `feature/fix-xyz` or `fix/fix-xyz`)
13 | 2. Implement your feature/bugfix and make sure it works correctly
14 | 3. Clean your code and make sure it is readable and understandable (e.g. use proper variable names)
15 | 4. Use the Google java code style (https://google.github.io/styleguide/javaguide.html) and format your code accordingly
16 | 5. Create a pull request and wait for it to be reviewed and merged.
17 | 6. You're done, congrats!
18 |
19 | ## Add support for a new Minecraft version
20 | 1. Create a new branch for the new version (e.g. `update/1.20.6`)
21 | 2. Create a new `viaforge-mc` folder in the root directory of the project
22 | 3. Add a `gradle.properties` file with the `forge_version` set (Available at https://files.minecraftforge.net/)
23 | 4. Register it inside the `settings.gradle` file
24 | 5. Copy the code from the previous version and update it accordingly
25 |
26 | ### Build logic
27 | The `build.gradle` file contains the shared build code for all submodules. Build code for only specific versions
28 | of the game can be wrapped with checks using the `versionId` integer which will be parsed from the `forge_version`.
29 |
30 | An example would be:
31 | ````groovy
32 | if (versionId >= 1_13_2) {
33 | // We don't need to package mixins into Forge 1.13+ jars, since Forge already has it
34 | exclude("org/spongepowered/**")
35 | }
36 | ````
37 |
38 | ### Notes
39 | Shared source code is inside the ``src/main/java`` root folder, while version-specific code is inside the ``/viaforge-mc`` folders.
--------------------------------------------------------------------------------
/gradle.properties:
--------------------------------------------------------------------------------
1 | # Gradle Properties
2 | org.gradle.jvmargs=-Xmx3G -XX:+UseG1GC
3 | org.gradle.daemon=false
4 |
5 | # Project Details
6 | maven_group=de.florianmichael
7 | maven_version=4.1.2-SNAPSHOT
8 | maven_description=Client-side ViaVersion implementation for MinecraftForge and NeoForge
9 |
10 | mixin_version=0.8.3
11 |
--------------------------------------------------------------------------------
/gradle/wrapper/gradle-wrapper.jar:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/ViaVersion/ViaForge/cb398bce900c93b14dd9911802695a9a2aa2812d/gradle/wrapper/gradle-wrapper.jar
--------------------------------------------------------------------------------
/gradle/wrapper/gradle-wrapper.properties:
--------------------------------------------------------------------------------
1 | distributionBase=GRADLE_USER_HOME
2 | distributionPath=wrapper/dists
3 | distributionSha256Sum=845952a9d6afa783db70bb3b0effaae45ae5542ca2bb7929619e8af49cb634cf
4 | distributionUrl=https\://services.gradle.org/distributions/gradle-8.14.1-bin.zip
5 | networkTimeout=10000
6 | validateDistributionUrl=true
7 | zipStoreBase=GRADLE_USER_HOME
8 | zipStorePath=wrapper/dists
9 |
--------------------------------------------------------------------------------
/settings.gradle:
--------------------------------------------------------------------------------
1 | pluginManagement {
2 | repositories {
3 | maven {
4 | url = "https://maven.wagyourtail.xyz/releases"
5 | }
6 | maven {
7 | url = "https://maven.minecraftforge.net/"
8 | }
9 | gradlePluginPortal()
10 | mavenCentral()
11 | }
12 | }
13 |
14 | plugins {
15 | id "org.gradle.toolchains.foojay-resolver-convention" version "1.0.0"
16 | }
17 |
18 | rootProject.name = "ViaForge"
19 |
20 | include "viaforge-mc189"
21 | include "viaforge-mc1122"
22 | include "viaforge-mc1165"
23 | include "viaforge-mc1171"
24 | include "viaforge-mc1182"
25 | include "viaforge-mc1192"
26 | include "viaforge-mc1194"
27 | include "viaforge-mc1201"
28 | include "viaforge-mc1204"
29 | include "viaforge-mc1206"
30 | include "viaforge-mc1215"
31 |
--------------------------------------------------------------------------------
/src/main/java/de/florianmichael/viaforge/common/gui/ExtendedServerData.java:
--------------------------------------------------------------------------------
1 | /*
2 | * This file is part of ViaForge - https://github.com/FlorianMichael/ViaForge
3 | * Copyright (C) 2021-2025 FlorianMichael/EnZaXD and contributors
4 | *
5 | * This program is free software: you can redistribute it and/or modify
6 | * it under the terms of the GNU General Public License as published by
7 | * the Free Software Foundation, either version 3 of the License, or
8 | * (at your option) any later version.
9 | *
10 | * This program is distributed in the hope that it will be useful,
11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 | * GNU General Public License for more details.
14 | *
15 | * You should have received a copy of the GNU General Public License
16 | * along with this program. If not, see .
17 | */
18 |
19 | package de.florianmichael.viaforge.common.gui;
20 |
21 | import com.viaversion.viaversion.api.protocol.version.ProtocolVersion;
22 |
23 | /**
24 | * This interface is used to store the target version for a specific server in the server list.
25 | */
26 | public interface ExtendedServerData {
27 |
28 | ProtocolVersion viaForge$getVersion();
29 |
30 | void viaForge$setVersion(final ProtocolVersion version);
31 |
32 | }
33 |
--------------------------------------------------------------------------------
/src/main/java/de/florianmichael/viaforge/common/platform/VFPlatform.java:
--------------------------------------------------------------------------------
1 | /*
2 | * This file is part of ViaForge - https://github.com/FlorianMichael/ViaForge
3 | * Copyright (C) 2021-2025 FlorianMichael/EnZaXD and contributors
4 | *
5 | * This program is free software: you can redistribute it and/or modify
6 | * it under the terms of the GNU General Public License as published by
7 | * the Free Software Foundation, either version 3 of the License, or
8 | * (at your option) any later version.
9 | *
10 | * This program is distributed in the hope that it will be useful,
11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 | * GNU General Public License for more details.
14 | *
15 | * You should have received a copy of the GNU General Public License
16 | * along with this program. If not, see .
17 | */
18 |
19 | package de.florianmichael.viaforge.common.platform;
20 |
21 | import com.viaversion.viaversion.api.protocol.packet.ServerboundPacketType;
22 | import net.raphimc.vialegacy.protocol.release.r1_7_6_10tor1_8.provider.GameProfileFetcher;
23 |
24 | import java.io.File;
25 | import java.util.function.Supplier;
26 |
27 | /**
28 | * This interface is used to access platform-specific fields.
29 | */
30 | public interface VFPlatform {
31 |
32 | String VERSION = "${version}";
33 |
34 | /**
35 | * @return the native version of the platform
36 | */
37 | int getGameVersion();
38 |
39 | /**
40 | * @return if the client is in singleplayer
41 | */
42 | Supplier isSingleplayer();
43 |
44 | /**
45 | * @return the leading directory of the platform
46 | */
47 | File getLeadingDirectory();
48 |
49 | /**
50 | * Sends the joinServer API request to Mojang's authentication servers.
51 | *
52 | * @param serverId the server id of the server
53 | */
54 | void joinServer(final String serverId) throws Throwable;
55 |
56 | /**
57 | * @return the game profile fetcher of the platform for ViaLegacy
58 | */
59 | GameProfileFetcher getGameProfileFetcher();
60 |
61 | /**
62 | * @return the name of the decode handler in the client connection
63 | */
64 | String getDecodeHandlerName();
65 |
66 | }
67 |
--------------------------------------------------------------------------------
/src/main/java/de/florianmichael/viaforge/common/platform/VersionTracker.java:
--------------------------------------------------------------------------------
1 | /*
2 | * This file is part of ViaForge - https://github.com/FlorianMichael/ViaForge
3 | * Copyright (C) 2021-2025 FlorianMichael/EnZaXD and contributors
4 | *
5 | * This program is free software: you can redistribute it and/or modify
6 | * it under the terms of the GNU General Public License as published by
7 | * the Free Software Foundation, either version 3 of the License, or
8 | * (at your option) any later version.
9 | *
10 | * This program is distributed in the hope that it will be useful,
11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 | * GNU General Public License for more details.
14 | *
15 | * You should have received a copy of the GNU General Public License
16 | * along with this program. If not, see .
17 | */
18 |
19 | package de.florianmichael.viaforge.common.platform;
20 |
21 | import com.viaversion.viaversion.api.protocol.version.ProtocolVersion;
22 | import de.florianmichael.viaforge.common.ViaForgeCommon;
23 |
24 | import java.net.InetAddress;
25 | import java.util.HashMap;
26 | import java.util.Map;
27 |
28 | /**
29 | * Dirty, but needed to store the server specific version until building the netty pipeline.
30 | */
31 | public class VersionTracker {
32 |
33 | public static final Map SERVER_PROTOCOL_VERSIONS = new HashMap<>();
34 |
35 | public static void storeServerProtocolVersion(InetAddress address, ProtocolVersion version) {
36 | SERVER_PROTOCOL_VERSIONS.put(address, version);
37 | ViaForgeCommon.getManager().setTargetVersionSilent(version);
38 | }
39 |
40 | public static ProtocolVersion getServerProtocolVersion(InetAddress address) {
41 | return SERVER_PROTOCOL_VERSIONS.remove(address);
42 | }
43 |
44 | }
45 |
--------------------------------------------------------------------------------
/src/main/java/de/florianmichael/viaforge/common/protocoltranslator/ViaForgeVLInjector.java:
--------------------------------------------------------------------------------
1 | /*
2 | * This file is part of ViaForge - https://github.com/FlorianMichael/ViaForge
3 | * Copyright (C) 2021-2025 FlorianMichael/EnZaXD and contributors
4 | *
5 | * This program is free software: you can redistribute it and/or modify
6 | * it under the terms of the GNU General Public License as published by
7 | * the Free Software Foundation, either version 3 of the License, or
8 | * (at your option) any later version.
9 | *
10 | * This program is distributed in the hope that it will be useful,
11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 | * GNU General Public License for more details.
14 | *
15 | * You should have received a copy of the GNU General Public License
16 | * along with this program. If not, see .
17 | */
18 |
19 | package de.florianmichael.viaforge.common.protocoltranslator;
20 |
21 | import com.viaversion.vialoader.impl.viaversion.VLInjector;
22 | import com.viaversion.vialoader.netty.VLLegacyPipeline;
23 |
24 | public class ViaForgeVLInjector extends VLInjector {
25 |
26 | @Override
27 | public String getDecoderName() {
28 | return VLLegacyPipeline.VIA_DECODER_NAME;
29 | }
30 |
31 | @Override
32 | public String getEncoderName() {
33 | return VLLegacyPipeline.VIA_ENCODER_NAME;
34 | }
35 |
36 | }
37 |
--------------------------------------------------------------------------------
/src/main/java/de/florianmichael/viaforge/common/protocoltranslator/netty/VFNetworkManager.java:
--------------------------------------------------------------------------------
1 | /*
2 | * This file is part of ViaForge - https://github.com/FlorianMichael/ViaForge
3 | * Copyright (C) 2021-2025 FlorianMichael/EnZaXD and contributors
4 | *
5 | * This program is free software: you can redistribute it and/or modify
6 | * it under the terms of the GNU General Public License as published by
7 | * the Free Software Foundation, either version 3 of the License, or
8 | * (at your option) any later version.
9 | *
10 | * This program is distributed in the hope that it will be useful,
11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 | * GNU General Public License for more details.
14 | *
15 | * You should have received a copy of the GNU General Public License
16 | * along with this program. If not, see .
17 | */
18 |
19 | package de.florianmichael.viaforge.common.protocoltranslator.netty;
20 |
21 | import com.viaversion.viaversion.api.protocol.version.ProtocolVersion;
22 |
23 | public interface VFNetworkManager {
24 |
25 | /**
26 | * API method to setup the decryption side of the pipeline.
27 | * This method is called by the {@link de.florianmichael.viaforge.common.protocoltranslator.provider.ViaForgeEncryptionProvider} class.
28 | */
29 | void viaForge$setupPreNettyDecryption();
30 |
31 | /**
32 | * @return the target version of the connection
33 | */
34 | ProtocolVersion viaForge$getTrackedVersion();
35 |
36 | /**
37 | * Sets the target version of the connection.
38 | *
39 | * @param version the target version
40 | */
41 | void viaForge$setTrackedVersion(final ProtocolVersion version);
42 |
43 | }
44 |
--------------------------------------------------------------------------------
/src/main/java/de/florianmichael/viaforge/common/protocoltranslator/netty/ViaForgeVLLegacyPipeline.java:
--------------------------------------------------------------------------------
1 | /*
2 | * This file is part of ViaForge - https://github.com/FlorianMichael/ViaForge
3 | * Copyright (C) 2021-2025 FlorianMichael/EnZaXD and contributors
4 | *
5 | * This program is free software: you can redistribute it and/or modify
6 | * it under the terms of the GNU General Public License as published by
7 | * the Free Software Foundation, either version 3 of the License, or
8 | * (at your option) any later version.
9 | *
10 | * This program is distributed in the hope that it will be useful,
11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 | * GNU General Public License for more details.
14 | *
15 | * You should have received a copy of the GNU General Public License
16 | * along with this program. If not, see .
17 | */
18 |
19 | package de.florianmichael.viaforge.common.protocoltranslator.netty;
20 |
21 | import com.viaversion.vialoader.netty.VLLegacyPipeline;
22 | import com.viaversion.viaversion.api.connection.UserConnection;
23 | import com.viaversion.viaversion.api.protocol.version.ProtocolVersion;
24 | import de.florianmichael.viaforge.common.ViaForgeCommon;
25 |
26 | public class ViaForgeVLLegacyPipeline extends VLLegacyPipeline {
27 |
28 | public ViaForgeVLLegacyPipeline(UserConnection user, ProtocolVersion version) {
29 | super(user, version);
30 | }
31 |
32 | @Override
33 | protected String decompressName() {
34 | return "decompress";
35 | }
36 |
37 | @Override
38 | protected String compressName() {
39 | return "compress";
40 | }
41 |
42 | @Override
43 | protected String packetDecoderName() {
44 | return ViaForgeCommon.getManager().getPlatform().getDecodeHandlerName();
45 | }
46 |
47 | @Override
48 | protected String packetEncoderName() {
49 | return "encoder";
50 | }
51 |
52 | @Override
53 | protected String lengthSplitterName() {
54 | return "splitter";
55 | }
56 |
57 | @Override
58 | protected String lengthPrependerName() {
59 | return "prepender";
60 | }
61 |
62 | }
63 |
--------------------------------------------------------------------------------
/src/main/java/de/florianmichael/viaforge/common/protocoltranslator/platform/ViaForgeViaVersionPlatformImpl.java:
--------------------------------------------------------------------------------
1 | /*
2 | * This file is part of ViaForge - https://github.com/FlorianMichael/ViaForge
3 | * Copyright (C) 2021-2025 FlorianMichael/EnZaXD and contributors
4 | *
5 | * This program is free software: you can redistribute it and/or modify
6 | * it under the terms of the GNU General Public License as published by
7 | * the Free Software Foundation, either version 3 of the License, or
8 | * (at your option) any later version.
9 | *
10 | * This program is distributed in the hope that it will be useful,
11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 | * GNU General Public License for more details.
14 | *
15 | * You should have received a copy of the GNU General Public License
16 | * along with this program. If not, see .
17 | */
18 |
19 | package de.florianmichael.viaforge.common.protocoltranslator.platform;
20 |
21 | import com.viaversion.vialoader.impl.platform.ViaVersionPlatformImpl;
22 | import com.viaversion.viaversion.libs.gson.JsonObject;
23 | import de.florianmichael.viaforge.common.ViaForgeCommon;
24 | import de.florianmichael.viaforge.common.platform.VFPlatform;
25 | import java.io.File;
26 |
27 | public final class ViaForgeViaVersionPlatformImpl extends ViaVersionPlatformImpl {
28 |
29 | public ViaForgeViaVersionPlatformImpl(final File rootFolder) {
30 | super(rootFolder);
31 | }
32 |
33 | @Override
34 | public String getPlatformName() {
35 | return "ViaForge";
36 | }
37 |
38 | @Override
39 | public String getPlatformVersion() {
40 | return VFPlatform.VERSION;
41 | }
42 |
43 | @Override
44 | public JsonObject getDump() {
45 | final JsonObject platformDump = new JsonObject();
46 | platformDump.addProperty("native_version", ViaForgeCommon.getManager().getNativeVersion().toString());
47 | platformDump.addProperty("target_version", ViaForgeCommon.getManager().getTargetVersion().toString());
48 | return platformDump;
49 | }
50 |
51 | }
52 |
--------------------------------------------------------------------------------
/src/main/java/de/florianmichael/viaforge/common/protocoltranslator/provider/ViaForgeEncryptionProvider.java:
--------------------------------------------------------------------------------
1 | /*
2 | * This file is part of ViaForge - https://github.com/FlorianMichael/ViaForge
3 | * Copyright (C) 2021-2025 FlorianMichael/EnZaXD and contributors
4 | *
5 | * This program is free software: you can redistribute it and/or modify
6 | * it under the terms of the GNU General Public License as published by
7 | * the Free Software Foundation, either version 3 of the License, or
8 | * (at your option) any later version.
9 | *
10 | * This program is distributed in the hope that it will be useful,
11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 | * GNU General Public License for more details.
14 | *
15 | * You should have received a copy of the GNU General Public License
16 | * along with this program. If not, see .
17 | */
18 |
19 | package de.florianmichael.viaforge.common.protocoltranslator.provider;
20 |
21 | import com.viaversion.viaversion.api.connection.UserConnection;
22 | import de.florianmichael.viaforge.common.ViaForgeCommon;
23 | import net.raphimc.vialegacy.protocol.release.r1_6_4tor1_7_2_5.provider.EncryptionProvider;
24 |
25 | public class ViaForgeEncryptionProvider extends EncryptionProvider {
26 |
27 | @Override
28 | public void enableDecryption(UserConnection user) {
29 | user.getChannel().attr(ViaForgeCommon.VF_NETWORK_MANAGER).getAndRemove().viaForge$setupPreNettyDecryption();
30 | }
31 |
32 | }
33 |
--------------------------------------------------------------------------------
/src/main/java/de/florianmichael/viaforge/common/protocoltranslator/provider/ViaForgeMovementTransmitterProvider.java:
--------------------------------------------------------------------------------
1 | /*
2 | * This file is part of ViaForge - https://github.com/FlorianMichael/ViaForge
3 | * Copyright (C) 2021-2025 FlorianMichael/EnZaXD and contributors
4 | *
5 | * This program is free software: you can redistribute it and/or modify
6 | * it under the terms of the GNU General Public License as published by
7 | * the Free Software Foundation, either version 3 of the License, or
8 | * (at your option) any later version.
9 | *
10 | * This program is distributed in the hope that it will be useful,
11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 | * GNU General Public License for more details.
14 | *
15 | * You should have received a copy of the GNU General Public License
16 | * along with this program. If not, see .
17 | */
18 |
19 | package de.florianmichael.viaforge.common.protocoltranslator.provider;
20 |
21 | import com.viaversion.viaversion.api.connection.UserConnection;
22 | import com.viaversion.viaversion.protocols.v1_8to1_9.provider.MovementTransmitterProvider;
23 |
24 | public class ViaForgeMovementTransmitterProvider extends MovementTransmitterProvider {
25 |
26 | @Override
27 | public void sendPlayer(UserConnection userConnection) {
28 | // We are on the client side, so we can handle the idle packet properly
29 | }
30 |
31 | }
32 |
--------------------------------------------------------------------------------
/src/main/java/de/florianmichael/viaforge/common/protocoltranslator/provider/ViaForgeOldAuthProvider.java:
--------------------------------------------------------------------------------
1 | /*
2 | * This file is part of ViaForge - https://github.com/FlorianMichael/ViaForge
3 | * Copyright (C) 2021-2025 FlorianMichael/EnZaXD and contributors
4 | *
5 | * This program is free software: you can redistribute it and/or modify
6 | * it under the terms of the GNU General Public License as published by
7 | * the Free Software Foundation, either version 3 of the License, or
8 | * (at your option) any later version.
9 | *
10 | * This program is distributed in the hope that it will be useful,
11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 | * GNU General Public License for more details.
14 | *
15 | * You should have received a copy of the GNU General Public License
16 | * along with this program. If not, see .
17 | */
18 |
19 | package de.florianmichael.viaforge.common.protocoltranslator.provider;
20 |
21 | import com.viaversion.viaversion.api.connection.UserConnection;
22 | import de.florianmichael.viaforge.common.ViaForgeCommon;
23 | import net.raphimc.vialegacy.protocol.release.r1_2_4_5tor1_3_1_2.provider.OldAuthProvider;
24 |
25 | public class ViaForgeOldAuthProvider extends OldAuthProvider {
26 |
27 | @Override
28 | public void sendAuthRequest(UserConnection user, String serverId) throws Throwable {
29 | final ViaForgeCommon common = ViaForgeCommon.getManager();
30 | if (!common.getConfig().isVerifySessionInOldVersions()) {
31 | return;
32 | }
33 | common.getPlatform().joinServer(serverId);
34 | }
35 |
36 | }
37 |
--------------------------------------------------------------------------------
/src/main/java/de/florianmichael/viaforge/common/protocoltranslator/provider/ViaForgeVersionProvider.java:
--------------------------------------------------------------------------------
1 | /*
2 | * This file is part of ViaForge - https://github.com/FlorianMichael/ViaForge
3 | * Copyright (C) 2021-2025 FlorianMichael/EnZaXD and contributors
4 | *
5 | * This program is free software: you can redistribute it and/or modify
6 | * it under the terms of the GNU General Public License as published by
7 | * the Free Software Foundation, either version 3 of the License, or
8 | * (at your option) any later version.
9 | *
10 | * This program is distributed in the hope that it will be useful,
11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 | * GNU General Public License for more details.
14 | *
15 | * You should have received a copy of the GNU General Public License
16 | * along with this program. If not, see .
17 | */
18 |
19 | package de.florianmichael.viaforge.common.protocoltranslator.provider;
20 |
21 | import com.viaversion.viaversion.api.connection.UserConnection;
22 | import com.viaversion.viaversion.api.protocol.version.ProtocolVersion;
23 | import com.viaversion.viaversion.protocol.version.BaseVersionProvider;
24 | import de.florianmichael.viaforge.common.ViaForgeCommon;
25 |
26 | public class ViaForgeVersionProvider extends BaseVersionProvider {
27 |
28 | @Override
29 | public ProtocolVersion getClosestServerProtocol(UserConnection connection) throws Exception {
30 | if (connection.isClientSide() && !ViaForgeCommon.getManager().getPlatform().isSingleplayer().get()) {
31 | return connection.getChannel().attr(ViaForgeCommon.VF_NETWORK_MANAGER).get().viaForge$getTrackedVersion();
32 | }
33 | return super.getClosestServerProtocol(connection);
34 | }
35 |
36 | }
37 |
--------------------------------------------------------------------------------
/src/main/resources/assets/viaforge/config.yml:
--------------------------------------------------------------------------------
1 | # Thanks for downloading ViaForge!
2 | # If you need help, you can join our Discord - https://viaversion.com/discord
3 | #
4 | # Disclaimer:
5 | # It cannot be guaranteed that this mod is allowed on specific servers as it can possibly cause problems with anti-cheat plugins
6 | # (USE ONLY WITH CAUTION!)
7 | #
8 | #----------------------------------------------------------#
9 | # GLOBAL OPTIONS #
10 | #----------------------------------------------------------#
11 | #
12 | # This option sets the protocol version to be used when connecting to servers. (can also be changed in-game)
13 | client-side-version: -1
14 | #
15 | # Manually sends the joinServer request when connecting to <= 1.2.5 servers.
16 | verify-session-in-old-versions: true
17 | #
18 | # Allow ViaForge to authenticate with BetaCraft's MP-Pass system for <= c0.30 servers.
19 | allow-betacraft-authentication: true
20 | #
21 | # If enabled, ViaForge will show the current protocol version in the F3 menu.
22 | show-protocol-version-in-f3: true
23 | #
24 | # If enabled, ViaForge will send connection details to the server when connecting.
25 | # This includes the actual client version as well as the ViaForge version.
26 | send-connection-details: true
27 | #
28 | #----------------------------------------------------------#
29 | # GUI OPTIONS #
30 | #----------------------------------------------------------#
31 | #
32 | # This option indicates if the ViaForge button should be shown in the main menu.
33 | show-main-menu-button: true
34 | #
35 | # This option indicates if the ViaForge button should be shown in the multiplayer.
36 | show-multiplayer-button: true
37 | #
38 | # This option indicates if the ViaForge button should be shown in the direct connect screen.
39 | show-direct-connect-button: true
40 | #
41 | # This option indicates if the ViaForge set version button should be shown in the server list.
42 | show-add-server-button: true
43 | #
44 | # This option indicates where the ViaForge button should be located in all screens.
45 | # Possible options: TOP_LEFT, TOP_RIGHT, BOTTOM_LEFT, BOTTOM_RIGHT
46 | via-forge-button-position: "TOP_LEFT"
47 | #
48 | # This option indicates where the ViaForge set version button should be located in the add server screen.
49 | # Possible options: TOP_LEFT, TOP_RIGHT, BOTTOM_LEFT, BOTTOM_RIGHT
50 | add-server-screen-button-position: "TOP_LEFT"
51 |
--------------------------------------------------------------------------------
/src/main/resources/icon.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/ViaVersion/ViaForge/cb398bce900c93b14dd9911802695a9a2aa2812d/src/main/resources/icon.png
--------------------------------------------------------------------------------
/src/main/resources/pack.mcmeta:
--------------------------------------------------------------------------------
1 | {
2 | "pack": {
3 | "description": "ViaForge",
4 | "pack_format": 3
5 | }
6 | }
7 |
--------------------------------------------------------------------------------
/viaforge-mc1122/build.gradle:
--------------------------------------------------------------------------------
1 | minecraft {
2 | mappings channel: "stable", version: "39-1.12"
3 | }
4 |
--------------------------------------------------------------------------------
/viaforge-mc1122/gradle.properties:
--------------------------------------------------------------------------------
1 | forge_version=1.12.2-14.23.5.2859
--------------------------------------------------------------------------------
/viaforge-mc1122/src/main/java/de/florianmichael/viaforge/mixin/MixinLoader.java:
--------------------------------------------------------------------------------
1 | /*
2 | * This file is part of ViaForge - https://github.com/FlorianMichael/ViaForge
3 | * Copyright (C) 2021-2025 FlorianMichael/EnZaXD and contributors
4 | *
5 | * This program is free software: you can redistribute it and/or modify
6 | * it under the terms of the GNU General Public License as published by
7 | * the Free Software Foundation, either version 3 of the License, or
8 | * (at your option) any later version.
9 | *
10 | * This program is distributed in the hope that it will be useful,
11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 | * GNU General Public License for more details.
14 | *
15 | * You should have received a copy of the GNU General Public License
16 | * along with this program. If not, see .
17 | */
18 |
19 | package de.florianmichael.viaforge.mixin;
20 |
21 | import net.minecraftforge.fml.relauncher.IFMLLoadingPlugin;
22 | import org.spongepowered.asm.launch.MixinBootstrap;
23 | import org.spongepowered.asm.mixin.MixinEnvironment;
24 | import org.spongepowered.asm.mixin.Mixins;
25 |
26 | import java.util.Map;
27 |
28 | public class MixinLoader implements IFMLLoadingPlugin {
29 |
30 | public MixinLoader() {
31 | MixinBootstrap.init();
32 | Mixins.addConfiguration("mixins.viaforge-mc1122.json");
33 | MixinEnvironment.getDefaultEnvironment().setSide(MixinEnvironment.Side.CLIENT);
34 | }
35 |
36 | @Override
37 | public String[] getASMTransformerClass() {
38 | return new String[0];
39 | }
40 |
41 | @Override
42 | public String getModContainerClass() {
43 | return null;
44 | }
45 |
46 | @Override
47 | public String getSetupClass() {
48 | return null;
49 | }
50 |
51 | @Override
52 | public void injectData(Map data) {
53 | }
54 |
55 | @Override
56 | public String getAccessTransformerClass() {
57 | return null;
58 | }
59 |
60 | }
61 |
--------------------------------------------------------------------------------
/viaforge-mc1122/src/main/java/de/florianmichael/viaforge/mixin/impl/MixinGuiOverlayDebug.java:
--------------------------------------------------------------------------------
1 | /*
2 | * This file is part of ViaForge - https://github.com/FlorianMichael/ViaForge
3 | * Copyright (C) 2021-2025 FlorianMichael/EnZaXD and contributors
4 | *
5 | * This program is free software: you can redistribute it and/or modify
6 | * it under the terms of the GNU General Public License as published by
7 | * the Free Software Foundation, either version 3 of the License, or
8 | * (at your option) any later version.
9 | *
10 | * This program is distributed in the hope that it will be useful,
11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 | * GNU General Public License for more details.
14 | *
15 | * You should have received a copy of the GNU General Public License
16 | * along with this program. If not, see .
17 | */
18 |
19 | package de.florianmichael.viaforge.mixin.impl;
20 |
21 | import com.viaversion.viaversion.api.protocol.version.ProtocolVersion;
22 | import de.florianmichael.viaforge.common.ViaForgeCommon;
23 | import net.minecraft.client.gui.GuiOverlayDebug;
24 | import org.spongepowered.asm.mixin.Mixin;
25 | import org.spongepowered.asm.mixin.injection.At;
26 | import org.spongepowered.asm.mixin.injection.Inject;
27 | import org.spongepowered.asm.mixin.injection.callback.CallbackInfoReturnable;
28 |
29 | import java.util.List;
30 |
31 | @Mixin(GuiOverlayDebug.class)
32 | public class MixinGuiOverlayDebug {
33 |
34 | @Inject(method = "getDebugInfoRight", at = @At(value = "TAIL"))
35 | public void addViaForgeVersion(CallbackInfoReturnable> cir) {
36 | final ViaForgeCommon common = ViaForgeCommon.getManager();
37 | final ProtocolVersion version = ViaForgeCommon.getManager().getTargetVersion();
38 |
39 | if (common.getConfig().isShowProtocolVersionInF3() && version != common.getNativeVersion() && !common.getPlatform().isSingleplayer().get()) {
40 | cir.getReturnValue().add("");
41 | cir.getReturnValue().add("ViaForge: " + version.toString());
42 | }
43 | }
44 |
45 | }
46 |
--------------------------------------------------------------------------------
/viaforge-mc1122/src/main/java/de/florianmichael/viaforge/mixin/impl/MixinNetHandlerPlayClient.java:
--------------------------------------------------------------------------------
1 | /*
2 | * This file is part of ViaForge - https://github.com/FlorianMichael/ViaForge
3 | * Copyright (C) 2021-2025 FlorianMichael/EnZaXD and contributors
4 | *
5 | * This program is free software: you can redistribute it and/or modify
6 | * it under the terms of the GNU General Public License as published by
7 | * the Free Software Foundation, either version 3 of the License, or
8 | * (at your option) any later version.
9 | *
10 | * This program is distributed in the hope that it will be useful,
11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 | * GNU General Public License for more details.
14 | *
15 | * You should have received a copy of the GNU General Public License
16 | * along with this program. If not, see .
17 | */
18 |
19 | package de.florianmichael.viaforge.mixin.impl;
20 |
21 | import de.florianmichael.viaforge.common.ViaForgeCommon;
22 | import net.minecraft.client.Minecraft;
23 | import net.minecraft.client.network.NetHandlerPlayClient;
24 | import org.spongepowered.asm.mixin.Mixin;
25 | import org.spongepowered.asm.mixin.injection.At;
26 | import org.spongepowered.asm.mixin.injection.Inject;
27 | import org.spongepowered.asm.mixin.injection.callback.CallbackInfo;
28 |
29 | @Mixin(NetHandlerPlayClient.class)
30 | public class MixinNetHandlerPlayClient {
31 |
32 | @Inject(method = "handleJoinGame", at = @At("RETURN"))
33 | public void sendConnectionDetails(CallbackInfo ci) {
34 | ViaForgeCommon.getManager().sendConnectionDetails(Minecraft.getMinecraft().player.connection.getNetworkManager().channel());
35 | }
36 |
37 | }
38 |
--------------------------------------------------------------------------------
/viaforge-mc1122/src/main/java/de/florianmichael/viaforge/mixin/impl/connect/MixinGuiConnecting_1.java:
--------------------------------------------------------------------------------
1 | /*
2 | * This file is part of ViaForge - https://github.com/FlorianMichael/ViaForge
3 | * Copyright (C) 2021-2025 FlorianMichael/EnZaXD and contributors
4 | *
5 | * This program is free software: you can redistribute it and/or modify
6 | * it under the terms of the GNU General Public License as published by
7 | * the Free Software Foundation, either version 3 of the License, or
8 | * (at your option) any later version.
9 | *
10 | * This program is distributed in the hope that it will be useful,
11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 | * GNU General Public License for more details.
14 | *
15 | * You should have received a copy of the GNU General Public License
16 | * along with this program. If not, see .
17 | */
18 |
19 | package de.florianmichael.viaforge.mixin.impl.connect;
20 |
21 | import com.viaversion.viaversion.api.protocol.version.ProtocolVersion;
22 | import de.florianmichael.viaforge.common.ViaForgeCommon;
23 | import de.florianmichael.viaforge.common.gui.ExtendedServerData;
24 | import de.florianmichael.viaforge.common.platform.VersionTracker;
25 | import net.minecraft.client.Minecraft;
26 | import org.spongepowered.asm.mixin.Mixin;
27 | import org.spongepowered.asm.mixin.injection.At;
28 | import org.spongepowered.asm.mixin.injection.Redirect;
29 |
30 | import java.net.InetAddress;
31 | import java.net.UnknownHostException;
32 |
33 | @Mixin(targets = "net.minecraft.client.multiplayer.GuiConnecting$1")
34 | public class MixinGuiConnecting_1 {
35 |
36 | @Redirect(method = "run", at = @At(value = "INVOKE", target = "Ljava/net/InetAddress;getByName(Ljava/lang/String;)Ljava/net/InetAddress;"))
37 | public InetAddress trackServerVersion(String s) throws UnknownHostException {
38 | final InetAddress address = InetAddress.getByName(s);
39 | ProtocolVersion version = ((ExtendedServerData) Minecraft.getMinecraft().getCurrentServerData()).viaForge$getVersion();
40 | if (version == null) {
41 | version = ViaForgeCommon.getManager().getTargetVersion();
42 | }
43 | VersionTracker.storeServerProtocolVersion(address, version);
44 | return address;
45 | }
46 |
47 | }
48 |
--------------------------------------------------------------------------------
/viaforge-mc1122/src/main/java/de/florianmichael/viaforge/mixin/impl/connect/MixinNetworkManager_5.java:
--------------------------------------------------------------------------------
1 | /*
2 | * This file is part of ViaForge - https://github.com/FlorianMichael/ViaForge
3 | * Copyright (C) 2021-2025 FlorianMichael/EnZaXD and contributors
4 | *
5 | * This program is free software: you can redistribute it and/or modify
6 | * it under the terms of the GNU General Public License as published by
7 | * the Free Software Foundation, either version 3 of the License, or
8 | * (at your option) any later version.
9 | *
10 | * This program is distributed in the hope that it will be useful,
11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 | * GNU General Public License for more details.
14 | *
15 | * You should have received a copy of the GNU General Public License
16 | * along with this program. If not, see .
17 | */
18 |
19 | package de.florianmichael.viaforge.mixin.impl.connect;
20 |
21 | import de.florianmichael.viaforge.common.ViaForgeCommon;
22 | import de.florianmichael.viaforge.common.protocoltranslator.netty.VFNetworkManager;
23 | import io.netty.channel.Channel;
24 | import net.minecraft.network.NetworkManager;
25 | import org.spongepowered.asm.mixin.*;
26 | import org.spongepowered.asm.mixin.injection.At;
27 | import org.spongepowered.asm.mixin.injection.Inject;
28 | import org.spongepowered.asm.mixin.injection.callback.CallbackInfo;
29 |
30 | @Mixin(targets = "net.minecraft.network.NetworkManager$5")
31 | public class MixinNetworkManager_5 {
32 |
33 | @Final
34 | @Mutable
35 | NetworkManager val$networkmanager;
36 |
37 | @Inject(method = "initChannel", at = @At(value = "TAIL"), remap = false)
38 | private void hookViaPipeline(Channel channel, CallbackInfo ci) {
39 | ViaForgeCommon.getManager().inject(channel, (VFNetworkManager) val$networkmanager);
40 | }
41 |
42 | }
43 |
--------------------------------------------------------------------------------
/viaforge-mc1122/src/main/resources/mcmod.info:
--------------------------------------------------------------------------------
1 | [
2 | {
3 | "modid": "viaforge",
4 | "name": "ViaForge",
5 | "description": "${description}",
6 | "version": "${version}",
7 | "mcversion": "[1.12,)",
8 | "url": "https://github.com/ViaVersion/ViaForge",
9 | "authorList": [
10 | "FlorianMichael/EnZaXD"
11 | ],
12 | "credits": "https://github.com/FlorianMichael/",
13 | "logoFile": "icon.png"
14 | }
15 | ]
16 |
--------------------------------------------------------------------------------
/viaforge-mc1122/src/main/resources/mixins.viaforge-mc1122.json:
--------------------------------------------------------------------------------
1 | {
2 | "required": true,
3 | "minVersion": "0.7.5",
4 | "compatibilityLevel": "JAVA_8",
5 | "package": "de.florianmichael.viaforge.mixin.impl",
6 | "refmap": "mixins.viaforge-mc1122.refmap.json",
7 | "client": [
8 | "MixinNetHandlerPlayClient",
9 | "MixinGuiMainMenu",
10 | "MixinGuiMultiplayer",
11 | "MixinGuiOverlayDebug",
12 | "MixinGuiScreenAddServer",
13 | "MixinGuiScreenServerList",
14 | "MixinServerData",
15 | "connect.MixinGuiConnecting_1",
16 | "connect.MixinNetHandlerLoginClient",
17 | "connect.MixinNetworkManager",
18 | "connect.MixinNetworkManager_5",
19 | "connect.MixinServerPinger"
20 | ],
21 | "verbose": true
22 | }
23 |
--------------------------------------------------------------------------------
/viaforge-mc1165/gradle.properties:
--------------------------------------------------------------------------------
1 | forge_version=1.16.5-36.2.39
--------------------------------------------------------------------------------
/viaforge-mc1165/src/main/java/de/florianmichael/viaforge/mixin/MixinClientPlayNetHandler.java:
--------------------------------------------------------------------------------
1 | /*
2 | * This file is part of ViaForge - https://github.com/FlorianMichael/ViaForge
3 | * Copyright (C) 2021-2025 FlorianMichael/EnZaXD and contributors
4 | *
5 | * This program is free software: you can redistribute it and/or modify
6 | * it under the terms of the GNU General Public License as published by
7 | * the Free Software Foundation, either version 3 of the License, or
8 | * (at your option) any later version.
9 | *
10 | * This program is distributed in the hope that it will be useful,
11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 | * GNU General Public License for more details.
14 | *
15 | * You should have received a copy of the GNU General Public License
16 | * along with this program. If not, see .
17 | */
18 |
19 | package de.florianmichael.viaforge.mixin;
20 |
21 | import de.florianmichael.viaforge.common.ViaForgeCommon;
22 | import net.minecraft.client.Minecraft;
23 | import net.minecraft.client.network.play.ClientPlayNetHandler;
24 | import org.spongepowered.asm.mixin.Mixin;
25 | import org.spongepowered.asm.mixin.injection.At;
26 | import org.spongepowered.asm.mixin.injection.Inject;
27 | import org.spongepowered.asm.mixin.injection.callback.CallbackInfo;
28 |
29 | @Mixin(ClientPlayNetHandler.class)
30 | public class MixinClientPlayNetHandler {
31 |
32 | @Inject(method = "handleLogin", at = @At("RETURN"))
33 | public void sendConnectionDetails(CallbackInfo ci) {
34 | if (Minecraft.getInstance().player != null) {
35 | ViaForgeCommon.getManager().sendConnectionDetails(Minecraft.getInstance().player.connection.getConnection().channel());
36 | }
37 | }
38 |
39 | }
40 |
--------------------------------------------------------------------------------
/viaforge-mc1165/src/main/java/de/florianmichael/viaforge/mixin/MixinDebugOverlayGui.java:
--------------------------------------------------------------------------------
1 | /*
2 | * This file is part of ViaForge - https://github.com/FlorianMichael/ViaForge
3 | * Copyright (C) 2021-2025 FlorianMichael/EnZaXD and contributors
4 | *
5 | * This program is free software: you can redistribute it and/or modify
6 | * it under the terms of the GNU General Public License as published by
7 | * the Free Software Foundation, either version 3 of the License, or
8 | * (at your option) any later version.
9 | *
10 | * This program is distributed in the hope that it will be useful,
11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 | * GNU General Public License for more details.
14 | *
15 | * You should have received a copy of the GNU General Public License
16 | * along with this program. If not, see .
17 | */
18 |
19 | package de.florianmichael.viaforge.mixin;
20 |
21 | import de.florianmichael.viaforge.common.ViaForgeCommon;
22 | import net.minecraft.client.gui.overlay.DebugOverlayGui;
23 | import com.viaversion.viaversion.api.protocol.version.ProtocolVersion;
24 | import org.spongepowered.asm.mixin.Mixin;
25 | import org.spongepowered.asm.mixin.injection.At;
26 | import org.spongepowered.asm.mixin.injection.Inject;
27 | import org.spongepowered.asm.mixin.injection.callback.CallbackInfoReturnable;
28 |
29 | import java.util.List;
30 |
31 | @Mixin(DebugOverlayGui.class)
32 | public class MixinDebugOverlayGui {
33 |
34 | @Inject(method = "getSystemInformation", at = @At(value = "TAIL"))
35 | public void addViaForgeVersion(CallbackInfoReturnable> cir) {
36 | final ViaForgeCommon common = ViaForgeCommon.getManager();
37 | final ProtocolVersion version = ViaForgeCommon.getManager().getTargetVersion();
38 |
39 | if (common.getConfig().isShowProtocolVersionInF3() && version != common.getNativeVersion() && !common.getPlatform().isSingleplayer().get()) {
40 | cir.getReturnValue().add("");
41 | cir.getReturnValue().add("ViaForge: " + version.toString());
42 | }
43 | }
44 |
45 | }
46 |
--------------------------------------------------------------------------------
/viaforge-mc1165/src/main/java/de/florianmichael/viaforge/mixin/MixinMainMenuScreen.java:
--------------------------------------------------------------------------------
1 | /*
2 | * This file is part of ViaForge - https://github.com/FlorianMichael/ViaForge
3 | * Copyright (C) 2021-2025 FlorianMichael/EnZaXD and contributors
4 | *
5 | * This program is free software: you can redistribute it and/or modify
6 | * it under the terms of the GNU General Public License as published by
7 | * the Free Software Foundation, either version 3 of the License, or
8 | * (at your option) any later version.
9 | *
10 | * This program is distributed in the hope that it will be useful,
11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 | * GNU General Public License for more details.
14 | *
15 | * You should have received a copy of the GNU General Public License
16 | * along with this program. If not, see .
17 | */
18 |
19 | package de.florianmichael.viaforge.mixin;
20 |
21 | import com.viaversion.viaversion.util.Pair;
22 | import de.florianmichael.viaforge.common.ViaForgeCommon;
23 | import de.florianmichael.viaforge.common.platform.ViaForgeConfig;
24 | import de.florianmichael.viaforge.gui.GuiProtocolSelector;
25 | import net.minecraft.client.gui.screen.MainMenuScreen;
26 | import net.minecraft.client.gui.screen.Screen;
27 | import net.minecraft.client.gui.widget.button.Button;
28 | import net.minecraft.util.text.ITextComponent;
29 | import net.minecraft.util.text.StringTextComponent;
30 | import org.spongepowered.asm.mixin.Mixin;
31 | import org.spongepowered.asm.mixin.injection.At;
32 | import org.spongepowered.asm.mixin.injection.Inject;
33 | import org.spongepowered.asm.mixin.injection.callback.CallbackInfo;
34 |
35 | @Mixin(MainMenuScreen.class)
36 | public class MixinMainMenuScreen extends Screen {
37 |
38 | public MixinMainMenuScreen(ITextComponent title) {
39 | super(title);
40 | }
41 |
42 | @Inject(method = "init", at = @At("RETURN"))
43 | public void hookViaForgeButton(CallbackInfo ci) {
44 | final ViaForgeConfig config = ViaForgeCommon.getManager().getConfig();
45 | if (config.isShowMainMenuButton()) {
46 | final Pair pos = config.getViaForgeButtonPosition().getPosition(this.width, this.height);
47 |
48 | addButton(new Button(pos.key(), pos.value(), 100, 20, new StringTextComponent("ViaForge"), buttons -> GuiProtocolSelector.open(minecraft)));
49 | }
50 | }
51 |
52 | }
53 |
--------------------------------------------------------------------------------
/viaforge-mc1165/src/main/java/de/florianmichael/viaforge/mixin/MixinMultiplayerScreen.java:
--------------------------------------------------------------------------------
1 | /*
2 | * This file is part of ViaForge - https://github.com/FlorianMichael/ViaForge
3 | * Copyright (C) 2021-2025 FlorianMichael/EnZaXD and contributors
4 | *
5 | * This program is free software: you can redistribute it and/or modify
6 | * it under the terms of the GNU General Public License as published by
7 | * the Free Software Foundation, either version 3 of the License, or
8 | * (at your option) any later version.
9 | *
10 | * This program is distributed in the hope that it will be useful,
11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 | * GNU General Public License for more details.
14 | *
15 | * You should have received a copy of the GNU General Public License
16 | * along with this program. If not, see .
17 | */
18 |
19 | package de.florianmichael.viaforge.mixin;
20 |
21 | import com.viaversion.viaversion.util.Pair;
22 | import de.florianmichael.viaforge.common.ViaForgeCommon;
23 | import de.florianmichael.viaforge.common.platform.ViaForgeConfig;
24 | import de.florianmichael.viaforge.gui.GuiProtocolSelector;
25 | import net.minecraft.client.gui.screen.MultiplayerScreen;
26 | import net.minecraft.client.gui.screen.Screen;
27 | import net.minecraft.client.gui.widget.button.Button;
28 | import net.minecraft.util.text.ITextComponent;
29 | import net.minecraft.util.text.StringTextComponent;
30 | import org.spongepowered.asm.mixin.Mixin;
31 | import org.spongepowered.asm.mixin.injection.At;
32 | import org.spongepowered.asm.mixin.injection.Inject;
33 | import org.spongepowered.asm.mixin.injection.callback.CallbackInfo;
34 |
35 | @Mixin(MultiplayerScreen.class)
36 | public class MixinMultiplayerScreen extends Screen {
37 |
38 | public MixinMultiplayerScreen(ITextComponent title) {
39 | super(title);
40 | }
41 |
42 | @Inject(method = "init", at = @At("RETURN"))
43 | public void hookViaForgeButton(CallbackInfo ci) {
44 | final ViaForgeConfig config = ViaForgeCommon.getManager().getConfig();
45 | if (config.isShowMainMenuButton()) {
46 | final Pair pos = config.getViaForgeButtonPosition().getPosition(this.width, this.height);
47 |
48 | addButton(new Button(pos.key(), pos.value(), 100, 20, new StringTextComponent("ViaForge"), buttons -> GuiProtocolSelector.open(minecraft)));
49 | }
50 | }
51 |
52 | }
53 |
--------------------------------------------------------------------------------
/viaforge-mc1165/src/main/java/de/florianmichael/viaforge/mixin/MixinServerListScreen.java:
--------------------------------------------------------------------------------
1 | /*
2 | * This file is part of ViaForge - https://github.com/FlorianMichael/ViaForge
3 | * Copyright (C) 2021-2025 FlorianMichael/EnZaXD and contributors
4 | *
5 | * This program is free software: you can redistribute it and/or modify
6 | * it under the terms of the GNU General Public License as published by
7 | * the Free Software Foundation, either version 3 of the License, or
8 | * (at your option) any later version.
9 | *
10 | * This program is distributed in the hope that it will be useful,
11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 | * GNU General Public License for more details.
14 | *
15 | * You should have received a copy of the GNU General Public License
16 | * along with this program. If not, see .
17 | */
18 |
19 | package de.florianmichael.viaforge.mixin;
20 |
21 | import com.viaversion.viaversion.util.Pair;
22 | import de.florianmichael.viaforge.common.ViaForgeCommon;
23 | import de.florianmichael.viaforge.common.platform.ViaForgeConfig;
24 | import de.florianmichael.viaforge.gui.GuiProtocolSelector;
25 | import net.minecraft.client.gui.screen.Screen;
26 | import net.minecraft.client.gui.screen.ServerListScreen;
27 | import net.minecraft.client.gui.widget.button.Button;
28 | import net.minecraft.util.text.ITextComponent;
29 | import net.minecraft.util.text.StringTextComponent;
30 | import org.spongepowered.asm.mixin.Mixin;
31 | import org.spongepowered.asm.mixin.injection.At;
32 | import org.spongepowered.asm.mixin.injection.Inject;
33 | import org.spongepowered.asm.mixin.injection.callback.CallbackInfo;
34 |
35 | @Mixin(ServerListScreen.class)
36 | public class MixinServerListScreen extends Screen {
37 |
38 | public MixinServerListScreen(ITextComponent title) {
39 | super(title);
40 | }
41 |
42 | @Inject(method = "init", at = @At("RETURN"))
43 | public void hookViaForgeButton(CallbackInfo ci) {
44 | final ViaForgeConfig config = ViaForgeCommon.getManager().getConfig();
45 | if (config.isShowDirectConnectButton()) {
46 | final Pair pos = config.getViaForgeButtonPosition().getPosition(this.width, this.height);
47 |
48 | addButton(new Button(pos.key(), pos.value(), 100, 20, new StringTextComponent("ViaForge"), b -> GuiProtocolSelector.open(minecraft)));
49 | }
50 | }
51 |
52 | }
53 |
--------------------------------------------------------------------------------
/viaforge-mc1165/src/main/java/de/florianmichael/viaforge/mixin/connect/MixinConnectingScreen_1.java:
--------------------------------------------------------------------------------
1 | /*
2 | * This file is part of ViaForge - https://github.com/FlorianMichael/ViaForge
3 | * Copyright (C) 2021-2025 FlorianMichael/EnZaXD and contributors
4 | *
5 | * This program is free software: you can redistribute it and/or modify
6 | * it under the terms of the GNU General Public License as published by
7 | * the Free Software Foundation, either version 3 of the License, or
8 | * (at your option) any later version.
9 | *
10 | * This program is distributed in the hope that it will be useful,
11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 | * GNU General Public License for more details.
14 | *
15 | * You should have received a copy of the GNU General Public License
16 | * along with this program. If not, see .
17 | */
18 |
19 | package de.florianmichael.viaforge.mixin.connect;
20 |
21 | import de.florianmichael.viaforge.common.ViaForgeCommon;
22 | import de.florianmichael.viaforge.common.gui.ExtendedServerData;
23 | import de.florianmichael.viaforge.common.platform.VersionTracker;
24 | import net.minecraft.client.Minecraft;
25 | import net.minecraft.network.NetworkManager;
26 | import com.viaversion.viaversion.api.protocol.version.ProtocolVersion;
27 | import org.spongepowered.asm.mixin.Mixin;
28 | import org.spongepowered.asm.mixin.injection.At;
29 | import org.spongepowered.asm.mixin.injection.Redirect;
30 |
31 | import java.net.InetAddress;
32 | import java.net.UnknownHostException;
33 |
34 | @Mixin(targets = "net.minecraft.client.gui.screen.ConnectingScreen$1")
35 | public class MixinConnectingScreen_1 {
36 |
37 | @Redirect(method = "run", at = @At(value = "INVOKE", target = "Ljava/net/InetAddress;getByName(Ljava/lang/String;)Ljava/net/InetAddress;"))
38 | public InetAddress trackServerVersion(String s) throws UnknownHostException {
39 | final InetAddress address = InetAddress.getByName(s);
40 | ProtocolVersion version = ((ExtendedServerData) Minecraft.getInstance().getCurrentServer()).viaForge$getVersion();
41 | if (version == null) {
42 | version = ViaForgeCommon.getManager().getTargetVersion();
43 | }
44 | VersionTracker.storeServerProtocolVersion(address, version);
45 | return address;
46 | }
47 |
48 | }
49 |
--------------------------------------------------------------------------------
/viaforge-mc1165/src/main/java/de/florianmichael/viaforge/mixin/connect/MixinNetworkManager_1.java:
--------------------------------------------------------------------------------
1 | /*
2 | * This file is part of ViaForge - https://github.com/FlorianMichael/ViaForge
3 | * Copyright (C) 2021-2025 FlorianMichael/EnZaXD and contributors
4 | *
5 | * This program is free software: you can redistribute it and/or modify
6 | * it under the terms of the GNU General Public License as published by
7 | * the Free Software Foundation, either version 3 of the License, or
8 | * (at your option) any later version.
9 | *
10 | * This program is distributed in the hope that it will be useful,
11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 | * GNU General Public License for more details.
14 | *
15 | * You should have received a copy of the GNU General Public License
16 | * along with this program. If not, see .
17 | */
18 |
19 | package de.florianmichael.viaforge.mixin.connect;
20 |
21 | import de.florianmichael.viaforge.common.ViaForgeCommon;
22 | import de.florianmichael.viaforge.common.protocoltranslator.netty.VFNetworkManager;
23 | import io.netty.channel.Channel;
24 | import net.minecraft.network.NetworkManager;
25 | import org.spongepowered.asm.mixin.Final;
26 | import org.spongepowered.asm.mixin.Mixin;
27 | import org.spongepowered.asm.mixin.Mutable;
28 | import org.spongepowered.asm.mixin.injection.At;
29 | import org.spongepowered.asm.mixin.injection.Inject;
30 | import org.spongepowered.asm.mixin.injection.callback.CallbackInfo;
31 |
32 | @Mixin(targets = "net.minecraft.network.NetworkManager$1")
33 | public class MixinNetworkManager_1 {
34 |
35 | @Final
36 | @Mutable
37 | NetworkManager val$networkmanager;
38 |
39 | @Inject(method = "initChannel", at = @At(value = "TAIL"), remap = false)
40 | private void hookViaPipeline(Channel channel, CallbackInfo ci) {
41 | ViaForgeCommon.getManager().inject(channel, (VFNetworkManager) val$networkmanager);
42 | }
43 |
44 | }
45 |
--------------------------------------------------------------------------------
/viaforge-mc1165/src/main/resources/META-INF/mods.toml:
--------------------------------------------------------------------------------
1 | modLoader="javafml"
2 | loaderVersion="[36,)"
3 |
4 | license="GPL-3.0 license"
5 | issueTrackerURL="https://github.com/ViaVersion/ViaForge/issues"
6 | showAsResourcePack=false
7 |
8 | [[mods]]
9 | modId="viaforge"
10 | version="${version}"
11 | displayName="ViaForge"
12 | displayURL="https://github.com/FlorianMichael"
13 | logoFile="icon.png"
14 | credits="Github contributors"
15 | authors="FlorianMichael/EnZaXD"
16 | description="${description}"
--------------------------------------------------------------------------------
/viaforge-mc1165/src/main/resources/mixins.viaforge-mc1165.json:
--------------------------------------------------------------------------------
1 | {
2 | "required": true,
3 | "minVersion": "0.7.5",
4 | "compatibilityLevel": "JAVA_8",
5 | "package": "de.florianmichael.viaforge.mixin",
6 | "client": [
7 | "MixinAddServerScreen",
8 | "MixinDebugOverlayGui",
9 | "MixinMainMenuScreen",
10 | "MixinMultiplayerScreen",
11 | "MixinServerData",
12 | "MixinServerListScreen",
13 | "connect.MixinClientLoginNetHandler",
14 | "connect.MixinConnectingScreen_1",
15 | "connect.MixinNetworkManager",
16 | "connect.MixinNetworkManager_1",
17 | "connect.MixinServerPinger",
18 | "MixinClientPlayNetHandler"
19 | ],
20 | "injectors": {
21 | "defaultRequire": 1
22 | },
23 | "refmap": "mixins.viaforge-mc1165.refmap.json"
24 | }
25 |
--------------------------------------------------------------------------------
/viaforge-mc1171/gradle.properties:
--------------------------------------------------------------------------------
1 | forge_version=1.17.1-37.1.1
--------------------------------------------------------------------------------
/viaforge-mc1171/src/main/java/de/florianmichael/viaforge/mixin/MixinClientPacketListener.java:
--------------------------------------------------------------------------------
1 | /*
2 | * This file is part of ViaForge - https://github.com/FlorianMichael/ViaForge
3 | * Copyright (C) 2021-2025 FlorianMichael/EnZaXD and contributors
4 | *
5 | * This program is free software: you can redistribute it and/or modify
6 | * it under the terms of the GNU General Public License as published by
7 | * the Free Software Foundation, either version 3 of the License, or
8 | * (at your option) any later version.
9 | *
10 | * This program is distributed in the hope that it will be useful,
11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 | * GNU General Public License for more details.
14 | *
15 | * You should have received a copy of the GNU General Public License
16 | * along with this program. If not, see .
17 | */
18 |
19 | package de.florianmichael.viaforge.mixin;
20 |
21 | import de.florianmichael.viaforge.common.ViaForgeCommon;
22 | import net.minecraft.client.Minecraft;
23 | import net.minecraft.client.multiplayer.ClientPacketListener;
24 | import org.spongepowered.asm.mixin.Mixin;
25 | import org.spongepowered.asm.mixin.injection.At;
26 | import org.spongepowered.asm.mixin.injection.Inject;
27 | import org.spongepowered.asm.mixin.injection.callback.CallbackInfo;
28 |
29 | @Mixin(ClientPacketListener.class)
30 | public class MixinClientPacketListener {
31 |
32 | @Inject(method = "handleLogin", at = @At("RETURN"))
33 | public void sendConnectionDetails(CallbackInfo ci) {
34 | if (Minecraft.getInstance().player != null) {
35 | ViaForgeCommon.getManager().sendConnectionDetails(Minecraft.getInstance().player.connection.getConnection().channel());
36 | }
37 | }
38 |
39 | }
40 |
--------------------------------------------------------------------------------
/viaforge-mc1171/src/main/java/de/florianmichael/viaforge/mixin/MixinDebugScreenOverlay.java:
--------------------------------------------------------------------------------
1 | /*
2 | * This file is part of ViaForge - https://github.com/FlorianMichael/ViaForge
3 | * Copyright (C) 2021-2025 FlorianMichael/EnZaXD and contributors
4 | *
5 | * This program is free software: you can redistribute it and/or modify
6 | * it under the terms of the GNU General Public License as published by
7 | * the Free Software Foundation, either version 3 of the License, or
8 | * (at your option) any later version.
9 | *
10 | * This program is distributed in the hope that it will be useful,
11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 | * GNU General Public License for more details.
14 | *
15 | * You should have received a copy of the GNU General Public License
16 | * along with this program. If not, see .
17 | */
18 |
19 | package de.florianmichael.viaforge.mixin;
20 |
21 | import de.florianmichael.viaforge.common.ViaForgeCommon;
22 | import net.minecraft.client.gui.components.DebugScreenOverlay;
23 | import com.viaversion.viaversion.api.protocol.version.ProtocolVersion;
24 | import org.spongepowered.asm.mixin.Mixin;
25 | import org.spongepowered.asm.mixin.injection.At;
26 | import org.spongepowered.asm.mixin.injection.Inject;
27 | import org.spongepowered.asm.mixin.injection.callback.CallbackInfoReturnable;
28 |
29 | import java.util.List;
30 |
31 | @Mixin(DebugScreenOverlay.class)
32 | public class MixinDebugScreenOverlay {
33 |
34 | @Inject(method = "getSystemInformation", at = @At(value = "TAIL"))
35 | public void addViaForgeVersion(CallbackInfoReturnable> cir) {
36 | final ViaForgeCommon common = ViaForgeCommon.getManager();
37 | final ProtocolVersion version = ViaForgeCommon.getManager().getTargetVersion();
38 |
39 | if (common.getConfig().isShowProtocolVersionInF3() && version != common.getNativeVersion() && !common.getPlatform().isSingleplayer().get()) {
40 | cir.getReturnValue().add("");
41 | cir.getReturnValue().add("ViaForge: " + version.toString());
42 | }
43 | }
44 |
45 | }
46 |
--------------------------------------------------------------------------------
/viaforge-mc1171/src/main/java/de/florianmichael/viaforge/mixin/MixinDirectJoinServerScreen.java:
--------------------------------------------------------------------------------
1 | /*
2 | * This file is part of ViaForge - https://github.com/FlorianMichael/ViaForge
3 | * Copyright (C) 2021-2025 FlorianMichael/EnZaXD and contributors
4 | *
5 | * This program is free software: you can redistribute it and/or modify
6 | * it under the terms of the GNU General Public License as published by
7 | * the Free Software Foundation, either version 3 of the License, or
8 | * (at your option) any later version.
9 | *
10 | * This program is distributed in the hope that it will be useful,
11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 | * GNU General Public License for more details.
14 | *
15 | * You should have received a copy of the GNU General Public License
16 | * along with this program. If not, see .
17 | */
18 |
19 | package de.florianmichael.viaforge.mixin;
20 |
21 | import com.viaversion.viaversion.util.Pair;
22 | import de.florianmichael.viaforge.common.ViaForgeCommon;
23 | import de.florianmichael.viaforge.common.platform.ViaForgeConfig;
24 | import de.florianmichael.viaforge.gui.GuiProtocolSelector;
25 | import net.minecraft.client.gui.components.Button;
26 | import net.minecraft.client.gui.screens.DirectJoinServerScreen;
27 | import net.minecraft.client.gui.screens.Screen;
28 | import net.minecraft.network.chat.Component;
29 | import net.minecraft.network.chat.TextComponent;
30 | import org.spongepowered.asm.mixin.Mixin;
31 | import org.spongepowered.asm.mixin.injection.At;
32 | import org.spongepowered.asm.mixin.injection.Inject;
33 | import org.spongepowered.asm.mixin.injection.callback.CallbackInfo;
34 |
35 | @Mixin(DirectJoinServerScreen.class)
36 | public class MixinDirectJoinServerScreen extends Screen {
37 |
38 | public MixinDirectJoinServerScreen(Component title) {
39 | super(title);
40 | }
41 |
42 | @Inject(method = "init", at = @At("RETURN"))
43 | public void hookViaForgeButton(CallbackInfo ci) {
44 | final ViaForgeConfig config = ViaForgeCommon.getManager().getConfig();
45 | if (config.isShowDirectConnectButton()) {
46 | final Pair pos = config.getViaForgeButtonPosition().getPosition(this.width, this.height);
47 |
48 | addRenderableWidget(new Button(pos.key(), pos.value(), 100, 20, new TextComponent("ViaForge"), b -> GuiProtocolSelector.open(minecraft)));
49 | }
50 | }
51 |
52 | }
53 |
--------------------------------------------------------------------------------
/viaforge-mc1171/src/main/java/de/florianmichael/viaforge/mixin/MixinTitleScreen.java:
--------------------------------------------------------------------------------
1 | /*
2 | * This file is part of ViaForge - https://github.com/FlorianMichael/ViaForge
3 | * Copyright (C) 2021-2025 FlorianMichael/EnZaXD and contributors
4 | *
5 | * This program is free software: you can redistribute it and/or modify
6 | * it under the terms of the GNU General Public License as published by
7 | * the Free Software Foundation, either version 3 of the License, or
8 | * (at your option) any later version.
9 | *
10 | * This program is distributed in the hope that it will be useful,
11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 | * GNU General Public License for more details.
14 | *
15 | * You should have received a copy of the GNU General Public License
16 | * along with this program. If not, see .
17 | */
18 |
19 | package de.florianmichael.viaforge.mixin;
20 |
21 | import com.viaversion.viaversion.util.Pair;
22 | import de.florianmichael.viaforge.common.ViaForgeCommon;
23 | import de.florianmichael.viaforge.common.platform.ViaForgeConfig;
24 | import de.florianmichael.viaforge.gui.GuiProtocolSelector;
25 | import net.minecraft.client.gui.components.Button;
26 | import net.minecraft.client.gui.screens.Screen;
27 | import net.minecraft.client.gui.screens.TitleScreen;
28 | import net.minecraft.network.chat.Component;
29 | import net.minecraft.network.chat.TextComponent;
30 | import org.spongepowered.asm.mixin.Mixin;
31 | import org.spongepowered.asm.mixin.injection.At;
32 | import org.spongepowered.asm.mixin.injection.Inject;
33 | import org.spongepowered.asm.mixin.injection.callback.CallbackInfo;
34 |
35 | @Mixin(TitleScreen.class)
36 | public class MixinTitleScreen extends Screen {
37 |
38 | public MixinTitleScreen(Component title) {
39 | super(title);
40 | }
41 |
42 | @Inject(method = "init", at = @At("RETURN"))
43 | public void hookViaForgeButton(CallbackInfo ci) {
44 | final ViaForgeConfig config = ViaForgeCommon.getManager().getConfig();
45 | if (config.isShowMainMenuButton()) {
46 | final Pair pos = config.getViaForgeButtonPosition().getPosition(this.width, this.height);
47 |
48 | addRenderableWidget(new Button(pos.key(), pos.value(), 100, 20, new TextComponent("ViaForge"), buttons -> GuiProtocolSelector.open(minecraft)));
49 | }
50 | }
51 |
52 | }
53 |
--------------------------------------------------------------------------------
/viaforge-mc1171/src/main/java/de/florianmichael/viaforge/mixin/connect/MixinConnectScreen_1.java:
--------------------------------------------------------------------------------
1 | /*
2 | * This file is part of ViaForge - https://github.com/FlorianMichael/ViaForge
3 | * Copyright (C) 2021-2025 FlorianMichael/EnZaXD and contributors
4 | *
5 | * This program is free software: you can redistribute it and/or modify
6 | * it under the terms of the GNU General Public License as published by
7 | * the Free Software Foundation, either version 3 of the License, or
8 | * (at your option) any later version.
9 | *
10 | * This program is distributed in the hope that it will be useful,
11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 | * GNU General Public License for more details.
14 | *
15 | * You should have received a copy of the GNU General Public License
16 | * along with this program. If not, see .
17 | */
18 |
19 | package de.florianmichael.viaforge.mixin.connect;
20 |
21 | import de.florianmichael.viaforge.common.ViaForgeCommon;
22 | import de.florianmichael.viaforge.common.gui.ExtendedServerData;
23 | import de.florianmichael.viaforge.common.platform.VersionTracker;
24 | import net.minecraft.client.Minecraft;
25 | import com.viaversion.viaversion.api.protocol.version.ProtocolVersion;
26 | import org.spongepowered.asm.mixin.Mixin;
27 | import org.spongepowered.asm.mixin.injection.At;
28 | import org.spongepowered.asm.mixin.injection.Redirect;
29 |
30 | import java.net.InetSocketAddress;
31 | import java.util.Optional;
32 |
33 | @Mixin(targets = "net.minecraft.client.gui.screens.ConnectScreen$1")
34 | public class MixinConnectScreen_1 {
35 |
36 | @Redirect(method = "run", at = @At(value = "INVOKE", target = "Ljava/util/Optional;get()Ljava/lang/Object;"))
37 | public Object trackServerVersion(Optional instance) {
38 | final InetSocketAddress address = (InetSocketAddress) instance.get();
39 | ProtocolVersion version = ((ExtendedServerData) Minecraft.getInstance().getCurrentServer()).viaForge$getVersion();
40 | if (version == null) {
41 | version = ViaForgeCommon.getManager().getTargetVersion();
42 | }
43 | VersionTracker.storeServerProtocolVersion(address.getAddress(), version);
44 | return address;
45 | }
46 |
47 | }
48 |
--------------------------------------------------------------------------------
/viaforge-mc1171/src/main/java/de/florianmichael/viaforge/mixin/connect/MixinConnection_1.java:
--------------------------------------------------------------------------------
1 | /*
2 | * This file is part of ViaForge - https://github.com/FlorianMichael/ViaForge
3 | * Copyright (C) 2021-2025 FlorianMichael/EnZaXD and contributors
4 | *
5 | * This program is free software: you can redistribute it and/or modify
6 | * it under the terms of the GNU General Public License as published by
7 | * the Free Software Foundation, either version 3 of the License, or
8 | * (at your option) any later version.
9 | *
10 | * This program is distributed in the hope that it will be useful,
11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 | * GNU General Public License for more details.
14 | *
15 | * You should have received a copy of the GNU General Public License
16 | * along with this program. If not, see .
17 | */
18 |
19 | package de.florianmichael.viaforge.mixin.connect;
20 |
21 | import de.florianmichael.viaforge.common.ViaForgeCommon;
22 | import de.florianmichael.viaforge.common.protocoltranslator.netty.VFNetworkManager;
23 | import io.netty.channel.Channel;
24 | import io.netty.channel.ChannelHandler;
25 | import org.spongepowered.asm.mixin.Mixin;
26 | import org.spongepowered.asm.mixin.injection.At;
27 | import org.spongepowered.asm.mixin.injection.Inject;
28 | import org.spongepowered.asm.mixin.injection.callback.CallbackInfo;
29 |
30 | @Mixin(targets = "net.minecraft.network.Connection$1")
31 | public class MixinConnection_1 {
32 |
33 | @Inject(method = "initChannel", at = @At("TAIL"))
34 | private void hookViaPipeline(Channel p_129552_, CallbackInfo ci) {
35 | final ChannelHandler connection = p_129552_.pipeline().get("packet_handler");
36 | ViaForgeCommon.getManager().inject(p_129552_, (VFNetworkManager) connection);
37 | }
38 |
39 | }
40 |
--------------------------------------------------------------------------------
/viaforge-mc1171/src/main/resources/META-INF/mods.toml:
--------------------------------------------------------------------------------
1 | modLoader="javafml"
2 | loaderVersion="[37,)"
3 |
4 | license="GPL-3.0 license"
5 | issueTrackerURL="https://github.com/ViaVersion/ViaForge/issues"
6 | showAsResourcePack=false
7 |
8 | [[mods]]
9 | modId="viaforge"
10 | version="${version}"
11 | displayName="ViaForge"
12 | displayURL="https://github.com/FlorianMichael"
13 | logoFile="icon.png"
14 | credits="Github contributors"
15 | authors="FlorianMichael/EnZaXD"
16 | description="${description}"
--------------------------------------------------------------------------------
/viaforge-mc1171/src/main/resources/mixins.viaforge-mc1171.json:
--------------------------------------------------------------------------------
1 | {
2 | "required": true,
3 | "minVersion": "0.7.5",
4 | "compatibilityLevel": "JAVA_8",
5 | "package": "de.florianmichael.viaforge.mixin",
6 | "client": [
7 | "MixinDebugScreenOverlay",
8 | "MixinDirectJoinServerScreen",
9 | "MixinEditServerScreen",
10 | "MixinJoinMultiplayerScreen",
11 | "MixinServerData",
12 | "MixinTitleScreen",
13 | "connect.MixinClientHandshakePacketListenerImpl",
14 | "connect.MixinConnection",
15 | "connect.MixinConnection_1",
16 | "connect.MixinConnectScreen_1",
17 | "connect.MixinServerStatusPinger",
18 | "MixinClientPacketListener"
19 | ],
20 | "injectors": {
21 | "defaultRequire": 1
22 | },
23 | "refmap": "mixins.viaforge-mc1171.refmap.json"
24 | }
25 |
--------------------------------------------------------------------------------
/viaforge-mc1182/gradle.properties:
--------------------------------------------------------------------------------
1 | forge_version=1.18.2-40.2.0
--------------------------------------------------------------------------------
/viaforge-mc1182/src/main/java/de/florianmichael/viaforge/mixin/MixinClientPacketListener.java:
--------------------------------------------------------------------------------
1 | /*
2 | * This file is part of ViaForge - https://github.com/FlorianMichael/ViaForge
3 | * Copyright (C) 2021-2025 FlorianMichael/EnZaXD and contributors
4 | *
5 | * This program is free software: you can redistribute it and/or modify
6 | * it under the terms of the GNU General Public License as published by
7 | * the Free Software Foundation, either version 3 of the License, or
8 | * (at your option) any later version.
9 | *
10 | * This program is distributed in the hope that it will be useful,
11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 | * GNU General Public License for more details.
14 | *
15 | * You should have received a copy of the GNU General Public License
16 | * along with this program. If not, see .
17 | */
18 |
19 | package de.florianmichael.viaforge.mixin;
20 |
21 | import de.florianmichael.viaforge.common.ViaForgeCommon;
22 | import net.minecraft.client.Minecraft;
23 | import net.minecraft.client.multiplayer.ClientPacketListener;
24 | import org.spongepowered.asm.mixin.Mixin;
25 | import org.spongepowered.asm.mixin.injection.At;
26 | import org.spongepowered.asm.mixin.injection.Inject;
27 | import org.spongepowered.asm.mixin.injection.callback.CallbackInfo;
28 |
29 | @Mixin(ClientPacketListener.class)
30 | public class MixinClientPacketListener {
31 |
32 | @Inject(method = "handleLogin", at = @At("RETURN"))
33 | public void sendConnectionDetails(CallbackInfo ci) {
34 | if (Minecraft.getInstance().player != null) {
35 | ViaForgeCommon.getManager().sendConnectionDetails(Minecraft.getInstance().player.connection.getConnection().channel());
36 | }
37 | }
38 |
39 | }
40 |
--------------------------------------------------------------------------------
/viaforge-mc1182/src/main/java/de/florianmichael/viaforge/mixin/MixinDebugScreenOverlay.java:
--------------------------------------------------------------------------------
1 | /*
2 | * This file is part of ViaForge - https://github.com/FlorianMichael/ViaForge
3 | * Copyright (C) 2021-2025 FlorianMichael/EnZaXD and contributors
4 | *
5 | * This program is free software: you can redistribute it and/or modify
6 | * it under the terms of the GNU General Public License as published by
7 | * the Free Software Foundation, either version 3 of the License, or
8 | * (at your option) any later version.
9 | *
10 | * This program is distributed in the hope that it will be useful,
11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 | * GNU General Public License for more details.
14 | *
15 | * You should have received a copy of the GNU General Public License
16 | * along with this program. If not, see .
17 | */
18 |
19 | package de.florianmichael.viaforge.mixin;
20 |
21 | import de.florianmichael.viaforge.common.ViaForgeCommon;
22 | import net.minecraft.client.gui.components.DebugScreenOverlay;
23 | import com.viaversion.viaversion.api.protocol.version.ProtocolVersion;
24 | import org.spongepowered.asm.mixin.Mixin;
25 | import org.spongepowered.asm.mixin.injection.At;
26 | import org.spongepowered.asm.mixin.injection.Inject;
27 | import org.spongepowered.asm.mixin.injection.callback.CallbackInfoReturnable;
28 |
29 | import java.util.List;
30 |
31 | @Mixin(DebugScreenOverlay.class)
32 | public class MixinDebugScreenOverlay {
33 |
34 | @Inject(method = "getSystemInformation", at = @At(value = "TAIL"))
35 | public void addViaForgeVersion(CallbackInfoReturnable> cir) {
36 | final ViaForgeCommon common = ViaForgeCommon.getManager();
37 | final ProtocolVersion version = ViaForgeCommon.getManager().getTargetVersion();
38 |
39 | if (common.getConfig().isShowProtocolVersionInF3() && version != common.getNativeVersion() && !common.getPlatform().isSingleplayer().get()) {
40 | cir.getReturnValue().add("");
41 | cir.getReturnValue().add("ViaForge: " + version.toString());
42 | }
43 | }
44 |
45 | }
46 |
--------------------------------------------------------------------------------
/viaforge-mc1182/src/main/java/de/florianmichael/viaforge/mixin/MixinDirectJoinServerScreen.java:
--------------------------------------------------------------------------------
1 | /*
2 | * This file is part of ViaForge - https://github.com/FlorianMichael/ViaForge
3 | * Copyright (C) 2021-2025 FlorianMichael/EnZaXD and contributors
4 | *
5 | * This program is free software: you can redistribute it and/or modify
6 | * it under the terms of the GNU General Public License as published by
7 | * the Free Software Foundation, either version 3 of the License, or
8 | * (at your option) any later version.
9 | *
10 | * This program is distributed in the hope that it will be useful,
11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 | * GNU General Public License for more details.
14 | *
15 | * You should have received a copy of the GNU General Public License
16 | * along with this program. If not, see .
17 | */
18 |
19 | package de.florianmichael.viaforge.mixin;
20 |
21 | import com.viaversion.viaversion.util.Pair;
22 | import de.florianmichael.viaforge.common.ViaForgeCommon;
23 | import de.florianmichael.viaforge.common.platform.ViaForgeConfig;
24 | import de.florianmichael.viaforge.gui.GuiProtocolSelector;
25 | import net.minecraft.client.gui.components.Button;
26 | import net.minecraft.client.gui.screens.DirectJoinServerScreen;
27 | import net.minecraft.client.gui.screens.Screen;
28 | import net.minecraft.network.chat.Component;
29 | import net.minecraft.network.chat.TextComponent;
30 | import org.spongepowered.asm.mixin.Mixin;
31 | import org.spongepowered.asm.mixin.injection.At;
32 | import org.spongepowered.asm.mixin.injection.Inject;
33 | import org.spongepowered.asm.mixin.injection.callback.CallbackInfo;
34 |
35 | @Mixin(DirectJoinServerScreen.class)
36 | public class MixinDirectJoinServerScreen extends Screen {
37 |
38 | public MixinDirectJoinServerScreen(Component title) {
39 | super(title);
40 | }
41 |
42 | @Inject(method = "init", at = @At("RETURN"))
43 | public void hookViaForgeButton(CallbackInfo ci) {
44 | final ViaForgeConfig config = ViaForgeCommon.getManager().getConfig();
45 | if (config.isShowDirectConnectButton()) {
46 | final Pair pos = config.getViaForgeButtonPosition().getPosition(this.width, this.height);
47 |
48 | addRenderableWidget(new Button(pos.key(), pos.value(), 100, 20, new TextComponent("ViaForge"), b -> GuiProtocolSelector.open(minecraft)));
49 | }
50 | }
51 |
52 | }
53 |
--------------------------------------------------------------------------------
/viaforge-mc1182/src/main/java/de/florianmichael/viaforge/mixin/MixinTitleScreen.java:
--------------------------------------------------------------------------------
1 | /*
2 | * This file is part of ViaForge - https://github.com/FlorianMichael/ViaForge
3 | * Copyright (C) 2021-2025 FlorianMichael/EnZaXD and contributors
4 | *
5 | * This program is free software: you can redistribute it and/or modify
6 | * it under the terms of the GNU General Public License as published by
7 | * the Free Software Foundation, either version 3 of the License, or
8 | * (at your option) any later version.
9 | *
10 | * This program is distributed in the hope that it will be useful,
11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 | * GNU General Public License for more details.
14 | *
15 | * You should have received a copy of the GNU General Public License
16 | * along with this program. If not, see .
17 | */
18 |
19 | package de.florianmichael.viaforge.mixin;
20 |
21 | import com.viaversion.viaversion.util.Pair;
22 | import de.florianmichael.viaforge.common.ViaForgeCommon;
23 | import de.florianmichael.viaforge.common.platform.ViaForgeConfig;
24 | import de.florianmichael.viaforge.gui.GuiProtocolSelector;
25 | import net.minecraft.client.gui.components.Button;
26 | import net.minecraft.client.gui.screens.Screen;
27 | import net.minecraft.client.gui.screens.TitleScreen;
28 | import net.minecraft.network.chat.Component;
29 | import net.minecraft.network.chat.TextComponent;
30 | import org.spongepowered.asm.mixin.Mixin;
31 | import org.spongepowered.asm.mixin.injection.At;
32 | import org.spongepowered.asm.mixin.injection.Inject;
33 | import org.spongepowered.asm.mixin.injection.callback.CallbackInfo;
34 |
35 | @Mixin(TitleScreen.class)
36 | public class MixinTitleScreen extends Screen {
37 |
38 | public MixinTitleScreen(Component title) {
39 | super(title);
40 | }
41 |
42 | @Inject(method = "init", at = @At("RETURN"))
43 | public void hookViaForgeButton(CallbackInfo ci) {
44 | final ViaForgeConfig config = ViaForgeCommon.getManager().getConfig();
45 | if (config.isShowMainMenuButton()) {
46 | final Pair pos = config.getViaForgeButtonPosition().getPosition(this.width, this.height);
47 |
48 | addRenderableWidget(new Button(pos.key(), pos.value(), 100, 20, new TextComponent("ViaForge"), buttons -> GuiProtocolSelector.open(minecraft)));
49 | }
50 | }
51 |
52 | }
53 |
--------------------------------------------------------------------------------
/viaforge-mc1182/src/main/java/de/florianmichael/viaforge/mixin/connect/MixinConnectScreen_1.java:
--------------------------------------------------------------------------------
1 | /*
2 | * This file is part of ViaForge - https://github.com/FlorianMichael/ViaForge
3 | * Copyright (C) 2021-2025 FlorianMichael/EnZaXD and contributors
4 | *
5 | * This program is free software: you can redistribute it and/or modify
6 | * it under the terms of the GNU General Public License as published by
7 | * the Free Software Foundation, either version 3 of the License, or
8 | * (at your option) any later version.
9 | *
10 | * This program is distributed in the hope that it will be useful,
11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 | * GNU General Public License for more details.
14 | *
15 | * You should have received a copy of the GNU General Public License
16 | * along with this program. If not, see .
17 | */
18 |
19 | package de.florianmichael.viaforge.mixin.connect;
20 |
21 | import de.florianmichael.viaforge.common.ViaForgeCommon;
22 | import de.florianmichael.viaforge.common.gui.ExtendedServerData;
23 | import de.florianmichael.viaforge.common.platform.VersionTracker;
24 | import net.minecraft.client.Minecraft;
25 | import com.viaversion.viaversion.api.protocol.version.ProtocolVersion;
26 | import org.spongepowered.asm.mixin.Mixin;
27 | import org.spongepowered.asm.mixin.injection.At;
28 | import org.spongepowered.asm.mixin.injection.Redirect;
29 |
30 | import java.net.InetSocketAddress;
31 | import java.util.Optional;
32 |
33 | @Mixin(targets = "net.minecraft.client.gui.screens.ConnectScreen$1")
34 | public class MixinConnectScreen_1 {
35 |
36 | @Redirect(method = "run", at = @At(value = "INVOKE", target = "Ljava/util/Optional;get()Ljava/lang/Object;"))
37 | public Object trackServerVersion(Optional instance) {
38 | final InetSocketAddress address = (InetSocketAddress) instance.get();
39 | ProtocolVersion version = ((ExtendedServerData) Minecraft.getInstance().getCurrentServer()).viaForge$getVersion();
40 | if (version == null) {
41 | version = ViaForgeCommon.getManager().getTargetVersion();
42 | }
43 | VersionTracker.storeServerProtocolVersion(address.getAddress(), version);
44 | return address;
45 | }
46 |
47 | }
48 |
--------------------------------------------------------------------------------
/viaforge-mc1182/src/main/java/de/florianmichael/viaforge/mixin/connect/MixinConnection_1.java:
--------------------------------------------------------------------------------
1 | /*
2 | * This file is part of ViaForge - https://github.com/FlorianMichael/ViaForge
3 | * Copyright (C) 2021-2025 FlorianMichael/EnZaXD and contributors
4 | *
5 | * This program is free software: you can redistribute it and/or modify
6 | * it under the terms of the GNU General Public License as published by
7 | * the Free Software Foundation, either version 3 of the License, or
8 | * (at your option) any later version.
9 | *
10 | * This program is distributed in the hope that it will be useful,
11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 | * GNU General Public License for more details.
14 | *
15 | * You should have received a copy of the GNU General Public License
16 | * along with this program. If not, see .
17 | */
18 |
19 | package de.florianmichael.viaforge.mixin.connect;
20 |
21 | import de.florianmichael.viaforge.common.ViaForgeCommon;
22 | import de.florianmichael.viaforge.common.protocoltranslator.netty.VFNetworkManager;
23 | import io.netty.channel.Channel;
24 | import io.netty.channel.ChannelHandler;
25 | import org.spongepowered.asm.mixin.Mixin;
26 | import org.spongepowered.asm.mixin.injection.At;
27 | import org.spongepowered.asm.mixin.injection.Inject;
28 | import org.spongepowered.asm.mixin.injection.callback.CallbackInfo;
29 |
30 | @Mixin(targets = "net.minecraft.network.Connection$1")
31 | public class MixinConnection_1 {
32 |
33 | @Inject(method = "initChannel", at = @At("TAIL"))
34 | private void hookViaPipeline(Channel p_129552_, CallbackInfo ci) {
35 | final ChannelHandler connection = p_129552_.pipeline().get("packet_handler");
36 | ViaForgeCommon.getManager().inject(p_129552_, (VFNetworkManager) connection);
37 | }
38 |
39 | }
40 |
--------------------------------------------------------------------------------
/viaforge-mc1182/src/main/resources/META-INF/mods.toml:
--------------------------------------------------------------------------------
1 | modLoader="javafml"
2 | loaderVersion="[40,)"
3 |
4 | license="GPL-3.0 license"
5 | issueTrackerURL="https://github.com/ViaVersion/ViaForge/issues"
6 | showAsResourcePack=false
7 |
8 | [[mods]]
9 | modId="viaforge"
10 | version="${version}"
11 | displayName="ViaForge"
12 | displayURL="https://github.com/FlorianMichael"
13 | logoFile="icon.png"
14 | credits="Github contributors"
15 | authors="FlorianMichael/EnZaXD"
16 | description="${description}"
--------------------------------------------------------------------------------
/viaforge-mc1182/src/main/resources/mixins.viaforge-mc1182.json:
--------------------------------------------------------------------------------
1 | {
2 | "required": true,
3 | "minVersion": "0.7.5",
4 | "compatibilityLevel": "JAVA_8",
5 | "package": "de.florianmichael.viaforge.mixin",
6 | "client": [
7 | "MixinDebugScreenOverlay",
8 | "MixinDirectJoinServerScreen",
9 | "MixinEditServerScreen",
10 | "MixinJoinMultiplayerScreen",
11 | "MixinClientPacketListener",
12 | "MixinServerData",
13 | "MixinTitleScreen",
14 | "connect.MixinClientHandshakePacketListenerImpl",
15 | "connect.MixinConnection",
16 | "connect.MixinConnection_1",
17 | "connect.MixinConnectScreen_1",
18 | "connect.MixinServerStatusPinger"
19 | ],
20 | "injectors": {
21 | "defaultRequire": 1
22 | },
23 | "refmap": "mixins.viaforge-mc1182.refmap.json"
24 | }
25 |
--------------------------------------------------------------------------------
/viaforge-mc1192/gradle.properties:
--------------------------------------------------------------------------------
1 | forge_version=1.19.2-43.4.2
--------------------------------------------------------------------------------
/viaforge-mc1192/src/main/java/de/florianmichael/viaforge/mixin/MixinClientPacketListener.java:
--------------------------------------------------------------------------------
1 | /*
2 | * This file is part of ViaForge - https://github.com/FlorianMichael/ViaForge
3 | * Copyright (C) 2021-2025 FlorianMichael/EnZaXD and contributors
4 | *
5 | * This program is free software: you can redistribute it and/or modify
6 | * it under the terms of the GNU General Public License as published by
7 | * the Free Software Foundation, either version 3 of the License, or
8 | * (at your option) any later version.
9 | *
10 | * This program is distributed in the hope that it will be useful,
11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 | * GNU General Public License for more details.
14 | *
15 | * You should have received a copy of the GNU General Public License
16 | * along with this program. If not, see .
17 | */
18 |
19 | package de.florianmichael.viaforge.mixin;
20 |
21 | import de.florianmichael.viaforge.common.ViaForgeCommon;
22 | import net.minecraft.client.Minecraft;
23 | import net.minecraft.client.multiplayer.ClientPacketListener;
24 | import org.spongepowered.asm.mixin.Mixin;
25 | import org.spongepowered.asm.mixin.injection.At;
26 | import org.spongepowered.asm.mixin.injection.Inject;
27 | import org.spongepowered.asm.mixin.injection.callback.CallbackInfo;
28 |
29 | @Mixin(ClientPacketListener.class)
30 | public class MixinClientPacketListener {
31 |
32 | @Inject(method = "handleLogin", at = @At("RETURN"))
33 | public void sendConnectionDetails(CallbackInfo ci) {
34 | if (Minecraft.getInstance().player != null) {
35 | ViaForgeCommon.getManager().sendConnectionDetails(Minecraft.getInstance().player.connection.getConnection().channel());
36 | }
37 | }
38 |
39 | }
40 |
--------------------------------------------------------------------------------
/viaforge-mc1192/src/main/java/de/florianmichael/viaforge/mixin/MixinDebugScreenOverlay.java:
--------------------------------------------------------------------------------
1 | /*
2 | * This file is part of ViaForge - https://github.com/FlorianMichael/ViaForge
3 | * Copyright (C) 2021-2025 FlorianMichael/EnZaXD and contributors
4 | *
5 | * This program is free software: you can redistribute it and/or modify
6 | * it under the terms of the GNU General Public License as published by
7 | * the Free Software Foundation, either version 3 of the License, or
8 | * (at your option) any later version.
9 | *
10 | * This program is distributed in the hope that it will be useful,
11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 | * GNU General Public License for more details.
14 | *
15 | * You should have received a copy of the GNU General Public License
16 | * along with this program. If not, see .
17 | */
18 |
19 | package de.florianmichael.viaforge.mixin;
20 |
21 | import de.florianmichael.viaforge.common.ViaForgeCommon;
22 | import net.minecraft.client.gui.components.DebugScreenOverlay;
23 | import com.viaversion.viaversion.api.protocol.version.ProtocolVersion;
24 | import org.spongepowered.asm.mixin.Mixin;
25 | import org.spongepowered.asm.mixin.injection.At;
26 | import org.spongepowered.asm.mixin.injection.Inject;
27 | import org.spongepowered.asm.mixin.injection.callback.CallbackInfoReturnable;
28 |
29 | import java.util.List;
30 |
31 | @Mixin(DebugScreenOverlay.class)
32 | public class MixinDebugScreenOverlay {
33 |
34 | @Inject(method = "getSystemInformation", at = @At(value = "TAIL"))
35 | public void addViaForgeVersion(CallbackInfoReturnable> cir) {
36 | final ViaForgeCommon common = ViaForgeCommon.getManager();
37 | final ProtocolVersion version = ViaForgeCommon.getManager().getTargetVersion();
38 |
39 | if (common.getConfig().isShowProtocolVersionInF3() && version != common.getNativeVersion() && !common.getPlatform().isSingleplayer().get()) {
40 | cir.getReturnValue().add("");
41 | cir.getReturnValue().add("ViaForge: " + version.toString());
42 | }
43 | }
44 |
45 | }
46 |
--------------------------------------------------------------------------------
/viaforge-mc1192/src/main/java/de/florianmichael/viaforge/mixin/MixinDirectJoinServerScreen.java:
--------------------------------------------------------------------------------
1 | /*
2 | * This file is part of ViaForge - https://github.com/FlorianMichael/ViaForge
3 | * Copyright (C) 2021-2025 FlorianMichael/EnZaXD and contributors
4 | *
5 | * This program is free software: you can redistribute it and/or modify
6 | * it under the terms of the GNU General Public License as published by
7 | * the Free Software Foundation, either version 3 of the License, or
8 | * (at your option) any later version.
9 | *
10 | * This program is distributed in the hope that it will be useful,
11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 | * GNU General Public License for more details.
14 | *
15 | * You should have received a copy of the GNU General Public License
16 | * along with this program. If not, see .
17 | */
18 |
19 | package de.florianmichael.viaforge.mixin;
20 |
21 | import com.viaversion.viaversion.util.Pair;
22 | import de.florianmichael.viaforge.common.ViaForgeCommon;
23 | import de.florianmichael.viaforge.common.platform.ViaForgeConfig;
24 | import de.florianmichael.viaforge.gui.GuiProtocolSelector;
25 | import net.minecraft.client.gui.components.Button;
26 | import net.minecraft.client.gui.screens.DirectJoinServerScreen;
27 | import net.minecraft.client.gui.screens.Screen;
28 | import net.minecraft.network.chat.Component;
29 | import org.spongepowered.asm.mixin.Mixin;
30 | import org.spongepowered.asm.mixin.injection.At;
31 | import org.spongepowered.asm.mixin.injection.Inject;
32 | import org.spongepowered.asm.mixin.injection.callback.CallbackInfo;
33 |
34 | @Mixin(DirectJoinServerScreen.class)
35 | public class MixinDirectJoinServerScreen extends Screen {
36 |
37 | public MixinDirectJoinServerScreen(Component title) {
38 | super(title);
39 | }
40 |
41 | @Inject(method = "init", at = @At("RETURN"))
42 | public void hookViaForgeButton(CallbackInfo ci) {
43 | final ViaForgeConfig config = ViaForgeCommon.getManager().getConfig();
44 | if (config.isShowDirectConnectButton()) {
45 | final Pair pos = config.getViaForgeButtonPosition().getPosition(this.width, this.height);
46 |
47 | addRenderableWidget(new Button(pos.key(), pos.value(), 100, 20, Component.literal("ViaForge"), b -> GuiProtocolSelector.open(minecraft)));
48 | }
49 | }
50 |
51 | }
52 |
--------------------------------------------------------------------------------
/viaforge-mc1192/src/main/java/de/florianmichael/viaforge/mixin/MixinJoinMultiplayerScreen.java:
--------------------------------------------------------------------------------
1 | /*
2 | * This file is part of ViaForge - https://github.com/FlorianMichael/ViaForge
3 | * Copyright (C) 2021-2025 FlorianMichael/EnZaXD and contributors
4 | *
5 | * This program is free software: you can redistribute it and/or modify
6 | * it under the terms of the GNU General Public License as published by
7 | * the Free Software Foundation, either version 3 of the License, or
8 | * (at your option) any later version.
9 | *
10 | * This program is distributed in the hope that it will be useful,
11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 | * GNU General Public License for more details.
14 | *
15 | * You should have received a copy of the GNU General Public License
16 | * along with this program. If not, see .
17 | */
18 |
19 | package de.florianmichael.viaforge.mixin;
20 |
21 | import com.viaversion.viaversion.util.Pair;
22 | import de.florianmichael.viaforge.common.ViaForgeCommon;
23 | import de.florianmichael.viaforge.common.platform.ViaForgeConfig;
24 | import de.florianmichael.viaforge.gui.GuiProtocolSelector;
25 | import net.minecraft.client.gui.components.Button;
26 | import net.minecraft.client.gui.screens.Screen;
27 | import net.minecraft.client.gui.screens.multiplayer.JoinMultiplayerScreen;
28 | import net.minecraft.network.chat.Component;
29 | import org.spongepowered.asm.mixin.Mixin;
30 | import org.spongepowered.asm.mixin.injection.At;
31 | import org.spongepowered.asm.mixin.injection.Inject;
32 | import org.spongepowered.asm.mixin.injection.callback.CallbackInfo;
33 |
34 | @Mixin(JoinMultiplayerScreen.class)
35 | public class MixinJoinMultiplayerScreen extends Screen {
36 |
37 | public MixinJoinMultiplayerScreen(Component title) {
38 | super(title);
39 | }
40 |
41 | @Inject(method = "init", at = @At("RETURN"))
42 | public void hookViaForgeButton(CallbackInfo ci) {
43 | final ViaForgeConfig config = ViaForgeCommon.getManager().getConfig();
44 | if (config.isShowMainMenuButton()) {
45 | final Pair pos = config.getViaForgeButtonPosition().getPosition(this.width, this.height);
46 |
47 | addRenderableWidget(new Button(pos.key(), pos.value(), 100, 20, Component.literal("ViaForge"), buttons -> GuiProtocolSelector.open(minecraft)));
48 | }
49 | }
50 |
51 | }
52 |
--------------------------------------------------------------------------------
/viaforge-mc1192/src/main/java/de/florianmichael/viaforge/mixin/MixinTitleScreen.java:
--------------------------------------------------------------------------------
1 | /*
2 | * This file is part of ViaForge - https://github.com/FlorianMichael/ViaForge
3 | * Copyright (C) 2021-2025 FlorianMichael/EnZaXD and contributors
4 | *
5 | * This program is free software: you can redistribute it and/or modify
6 | * it under the terms of the GNU General Public License as published by
7 | * the Free Software Foundation, either version 3 of the License, or
8 | * (at your option) any later version.
9 | *
10 | * This program is distributed in the hope that it will be useful,
11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 | * GNU General Public License for more details.
14 | *
15 | * You should have received a copy of the GNU General Public License
16 | * along with this program. If not, see .
17 | */
18 |
19 | package de.florianmichael.viaforge.mixin;
20 |
21 | import com.viaversion.viaversion.util.Pair;
22 | import de.florianmichael.viaforge.common.ViaForgeCommon;
23 | import de.florianmichael.viaforge.common.platform.ViaForgeConfig;
24 | import de.florianmichael.viaforge.gui.GuiProtocolSelector;
25 | import net.minecraft.client.gui.components.Button;
26 | import net.minecraft.client.gui.screens.Screen;
27 | import net.minecraft.client.gui.screens.TitleScreen;
28 | import net.minecraft.network.chat.Component;
29 | import org.spongepowered.asm.mixin.Mixin;
30 | import org.spongepowered.asm.mixin.injection.At;
31 | import org.spongepowered.asm.mixin.injection.Inject;
32 | import org.spongepowered.asm.mixin.injection.callback.CallbackInfo;
33 |
34 | @Mixin(TitleScreen.class)
35 | public class MixinTitleScreen extends Screen {
36 |
37 | public MixinTitleScreen(Component title) {
38 | super(title);
39 | }
40 |
41 | @Inject(method = "init", at = @At("RETURN"))
42 | public void hookViaForgeButton(CallbackInfo ci) {
43 | final ViaForgeConfig config = ViaForgeCommon.getManager().getConfig();
44 | if (config.isShowMainMenuButton()) {
45 | final Pair pos = config.getViaForgeButtonPosition().getPosition(this.width, this.height);
46 |
47 | addRenderableWidget(new Button(pos.key(), pos.value(), 100, 20, Component.literal("ViaForge"), buttons -> GuiProtocolSelector.open(minecraft)));
48 | }
49 | }
50 |
51 | }
52 |
--------------------------------------------------------------------------------
/viaforge-mc1192/src/main/java/de/florianmichael/viaforge/mixin/connect/MixinConnectScreen_1.java:
--------------------------------------------------------------------------------
1 | /*
2 | * This file is part of ViaForge - https://github.com/FlorianMichael/ViaForge
3 | * Copyright (C) 2021-2025 FlorianMichael/EnZaXD and contributors
4 | *
5 | * This program is free software: you can redistribute it and/or modify
6 | * it under the terms of the GNU General Public License as published by
7 | * the Free Software Foundation, either version 3 of the License, or
8 | * (at your option) any later version.
9 | *
10 | * This program is distributed in the hope that it will be useful,
11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 | * GNU General Public License for more details.
14 | *
15 | * You should have received a copy of the GNU General Public License
16 | * along with this program. If not, see .
17 | */
18 |
19 | package de.florianmichael.viaforge.mixin.connect;
20 |
21 | import de.florianmichael.viaforge.common.ViaForgeCommon;
22 | import de.florianmichael.viaforge.common.gui.ExtendedServerData;
23 | import de.florianmichael.viaforge.common.platform.VersionTracker;
24 | import com.viaversion.viaversion.api.protocol.version.ProtocolVersion;
25 | import net.minecraft.client.Minecraft;
26 | import net.minecraft.client.multiplayer.ServerData;
27 | import org.spongepowered.asm.mixin.Final;
28 | import org.spongepowered.asm.mixin.Mixin;
29 | import org.spongepowered.asm.mixin.Shadow;
30 | import org.spongepowered.asm.mixin.injection.At;
31 | import org.spongepowered.asm.mixin.injection.Redirect;
32 |
33 | import java.net.InetSocketAddress;
34 | import java.util.Optional;
35 |
36 | @Mixin(targets = "net.minecraft.client.gui.screens.ConnectScreen$1")
37 | public class MixinConnectScreen_1 {
38 |
39 | @Redirect(method = "run", at = @At(value = "INVOKE", target = "Ljava/util/Optional;get()Ljava/lang/Object;"))
40 | public Object trackServerVersion(Optional instance) {
41 | final InetSocketAddress address = (InetSocketAddress) instance.get();
42 | ProtocolVersion version = ((ExtendedServerData) Minecraft.getInstance().getCurrentServer()).viaForge$getVersion();
43 | if (version == null) {
44 | version = ViaForgeCommon.getManager().getTargetVersion();
45 | }
46 | VersionTracker.storeServerProtocolVersion(address.getAddress(), version);
47 | return address;
48 | }
49 |
50 | }
51 |
--------------------------------------------------------------------------------
/viaforge-mc1192/src/main/java/de/florianmichael/viaforge/mixin/connect/MixinConnection_1.java:
--------------------------------------------------------------------------------
1 | /*
2 | * This file is part of ViaForge - https://github.com/FlorianMichael/ViaForge
3 | * Copyright (C) 2021-2025 FlorianMichael/EnZaXD and contributors
4 | *
5 | * This program is free software: you can redistribute it and/or modify
6 | * it under the terms of the GNU General Public License as published by
7 | * the Free Software Foundation, either version 3 of the License, or
8 | * (at your option) any later version.
9 | *
10 | * This program is distributed in the hope that it will be useful,
11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 | * GNU General Public License for more details.
14 | *
15 | * You should have received a copy of the GNU General Public License
16 | * along with this program. If not, see .
17 | */
18 |
19 | package de.florianmichael.viaforge.mixin.connect;
20 |
21 | import de.florianmichael.viaforge.common.ViaForgeCommon;
22 | import de.florianmichael.viaforge.common.protocoltranslator.netty.VFNetworkManager;
23 | import io.netty.channel.Channel;
24 | import io.netty.channel.ChannelHandler;
25 | import org.spongepowered.asm.mixin.Mixin;
26 | import org.spongepowered.asm.mixin.injection.At;
27 | import org.spongepowered.asm.mixin.injection.Inject;
28 | import org.spongepowered.asm.mixin.injection.callback.CallbackInfo;
29 |
30 | @Mixin(targets = "net.minecraft.network.Connection$1")
31 | public class MixinConnection_1 {
32 |
33 | @Inject(method = "initChannel", at = @At("TAIL"))
34 | private void hookViaPipeline(Channel p_129552_, CallbackInfo ci) {
35 | final ChannelHandler connection = p_129552_.pipeline().get("packet_handler");
36 | ViaForgeCommon.getManager().inject(p_129552_, (VFNetworkManager) connection);
37 | }
38 |
39 | }
40 |
--------------------------------------------------------------------------------
/viaforge-mc1192/src/main/resources/META-INF/mods.toml:
--------------------------------------------------------------------------------
1 | modLoader="javafml"
2 | loaderVersion="[43,)"
3 |
4 | license="GPL-3.0 license"
5 | issueTrackerURL="https://github.com/ViaVersion/ViaForge/issues"
6 | showAsResourcePack=false
7 |
8 | [[mods]]
9 | modId="viaforge"
10 | version="${version}"
11 | displayName="ViaForge"
12 | displayURL="https://github.com/FlorianMichael"
13 | logoFile="icon.png"
14 | credits="Github contributors"
15 | authors="FlorianMichael/EnZaXD"
16 | description="${description}"
--------------------------------------------------------------------------------
/viaforge-mc1192/src/main/resources/mixins.viaforge-mc1192.json:
--------------------------------------------------------------------------------
1 | {
2 | "required": true,
3 | "minVersion": "0.7.5",
4 | "compatibilityLevel": "JAVA_8",
5 | "package": "de.florianmichael.viaforge.mixin",
6 | "client": [
7 | "MixinClientPacketListener",
8 | "MixinDebugScreenOverlay",
9 | "MixinDirectJoinServerScreen",
10 | "MixinEditServerScreen",
11 | "MixinJoinMultiplayerScreen",
12 | "MixinServerData",
13 | "MixinTitleScreen",
14 | "connect.MixinClientHandshakePacketListenerImpl",
15 | "connect.MixinConnection",
16 | "connect.MixinConnection_1",
17 | "connect.MixinConnectScreen_1",
18 | "connect.MixinServerStatusPinger"
19 | ],
20 | "injectors": {
21 | "defaultRequire": 1
22 | },
23 | "refmap": "mixins.viaforge-mc1192.refmap.json"
24 | }
25 |
--------------------------------------------------------------------------------
/viaforge-mc1194/gradle.properties:
--------------------------------------------------------------------------------
1 | forge_version=1.19.4-45.2.0
--------------------------------------------------------------------------------
/viaforge-mc1194/src/main/java/de/florianmichael/viaforge/mixin/MixinClientPacketListener.java:
--------------------------------------------------------------------------------
1 | /*
2 | * This file is part of ViaForge - https://github.com/FlorianMichael/ViaForge
3 | * Copyright (C) 2021-2025 FlorianMichael/EnZaXD and contributors
4 | *
5 | * This program is free software: you can redistribute it and/or modify
6 | * it under the terms of the GNU General Public License as published by
7 | * the Free Software Foundation, either version 3 of the License, or
8 | * (at your option) any later version.
9 | *
10 | * This program is distributed in the hope that it will be useful,
11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 | * GNU General Public License for more details.
14 | *
15 | * You should have received a copy of the GNU General Public License
16 | * along with this program. If not, see .
17 | */
18 |
19 | package de.florianmichael.viaforge.mixin;
20 |
21 | import de.florianmichael.viaforge.common.ViaForgeCommon;
22 | import net.minecraft.client.Minecraft;
23 | import net.minecraft.client.multiplayer.ClientPacketListener;
24 | import org.spongepowered.asm.mixin.Mixin;
25 | import org.spongepowered.asm.mixin.injection.At;
26 | import org.spongepowered.asm.mixin.injection.Inject;
27 | import org.spongepowered.asm.mixin.injection.callback.CallbackInfo;
28 |
29 | @Mixin(ClientPacketListener.class)
30 | public class MixinClientPacketListener {
31 |
32 | @Inject(method = "handleLogin", at = @At("RETURN"))
33 | public void sendConnectionDetails(CallbackInfo ci) {
34 | if (Minecraft.getInstance().player != null) {
35 | ViaForgeCommon.getManager().sendConnectionDetails(Minecraft.getInstance().player.connection.getConnection().channel());
36 | }
37 | }
38 |
39 | }
40 |
--------------------------------------------------------------------------------
/viaforge-mc1194/src/main/java/de/florianmichael/viaforge/mixin/MixinDebugScreenOverlay.java:
--------------------------------------------------------------------------------
1 | /*
2 | * This file is part of ViaForge - https://github.com/FlorianMichael/ViaForge
3 | * Copyright (C) 2021-2025 FlorianMichael/EnZaXD and contributors
4 | *
5 | * This program is free software: you can redistribute it and/or modify
6 | * it under the terms of the GNU General Public License as published by
7 | * the Free Software Foundation, either version 3 of the License, or
8 | * (at your option) any later version.
9 | *
10 | * This program is distributed in the hope that it will be useful,
11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 | * GNU General Public License for more details.
14 | *
15 | * You should have received a copy of the GNU General Public License
16 | * along with this program. If not, see .
17 | */
18 |
19 | package de.florianmichael.viaforge.mixin;
20 |
21 | import de.florianmichael.viaforge.common.ViaForgeCommon;
22 | import net.minecraft.client.gui.components.DebugScreenOverlay;
23 | import com.viaversion.viaversion.api.protocol.version.ProtocolVersion;
24 | import org.spongepowered.asm.mixin.Mixin;
25 | import org.spongepowered.asm.mixin.injection.At;
26 | import org.spongepowered.asm.mixin.injection.Inject;
27 | import org.spongepowered.asm.mixin.injection.callback.CallbackInfoReturnable;
28 |
29 | import java.util.List;
30 |
31 | @Mixin(DebugScreenOverlay.class)
32 | public class MixinDebugScreenOverlay {
33 |
34 | @Inject(method = "getSystemInformation", at = @At(value = "TAIL"))
35 | public void addViaForgeVersion(CallbackInfoReturnable> cir) {
36 | final ViaForgeCommon common = ViaForgeCommon.getManager();
37 | final ProtocolVersion version = ViaForgeCommon.getManager().getTargetVersion();
38 |
39 | if (common.getConfig().isShowProtocolVersionInF3() && version != common.getNativeVersion() && !common.getPlatform().isSingleplayer().get()) {
40 | cir.getReturnValue().add("");
41 | cir.getReturnValue().add("ViaForge: " + version.toString());
42 | }
43 | }
44 |
45 | }
46 |
--------------------------------------------------------------------------------
/viaforge-mc1194/src/main/java/de/florianmichael/viaforge/mixin/MixinDirectJoinServerScreen.java:
--------------------------------------------------------------------------------
1 | /*
2 | * This file is part of ViaForge - https://github.com/FlorianMichael/ViaForge
3 | * Copyright (C) 2021-2025 FlorianMichael/EnZaXD and contributors
4 | *
5 | * This program is free software: you can redistribute it and/or modify
6 | * it under the terms of the GNU General Public License as published by
7 | * the Free Software Foundation, either version 3 of the License, or
8 | * (at your option) any later version.
9 | *
10 | * This program is distributed in the hope that it will be useful,
11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 | * GNU General Public License for more details.
14 | *
15 | * You should have received a copy of the GNU General Public License
16 | * along with this program. If not, see .
17 | */
18 |
19 | package de.florianmichael.viaforge.mixin;
20 |
21 | import com.viaversion.viaversion.util.Pair;
22 | import de.florianmichael.viaforge.common.ViaForgeCommon;
23 | import de.florianmichael.viaforge.common.platform.ViaForgeConfig;
24 | import de.florianmichael.viaforge.gui.GuiProtocolSelector;
25 | import net.minecraft.client.gui.components.Button;
26 | import net.minecraft.client.gui.screens.DirectJoinServerScreen;
27 | import net.minecraft.client.gui.screens.Screen;
28 | import net.minecraft.network.chat.Component;
29 | import org.spongepowered.asm.mixin.Mixin;
30 | import org.spongepowered.asm.mixin.injection.At;
31 | import org.spongepowered.asm.mixin.injection.Inject;
32 | import org.spongepowered.asm.mixin.injection.callback.CallbackInfo;
33 |
34 | @Mixin(DirectJoinServerScreen.class)
35 | public class MixinDirectJoinServerScreen extends Screen {
36 |
37 | public MixinDirectJoinServerScreen(Component title) {
38 | super(title);
39 | }
40 |
41 | @Inject(method = "init", at = @At("RETURN"))
42 | public void hookViaForgeButton(CallbackInfo ci) {
43 | final ViaForgeConfig config = ViaForgeCommon.getManager().getConfig();
44 | if (config.isShowDirectConnectButton()) {
45 | final Pair pos = config.getViaForgeButtonPosition().getPosition(this.width, this.height);
46 |
47 | addRenderableWidget(Button.builder(Component.literal("ViaForge"), b -> GuiProtocolSelector.open(minecraft)).bounds(pos.key(), pos.value(), 100, 20).build());
48 | }
49 | }
50 |
51 | }
52 |
--------------------------------------------------------------------------------
/viaforge-mc1194/src/main/java/de/florianmichael/viaforge/mixin/MixinJoinMultiplayerScreen.java:
--------------------------------------------------------------------------------
1 | /*
2 | * This file is part of ViaForge - https://github.com/FlorianMichael/ViaForge
3 | * Copyright (C) 2021-2025 FlorianMichael/EnZaXD and contributors
4 | *
5 | * This program is free software: you can redistribute it and/or modify
6 | * it under the terms of the GNU General Public License as published by
7 | * the Free Software Foundation, either version 3 of the License, or
8 | * (at your option) any later version.
9 | *
10 | * This program is distributed in the hope that it will be useful,
11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 | * GNU General Public License for more details.
14 | *
15 | * You should have received a copy of the GNU General Public License
16 | * along with this program. If not, see .
17 | */
18 |
19 | package de.florianmichael.viaforge.mixin;
20 |
21 | import com.viaversion.viaversion.util.Pair;
22 | import de.florianmichael.viaforge.common.ViaForgeCommon;
23 | import de.florianmichael.viaforge.common.platform.ViaForgeConfig;
24 | import de.florianmichael.viaforge.gui.GuiProtocolSelector;
25 | import net.minecraft.client.gui.components.Button;
26 | import net.minecraft.client.gui.screens.Screen;
27 | import net.minecraft.client.gui.screens.multiplayer.JoinMultiplayerScreen;
28 | import net.minecraft.network.chat.Component;
29 | import org.spongepowered.asm.mixin.Mixin;
30 | import org.spongepowered.asm.mixin.injection.At;
31 | import org.spongepowered.asm.mixin.injection.Inject;
32 | import org.spongepowered.asm.mixin.injection.callback.CallbackInfo;
33 |
34 | @Mixin(JoinMultiplayerScreen.class)
35 | public class MixinJoinMultiplayerScreen extends Screen {
36 |
37 | public MixinJoinMultiplayerScreen(Component title) {
38 | super(title);
39 | }
40 |
41 | @Inject(method = "init", at = @At("RETURN"))
42 | public void hookViaForgeButton(CallbackInfo ci) {
43 | final ViaForgeConfig config = ViaForgeCommon.getManager().getConfig();
44 | if (config.isShowMainMenuButton()) {
45 | final Pair pos = config.getViaForgeButtonPosition().getPosition(this.width, this.height);
46 |
47 | addRenderableWidget(Button.builder(Component.literal("ViaForge"), buttons -> GuiProtocolSelector.open(minecraft)).bounds(pos.key(), pos.value(), 100, 20).build());
48 | }
49 | }
50 |
51 | }
52 |
--------------------------------------------------------------------------------
/viaforge-mc1194/src/main/java/de/florianmichael/viaforge/mixin/MixinTitleScreen.java:
--------------------------------------------------------------------------------
1 | /*
2 | * This file is part of ViaForge - https://github.com/FlorianMichael/ViaForge
3 | * Copyright (C) 2021-2025 FlorianMichael/EnZaXD and contributors
4 | *
5 | * This program is free software: you can redistribute it and/or modify
6 | * it under the terms of the GNU General Public License as published by
7 | * the Free Software Foundation, either version 3 of the License, or
8 | * (at your option) any later version.
9 | *
10 | * This program is distributed in the hope that it will be useful,
11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 | * GNU General Public License for more details.
14 | *
15 | * You should have received a copy of the GNU General Public License
16 | * along with this program. If not, see .
17 | */
18 |
19 | package de.florianmichael.viaforge.mixin;
20 |
21 | import com.viaversion.viaversion.util.Pair;
22 | import de.florianmichael.viaforge.common.ViaForgeCommon;
23 | import de.florianmichael.viaforge.common.platform.ViaForgeConfig;
24 | import de.florianmichael.viaforge.gui.GuiProtocolSelector;
25 | import net.minecraft.client.gui.components.Button;
26 | import net.minecraft.client.gui.screens.Screen;
27 | import net.minecraft.client.gui.screens.TitleScreen;
28 | import net.minecraft.network.chat.Component;
29 | import org.spongepowered.asm.mixin.Mixin;
30 | import org.spongepowered.asm.mixin.injection.At;
31 | import org.spongepowered.asm.mixin.injection.Inject;
32 | import org.spongepowered.asm.mixin.injection.callback.CallbackInfo;
33 |
34 | @Mixin(TitleScreen.class)
35 | public class MixinTitleScreen extends Screen {
36 |
37 | public MixinTitleScreen(Component title) {
38 | super(title);
39 | }
40 |
41 | @Inject(method = "init", at = @At("RETURN"))
42 | public void hookViaForgeButton(CallbackInfo ci) {
43 | final ViaForgeConfig config = ViaForgeCommon.getManager().getConfig();
44 | if (config.isShowMainMenuButton()) {
45 | final Pair pos = config.getViaForgeButtonPosition().getPosition(this.width, this.height);
46 |
47 | addRenderableWidget(Button.builder(Component.literal("ViaForge"), buttons -> GuiProtocolSelector.open(minecraft)).bounds(pos.key(), pos.value(), 100, 20).build());
48 | }
49 | }
50 |
51 | }
52 |
--------------------------------------------------------------------------------
/viaforge-mc1194/src/main/java/de/florianmichael/viaforge/mixin/connect/MixinConnectScreen_1.java:
--------------------------------------------------------------------------------
1 | /*
2 | * This file is part of ViaForge - https://github.com/FlorianMichael/ViaForge
3 | * Copyright (C) 2021-2025 FlorianMichael/EnZaXD and contributors
4 | *
5 | * This program is free software: you can redistribute it and/or modify
6 | * it under the terms of the GNU General Public License as published by
7 | * the Free Software Foundation, either version 3 of the License, or
8 | * (at your option) any later version.
9 | *
10 | * This program is distributed in the hope that it will be useful,
11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 | * GNU General Public License for more details.
14 | *
15 | * You should have received a copy of the GNU General Public License
16 | * along with this program. If not, see .
17 | */
18 |
19 | package de.florianmichael.viaforge.mixin.connect;
20 |
21 | import de.florianmichael.viaforge.common.ViaForgeCommon;
22 | import de.florianmichael.viaforge.common.gui.ExtendedServerData;
23 | import de.florianmichael.viaforge.common.platform.VersionTracker;
24 | import com.viaversion.viaversion.api.protocol.version.ProtocolVersion;
25 | import net.minecraft.client.multiplayer.ServerData;
26 | import org.spongepowered.asm.mixin.Final;
27 | import org.spongepowered.asm.mixin.Mixin;
28 | import org.spongepowered.asm.mixin.Shadow;
29 | import org.spongepowered.asm.mixin.injection.At;
30 | import org.spongepowered.asm.mixin.injection.Redirect;
31 |
32 | import java.net.InetSocketAddress;
33 | import java.util.Optional;
34 |
35 | @Mixin(targets = "net.minecraft.client.gui.screens.ConnectScreen$1")
36 | public class MixinConnectScreen_1 {
37 |
38 | @Shadow @Final ServerData val$p_252078_;
39 |
40 | @Redirect(method = "run", at = @At(value = "INVOKE", target = "Ljava/util/Optional;get()Ljava/lang/Object;"))
41 | public Object trackServerVersion(Optional instance) {
42 | final InetSocketAddress address = (InetSocketAddress) instance.get();
43 | ProtocolVersion version = ((ExtendedServerData) val$p_252078_).viaForge$getVersion();
44 | if (version == null) {
45 | version = ViaForgeCommon.getManager().getTargetVersion();
46 | }
47 | VersionTracker.storeServerProtocolVersion(address.getAddress(), version);
48 | return address;
49 | }
50 |
51 | }
52 |
--------------------------------------------------------------------------------
/viaforge-mc1194/src/main/java/de/florianmichael/viaforge/mixin/connect/MixinConnection_1.java:
--------------------------------------------------------------------------------
1 | /*
2 | * This file is part of ViaForge - https://github.com/FlorianMichael/ViaForge
3 | * Copyright (C) 2021-2025 FlorianMichael/EnZaXD and contributors
4 | *
5 | * This program is free software: you can redistribute it and/or modify
6 | * it under the terms of the GNU General Public License as published by
7 | * the Free Software Foundation, either version 3 of the License, or
8 | * (at your option) any later version.
9 | *
10 | * This program is distributed in the hope that it will be useful,
11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 | * GNU General Public License for more details.
14 | *
15 | * You should have received a copy of the GNU General Public License
16 | * along with this program. If not, see .
17 | */
18 |
19 | package de.florianmichael.viaforge.mixin.connect;
20 |
21 | import de.florianmichael.viaforge.common.ViaForgeCommon;
22 | import de.florianmichael.viaforge.common.protocoltranslator.netty.VFNetworkManager;
23 | import io.netty.channel.Channel;
24 | import io.netty.channel.ChannelHandler;
25 | import org.spongepowered.asm.mixin.Mixin;
26 | import org.spongepowered.asm.mixin.injection.At;
27 | import org.spongepowered.asm.mixin.injection.Inject;
28 | import org.spongepowered.asm.mixin.injection.callback.CallbackInfo;
29 |
30 | @Mixin(targets = "net.minecraft.network.Connection$1")
31 | public class MixinConnection_1 {
32 |
33 | @Inject(method = "initChannel", at = @At("TAIL"))
34 | private void hookViaPipeline(Channel p_129552_, CallbackInfo ci) {
35 | final ChannelHandler connection = p_129552_.pipeline().get("packet_handler");
36 | ViaForgeCommon.getManager().inject(p_129552_, (VFNetworkManager) connection);
37 | }
38 |
39 | }
40 |
--------------------------------------------------------------------------------
/viaforge-mc1194/src/main/resources/META-INF/mods.toml:
--------------------------------------------------------------------------------
1 | modLoader="javafml"
2 | loaderVersion="[45,)"
3 |
4 | license="GPL-3.0 license"
5 | issueTrackerURL="https://github.com/ViaVersion/ViaForge/issues"
6 | showAsResourcePack=false
7 |
8 | [[mods]]
9 | modId="viaforge"
10 | version="${version}"
11 | displayName="ViaForge"
12 | displayURL="https://github.com/FlorianMichael"
13 | logoFile="icon.png"
14 | credits="Github contributors"
15 | authors="FlorianMichael/EnZaXD"
16 | description="${description}"
--------------------------------------------------------------------------------
/viaforge-mc1194/src/main/resources/mixins.viaforge-mc1194.json:
--------------------------------------------------------------------------------
1 | {
2 | "required": true,
3 | "minVersion": "0.7.5",
4 | "compatibilityLevel": "JAVA_8",
5 | "package": "de.florianmichael.viaforge.mixin",
6 | "client": [
7 | "MixinClientPacketListener",
8 | "MixinDebugScreenOverlay",
9 | "MixinDirectJoinServerScreen",
10 | "MixinEditServerScreen",
11 | "MixinJoinMultiplayerScreen",
12 | "MixinServerData",
13 | "MixinTitleScreen",
14 | "connect.MixinClientHandshakePacketListenerImpl",
15 | "connect.MixinConnection",
16 | "connect.MixinConnection_1",
17 | "connect.MixinConnectScreen_1",
18 | "connect.MixinServerStatusPinger"
19 | ],
20 | "injectors": {
21 | "defaultRequire": 1
22 | },
23 | "refmap": "mixins.viaforge-mc1194.refmap.json"
24 | }
25 |
--------------------------------------------------------------------------------
/viaforge-mc1201/gradle.properties:
--------------------------------------------------------------------------------
1 | forge_version=1.20.1-47.1.3
--------------------------------------------------------------------------------
/viaforge-mc1201/src/main/java/de/florianmichael/viaforge/mixin/MixinClientPacketListener.java:
--------------------------------------------------------------------------------
1 | /*
2 | * This file is part of ViaForge - https://github.com/FlorianMichael/ViaForge
3 | * Copyright (C) 2021-2025 FlorianMichael/EnZaXD and contributors
4 | *
5 | * This program is free software: you can redistribute it and/or modify
6 | * it under the terms of the GNU General Public License as published by
7 | * the Free Software Foundation, either version 3 of the License, or
8 | * (at your option) any later version.
9 | *
10 | * This program is distributed in the hope that it will be useful,
11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 | * GNU General Public License for more details.
14 | *
15 | * You should have received a copy of the GNU General Public License
16 | * along with this program. If not, see .
17 | */
18 |
19 | package de.florianmichael.viaforge.mixin;
20 |
21 | import de.florianmichael.viaforge.common.ViaForgeCommon;
22 | import net.minecraft.client.Minecraft;
23 | import net.minecraft.client.multiplayer.ClientPacketListener;
24 | import org.spongepowered.asm.mixin.Mixin;
25 | import org.spongepowered.asm.mixin.injection.At;
26 | import org.spongepowered.asm.mixin.injection.Inject;
27 | import org.spongepowered.asm.mixin.injection.callback.CallbackInfo;
28 |
29 | @Mixin(ClientPacketListener.class)
30 | public class MixinClientPacketListener {
31 |
32 | @Inject(method = "handleLogin", at = @At("RETURN"))
33 | public void sendConnectionDetails(CallbackInfo ci) {
34 | if (Minecraft.getInstance().player != null) {
35 | ViaForgeCommon.getManager().sendConnectionDetails(Minecraft.getInstance().player.connection.getConnection().channel());
36 | }
37 | }
38 |
39 | }
40 |
--------------------------------------------------------------------------------
/viaforge-mc1201/src/main/java/de/florianmichael/viaforge/mixin/MixinDebugScreenOverlay.java:
--------------------------------------------------------------------------------
1 | /*
2 | * This file is part of ViaForge - https://github.com/FlorianMichael/ViaForge
3 | * Copyright (C) 2021-2025 FlorianMichael/EnZaXD and contributors
4 | *
5 | * This program is free software: you can redistribute it and/or modify
6 | * it under the terms of the GNU General Public License as published by
7 | * the Free Software Foundation, either version 3 of the License, or
8 | * (at your option) any later version.
9 | *
10 | * This program is distributed in the hope that it will be useful,
11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 | * GNU General Public License for more details.
14 | *
15 | * You should have received a copy of the GNU General Public License
16 | * along with this program. If not, see .
17 | */
18 |
19 | package de.florianmichael.viaforge.mixin;
20 |
21 | import de.florianmichael.viaforge.common.ViaForgeCommon;
22 | import net.minecraft.client.gui.components.DebugScreenOverlay;
23 | import com.viaversion.viaversion.api.protocol.version.ProtocolVersion;
24 | import org.spongepowered.asm.mixin.Mixin;
25 | import org.spongepowered.asm.mixin.injection.At;
26 | import org.spongepowered.asm.mixin.injection.Inject;
27 | import org.spongepowered.asm.mixin.injection.callback.CallbackInfoReturnable;
28 |
29 | import java.util.List;
30 |
31 | @Mixin(DebugScreenOverlay.class)
32 | public class MixinDebugScreenOverlay {
33 |
34 | @Inject(method = "getSystemInformation", at = @At(value = "TAIL"))
35 | public void addViaForgeVersion(CallbackInfoReturnable> cir) {
36 | final ViaForgeCommon common = ViaForgeCommon.getManager();
37 | final ProtocolVersion version = ViaForgeCommon.getManager().getTargetVersion();
38 |
39 | if (common.getConfig().isShowProtocolVersionInF3() && version != common.getNativeVersion() && !common.getPlatform().isSingleplayer().get()) {
40 | cir.getReturnValue().add("");
41 | cir.getReturnValue().add("ViaForge: " + version.toString());
42 | }
43 | }
44 |
45 | }
46 |
--------------------------------------------------------------------------------
/viaforge-mc1201/src/main/java/de/florianmichael/viaforge/mixin/MixinDirectJoinServerScreen.java:
--------------------------------------------------------------------------------
1 | /*
2 | * This file is part of ViaForge - https://github.com/FlorianMichael/ViaForge
3 | * Copyright (C) 2021-2025 FlorianMichael/EnZaXD and contributors
4 | *
5 | * This program is free software: you can redistribute it and/or modify
6 | * it under the terms of the GNU General Public License as published by
7 | * the Free Software Foundation, either version 3 of the License, or
8 | * (at your option) any later version.
9 | *
10 | * This program is distributed in the hope that it will be useful,
11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 | * GNU General Public License for more details.
14 | *
15 | * You should have received a copy of the GNU General Public License
16 | * along with this program. If not, see .
17 | */
18 |
19 | package de.florianmichael.viaforge.mixin;
20 |
21 | import com.viaversion.viaversion.util.Pair;
22 | import de.florianmichael.viaforge.common.ViaForgeCommon;
23 | import de.florianmichael.viaforge.common.platform.ViaForgeConfig;
24 | import de.florianmichael.viaforge.gui.GuiProtocolSelector;
25 | import net.minecraft.client.gui.components.Button;
26 | import net.minecraft.client.gui.screens.DirectJoinServerScreen;
27 | import net.minecraft.client.gui.screens.Screen;
28 | import net.minecraft.network.chat.Component;
29 | import org.spongepowered.asm.mixin.Mixin;
30 | import org.spongepowered.asm.mixin.injection.At;
31 | import org.spongepowered.asm.mixin.injection.Inject;
32 | import org.spongepowered.asm.mixin.injection.callback.CallbackInfo;
33 |
34 | @Mixin(DirectJoinServerScreen.class)
35 | public class MixinDirectJoinServerScreen extends Screen {
36 |
37 | public MixinDirectJoinServerScreen(Component title) {
38 | super(title);
39 | }
40 |
41 | @Inject(method = "init", at = @At("RETURN"))
42 | public void hookViaForgeButton(CallbackInfo ci) {
43 | final ViaForgeConfig config = ViaForgeCommon.getManager().getConfig();
44 | if (config.isShowDirectConnectButton()) {
45 | final Pair pos = config.getViaForgeButtonPosition().getPosition(this.width, this.height);
46 |
47 | addRenderableWidget(Button.builder(Component.literal("ViaForge"), b -> GuiProtocolSelector.open(minecraft)).bounds(pos.key(), pos.value(), 100, 20).build());
48 | }
49 | }
50 |
51 | }
52 |
--------------------------------------------------------------------------------
/viaforge-mc1201/src/main/java/de/florianmichael/viaforge/mixin/MixinJoinMultiplayerScreen.java:
--------------------------------------------------------------------------------
1 | /*
2 | * This file is part of ViaForge - https://github.com/FlorianMichael/ViaForge
3 | * Copyright (C) 2021-2025 FlorianMichael/EnZaXD and contributors
4 | *
5 | * This program is free software: you can redistribute it and/or modify
6 | * it under the terms of the GNU General Public License as published by
7 | * the Free Software Foundation, either version 3 of the License, or
8 | * (at your option) any later version.
9 | *
10 | * This program is distributed in the hope that it will be useful,
11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 | * GNU General Public License for more details.
14 | *
15 | * You should have received a copy of the GNU General Public License
16 | * along with this program. If not, see .
17 | */
18 |
19 | package de.florianmichael.viaforge.mixin;
20 |
21 | import com.viaversion.viaversion.util.Pair;
22 | import de.florianmichael.viaforge.common.ViaForgeCommon;
23 | import de.florianmichael.viaforge.common.platform.ViaForgeConfig;
24 | import de.florianmichael.viaforge.gui.GuiProtocolSelector;
25 | import net.minecraft.client.gui.components.Button;
26 | import net.minecraft.client.gui.screens.Screen;
27 | import net.minecraft.client.gui.screens.multiplayer.JoinMultiplayerScreen;
28 | import net.minecraft.network.chat.Component;
29 | import org.spongepowered.asm.mixin.Mixin;
30 | import org.spongepowered.asm.mixin.injection.At;
31 | import org.spongepowered.asm.mixin.injection.Inject;
32 | import org.spongepowered.asm.mixin.injection.callback.CallbackInfo;
33 |
34 | @Mixin(JoinMultiplayerScreen.class)
35 | public class MixinJoinMultiplayerScreen extends Screen {
36 |
37 | public MixinJoinMultiplayerScreen(Component title) {
38 | super(title);
39 | }
40 |
41 | @Inject(method = "init", at = @At("RETURN"))
42 | public void hookViaForgeButton(CallbackInfo ci) {
43 | final ViaForgeConfig config = ViaForgeCommon.getManager().getConfig();
44 | if (config.isShowMainMenuButton()) {
45 | final Pair pos = config.getViaForgeButtonPosition().getPosition(this.width, this.height);
46 |
47 | addRenderableWidget(Button.builder(Component.literal("ViaForge"), buttons -> GuiProtocolSelector.open(minecraft)).bounds(pos.key(), pos.value(), 100, 20).build());
48 | }
49 | }
50 |
51 | }
52 |
--------------------------------------------------------------------------------
/viaforge-mc1201/src/main/java/de/florianmichael/viaforge/mixin/MixinTitleScreen.java:
--------------------------------------------------------------------------------
1 | /*
2 | * This file is part of ViaForge - https://github.com/FlorianMichael/ViaForge
3 | * Copyright (C) 2021-2025 FlorianMichael/EnZaXD and contributors
4 | *
5 | * This program is free software: you can redistribute it and/or modify
6 | * it under the terms of the GNU General Public License as published by
7 | * the Free Software Foundation, either version 3 of the License, or
8 | * (at your option) any later version.
9 | *
10 | * This program is distributed in the hope that it will be useful,
11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 | * GNU General Public License for more details.
14 | *
15 | * You should have received a copy of the GNU General Public License
16 | * along with this program. If not, see .
17 | */
18 |
19 | package de.florianmichael.viaforge.mixin;
20 |
21 | import com.viaversion.viaversion.util.Pair;
22 | import de.florianmichael.viaforge.common.ViaForgeCommon;
23 | import de.florianmichael.viaforge.common.platform.ViaForgeConfig;
24 | import de.florianmichael.viaforge.gui.GuiProtocolSelector;
25 | import net.minecraft.client.gui.components.Button;
26 | import net.minecraft.client.gui.screens.Screen;
27 | import net.minecraft.client.gui.screens.TitleScreen;
28 | import net.minecraft.network.chat.Component;
29 | import org.spongepowered.asm.mixin.Mixin;
30 | import org.spongepowered.asm.mixin.injection.At;
31 | import org.spongepowered.asm.mixin.injection.Inject;
32 | import org.spongepowered.asm.mixin.injection.callback.CallbackInfo;
33 |
34 | @Mixin(TitleScreen.class)
35 | public class MixinTitleScreen extends Screen {
36 |
37 | public MixinTitleScreen(Component title) {
38 | super(title);
39 | }
40 |
41 | @Inject(method = "init", at = @At("RETURN"))
42 | public void hookViaForgeButton(CallbackInfo ci) {
43 | final ViaForgeConfig config = ViaForgeCommon.getManager().getConfig();
44 | if (config.isShowMainMenuButton()) {
45 | final Pair pos = config.getViaForgeButtonPosition().getPosition(this.width, this.height);
46 |
47 | addRenderableWidget(Button.builder(Component.literal("ViaForge"), buttons -> GuiProtocolSelector.open(minecraft)).bounds(pos.key(), pos.value(), 100, 20).build());
48 | }
49 | }
50 |
51 | }
52 |
--------------------------------------------------------------------------------
/viaforge-mc1201/src/main/java/de/florianmichael/viaforge/mixin/connect/MixinConnection_1.java:
--------------------------------------------------------------------------------
1 | /*
2 | * This file is part of ViaForge - https://github.com/FlorianMichael/ViaForge
3 | * Copyright (C) 2021-2025 FlorianMichael/EnZaXD and contributors
4 | *
5 | * This program is free software: you can redistribute it and/or modify
6 | * it under the terms of the GNU General Public License as published by
7 | * the Free Software Foundation, either version 3 of the License, or
8 | * (at your option) any later version.
9 | *
10 | * This program is distributed in the hope that it will be useful,
11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 | * GNU General Public License for more details.
14 | *
15 | * You should have received a copy of the GNU General Public License
16 | * along with this program. If not, see .
17 | */
18 |
19 | package de.florianmichael.viaforge.mixin.connect;
20 |
21 | import de.florianmichael.viaforge.common.ViaForgeCommon;
22 | import de.florianmichael.viaforge.common.protocoltranslator.netty.VFNetworkManager;
23 | import io.netty.channel.Channel;
24 | import io.netty.channel.ChannelHandler;
25 | import org.spongepowered.asm.mixin.Mixin;
26 | import org.spongepowered.asm.mixin.injection.At;
27 | import org.spongepowered.asm.mixin.injection.Inject;
28 | import org.spongepowered.asm.mixin.injection.callback.CallbackInfo;
29 |
30 | @Mixin(targets = "net.minecraft.network.Connection$1")
31 | public class MixinConnection_1 {
32 |
33 | @Inject(method = "initChannel", at = @At("TAIL"))
34 | private void hookViaPipeline(Channel p_129552_, CallbackInfo ci) {
35 | final ChannelHandler connection = p_129552_.pipeline().get("packet_handler");
36 | ViaForgeCommon.getManager().inject(p_129552_, (VFNetworkManager) connection);
37 | }
38 |
39 | }
40 |
--------------------------------------------------------------------------------
/viaforge-mc1201/src/main/resources/META-INF/mods.toml:
--------------------------------------------------------------------------------
1 | modLoader="javafml"
2 | loaderVersion="[46,)"
3 |
4 | license="GPL-3.0 license"
5 | issueTrackerURL="https://github.com/ViaVersion/ViaForge/issues"
6 | showAsResourcePack=false
7 |
8 | [[mods]]
9 | modId="viaforge"
10 | version="${version}"
11 | displayName="ViaForge"
12 | displayURL="https://github.com/FlorianMichael"
13 | logoFile="icon.png"
14 | credits="Github contributors"
15 | authors="FlorianMichael/EnZaXD"
16 | description="${description}"
--------------------------------------------------------------------------------
/viaforge-mc1201/src/main/resources/mixins.viaforge-mc1201.json:
--------------------------------------------------------------------------------
1 | {
2 | "required": true,
3 | "minVersion": "0.7.5",
4 | "compatibilityLevel": "JAVA_8",
5 | "package": "de.florianmichael.viaforge.mixin",
6 | "client": [
7 | "MixinClientPacketListener",
8 | "MixinDebugScreenOverlay",
9 | "MixinDirectJoinServerScreen",
10 | "MixinEditServerScreen",
11 | "MixinJoinMultiplayerScreen",
12 | "MixinServerData",
13 | "MixinTitleScreen",
14 | "connect.MixinClientHandshakePacketListenerImpl",
15 | "connect.MixinConnection",
16 | "connect.MixinConnection_1",
17 | "connect.MixinConnectScreen_1",
18 | "connect.MixinServerStatusPinger"
19 | ],
20 | "injectors": {
21 | "defaultRequire": 1
22 | },
23 | "refmap": "mixins.viaforge-mc1201.refmap.json"
24 | }
25 |
--------------------------------------------------------------------------------
/viaforge-mc1204/gradle.properties:
--------------------------------------------------------------------------------
1 | forge_version=1.20.4-49.0.13
--------------------------------------------------------------------------------
/viaforge-mc1204/src/main/java/de/florianmichael/viaforge/mixin/MixinClientPacketListener.java:
--------------------------------------------------------------------------------
1 | /*
2 | * This file is part of ViaForge - https://github.com/FlorianMichael/ViaForge
3 | * Copyright (C) 2021-2025 FlorianMichael/EnZaXD and contributors
4 | *
5 | * This program is free software: you can redistribute it and/or modify
6 | * it under the terms of the GNU General Public License as published by
7 | * the Free Software Foundation, either version 3 of the License, or
8 | * (at your option) any later version.
9 | *
10 | * This program is distributed in the hope that it will be useful,
11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 | * GNU General Public License for more details.
14 | *
15 | * You should have received a copy of the GNU General Public License
16 | * along with this program. If not, see .
17 | */
18 |
19 | package de.florianmichael.viaforge.mixin;
20 |
21 | import de.florianmichael.viaforge.common.ViaForgeCommon;
22 | import net.minecraft.client.Minecraft;
23 | import net.minecraft.client.multiplayer.ClientPacketListener;
24 | import org.spongepowered.asm.mixin.Mixin;
25 | import org.spongepowered.asm.mixin.injection.At;
26 | import org.spongepowered.asm.mixin.injection.Inject;
27 | import org.spongepowered.asm.mixin.injection.callback.CallbackInfo;
28 |
29 | @Mixin(ClientPacketListener.class)
30 | public class MixinClientPacketListener {
31 |
32 | @Inject(method = "handleLogin", at = @At("RETURN"))
33 | public void sendConnectionDetails(CallbackInfo ci) {
34 | if (Minecraft.getInstance().player != null) {
35 | ViaForgeCommon.getManager().sendConnectionDetails(Minecraft.getInstance().player.connection.getConnection().channel());
36 | }
37 | }
38 |
39 | }
40 |
--------------------------------------------------------------------------------
/viaforge-mc1204/src/main/java/de/florianmichael/viaforge/mixin/MixinDebugScreenOverlay.java:
--------------------------------------------------------------------------------
1 | /*
2 | * This file is part of ViaForge - https://github.com/FlorianMichael/ViaForge
3 | * Copyright (C) 2021-2025 FlorianMichael/EnZaXD and contributors
4 | *
5 | * This program is free software: you can redistribute it and/or modify
6 | * it under the terms of the GNU General Public License as published by
7 | * the Free Software Foundation, either version 3 of the License, or
8 | * (at your option) any later version.
9 | *
10 | * This program is distributed in the hope that it will be useful,
11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 | * GNU General Public License for more details.
14 | *
15 | * You should have received a copy of the GNU General Public License
16 | * along with this program. If not, see .
17 | */
18 |
19 | package de.florianmichael.viaforge.mixin;
20 |
21 | import de.florianmichael.viaforge.common.ViaForgeCommon;
22 | import net.minecraft.client.gui.components.DebugScreenOverlay;
23 | import com.viaversion.viaversion.api.protocol.version.ProtocolVersion;
24 | import org.spongepowered.asm.mixin.Mixin;
25 | import org.spongepowered.asm.mixin.injection.At;
26 | import org.spongepowered.asm.mixin.injection.Inject;
27 | import org.spongepowered.asm.mixin.injection.callback.CallbackInfoReturnable;
28 |
29 | import java.util.List;
30 |
31 | @Mixin(DebugScreenOverlay.class)
32 | public class MixinDebugScreenOverlay {
33 |
34 | @Inject(method = "getSystemInformation", at = @At(value = "TAIL"))
35 | public void addViaForgeVersion(CallbackInfoReturnable> cir) {
36 | final ViaForgeCommon common = ViaForgeCommon.getManager();
37 | final ProtocolVersion version = ViaForgeCommon.getManager().getTargetVersion();
38 |
39 | if (common.getConfig().isShowProtocolVersionInF3() && version != common.getNativeVersion() && !common.getPlatform().isSingleplayer().get()) {
40 | cir.getReturnValue().add("");
41 | cir.getReturnValue().add("ViaForge: " + version.toString());
42 | }
43 | }
44 |
45 | }
46 |
--------------------------------------------------------------------------------
/viaforge-mc1204/src/main/java/de/florianmichael/viaforge/mixin/MixinDirectJoinServerScreen.java:
--------------------------------------------------------------------------------
1 | /*
2 | * This file is part of ViaForge - https://github.com/FlorianMichael/ViaForge
3 | * Copyright (C) 2021-2025 FlorianMichael/EnZaXD and contributors
4 | *
5 | * This program is free software: you can redistribute it and/or modify
6 | * it under the terms of the GNU General Public License as published by
7 | * the Free Software Foundation, either version 3 of the License, or
8 | * (at your option) any later version.
9 | *
10 | * This program is distributed in the hope that it will be useful,
11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 | * GNU General Public License for more details.
14 | *
15 | * You should have received a copy of the GNU General Public License
16 | * along with this program. If not, see .
17 | */
18 |
19 | package de.florianmichael.viaforge.mixin;
20 |
21 | import com.viaversion.viaversion.util.Pair;
22 | import de.florianmichael.viaforge.common.ViaForgeCommon;
23 | import de.florianmichael.viaforge.common.platform.ViaForgeConfig;
24 | import de.florianmichael.viaforge.gui.GuiProtocolSelector;
25 | import net.minecraft.client.gui.components.Button;
26 | import net.minecraft.client.gui.screens.DirectJoinServerScreen;
27 | import net.minecraft.client.gui.screens.Screen;
28 | import net.minecraft.network.chat.Component;
29 | import org.spongepowered.asm.mixin.Mixin;
30 | import org.spongepowered.asm.mixin.injection.At;
31 | import org.spongepowered.asm.mixin.injection.Inject;
32 | import org.spongepowered.asm.mixin.injection.callback.CallbackInfo;
33 |
34 | @Mixin(DirectJoinServerScreen.class)
35 | public class MixinDirectJoinServerScreen extends Screen {
36 |
37 | public MixinDirectJoinServerScreen(Component title) {
38 | super(title);
39 | }
40 |
41 | @Inject(method = "init", at = @At("RETURN"))
42 | public void hookViaForgeButton(CallbackInfo ci) {
43 | final ViaForgeConfig config = ViaForgeCommon.getManager().getConfig();
44 | if (config.isShowDirectConnectButton()) {
45 | final Pair pos = config.getViaForgeButtonPosition().getPosition(this.width, this.height);
46 |
47 | addRenderableWidget(Button.builder(Component.literal("ViaForge"), b -> GuiProtocolSelector.open(minecraft)).bounds(pos.key(), pos.value(), 100, 20).build());
48 | }
49 | }
50 |
51 | }
52 |
--------------------------------------------------------------------------------
/viaforge-mc1204/src/main/java/de/florianmichael/viaforge/mixin/MixinJoinMultiplayerScreen.java:
--------------------------------------------------------------------------------
1 | /*
2 | * This file is part of ViaForge - https://github.com/FlorianMichael/ViaForge
3 | * Copyright (C) 2021-2025 FlorianMichael/EnZaXD and contributors
4 | *
5 | * This program is free software: you can redistribute it and/or modify
6 | * it under the terms of the GNU General Public License as published by
7 | * the Free Software Foundation, either version 3 of the License, or
8 | * (at your option) any later version.
9 | *
10 | * This program is distributed in the hope that it will be useful,
11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 | * GNU General Public License for more details.
14 | *
15 | * You should have received a copy of the GNU General Public License
16 | * along with this program. If not, see .
17 | */
18 |
19 | package de.florianmichael.viaforge.mixin;
20 |
21 | import com.viaversion.viaversion.util.Pair;
22 | import de.florianmichael.viaforge.common.ViaForgeCommon;
23 | import de.florianmichael.viaforge.common.platform.ViaForgeConfig;
24 | import de.florianmichael.viaforge.gui.GuiProtocolSelector;
25 | import net.minecraft.client.gui.components.Button;
26 | import net.minecraft.client.gui.screens.Screen;
27 | import net.minecraft.client.gui.screens.multiplayer.JoinMultiplayerScreen;
28 | import net.minecraft.network.chat.Component;
29 | import org.spongepowered.asm.mixin.Mixin;
30 | import org.spongepowered.asm.mixin.injection.At;
31 | import org.spongepowered.asm.mixin.injection.Inject;
32 | import org.spongepowered.asm.mixin.injection.callback.CallbackInfo;
33 |
34 | @Mixin(JoinMultiplayerScreen.class)
35 | public class MixinJoinMultiplayerScreen extends Screen {
36 |
37 | public MixinJoinMultiplayerScreen(Component title) {
38 | super(title);
39 | }
40 |
41 | @Inject(method = "init", at = @At("RETURN"))
42 | public void hookViaForgeButton(CallbackInfo ci) {
43 | final ViaForgeConfig config = ViaForgeCommon.getManager().getConfig();
44 | if (config.isShowMainMenuButton()) {
45 | final Pair pos = config.getViaForgeButtonPosition().getPosition(this.width, this.height);
46 |
47 | addRenderableWidget(Button.builder(Component.literal("ViaForge"), buttons -> GuiProtocolSelector.open(minecraft)).bounds(pos.key(), pos.value(), 100, 20).build());
48 | }
49 | }
50 |
51 | }
52 |
--------------------------------------------------------------------------------
/viaforge-mc1204/src/main/java/de/florianmichael/viaforge/mixin/MixinTitleScreen.java:
--------------------------------------------------------------------------------
1 | /*
2 | * This file is part of ViaForge - https://github.com/FlorianMichael/ViaForge
3 | * Copyright (C) 2021-2025 FlorianMichael/EnZaXD and contributors
4 | *
5 | * This program is free software: you can redistribute it and/or modify
6 | * it under the terms of the GNU General Public License as published by
7 | * the Free Software Foundation, either version 3 of the License, or
8 | * (at your option) any later version.
9 | *
10 | * This program is distributed in the hope that it will be useful,
11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 | * GNU General Public License for more details.
14 | *
15 | * You should have received a copy of the GNU General Public License
16 | * along with this program. If not, see .
17 | */
18 |
19 | package de.florianmichael.viaforge.mixin;
20 |
21 | import com.viaversion.viaversion.util.Pair;
22 | import de.florianmichael.viaforge.common.ViaForgeCommon;
23 | import de.florianmichael.viaforge.common.platform.ViaForgeConfig;
24 | import de.florianmichael.viaforge.gui.GuiProtocolSelector;
25 | import net.minecraft.client.gui.components.Button;
26 | import net.minecraft.client.gui.screens.Screen;
27 | import net.minecraft.client.gui.screens.TitleScreen;
28 | import net.minecraft.network.chat.Component;
29 | import org.spongepowered.asm.mixin.Mixin;
30 | import org.spongepowered.asm.mixin.injection.At;
31 | import org.spongepowered.asm.mixin.injection.Inject;
32 | import org.spongepowered.asm.mixin.injection.callback.CallbackInfo;
33 |
34 | @Mixin(TitleScreen.class)
35 | public class MixinTitleScreen extends Screen {
36 |
37 | public MixinTitleScreen(Component title) {
38 | super(title);
39 | }
40 |
41 | @Inject(method = "init", at = @At("RETURN"))
42 | public void hookViaForgeButton(CallbackInfo ci) {
43 | final ViaForgeConfig config = ViaForgeCommon.getManager().getConfig();
44 | if (config.isShowMainMenuButton()) {
45 | final Pair pos = config.getViaForgeButtonPosition().getPosition(this.width, this.height);
46 |
47 | addRenderableWidget(Button.builder(Component.literal("ViaForge"), buttons -> GuiProtocolSelector.open(minecraft)).bounds(pos.key(), pos.value(), 100, 20).build());
48 | }
49 | }
50 |
51 | }
52 |
--------------------------------------------------------------------------------
/viaforge-mc1204/src/main/java/de/florianmichael/viaforge/mixin/connect/MixinConnectScreen_1.java:
--------------------------------------------------------------------------------
1 | /*
2 | * This file is part of ViaForge - https://github.com/FlorianMichael/ViaForge
3 | * Copyright (C) 2021-2025 FlorianMichael/EnZaXD and contributors
4 | *
5 | * This program is free software: you can redistribute it and/or modify
6 | * it under the terms of the GNU General Public License as published by
7 | * the Free Software Foundation, either version 3 of the License, or
8 | * (at your option) any later version.
9 | *
10 | * This program is distributed in the hope that it will be useful,
11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 | * GNU General Public License for more details.
14 | *
15 | * You should have received a copy of the GNU General Public License
16 | * along with this program. If not, see .
17 | */
18 |
19 | package de.florianmichael.viaforge.mixin.connect;
20 |
21 | import com.viaversion.viaversion.api.protocol.version.ProtocolVersion;
22 | import de.florianmichael.viaforge.common.ViaForgeCommon;
23 | import de.florianmichael.viaforge.common.gui.ExtendedServerData;
24 | import de.florianmichael.viaforge.common.platform.VersionTracker;
25 | import net.minecraft.client.multiplayer.ServerData;
26 | import org.spongepowered.asm.mixin.Final;
27 | import org.spongepowered.asm.mixin.Mixin;
28 | import org.spongepowered.asm.mixin.Shadow;
29 | import org.spongepowered.asm.mixin.injection.At;
30 | import org.spongepowered.asm.mixin.injection.Redirect;
31 |
32 | import java.net.InetSocketAddress;
33 | import java.util.Optional;
34 |
35 | @Mixin(targets = "net.minecraft.client.gui.screens.ConnectScreen$1")
36 | public class MixinConnectScreen_1 {
37 |
38 | @Shadow
39 | @Final
40 | private ServerData val$p_252078_;
41 |
42 | @Redirect(method = "run", at = @At(value = "INVOKE", target = "Ljava/util/Optional;get()Ljava/lang/Object;"))
43 | public Object trackServerVersion(Optional instance) {
44 | final InetSocketAddress address = (InetSocketAddress) instance.get();
45 | ProtocolVersion version = ((ExtendedServerData) val$p_252078_).viaForge$getVersion();
46 | if (version == null) {
47 | version = ViaForgeCommon.getManager().getTargetVersion();
48 | }
49 | VersionTracker.storeServerProtocolVersion(address.getAddress(), version);
50 | return address;
51 | }
52 |
53 | }
54 |
--------------------------------------------------------------------------------
/viaforge-mc1204/src/main/java/de/florianmichael/viaforge/mixin/connect/MixinConnection_1.java:
--------------------------------------------------------------------------------
1 | /*
2 | * This file is part of ViaForge - https://github.com/FlorianMichael/ViaForge
3 | * Copyright (C) 2021-2025 FlorianMichael/EnZaXD and contributors
4 | *
5 | * This program is free software: you can redistribute it and/or modify
6 | * it under the terms of the GNU General Public License as published by
7 | * the Free Software Foundation, either version 3 of the License, or
8 | * (at your option) any later version.
9 | *
10 | * This program is distributed in the hope that it will be useful,
11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 | * GNU General Public License for more details.
14 | *
15 | * You should have received a copy of the GNU General Public License
16 | * along with this program. If not, see .
17 | */
18 |
19 | package de.florianmichael.viaforge.mixin.connect;
20 |
21 | import de.florianmichael.viaforge.common.ViaForgeCommon;
22 | import de.florianmichael.viaforge.common.protocoltranslator.netty.VFNetworkManager;
23 | import io.netty.channel.Channel;
24 | import io.netty.channel.ChannelHandler;
25 | import org.spongepowered.asm.mixin.Mixin;
26 | import org.spongepowered.asm.mixin.injection.At;
27 | import org.spongepowered.asm.mixin.injection.Inject;
28 | import org.spongepowered.asm.mixin.injection.callback.CallbackInfo;
29 |
30 | @Mixin(targets = "net.minecraft.network.Connection$1")
31 | public class MixinConnection_1 {
32 |
33 | @Inject(method = "initChannel", at = @At("TAIL"))
34 | private void hookViaPipeline(Channel p_129552_, CallbackInfo ci) {
35 | final ChannelHandler connection = p_129552_.pipeline().get("packet_handler");
36 | ViaForgeCommon.getManager().inject(p_129552_, (VFNetworkManager) connection);
37 | }
38 |
39 | }
40 |
--------------------------------------------------------------------------------
/viaforge-mc1204/src/main/resources/META-INF/mods.toml:
--------------------------------------------------------------------------------
1 | modLoader="javafml"
2 | loaderVersion="[49,)"
3 |
4 | license="GPL-3.0 license"
5 | issueTrackerURL="https://github.com/ViaVersion/ViaForge/issues"
6 | showAsResourcePack=false
7 |
8 | [[mods]]
9 | modId="viaforge"
10 | version="${version}"
11 | displayName="ViaForge"
12 | displayURL="https://github.com/FlorianMichael"
13 | logoFile="icon.png"
14 | credits="Github contributors"
15 | authors="FlorianMichael/EnZaXD"
16 | description="${description}"
--------------------------------------------------------------------------------
/viaforge-mc1204/src/main/resources/mixins.viaforge-mc1204.json:
--------------------------------------------------------------------------------
1 | {
2 | "required": true,
3 | "minVersion": "0.7.5",
4 | "compatibilityLevel": "JAVA_8",
5 | "package": "de.florianmichael.viaforge.mixin",
6 | "client": [
7 | "MixinClientPacketListener",
8 | "MixinDebugScreenOverlay",
9 | "MixinDirectJoinServerScreen",
10 | "MixinEditServerScreen",
11 | "MixinJoinMultiplayerScreen",
12 | "MixinServerData",
13 | "MixinTitleScreen",
14 | "connect.MixinClientHandshakePacketListenerImpl",
15 | "connect.MixinConnection",
16 | "connect.MixinConnection_1",
17 | "connect.MixinConnectScreen_1",
18 | "connect.MixinServerStatusPinger"
19 | ],
20 | "injectors": {
21 | "defaultRequire": 1
22 | },
23 | "refmap": "mixins.viaforge-mc1204.refmap.json"
24 | }
25 |
--------------------------------------------------------------------------------
/viaforge-mc1206/build.gradle:
--------------------------------------------------------------------------------
1 | // ....
2 |
3 | minecraft {
4 | reobf = false // Official mappings at runtime for 1.20.5+
5 | }
--------------------------------------------------------------------------------
/viaforge-mc1206/gradle.properties:
--------------------------------------------------------------------------------
1 | forge_version=1.20.6-50.1.12
--------------------------------------------------------------------------------
/viaforge-mc1206/src/main/java/de/florianmichael/viaforge/mixin/MixinClientPacketListener.java:
--------------------------------------------------------------------------------
1 | /*
2 | * This file is part of ViaForge - https://github.com/FlorianMichael/ViaForge
3 | * Copyright (C) 2021-2025 FlorianMichael/EnZaXD and contributors
4 | *
5 | * This program is free software: you can redistribute it and/or modify
6 | * it under the terms of the GNU General Public License as published by
7 | * the Free Software Foundation, either version 3 of the License, or
8 | * (at your option) any later version.
9 | *
10 | * This program is distributed in the hope that it will be useful,
11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 | * GNU General Public License for more details.
14 | *
15 | * You should have received a copy of the GNU General Public License
16 | * along with this program. If not, see .
17 | */
18 |
19 | package de.florianmichael.viaforge.mixin;
20 |
21 | import de.florianmichael.viaforge.common.ViaForgeCommon;
22 | import net.minecraft.client.Minecraft;
23 | import net.minecraft.client.multiplayer.ClientPacketListener;
24 | import org.spongepowered.asm.mixin.Mixin;
25 | import org.spongepowered.asm.mixin.injection.At;
26 | import org.spongepowered.asm.mixin.injection.Inject;
27 | import org.spongepowered.asm.mixin.injection.callback.CallbackInfo;
28 |
29 | @Mixin(ClientPacketListener.class)
30 | public class MixinClientPacketListener {
31 |
32 | @Inject(method = "handleLogin", at = @At("RETURN"))
33 | public void sendConnectionDetails(CallbackInfo ci) {
34 | if (Minecraft.getInstance().player != null) {
35 | ViaForgeCommon.getManager().sendConnectionDetails(Minecraft.getInstance().player.connection.getConnection().channel());
36 | }
37 | }
38 |
39 | }
40 |
--------------------------------------------------------------------------------
/viaforge-mc1206/src/main/java/de/florianmichael/viaforge/mixin/MixinDebugScreenOverlay.java:
--------------------------------------------------------------------------------
1 | /*
2 | * This file is part of ViaForge - https://github.com/FlorianMichael/ViaForge
3 | * Copyright (C) 2021-2025 FlorianMichael/EnZaXD and contributors
4 | *
5 | * This program is free software: you can redistribute it and/or modify
6 | * it under the terms of the GNU General Public License as published by
7 | * the Free Software Foundation, either version 3 of the License, or
8 | * (at your option) any later version.
9 | *
10 | * This program is distributed in the hope that it will be useful,
11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 | * GNU General Public License for more details.
14 | *
15 | * You should have received a copy of the GNU General Public License
16 | * along with this program. If not, see .
17 | */
18 |
19 | package de.florianmichael.viaforge.mixin;
20 |
21 | import de.florianmichael.viaforge.common.ViaForgeCommon;
22 | import net.minecraft.client.gui.components.DebugScreenOverlay;
23 | import com.viaversion.viaversion.api.protocol.version.ProtocolVersion;
24 | import org.spongepowered.asm.mixin.Mixin;
25 | import org.spongepowered.asm.mixin.injection.At;
26 | import org.spongepowered.asm.mixin.injection.Inject;
27 | import org.spongepowered.asm.mixin.injection.callback.CallbackInfoReturnable;
28 |
29 | import java.util.List;
30 |
31 | @Mixin(DebugScreenOverlay.class)
32 | public class MixinDebugScreenOverlay {
33 |
34 | @Inject(method = "getSystemInformation", at = @At(value = "TAIL"))
35 | public void addViaForgeVersion(CallbackInfoReturnable> cir) {
36 | final ViaForgeCommon common = ViaForgeCommon.getManager();
37 | final ProtocolVersion version = ViaForgeCommon.getManager().getTargetVersion();
38 |
39 | if (common.getConfig().isShowProtocolVersionInF3() && version != common.getNativeVersion() && !common.getPlatform().isSingleplayer().get()) {
40 | cir.getReturnValue().add("");
41 | cir.getReturnValue().add("ViaForge: " + version.toString());
42 | }
43 | }
44 |
45 | }
46 |
--------------------------------------------------------------------------------
/viaforge-mc1206/src/main/java/de/florianmichael/viaforge/mixin/MixinDirectJoinServerScreen.java:
--------------------------------------------------------------------------------
1 | /*
2 | * This file is part of ViaForge - https://github.com/FlorianMichael/ViaForge
3 | * Copyright (C) 2021-2025 FlorianMichael/EnZaXD and contributors
4 | *
5 | * This program is free software: you can redistribute it and/or modify
6 | * it under the terms of the GNU General Public License as published by
7 | * the Free Software Foundation, either version 3 of the License, or
8 | * (at your option) any later version.
9 | *
10 | * This program is distributed in the hope that it will be useful,
11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 | * GNU General Public License for more details.
14 | *
15 | * You should have received a copy of the GNU General Public License
16 | * along with this program. If not, see .
17 | */
18 |
19 | package de.florianmichael.viaforge.mixin;
20 |
21 | import com.viaversion.viaversion.util.Pair;
22 | import de.florianmichael.viaforge.common.ViaForgeCommon;
23 | import de.florianmichael.viaforge.common.platform.ViaForgeConfig;
24 | import de.florianmichael.viaforge.gui.GuiProtocolSelector;
25 | import net.minecraft.client.gui.components.Button;
26 | import net.minecraft.client.gui.screens.DirectJoinServerScreen;
27 | import net.minecraft.client.gui.screens.Screen;
28 | import net.minecraft.network.chat.Component;
29 | import org.spongepowered.asm.mixin.Mixin;
30 | import org.spongepowered.asm.mixin.injection.At;
31 | import org.spongepowered.asm.mixin.injection.Inject;
32 | import org.spongepowered.asm.mixin.injection.callback.CallbackInfo;
33 |
34 | @Mixin(DirectJoinServerScreen.class)
35 | public class MixinDirectJoinServerScreen extends Screen {
36 |
37 | public MixinDirectJoinServerScreen(Component title) {
38 | super(title);
39 | }
40 |
41 | @Inject(method = "init", at = @At("RETURN"))
42 | public void hookViaForgeButton(CallbackInfo ci) {
43 | final ViaForgeConfig config = ViaForgeCommon.getManager().getConfig();
44 | if (config.isShowDirectConnectButton()) {
45 | final Pair pos = config.getViaForgeButtonPosition().getPosition(this.width, this.height);
46 |
47 | addRenderableWidget(Button.builder(Component.literal("ViaForge"), b -> GuiProtocolSelector.open(minecraft)).bounds(pos.key(), pos.value(), 100, 20).build());
48 | }
49 | }
50 |
51 | }
52 |
--------------------------------------------------------------------------------
/viaforge-mc1206/src/main/java/de/florianmichael/viaforge/mixin/MixinJoinMultiplayerScreen.java:
--------------------------------------------------------------------------------
1 | /*
2 | * This file is part of ViaForge - https://github.com/FlorianMichael/ViaForge
3 | * Copyright (C) 2021-2025 FlorianMichael/EnZaXD and contributors
4 | *
5 | * This program is free software: you can redistribute it and/or modify
6 | * it under the terms of the GNU General Public License as published by
7 | * the Free Software Foundation, either version 3 of the License, or
8 | * (at your option) any later version.
9 | *
10 | * This program is distributed in the hope that it will be useful,
11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 | * GNU General Public License for more details.
14 | *
15 | * You should have received a copy of the GNU General Public License
16 | * along with this program. If not, see .
17 | */
18 |
19 | package de.florianmichael.viaforge.mixin;
20 |
21 | import com.viaversion.viaversion.util.Pair;
22 | import de.florianmichael.viaforge.common.ViaForgeCommon;
23 | import de.florianmichael.viaforge.common.platform.ViaForgeConfig;
24 | import de.florianmichael.viaforge.gui.GuiProtocolSelector;
25 | import net.minecraft.client.gui.components.Button;
26 | import net.minecraft.client.gui.screens.Screen;
27 | import net.minecraft.client.gui.screens.multiplayer.JoinMultiplayerScreen;
28 | import net.minecraft.network.chat.Component;
29 | import org.spongepowered.asm.mixin.Mixin;
30 | import org.spongepowered.asm.mixin.injection.At;
31 | import org.spongepowered.asm.mixin.injection.Inject;
32 | import org.spongepowered.asm.mixin.injection.callback.CallbackInfo;
33 |
34 | @Mixin(JoinMultiplayerScreen.class)
35 | public class MixinJoinMultiplayerScreen extends Screen {
36 |
37 | public MixinJoinMultiplayerScreen(Component title) {
38 | super(title);
39 | }
40 |
41 | @Inject(method = "init", at = @At("RETURN"))
42 | public void hookViaForgeButton(CallbackInfo ci) {
43 | final ViaForgeConfig config = ViaForgeCommon.getManager().getConfig();
44 | if (config.isShowMainMenuButton()) {
45 | final Pair pos = config.getViaForgeButtonPosition().getPosition(this.width, this.height);
46 |
47 | addRenderableWidget(Button.builder(Component.literal("ViaForge"), buttons -> GuiProtocolSelector.open(minecraft)).bounds(pos.key(), pos.value(), 100, 20).build());
48 | }
49 | }
50 |
51 | }
52 |
--------------------------------------------------------------------------------
/viaforge-mc1206/src/main/java/de/florianmichael/viaforge/mixin/MixinTitleScreen.java:
--------------------------------------------------------------------------------
1 | /*
2 | * This file is part of ViaForge - https://github.com/FlorianMichael/ViaForge
3 | * Copyright (C) 2021-2025 FlorianMichael/EnZaXD and contributors
4 | *
5 | * This program is free software: you can redistribute it and/or modify
6 | * it under the terms of the GNU General Public License as published by
7 | * the Free Software Foundation, either version 3 of the License, or
8 | * (at your option) any later version.
9 | *
10 | * This program is distributed in the hope that it will be useful,
11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 | * GNU General Public License for more details.
14 | *
15 | * You should have received a copy of the GNU General Public License
16 | * along with this program. If not, see .
17 | */
18 |
19 | package de.florianmichael.viaforge.mixin;
20 |
21 | import com.viaversion.viaversion.util.Pair;
22 | import de.florianmichael.viaforge.common.ViaForgeCommon;
23 | import de.florianmichael.viaforge.common.platform.ViaForgeConfig;
24 | import de.florianmichael.viaforge.gui.GuiProtocolSelector;
25 | import net.minecraft.client.gui.components.Button;
26 | import net.minecraft.client.gui.screens.Screen;
27 | import net.minecraft.client.gui.screens.TitleScreen;
28 | import net.minecraft.network.chat.Component;
29 | import org.spongepowered.asm.mixin.Mixin;
30 | import org.spongepowered.asm.mixin.injection.At;
31 | import org.spongepowered.asm.mixin.injection.Inject;
32 | import org.spongepowered.asm.mixin.injection.callback.CallbackInfo;
33 |
34 | @Mixin(TitleScreen.class)
35 | public class MixinTitleScreen extends Screen {
36 |
37 | public MixinTitleScreen(Component title) {
38 | super(title);
39 | }
40 |
41 | @Inject(method = "init", at = @At("RETURN"))
42 | public void hookViaForgeButton(CallbackInfo ci) {
43 | final ViaForgeConfig config = ViaForgeCommon.getManager().getConfig();
44 | if (config.isShowMainMenuButton()) {
45 | final Pair pos = config.getViaForgeButtonPosition().getPosition(this.width, this.height);
46 |
47 | addRenderableWidget(Button.builder(Component.literal("ViaForge"), buttons -> GuiProtocolSelector.open(minecraft)).bounds(pos.key(), pos.value(), 100, 20).build());
48 | }
49 | }
50 |
51 | }
52 |
--------------------------------------------------------------------------------
/viaforge-mc1206/src/main/java/de/florianmichael/viaforge/mixin/connect/MixinConnectScreen_1.java:
--------------------------------------------------------------------------------
1 | /*
2 | * This file is part of ViaForge - https://github.com/FlorianMichael/ViaForge
3 | * Copyright (C) 2021-2025 FlorianMichael/EnZaXD and contributors
4 | *
5 | * This program is free software: you can redistribute it and/or modify
6 | * it under the terms of the GNU General Public License as published by
7 | * the Free Software Foundation, either version 3 of the License, or
8 | * (at your option) any later version.
9 | *
10 | * This program is distributed in the hope that it will be useful,
11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 | * GNU General Public License for more details.
14 | *
15 | * You should have received a copy of the GNU General Public License
16 | * along with this program. If not, see .
17 | */
18 |
19 | package de.florianmichael.viaforge.mixin.connect;
20 |
21 | import com.viaversion.viaversion.api.protocol.version.ProtocolVersion;
22 | import de.florianmichael.viaforge.common.ViaForgeCommon;
23 | import de.florianmichael.viaforge.common.gui.ExtendedServerData;
24 | import de.florianmichael.viaforge.common.platform.VersionTracker;
25 | import net.minecraft.client.multiplayer.ServerData;
26 | import org.spongepowered.asm.mixin.Mixin;
27 | import org.spongepowered.asm.mixin.Shadow;
28 | import org.spongepowered.asm.mixin.injection.At;
29 | import org.spongepowered.asm.mixin.injection.Redirect;
30 |
31 | import java.net.InetSocketAddress;
32 | import java.util.Optional;
33 |
34 | @Mixin(targets = "net.minecraft.client.gui.screens.ConnectScreen$1")
35 | public class MixinConnectScreen_1 {
36 |
37 | @Shadow
38 | private ServerData val$p_252078_;
39 |
40 | @Redirect(method = "run", at = @At(value = "INVOKE", target = "Ljava/util/Optional;get()Ljava/lang/Object;"))
41 | public Object trackServerVersion(Optional instance) {
42 | final InetSocketAddress address = (InetSocketAddress) instance.get();
43 | ProtocolVersion version = ((ExtendedServerData) val$p_252078_).viaForge$getVersion();
44 | if (version == null) {
45 | version = ViaForgeCommon.getManager().getTargetVersion();
46 | }
47 | VersionTracker.storeServerProtocolVersion(address.getAddress(), version);
48 | return address;
49 | }
50 |
51 | }
52 |
--------------------------------------------------------------------------------
/viaforge-mc1206/src/main/java/de/florianmichael/viaforge/mixin/connect/MixinConnection_1.java:
--------------------------------------------------------------------------------
1 | /*
2 | * This file is part of ViaForge - https://github.com/FlorianMichael/ViaForge
3 | * Copyright (C) 2021-2025 FlorianMichael/EnZaXD and contributors
4 | *
5 | * This program is free software: you can redistribute it and/or modify
6 | * it under the terms of the GNU General Public License as published by
7 | * the Free Software Foundation, either version 3 of the License, or
8 | * (at your option) any later version.
9 | *
10 | * This program is distributed in the hope that it will be useful,
11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 | * GNU General Public License for more details.
14 | *
15 | * You should have received a copy of the GNU General Public License
16 | * along with this program. If not, see .
17 | */
18 |
19 | package de.florianmichael.viaforge.mixin.connect;
20 |
21 | import de.florianmichael.viaforge.common.ViaForgeCommon;
22 | import de.florianmichael.viaforge.common.protocoltranslator.netty.VFNetworkManager;
23 | import io.netty.channel.Channel;
24 | import io.netty.channel.ChannelHandler;
25 | import org.spongepowered.asm.mixin.Mixin;
26 | import org.spongepowered.asm.mixin.injection.At;
27 | import org.spongepowered.asm.mixin.injection.Inject;
28 | import org.spongepowered.asm.mixin.injection.callback.CallbackInfo;
29 |
30 | @Mixin(targets = "net.minecraft.network.Connection$1")
31 | public class MixinConnection_1 {
32 |
33 | @Inject(method = "initChannel", at = @At("TAIL"))
34 | private void hookViaPipeline(Channel p_129552_, CallbackInfo ci) {
35 | final ChannelHandler connection = p_129552_.pipeline().get("packet_handler");
36 | ViaForgeCommon.getManager().inject(p_129552_, (VFNetworkManager) connection);
37 | }
38 |
39 | }
40 |
--------------------------------------------------------------------------------
/viaforge-mc1206/src/main/resources/META-INF/mods.toml:
--------------------------------------------------------------------------------
1 | modLoader="javafml"
2 | loaderVersion="[50,)"
3 |
4 | license="GPL-3.0 license"
5 | issueTrackerURL="https://github.com/ViaVersion/ViaForge/issues"
6 | showAsResourcePack=false
7 |
8 | [[mods]]
9 | modId="viaforge"
10 | version="${version}"
11 | displayName="ViaForge"
12 | displayURL="https://github.com/FlorianMichael"
13 | logoFile="icon.png"
14 | credits="Github contributors"
15 | authors="FlorianMichael/EnZaXD"
16 | description="${description}"
--------------------------------------------------------------------------------
/viaforge-mc1206/src/main/resources/META-INF/neoforge.mods.toml:
--------------------------------------------------------------------------------
1 | modLoader="javafml" #mandatory
2 | loaderVersion="[2,)" #mandatory
3 |
4 |
5 | license="GPL-3.0 license"
6 | issueTrackerURL="https://github.com/ViaVersion/ViaForge/issues"
7 | showAsResourcePack=false
8 |
9 | [[mods]]
10 | modId="viaforge"
11 | version="1.20.6"
12 | displayName="ViaForge"
13 | displayURL="https://github.com/FlorianMichael"
14 | logoFile="icon.png"
15 | credits="Github contributors"
16 | authors="FlorianMichael/EnZaXD"
17 | description="description"
18 |
--------------------------------------------------------------------------------
/viaforge-mc1206/src/main/resources/mixins.viaforge-mc1206.json:
--------------------------------------------------------------------------------
1 | {
2 | "required": true,
3 | "minVersion": "0.7.5",
4 | "compatibilityLevel": "JAVA_8",
5 | "package": "de.florianmichael.viaforge.mixin",
6 | "client": [
7 | "MixinClientPacketListener",
8 | "MixinDebugScreenOverlay",
9 | "MixinDirectJoinServerScreen",
10 | "MixinEditServerScreen",
11 | "MixinJoinMultiplayerScreen",
12 | "MixinServerData",
13 | "MixinTitleScreen",
14 | "connect.MixinClientHandshakePacketListenerImpl",
15 | "connect.MixinConnection",
16 | "connect.MixinConnection_1",
17 | "connect.MixinConnectScreen_1",
18 | "connect.MixinServerStatusPinger"
19 | ],
20 | "injectors": {
21 | "defaultRequire": 1
22 | }
23 | }
24 |
--------------------------------------------------------------------------------
/viaforge-mc1215/build.gradle:
--------------------------------------------------------------------------------
1 | // ....
2 |
3 | minecraft {
4 | reobf = false // Official mappings at runtime for 1.20.5+
5 | }
--------------------------------------------------------------------------------
/viaforge-mc1215/gradle.properties:
--------------------------------------------------------------------------------
1 | forge_version=1.21.5-55.0.3
2 |
--------------------------------------------------------------------------------
/viaforge-mc1215/src/main/java/de/florianmichael/viaforge/mixin/MixinClientPacketListener.java:
--------------------------------------------------------------------------------
1 | /*
2 | * This file is part of ViaForge - https://github.com/FlorianMichael/ViaForge
3 | * Copyright (C) 2021-2025 FlorianMichael/EnZaXD and contributors
4 | *
5 | * This program is free software: you can redistribute it and/or modify
6 | * it under the terms of the GNU General Public License as published by
7 | * the Free Software Foundation, either version 3 of the License, or
8 | * (at your option) any later version.
9 | *
10 | * This program is distributed in the hope that it will be useful,
11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 | * GNU General Public License for more details.
14 | *
15 | * You should have received a copy of the GNU General Public License
16 | * along with this program. If not, see .
17 | */
18 |
19 | package de.florianmichael.viaforge.mixin;
20 |
21 | import de.florianmichael.viaforge.common.ViaForgeCommon;
22 | import net.minecraft.client.Minecraft;
23 | import net.minecraft.client.multiplayer.ClientPacketListener;
24 | import org.spongepowered.asm.mixin.Mixin;
25 | import org.spongepowered.asm.mixin.injection.At;
26 | import org.spongepowered.asm.mixin.injection.Inject;
27 | import org.spongepowered.asm.mixin.injection.callback.CallbackInfo;
28 |
29 | @Mixin(ClientPacketListener.class)
30 | public class MixinClientPacketListener {
31 |
32 | @Inject(method = "handleLogin", at = @At("RETURN"))
33 | public void sendConnectionDetails(CallbackInfo ci) {
34 | if (Minecraft.getInstance().player != null) {
35 | ViaForgeCommon.getManager().sendConnectionDetails(Minecraft.getInstance().player.connection.getConnection().channel());
36 | }
37 | }
38 |
39 | }
40 |
--------------------------------------------------------------------------------
/viaforge-mc1215/src/main/java/de/florianmichael/viaforge/mixin/MixinDebugScreenOverlay.java:
--------------------------------------------------------------------------------
1 | /*
2 | * This file is part of ViaForge - https://github.com/FlorianMichael/ViaForge
3 | * Copyright (C) 2021-2025 FlorianMichael/EnZaXD and contributors
4 | *
5 | * This program is free software: you can redistribute it and/or modify
6 | * it under the terms of the GNU General Public License as published by
7 | * the Free Software Foundation, either version 3 of the License, or
8 | * (at your option) any later version.
9 | *
10 | * This program is distributed in the hope that it will be useful,
11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 | * GNU General Public License for more details.
14 | *
15 | * You should have received a copy of the GNU General Public License
16 | * along with this program. If not, see .
17 | */
18 |
19 | package de.florianmichael.viaforge.mixin;
20 |
21 | import de.florianmichael.viaforge.common.ViaForgeCommon;
22 | import net.minecraft.client.gui.components.DebugScreenOverlay;
23 | import com.viaversion.viaversion.api.protocol.version.ProtocolVersion;
24 | import org.spongepowered.asm.mixin.Mixin;
25 | import org.spongepowered.asm.mixin.injection.At;
26 | import org.spongepowered.asm.mixin.injection.Inject;
27 | import org.spongepowered.asm.mixin.injection.callback.CallbackInfoReturnable;
28 |
29 | import java.util.List;
30 |
31 | @Mixin(DebugScreenOverlay.class)
32 | public class MixinDebugScreenOverlay {
33 |
34 | @Inject(method = "getSystemInformation", at = @At(value = "TAIL"))
35 | public void addViaForgeVersion(CallbackInfoReturnable> cir) {
36 | final ViaForgeCommon common = ViaForgeCommon.getManager();
37 | final ProtocolVersion version = ViaForgeCommon.getManager().getTargetVersion();
38 |
39 | if (common.getConfig().isShowProtocolVersionInF3() && version != common.getNativeVersion() && !common.getPlatform().isSingleplayer().get()) {
40 | cir.getReturnValue().add("");
41 | cir.getReturnValue().add("ViaForge: " + version.toString());
42 | }
43 | }
44 |
45 | }
46 |
--------------------------------------------------------------------------------
/viaforge-mc1215/src/main/java/de/florianmichael/viaforge/mixin/MixinDirectJoinServerScreen.java:
--------------------------------------------------------------------------------
1 | /*
2 | * This file is part of ViaForge - https://github.com/FlorianMichael/ViaForge
3 | * Copyright (C) 2021-2025 FlorianMichael/EnZaXD and contributors
4 | *
5 | * This program is free software: you can redistribute it and/or modify
6 | * it under the terms of the GNU General Public License as published by
7 | * the Free Software Foundation, either version 3 of the License, or
8 | * (at your option) any later version.
9 | *
10 | * This program is distributed in the hope that it will be useful,
11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 | * GNU General Public License for more details.
14 | *
15 | * You should have received a copy of the GNU General Public License
16 | * along with this program. If not, see .
17 | */
18 |
19 | package de.florianmichael.viaforge.mixin;
20 |
21 | import com.viaversion.viaversion.util.Pair;
22 | import de.florianmichael.viaforge.common.ViaForgeCommon;
23 | import de.florianmichael.viaforge.common.platform.ViaForgeConfig;
24 | import de.florianmichael.viaforge.gui.GuiProtocolSelector;
25 | import net.minecraft.client.gui.components.Button;
26 | import net.minecraft.client.gui.screens.DirectJoinServerScreen;
27 | import net.minecraft.client.gui.screens.Screen;
28 | import net.minecraft.network.chat.Component;
29 | import org.spongepowered.asm.mixin.Mixin;
30 | import org.spongepowered.asm.mixin.injection.At;
31 | import org.spongepowered.asm.mixin.injection.Inject;
32 | import org.spongepowered.asm.mixin.injection.callback.CallbackInfo;
33 |
34 | @Mixin(DirectJoinServerScreen.class)
35 | public class MixinDirectJoinServerScreen extends Screen {
36 |
37 | public MixinDirectJoinServerScreen(Component title) {
38 | super(title);
39 | }
40 |
41 | @Inject(method = "init", at = @At("RETURN"))
42 | public void hookViaForgeButton(CallbackInfo ci) {
43 | final ViaForgeConfig config = ViaForgeCommon.getManager().getConfig();
44 | if (config.isShowDirectConnectButton()) {
45 | final Pair pos = config.getViaForgeButtonPosition().getPosition(this.width, this.height);
46 |
47 | addRenderableWidget(Button.builder(Component.literal("ViaForge"), b -> GuiProtocolSelector.open(minecraft)).bounds(pos.key(), pos.value(), 100, 20).build());
48 | }
49 | }
50 |
51 | }
52 |
--------------------------------------------------------------------------------
/viaforge-mc1215/src/main/java/de/florianmichael/viaforge/mixin/MixinJoinMultiplayerScreen.java:
--------------------------------------------------------------------------------
1 | /*
2 | * This file is part of ViaForge - https://github.com/FlorianMichael/ViaForge
3 | * Copyright (C) 2021-2025 FlorianMichael/EnZaXD and contributors
4 | *
5 | * This program is free software: you can redistribute it and/or modify
6 | * it under the terms of the GNU General Public License as published by
7 | * the Free Software Foundation, either version 3 of the License, or
8 | * (at your option) any later version.
9 | *
10 | * This program is distributed in the hope that it will be useful,
11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 | * GNU General Public License for more details.
14 | *
15 | * You should have received a copy of the GNU General Public License
16 | * along with this program. If not, see .
17 | */
18 |
19 | package de.florianmichael.viaforge.mixin;
20 |
21 | import com.viaversion.viaversion.util.Pair;
22 | import de.florianmichael.viaforge.common.ViaForgeCommon;
23 | import de.florianmichael.viaforge.common.platform.ViaForgeConfig;
24 | import de.florianmichael.viaforge.gui.GuiProtocolSelector;
25 | import net.minecraft.client.gui.components.Button;
26 | import net.minecraft.client.gui.screens.Screen;
27 | import net.minecraft.client.gui.screens.multiplayer.JoinMultiplayerScreen;
28 | import net.minecraft.network.chat.Component;
29 | import org.spongepowered.asm.mixin.Mixin;
30 | import org.spongepowered.asm.mixin.injection.At;
31 | import org.spongepowered.asm.mixin.injection.Inject;
32 | import org.spongepowered.asm.mixin.injection.callback.CallbackInfo;
33 |
34 | @Mixin(JoinMultiplayerScreen.class)
35 | public class MixinJoinMultiplayerScreen extends Screen {
36 |
37 | public MixinJoinMultiplayerScreen(Component title) {
38 | super(title);
39 | }
40 |
41 | @Inject(method = "init", at = @At("RETURN"))
42 | public void hookViaForgeButton(CallbackInfo ci) {
43 | final ViaForgeConfig config = ViaForgeCommon.getManager().getConfig();
44 | if (config.isShowMainMenuButton()) {
45 | final Pair pos = config.getViaForgeButtonPosition().getPosition(this.width, this.height);
46 |
47 | addRenderableWidget(Button.builder(Component.literal("ViaForge"), buttons -> GuiProtocolSelector.open(minecraft)).bounds(pos.key(), pos.value(), 100, 20).build());
48 | }
49 | }
50 |
51 | }
52 |
--------------------------------------------------------------------------------
/viaforge-mc1215/src/main/java/de/florianmichael/viaforge/mixin/MixinTitleScreen.java:
--------------------------------------------------------------------------------
1 | /*
2 | * This file is part of ViaForge - https://github.com/FlorianMichael/ViaForge
3 | * Copyright (C) 2021-2025 FlorianMichael/EnZaXD and contributors
4 | *
5 | * This program is free software: you can redistribute it and/or modify
6 | * it under the terms of the GNU General Public License as published by
7 | * the Free Software Foundation, either version 3 of the License, or
8 | * (at your option) any later version.
9 | *
10 | * This program is distributed in the hope that it will be useful,
11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 | * GNU General Public License for more details.
14 | *
15 | * You should have received a copy of the GNU General Public License
16 | * along with this program. If not, see .
17 | */
18 |
19 | package de.florianmichael.viaforge.mixin;
20 |
21 | import com.viaversion.viaversion.util.Pair;
22 | import de.florianmichael.viaforge.common.ViaForgeCommon;
23 | import de.florianmichael.viaforge.common.platform.ViaForgeConfig;
24 | import de.florianmichael.viaforge.gui.GuiProtocolSelector;
25 | import net.minecraft.client.gui.components.Button;
26 | import net.minecraft.client.gui.screens.Screen;
27 | import net.minecraft.client.gui.screens.TitleScreen;
28 | import net.minecraft.network.chat.Component;
29 | import org.spongepowered.asm.mixin.Mixin;
30 | import org.spongepowered.asm.mixin.injection.At;
31 | import org.spongepowered.asm.mixin.injection.Inject;
32 | import org.spongepowered.asm.mixin.injection.callback.CallbackInfo;
33 |
34 | @Mixin(TitleScreen.class)
35 | public class MixinTitleScreen extends Screen {
36 |
37 | public MixinTitleScreen(Component title) {
38 | super(title);
39 | }
40 |
41 | @Inject(method = "init", at = @At("RETURN"))
42 | public void hookViaForgeButton(CallbackInfo ci) {
43 | final ViaForgeConfig config = ViaForgeCommon.getManager().getConfig();
44 | if (config.isShowMainMenuButton()) {
45 | final Pair pos = config.getViaForgeButtonPosition().getPosition(this.width, this.height);
46 |
47 | addRenderableWidget(Button.builder(Component.literal("ViaForge"), buttons -> GuiProtocolSelector.open(minecraft)).bounds(pos.key(), pos.value(), 100, 20).build());
48 | }
49 | }
50 |
51 | }
52 |
--------------------------------------------------------------------------------
/viaforge-mc1215/src/main/java/de/florianmichael/viaforge/mixin/connect/MixinConnectScreen_1.java:
--------------------------------------------------------------------------------
1 | /*
2 | * This file is part of ViaForge - https://github.com/FlorianMichael/ViaForge
3 | * Copyright (C) 2021-2025 FlorianMichael/EnZaXD and contributors
4 | *
5 | * This program is free software: you can redistribute it and/or modify
6 | * it under the terms of the GNU General Public License as published by
7 | * the Free Software Foundation, either version 3 of the License, or
8 | * (at your option) any later version.
9 | *
10 | * This program is distributed in the hope that it will be useful,
11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 | * GNU General Public License for more details.
14 | *
15 | * You should have received a copy of the GNU General Public License
16 | * along with this program. If not, see .
17 | */
18 |
19 | package de.florianmichael.viaforge.mixin.connect;
20 |
21 | import com.viaversion.viaversion.api.protocol.version.ProtocolVersion;
22 | import de.florianmichael.viaforge.common.ViaForgeCommon;
23 | import de.florianmichael.viaforge.common.gui.ExtendedServerData;
24 | import de.florianmichael.viaforge.common.platform.VersionTracker;
25 | import net.minecraft.client.multiplayer.ServerData;
26 | import org.spongepowered.asm.mixin.Mixin;
27 | import org.spongepowered.asm.mixin.Shadow;
28 | import org.spongepowered.asm.mixin.injection.At;
29 | import org.spongepowered.asm.mixin.injection.Redirect;
30 |
31 | import java.net.InetSocketAddress;
32 | import java.util.Optional;
33 |
34 | @Mixin(targets = "net.minecraft.client.gui.screens.ConnectScreen$1")
35 | public class MixinConnectScreen_1 {
36 |
37 | @Shadow
38 | private ServerData val$p_252078_;
39 |
40 | @Redirect(method = "run", at = @At(value = "INVOKE", target = "Ljava/util/Optional;get()Ljava/lang/Object;"))
41 | public Object trackServerVersion(Optional instance) {
42 | final InetSocketAddress address = (InetSocketAddress) instance.get();
43 | ProtocolVersion version = ((ExtendedServerData) val$p_252078_).viaForge$getVersion();
44 | if (version == null) {
45 | version = ViaForgeCommon.getManager().getTargetVersion();
46 | }
47 | VersionTracker.storeServerProtocolVersion(address.getAddress(), version);
48 | return address;
49 | }
50 |
51 | }
52 |
--------------------------------------------------------------------------------
/viaforge-mc1215/src/main/java/de/florianmichael/viaforge/mixin/connect/MixinConnection_1.java:
--------------------------------------------------------------------------------
1 | /*
2 | * This file is part of ViaForge - https://github.com/FlorianMichael/ViaForge
3 | * Copyright (C) 2021-2025 FlorianMichael/EnZaXD and contributors
4 | *
5 | * This program is free software: you can redistribute it and/or modify
6 | * it under the terms of the GNU General Public License as published by
7 | * the Free Software Foundation, either version 3 of the License, or
8 | * (at your option) any later version.
9 | *
10 | * This program is distributed in the hope that it will be useful,
11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 | * GNU General Public License for more details.
14 | *
15 | * You should have received a copy of the GNU General Public License
16 | * along with this program. If not, see .
17 | */
18 |
19 | package de.florianmichael.viaforge.mixin.connect;
20 |
21 | import de.florianmichael.viaforge.common.ViaForgeCommon;
22 | import de.florianmichael.viaforge.common.protocoltranslator.netty.VFNetworkManager;
23 | import io.netty.channel.Channel;
24 | import io.netty.channel.ChannelHandler;
25 | import org.spongepowered.asm.mixin.Mixin;
26 | import org.spongepowered.asm.mixin.injection.At;
27 | import org.spongepowered.asm.mixin.injection.Inject;
28 | import org.spongepowered.asm.mixin.injection.callback.CallbackInfo;
29 |
30 | @Mixin(targets = "net.minecraft.network.Connection$1")
31 | public class MixinConnection_1 {
32 |
33 | @Inject(method = "initChannel", at = @At("TAIL"))
34 | private void hookViaPipeline(Channel p_129552_, CallbackInfo ci) {
35 | final ChannelHandler connection = p_129552_.pipeline().get("packet_handler");
36 | ViaForgeCommon.getManager().inject(p_129552_, (VFNetworkManager) connection);
37 | }
38 |
39 | }
40 |
--------------------------------------------------------------------------------
/viaforge-mc1215/src/main/resources/META-INF/mods.toml:
--------------------------------------------------------------------------------
1 | modLoader="javafml"
2 | loaderVersion="[54,)"
3 |
4 | license="GPL-3.0 license"
5 | issueTrackerURL="https://github.com/ViaVersion/ViaForge/issues"
6 | showAsResourcePack=false
7 |
8 | [[mods]]
9 | modId="viaforge"
10 | version="${version}"
11 | displayName="ViaForge"
12 | displayURL="https://github.com/FlorianMichael"
13 | logoFile="icon.png"
14 | credits="Github contributors"
15 | authors="FlorianMichael/EnZaXD"
16 | description="${description}"
--------------------------------------------------------------------------------
/viaforge-mc1215/src/main/resources/META-INF/neoforge.mods.toml:
--------------------------------------------------------------------------------
1 | modLoader="javafml" #mandatory
2 | loaderVersion="[2,)" #mandatory
3 |
4 |
5 | license="GPL-3.0 license"
6 | issueTrackerURL="https://github.com/ViaVersion/ViaForge/issues"
7 | showAsResourcePack=false
8 |
9 | [[mods]]
10 | modId="viaforge"
11 | version="1.21.5"
12 | displayName="ViaForge"
13 | displayURL="https://github.com/FlorianMichael"
14 | logoFile="icon.png"
15 | credits="Github contributors"
16 | authors="FlorianMichael/EnZaXD"
17 | description="description"
18 |
--------------------------------------------------------------------------------
/viaforge-mc1215/src/main/resources/mixins.viaforge-mc1215.json:
--------------------------------------------------------------------------------
1 | {
2 | "required": true,
3 | "minVersion": "0.7.5",
4 | "compatibilityLevel": "JAVA_8",
5 | "package": "de.florianmichael.viaforge.mixin",
6 | "client": [
7 | "MixinClientPacketListener",
8 | "MixinDebugScreenOverlay",
9 | "MixinDirectJoinServerScreen",
10 | "MixinEditServerScreen",
11 | "MixinJoinMultiplayerScreen",
12 | "MixinServerData",
13 | "MixinTitleScreen",
14 | "connect.MixinClientHandshakePacketListenerImpl",
15 | "connect.MixinConnection",
16 | "connect.MixinConnection_1",
17 | "connect.MixinConnectScreen_1",
18 | "connect.MixinServerStatusPinger"
19 | ],
20 | "injectors": {
21 | "defaultRequire": 1
22 | }
23 | }
24 |
--------------------------------------------------------------------------------
/viaforge-mc189/build.gradle:
--------------------------------------------------------------------------------
1 | plugins {
2 | id "xyz.wagyourtail.unimined" version "1.3.14"
3 | }
4 |
5 | dependencies {
6 | library ("org.spongepowered:mixin:0.7.10-SNAPSHOT") {
7 | exclude module: "launchwrapper"
8 | }
9 | library "org.slf4j:slf4j-api:2.0.17"
10 | }
11 |
12 | unimined.minecraft {
13 | version "1.8.9"
14 |
15 | minecraftForge {
16 | loader "11.15.1.2318-1.8.9"
17 | mixinConfig("mixins.viaforge-mc189.json")
18 | }
19 |
20 | mappings {
21 | searge()
22 | mcp("stable", "22-1.8.9")
23 | }
24 |
25 | remap(tasks.shadowJar) {
26 | prodNamespace("searge")
27 | mixinRemap {
28 | }
29 | }
30 | }
31 |
--------------------------------------------------------------------------------
/viaforge-mc189/gradle.properties:
--------------------------------------------------------------------------------
1 | applyFg=false
2 | mcVersion=1.8.9
3 |
--------------------------------------------------------------------------------
/viaforge-mc189/src/main/java/de/florianmichael/viaforge/mixin/MixinLoader.java:
--------------------------------------------------------------------------------
1 | /*
2 | * This file is part of ViaForge - https://github.com/FlorianMichael/ViaForge
3 | * Copyright (C) 2021-2024 FlorianMichael/EnZaXD and contributors
4 | *
5 | * This program is free software: you can redistribute it and/or modify
6 | * it under the terms of the GNU General Public License as published by
7 | * the Free Software Foundation, either version 3 of the License, or
8 | * (at your option) any later version.
9 | *
10 | * This program is distributed in the hope that it will be useful,
11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 | * GNU General Public License for more details.
14 | *
15 | * You should have received a copy of the GNU General Public License
16 | * along with this program. If not, see .
17 | */
18 |
19 | package de.florianmichael.viaforge.mixin;
20 |
21 | import net.minecraftforge.fml.relauncher.IFMLLoadingPlugin;
22 | import org.spongepowered.asm.launch.MixinBootstrap;
23 | import org.spongepowered.asm.mixin.MixinEnvironment;
24 | import org.spongepowered.asm.mixin.Mixins;
25 |
26 | import java.util.Map;
27 |
28 | public class MixinLoader implements IFMLLoadingPlugin {
29 |
30 | public MixinLoader() {
31 | MixinBootstrap.init();
32 | Mixins.addConfiguration("mixins.viaforge-mc189.json");
33 | MixinEnvironment.getDefaultEnvironment().setSide(MixinEnvironment.Side.CLIENT);
34 | }
35 |
36 | @Override
37 | public String[] getASMTransformerClass() {
38 | return new String[0];
39 | }
40 |
41 | @Override
42 | public String getModContainerClass() {
43 | return null;
44 | }
45 |
46 | @Override
47 | public String getSetupClass() {
48 | return null;
49 | }
50 |
51 | @Override
52 | public void injectData(Map data) {
53 | }
54 |
55 | @Override
56 | public String getAccessTransformerClass() {
57 | return null;
58 | }
59 |
60 | }
61 |
--------------------------------------------------------------------------------
/viaforge-mc189/src/main/java/de/florianmichael/viaforge/mixin/impl/MixinGuiOverlayDebug.java:
--------------------------------------------------------------------------------
1 | /*
2 | * This file is part of ViaForge - https://github.com/FlorianMichael/ViaForge
3 | * Copyright (C) 2021-2024 FlorianMichael/EnZaXD and contributors
4 | *
5 | * This program is free software: you can redistribute it and/or modify
6 | * it under the terms of the GNU General Public License as published by
7 | * the Free Software Foundation, either version 3 of the License, or
8 | * (at your option) any later version.
9 | *
10 | * This program is distributed in the hope that it will be useful,
11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 | * GNU General Public License for more details.
14 | *
15 | * You should have received a copy of the GNU General Public License
16 | * along with this program. If not, see .
17 | */
18 |
19 | package de.florianmichael.viaforge.mixin.impl;
20 |
21 | import com.viaversion.viaversion.api.protocol.version.ProtocolVersion;
22 | import de.florianmichael.viaforge.common.ViaForgeCommon;
23 | import net.minecraft.client.gui.GuiOverlayDebug;
24 | import net.raphimc.vialegacy.api.LegacyProtocolVersion;
25 | import org.spongepowered.asm.mixin.Mixin;
26 | import org.spongepowered.asm.mixin.injection.At;
27 | import org.spongepowered.asm.mixin.injection.Inject;
28 | import org.spongepowered.asm.mixin.injection.callback.CallbackInfoReturnable;
29 |
30 | import java.util.List;
31 |
32 | @Mixin(GuiOverlayDebug.class)
33 | public class MixinGuiOverlayDebug {
34 |
35 | @Inject(method = "getDebugInfoRight", at = @At(value = "TAIL"))
36 | public void addViaForgeVersion(CallbackInfoReturnable> cir) {
37 | final ViaForgeCommon common = ViaForgeCommon.getManager();
38 | final ProtocolVersion version = ViaForgeCommon.getManager().getTargetVersion();
39 |
40 | if (common.getConfig().isShowProtocolVersionInF3() && version != common.getNativeVersion() && !common.getPlatform().isSingleplayer().get()) {
41 | cir.getReturnValue().add("");
42 | cir.getReturnValue().add("ViaForge: " + version.toString());
43 | }
44 | }
45 |
46 | }
47 |
--------------------------------------------------------------------------------
/viaforge-mc189/src/main/java/de/florianmichael/viaforge/mixin/impl/MixinNetHandlerPlayClient.java:
--------------------------------------------------------------------------------
1 | /*
2 | * This file is part of ViaForge - https://github.com/FlorianMichael/ViaForge
3 | * Copyright (C) 2021-2025 FlorianMichael/EnZaXD and contributors
4 | *
5 | * This program is free software: you can redistribute it and/or modify
6 | * it under the terms of the GNU General Public License as published by
7 | * the Free Software Foundation, either version 3 of the License, or
8 | * (at your option) any later version.
9 | *
10 | * This program is distributed in the hope that it will be useful,
11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 | * GNU General Public License for more details.
14 | *
15 | * You should have received a copy of the GNU General Public License
16 | * along with this program. If not, see .
17 | */
18 |
19 | package de.florianmichael.viaforge.mixin.impl;
20 |
21 | import com.viaversion.viaversion.api.connection.UserConnection;
22 | import com.viaversion.viaversion.connection.ConnectionDetails;
23 | import de.florianmichael.viaforge.common.ViaForgeCommon;
24 | import io.netty.channel.Channel;
25 | import net.minecraft.client.Minecraft;
26 | import net.minecraft.client.network.NetHandlerPlayClient;
27 | import org.spongepowered.asm.mixin.Mixin;
28 | import org.spongepowered.asm.mixin.injection.At;
29 | import org.spongepowered.asm.mixin.injection.Inject;
30 | import org.spongepowered.asm.mixin.injection.callback.CallbackInfo;
31 |
32 | @Mixin(NetHandlerPlayClient.class)
33 | public class MixinNetHandlerPlayClient {
34 |
35 | @Inject(method = "handleJoinGame", at = @At("RETURN"))
36 | public void sendConnectionDetails(CallbackInfo ci) {
37 | if (!ViaForgeCommon.getManager().getConfig().isSendConnectionDetails()) {
38 | return;
39 | }
40 |
41 | final Channel channel = Minecraft.getMinecraft().thePlayer.sendQueue.getNetworkManager().channel();
42 | final UserConnection connection = channel.attr(ViaForgeCommon.VF_VIA_USER).get();
43 | if (connection == null) {
44 | return;
45 | }
46 |
47 | ConnectionDetails.sendConnectionDetails(connection, ConnectionDetails.MOD_CHANNEL);
48 | }
49 |
50 | }
51 |
--------------------------------------------------------------------------------
/viaforge-mc189/src/main/java/de/florianmichael/viaforge/mixin/impl/compatibility/patcher/MixinProtocolVersionDetector.java:
--------------------------------------------------------------------------------
1 | /*
2 | * This file is part of ViaForge - https://github.com/FlorianMichael/ViaForge
3 | * Copyright (C) 2021-2024 FlorianMichael/EnZaXD and contributors
4 | *
5 | * This program is free software: you can redistribute it and/or modify
6 | * it under the terms of the GNU General Public License as published by
7 | * the Free Software Foundation, either version 3 of the License, or
8 | * (at your option) any later version.
9 | *
10 | * This program is distributed in the hope that it will be useful,
11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 | * GNU General Public License for more details.
14 | *
15 | * You should have received a copy of the GNU General Public License
16 | * along with this program. If not, see .
17 | */
18 |
19 | package de.florianmichael.viaforge.mixin.impl.compatibility.patcher;
20 |
21 | import com.viaversion.viaversion.api.protocol.version.ProtocolVersion;
22 | import de.florianmichael.viaforge.common.ViaForgeCommon;
23 | import org.spongepowered.asm.mixin.Dynamic;
24 | import org.spongepowered.asm.mixin.Mixin;
25 | import org.spongepowered.asm.mixin.Pseudo;
26 | import org.spongepowered.asm.mixin.injection.At;
27 | import org.spongepowered.asm.mixin.injection.Inject;
28 | import org.spongepowered.asm.mixin.injection.callback.CallbackInfoReturnable;
29 |
30 | @Pseudo
31 | @Mixin(targets = "club.sk1er.patcher.util.status.ProtocolVersionDetector", remap = false)
32 | public abstract class MixinProtocolVersionDetector {
33 |
34 | @SuppressWarnings("rawtypes, unchecked")
35 | @Dynamic
36 | @Inject(method = "isCompatibleWithVersion", at = @At("HEAD"), cancellable = true)
37 | private void viaforge$setCompatible(String ip, int version, CallbackInfoReturnable cir) {
38 | cir.setReturnValue(ViaForgeCommon.getManager().getTargetVersion().newerThanOrEqualTo(ProtocolVersion.v1_11));
39 | }
40 |
41 | }
42 |
--------------------------------------------------------------------------------
/viaforge-mc189/src/main/java/de/florianmichael/viaforge/mixin/impl/connect/MixinGuiConnecting_1.java:
--------------------------------------------------------------------------------
1 | /*
2 | * This file is part of ViaForge - https://github.com/FlorianMichael/ViaForge
3 | * Copyright (C) 2021-2024 FlorianMichael/EnZaXD and contributors
4 | *
5 | * This program is free software: you can redistribute it and/or modify
6 | * it under the terms of the GNU General Public License as published by
7 | * the Free Software Foundation, either version 3 of the License, or
8 | * (at your option) any later version.
9 | *
10 | * This program is distributed in the hope that it will be useful,
11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 | * GNU General Public License for more details.
14 | *
15 | * You should have received a copy of the GNU General Public License
16 | * along with this program. If not, see .
17 | */
18 |
19 | package de.florianmichael.viaforge.mixin.impl.connect;
20 |
21 | import com.viaversion.viaversion.api.protocol.version.ProtocolVersion;
22 | import de.florianmichael.viaforge.common.ViaForgeCommon;
23 | import de.florianmichael.viaforge.common.gui.ExtendedServerData;
24 | import de.florianmichael.viaforge.common.platform.VersionTracker;
25 | import net.minecraft.client.Minecraft;
26 | import org.spongepowered.asm.mixin.Mixin;
27 | import org.spongepowered.asm.mixin.injection.At;
28 | import org.spongepowered.asm.mixin.injection.Redirect;
29 |
30 | import java.net.InetAddress;
31 | import java.net.UnknownHostException;
32 |
33 | @Mixin(targets = "net.minecraft.client.multiplayer.GuiConnecting$1")
34 | public class MixinGuiConnecting_1 {
35 |
36 | @Redirect(method = "run", at = @At(value = "INVOKE", target = "Ljava/net/InetAddress;getByName(Ljava/lang/String;)Ljava/net/InetAddress;"))
37 | public InetAddress trackServerVersion(String s) throws UnknownHostException {
38 | final InetAddress address = InetAddress.getByName(s);
39 | ProtocolVersion version = ((ExtendedServerData) Minecraft.getMinecraft().getCurrentServerData()).viaForge$getVersion();
40 | if (version == null) {
41 | version = ViaForgeCommon.getManager().getTargetVersion();
42 | }
43 | VersionTracker.storeServerProtocolVersion(address, version);
44 | return address;
45 | }
46 |
47 | }
48 |
--------------------------------------------------------------------------------
/viaforge-mc189/src/main/java/de/florianmichael/viaforge/mixin/impl/connect/MixinNetworkManager_5.java:
--------------------------------------------------------------------------------
1 | /*
2 | * This file is part of ViaForge - https://github.com/FlorianMichael/ViaForge
3 | * Copyright (C) 2021-2024 FlorianMichael/EnZaXD and contributors
4 | *
5 | * This program is free software: you can redistribute it and/or modify
6 | * it under the terms of the GNU General Public License as published by
7 | * the Free Software Foundation, either version 3 of the License, or
8 | * (at your option) any later version.
9 | *
10 | * This program is distributed in the hope that it will be useful,
11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 | * GNU General Public License for more details.
14 | *
15 | * You should have received a copy of the GNU General Public License
16 | * along with this program. If not, see .
17 | */
18 |
19 | package de.florianmichael.viaforge.mixin.impl.connect;
20 |
21 | import de.florianmichael.viaforge.common.ViaForgeCommon;
22 | import de.florianmichael.viaforge.common.protocoltranslator.netty.VFNetworkManager;
23 | import io.netty.channel.Channel;
24 | import net.minecraft.network.NetworkManager;
25 | import org.spongepowered.asm.mixin.*;
26 | import org.spongepowered.asm.mixin.injection.At;
27 | import org.spongepowered.asm.mixin.injection.Inject;
28 | import org.spongepowered.asm.mixin.injection.callback.CallbackInfo;
29 |
30 | @Mixin(targets = "net.minecraft.network.NetworkManager$5")
31 | public class MixinNetworkManager_5 {
32 |
33 | @Final
34 | @Mutable
35 | NetworkManager val$networkmanager;
36 |
37 | @Inject(method = "initChannel", at = @At(value = "TAIL"), remap = false)
38 | private void hookViaPipeline(Channel channel, CallbackInfo ci) {
39 | ViaForgeCommon.getManager().inject(channel, (VFNetworkManager) val$networkmanager);
40 | }
41 |
42 | }
43 |
--------------------------------------------------------------------------------
/viaforge-mc189/src/main/java/de/florianmichael/viaforge/mixin/impl/javadowngrader/MixinBulkChunkType.java:
--------------------------------------------------------------------------------
1 | /*
2 | * This file is part of ViaForge - https://github.com/FlorianMichael/ViaForge
3 | * Copyright (C) 2021-2025 FlorianMichael/EnZaXD and contributors
4 | *
5 | * This program is free software: you can redistribute it and/or modify
6 | * it under the terms of the GNU General Public License as published by
7 | * the Free Software Foundation, either version 3 of the License, or
8 | * (at your option) any later version.
9 | *
10 | * This program is distributed in the hope that it will be useful,
11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 | * GNU General Public License for more details.
14 | *
15 | * You should have received a copy of the GNU General Public License
16 | * along with this program. If not, see .
17 | */
18 |
19 | package de.florianmichael.viaforge.mixin.impl.javadowngrader;
20 |
21 | import net.raphimc.vialegacy.protocol.release.r1_7_6_10tor1_8.types.BulkChunkType;
22 | import org.spongepowered.asm.mixin.Mixin;
23 | import org.spongepowered.asm.mixin.injection.At;
24 | import org.spongepowered.asm.mixin.injection.Redirect;
25 |
26 | import java.io.ByteArrayOutputStream;
27 |
28 | @Mixin(value = BulkChunkType.class, remap = false)
29 | public class MixinBulkChunkType {
30 |
31 | @Redirect(method = "write(Lio/netty/buffer/ByteBuf;[Lcom/viaversion/viaversion/api/minecraft/chunks/Chunk;)V", at = @At(value = "INVOKE", target = "Ljava/io/ByteArrayOutputStream;writeBytes([B)V"))
32 | private void write(ByteArrayOutputStream instance, byte[] b) {
33 | instance.write(b, 0, b.length);
34 | }
35 |
36 | }
37 |
--------------------------------------------------------------------------------
/viaforge-mc189/src/main/java/de/florianmichael/viaforge/mixin/impl/javadowngrader/MixinChunkType.java:
--------------------------------------------------------------------------------
1 | /*
2 | * This file is part of ViaForge - https://github.com/FlorianMichael/ViaForge
3 | * Copyright (C) 2021-2025 FlorianMichael/EnZaXD and contributors
4 | *
5 | * This program is free software: you can redistribute it and/or modify
6 | * it under the terms of the GNU General Public License as published by
7 | * the Free Software Foundation, either version 3 of the License, or
8 | * (at your option) any later version.
9 | *
10 | * This program is distributed in the hope that it will be useful,
11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 | * GNU General Public License for more details.
14 | *
15 | * You should have received a copy of the GNU General Public License
16 | * along with this program. If not, see .
17 | */
18 |
19 | package de.florianmichael.viaforge.mixin.impl.javadowngrader;
20 |
21 | import net.raphimc.vialegacy.protocol.release.r1_7_6_10tor1_8.types.ChunkType;
22 | import org.spongepowered.asm.mixin.Mixin;
23 | import org.spongepowered.asm.mixin.injection.At;
24 | import org.spongepowered.asm.mixin.injection.Redirect;
25 |
26 | import java.io.ByteArrayOutputStream;
27 |
28 | @Mixin(value = ChunkType.class, remap = false)
29 | public class MixinChunkType {
30 |
31 | @Redirect(method = "serialize", at = @At(value = "INVOKE", target = "Ljava/io/ByteArrayOutputStream;writeBytes([B)V"))
32 | private static void serialize(ByteArrayOutputStream instance, byte[] b) {
33 | instance.write(b, 0, b.length);
34 | }
35 |
36 | }
37 |
--------------------------------------------------------------------------------
/viaforge-mc189/src/main/resources/assets/viaforge/config.yml:
--------------------------------------------------------------------------------
1 | # Thanks for downloading ViaForge!
2 | # If you need help, you can join our Discord - https://viaversion.com/discord
3 | #
4 | # Disclaimer:
5 | # It cannot be guaranteed that this mod is allowed on specific servers as it can possibly cause problems with anti-cheat plugins
6 | # (USE ONLY WITH CAUTION!)
7 | #
8 | #----------------------------------------------------------#
9 | # GLOBAL OPTIONS #
10 | #----------------------------------------------------------#
11 | #
12 | # This option sets the protocol version to be used when connecting to servers. (can also be changed in-game)
13 | client-side-version: -1
14 | #
15 | # Manually sends the joinServer request when connecting to <= 1.2.5 servers.
16 | verify-session-in-old-versions: true
17 | #
18 | # Allow ViaForge to authenticate with BetaCraft's MP-Pass system for <= c0.30 servers.
19 | allow-betacraft-authentication: true
20 | #
21 | # If enabled, ViaForge will show the current protocol version in the F3 menu.
22 | show-protocol-version-in-f3: true
23 | # If enabled, ViaForge will send connection details to the server when connecting.
24 | # This includes the actual client version as well as the ViaForge version.
25 | send-connection-details: true
26 | #
27 | #----------------------------------------------------------#
28 | # GUI OPTIONS #
29 | #----------------------------------------------------------#
30 | #
31 | # This option indicates if the ViaForge button should be shown in the main menu.
32 | show-main-menu-button: true
33 | #
34 | # This option indicates if the ViaForge button should be shown in the multiplayer.
35 | show-multiplayer-button: true
36 | #
37 | # This option indicates if the ViaForge button should be shown in the direct connect screen.
38 | show-direct-connect-button: true
39 | #
40 | # This option indicates if the ViaForge set version button should be shown in the server list.
41 | show-add-server-button: true
42 | #
43 | # This option indicates where the ViaForge button should be located in all screens.
44 | # Possible options: TOP_LEFT, TOP_RIGHT, BOTTOM_LEFT, BOTTOM_RIGHT
45 | via-forge-button-position: "TOP_LEFT"
46 | #
47 | # This option indicates where the ViaForge set version button should be located in the add server screen.
48 | # Possible options: TOP_LEFT, TOP_RIGHT, BOTTOM_LEFT, BOTTOM_RIGHT
49 | add-server-screen-button-position: "TOP_LEFT"
50 |
--------------------------------------------------------------------------------
/viaforge-mc189/src/main/resources/mcmod.info:
--------------------------------------------------------------------------------
1 | [
2 | {
3 | "modid": "viaforge",
4 | "name": "ViaForge",
5 | "description": "${description}",
6 | "version": "${version}",
7 | "mcversion": "[1.8.8,)",
8 | "url": "https://github.com/ViaVersion/ViaForge",
9 | "authorList": [
10 | "FlorianMichael/EnZaXD"
11 | ],
12 | "credits": "https://github.com/FlorianMichael/"
13 | }
14 | ]
15 |
--------------------------------------------------------------------------------
/viaforge-mc189/src/main/resources/mixins.viaforge-mc189.json:
--------------------------------------------------------------------------------
1 | {
2 | "required": true,
3 | "minVersion": "0.7.5",
4 | "compatibilityLevel": "JAVA_8",
5 | "package": "de.florianmichael.viaforge.mixin.impl",
6 | "refmap": "mixins.viaforge-mc189.refmap.json",
7 | "client": [
8 | "MixinGuiMainMenu",
9 | "MixinGuiMultiplayer",
10 | "MixinGuiOverlayDebug",
11 | "MixinGuiScreenAddServer",
12 | "MixinGuiScreenServerList",
13 | "MixinNetHandlerPlayClient",
14 | "MixinServerData",
15 | "compatibility.patcher.MixinProtocolVersionDetector",
16 | "connect.MixinGuiConnecting_1",
17 | "connect.MixinNetHandlerLoginClient",
18 | "connect.MixinNetworkManager",
19 | "connect.MixinNetworkManager_5",
20 | "connect.MixinServerPinger",
21 | "javadowngrader.MixinBulkChunkType",
22 | "javadowngrader.MixinChunkType"
23 | ],
24 | "verbose": true
25 | }
26 |
--------------------------------------------------------------------------------