Compare commits

...

12 Commits

Author SHA1 Message Date
FlorianMichael d325b0691d
Fix and clean 1.20.4 platform 2024-04-28 23:42:51 +02:00
FlorianMichael f589b3a28d
Fix pipeline injection in 1.17+ 2024-04-28 22:57:52 +02:00
FlorianMichael d2d5ed4458
Don't hook VV into pipeline if target == native ver 2024-04-28 22:38:17 +02:00
Howard ZHY 325494824c
[ci skip] Update README.md (#87) 2024-04-28 22:36:23 +02:00
FlorianMichael 2548bfa8dd
Fix protocol selection in 1.20.4 not working 2024-04-28 22:24:16 +02:00
FlorianMichael 9ba5f28ebd
Rename mixin references as well 2024-04-28 22:15:05 +02:00
FlorianMichael d93c875d88
Repackage submodules to their explicit game versions 2024-04-28 22:09:11 +02:00
FlorianMichael 2721955931
Add mod publish plugin 2024-04-28 21:30:43 +02:00
FlorianMichael 08cf5e9929
Move mcmod.info into mc 1.12 module, fix artifact names 2024-04-28 21:10:10 +02:00
FlorianMichael cb49b6d819
Merge remote-tracking branch 'origin/master' 2024-04-28 18:54:48 +02:00
FlorianMichael d19e57a98e
Beautify version comparisons 2024-04-28 18:54:38 +02:00
FlorianMichael 1f047f0a84
Update Via*, only include common modules 2024-04-28 18:53:39 +02:00
126 changed files with 139 additions and 130 deletions

2
CHANGELOG.md Normal file
View File

@ -0,0 +1,2 @@
- Updated Via* projects to support 1.20.5
- Fixed version in 1.12 mcmod.info file

View File

@ -20,17 +20,17 @@ GitHub Releases: https://github.com/ViaVersion/ViaForge
## For developers
### Project Structure
All ViaForge versions from Minecraft version 1.12 onwards are on the `master` branch. <br>
All ViaForge versions from Minecraft version 1.12.2 onwards are on the `master` branch. <br>
The names of the submodules indicate the version, they are always given in the format `mc-<version name without .>`. <br>
`Minecraft 1.12.2` - `mc112` <br>
`Minecraft 1.16.5` - `mc116` <br>
`Minecraft 1.17.1` - `mc117` <br>
`Minecraft 1.18.2` - `mc118` <br>
`Minecraft 1.19.4` - `mc119` <br>
`Minecraft 1.20.4` - `mc120` <br>
`Minecraft 1.12.2` - `viaforge-mc1122` <br>
`Minecraft 1.16.5` - `viaforge-mc1165` <br>
`Minecraft 1.17.1` - `viaforge-mc1171` <br>
`Minecraft 1.18.2` - `viaforge-mc1182` <br>
`Minecraft 1.19.4` - `viaforge-mc1194` <br>
`Minecraft 1.20.4` - `viaforge-mc1204` <br>
### ViaForge for Minecraft 1.8
Since ForgeGradle for Minecraft 1.8 is too old, it has its own branch called `legacy-1.8`
Since ForgeGradle for Minecraft 1.8.9 is too old, it has its own branch called `legacy-1.8`
### I want ViaForge in my own utility mod
Just take a look at my other Project called `ViaMCP`: https://github.com/FlorianMichael/ViaMCP

View File

@ -11,12 +11,14 @@ buildscript {
classpath "com.github.johnrengelman:shadow:7.1.2"
classpath "net.minecraftforge.gradle:ForgeGradle:6.+"
classpath "org.spongepowered:mixingradle:0.7-SNAPSHOT"
classpath "me.modmuss50:mod-publish-plugin:0.5.1"
}
}
allprojects {
apply plugin: "java-library"
apply plugin: "com.github.johnrengelman.shadow"
apply plugin: "me.modmuss50.mod-publish-plugin"
// We define the configuration here so we can use it across all conventions and platforms
// To define which projects/source files should be included in the jar
@ -37,12 +39,12 @@ allprojects {
// Replace the version in the mcmod.info and mods.toml files with the project version
// Since this depends on the platform version, we can't define it in the global scope :(
processResources {
for (final def file in ["mcmod.info", "META-INF/mods.toml"]) {
inputs.property "version", project.version
filesMatching(file) {
expand "version": project.version
tasks {
processResources {
for (final def file in ["mcmod.info", "META-INF/mods.toml"]) {
filesMatching(file) {
expand "version": project.version
}
}
}
}
@ -51,9 +53,9 @@ allprojects {
dependencies {
compileOnly "io.netty:netty-all:4.0.20.Final"
library "com.viaversion:viaversion:${project.viaversion_version}"
library "com.viaversion:viabackwards:${project.viabackwards_version}"
library "com.viaversion:viarewind-universal:${project.viarewind_version}"
library "com.viaversion:viaversion-common:${project.viaversion_version}"
library "com.viaversion:viabackwards-common:${project.viabackwards_version}"
library "com.viaversion:viarewind-common:${project.viarewind_version}"
library ("net.raphimc:ViaLegacy:${project.vialegacy_version}") {
exclude group: "com.google.code.gson", module: "gson"
}
@ -73,7 +75,7 @@ subprojects {
// Define the jar output attributes for all platforms
archivesBaseName = project.maven_name
version = maven_version + "-" + project.mc_version
version = maven_version
group = maven_group
// Used to execute code only for specific submodules
@ -110,7 +112,7 @@ subprojects {
}
dependencies {
if (versionId >= 1171) {
if (versionId >= 1_17_1) {
// Minecraft 1.17+ already includes slf4j, so we don't need to include it
compileOnly "org.slf4j:slf4j-api:${slf4j_version}"
} else {
@ -147,7 +149,7 @@ subprojects {
}
java {
if (versionId >= 1171) {
if (versionId >= 1_17_1) {
// Minecraft 1.17+ required Java 16/17 to compile
toolchain.languageVersion = JavaLanguageVersion.of(17)
}
@ -162,17 +164,38 @@ subprojects {
exclude("META-INF/maven/**")
exclude("META-INF/versions/**")
if (versionId >= 1132) {
if (versionId >= 1_13_2) {
// We don't need to package mixins into Forge 1.13+ jars, since Forge already has it
exclude("org/spongepowered/**")
}
if (versionId >= 1165) {
if (versionId >= 1_16_5) {
// Get rid of the services folder, since Forge 1.16+ would conflict with some of the ForgeDev Environment's services
// And since we don't need them for Mixins anyway, we can just exclude them from the shadowJar
exclude("META-INF/services/**")
}
}
publishMods {
file = shadowJar.archiveFile
type = STABLE
displayName = rootProject.name + ' ' + project.version
version = project.version + "+" + project.mc_version
modLoaders.add("forge")
changelog = file("../CHANGELOG.md").text
dryRun = rootProject.maven_version.contains("SNAPSHOT")
curseforge {
accessToken = providers.gradleProperty("curseforge.publishing_token")
projectId = "418933"
minecraftVersions.addAll(project.mc_version.split(','))
}
modrinth {
accessToken = providers.gradleProperty("modrinth.publishing_token")
projectId = "Z6se2s8f"
minecraftVersions.addAll(project.mc_version.split(','))
}
}
reobf {
shadowJar {}
}

View File

@ -7,12 +7,12 @@ maven_version=3.6.0-SNAPSHOT
maven_group=de.florianmichael
# ViaVersion
viaversion_version=4.10.0-24w09a-SNAPSHOT
viabackwards_version=4.10.0-24w09a-SNAPSHOT
viarewind_version=3.0.7-24w09a-SNAPSHOT
vialegacy_version=2.2.22-SNAPSHOT
viaaprilfools_version=2.0.11-SNAPSHOT
vialoader_version=2.2.13-SNAPSHOT
viaversion_version=4.10.0
viabackwards_version=4.10.0
viarewind_version=3.1.0
vialegacy_version=2.2.22
viaaprilfools_version=2.0.11
vialoader_version=2.2.13
snake_yml_version=2.2

View File

@ -1,9 +1,9 @@
rootProject.name = "ViaForge"
include "viaforge-mc112"
include "viaforge-mc116"
include "viaforge-mc117"
include "viaforge-mc118"
include "viaforge-mc119"
include "viaforge-mc120"
include "viaforge-mc1122"
include "viaforge-mc1165"
include "viaforge-mc1171"
include "viaforge-mc1182"
include "viaforge-mc1194"
include "viaforge-mc1204"

View File

@ -90,11 +90,15 @@ public class ViaForgeCommon {
*/
public void inject(final Channel channel, final VFNetworkManager networkManager) {
if (channel instanceof SocketChannel) {
if (targetVersion.equals(getNativeVersion())) {
return; // Don't inject ViaVersion into pipeline if there is nothing to translate anyway
}
channel.attr(VF_NETWORK_MANAGER).set(networkManager);
final UserConnection user = new UserConnectionImpl(channel, true);
new ProtocolPipelineImpl(user);
channel.attr(LOCAL_VIA_USER).set(user);
channel.attr(VF_NETWORK_MANAGER).set(networkManager);
channel.pipeline().addLast(new ViaForgeVLLegacyPipeline(user, targetVersion));
}

View File

@ -1,2 +0,0 @@
maven_name=viaforge-mc112
mc_version=1.12.2

View File

@ -0,0 +1,2 @@
maven_name=viaforge-mc1122
mc_version=1.12.2

View File

@ -32,7 +32,7 @@ import java.io.File;
import java.util.function.Supplier;
@Mod(modid = "viaforge")
public class ViaForge112 implements VFPlatform {
public class ViaForge1122 implements VFPlatform {
@Mod.EventHandler
public void onInit(FMLInitializationEvent event) {

View File

@ -29,7 +29,7 @@ public class MixinLoader implements IFMLLoadingPlugin {
public MixinLoader() {
MixinBootstrap.init();
Mixins.addConfiguration("mixins.viaforge-mc112.json");
Mixins.addConfiguration("mixins.viaforge-mc1122.json");
MixinEnvironment.getDefaultEnvironment().setSide(MixinEnvironment.Side.CLIENT);
}

View File

@ -3,7 +3,7 @@
"modid": "viaforge",
"name": "ViaForge",
"description": "Client-side Implementation of the Via* projects for Minecraft Forge",
"version": "3.5.0",
"version": "${version}",
"mcversion": "[1.12.2]",
"url": "https://github.com/ViaVersion/ViaForge",
"updateUrl": "",

View File

@ -3,7 +3,7 @@
"minVersion": "0.7.5",
"compatibilityLevel": "JAVA_8",
"package": "de.florianmichael.viaforge.mixin.impl",
"refmap": "mixins.viaforge-mc112.refmap.json",
"refmap": "mixins.viaforge-mc1122.refmap.json",
"client": [
"MixinGuiConnecting_1",
"MixinGuiMainMenu",

View File

@ -1,2 +0,0 @@
maven_name=viaforge-mc116
mc_version=1.16.5

View File

@ -0,0 +1,2 @@
maven_name=viaforge-mc1165
mc_version=1.16.5

View File

@ -33,9 +33,9 @@ import java.io.File;
import java.util.function.Supplier;
@Mod("viaforge")
public class ViaForge116 implements VFPlatform {
public class ViaForge1165 implements VFPlatform {
public ViaForge116() {
public ViaForge1165() {
FMLJavaModLoadingContext.get().getModEventBus().addListener(this::onInit);
}

View File

@ -20,5 +20,5 @@
"injectors": {
"defaultRequire": 1
},
"refmap": "mixins.viaforge-mc116.refmap.json"
"refmap": "mixins.viaforge-mc1165.refmap.json"
}

View File

@ -1,2 +0,0 @@
maven_name=viaforge-mc117
mc_version=1.17.1

View File

@ -0,0 +1,2 @@
maven_name=viaforge-mc1171
mc_version=1.17.1

View File

@ -33,9 +33,9 @@ import java.io.File;
import java.util.function.Supplier;
@Mod("viaforge")
public class ViaForge117 implements VFPlatform {
public class ViaForge1171 implements VFPlatform {
public ViaForge117() {
public ViaForge1171() {
FMLJavaModLoadingContext.get().getModEventBus().addListener(this::onInit);
}

View File

@ -20,25 +20,22 @@ package de.florianmichael.viaforge.mixin;
import de.florianmichael.viaforge.common.ViaForgeCommon;
import de.florianmichael.viaforge.common.protocoltranslator.netty.VFNetworkManager;
import io.netty.channel.Channel;
import net.minecraft.network.Connection;
import org.spongepowered.asm.mixin.Final;
import io.netty.channel.ChannelHandler;
import io.netty.channel.ChannelPipeline;
import org.spongepowered.asm.mixin.Mixin;
import org.spongepowered.asm.mixin.Mutable;
import org.spongepowered.asm.mixin.injection.At;
import org.spongepowered.asm.mixin.injection.Inject;
import org.spongepowered.asm.mixin.injection.callback.CallbackInfo;
import org.spongepowered.asm.mixin.injection.Redirect;
@Mixin(targets = "net.minecraft.network.Connection$1")
public class MixinConnection_1 {
@Final
@Mutable
Connection val$connection;
@Inject(method = "initChannel", at = @At(value = "TAIL"), remap = false)
private void onInitChannel(Channel channel, CallbackInfo ci) {
ViaForgeCommon.getManager().inject(channel, (VFNetworkManager) val$connection);
@Redirect(method = "initChannel", at = @At(value = "INVOKE", target = "Lio/netty/channel/ChannelPipeline;addLast(Ljava/lang/String;Lio/netty/channel/ChannelHandler;)Lio/netty/channel/ChannelPipeline;"))
private ChannelPipeline hookViaPipeline(ChannelPipeline instance, String s, ChannelHandler channelHandler) {
final ChannelPipeline handler = instance.addLast(s, channelHandler);
if (channelHandler instanceof VFNetworkManager mixinNetworkManager) {
ViaForgeCommon.getManager().inject(instance.channel(), mixinNetworkManager);
}
return handler;
}
}

View File

@ -14,14 +14,12 @@
"MixinServerData",
"MixinServerStatusPinger",
"MixinTitleScreen",
"fixes.MixinLocalPlayer"
"fixes.MixinLocalPlayer",
"MixinConnection_1",
"MixinConnectScreen_1"
],
"injectors": {
"defaultRequire": 1
},
"refmap": "mixins.viaforge-mc117.refmap.json",
"mixins": [
"MixinConnection_1",
"MixinConnectScreen_1"
]
"refmap": "mixins.viaforge-mc1171.refmap.json"
}

View File

@ -1,2 +0,0 @@
maven_name=viaforge-mc118
mc_version=1.18.2

View File

@ -0,0 +1,2 @@
maven_name=viaforge-mc1182
mc_version=1.18.2

View File

@ -33,9 +33,9 @@ import java.io.File;
import java.util.function.Supplier;
@Mod("viaforge")
public class ViaForge118 implements VFPlatform {
public class ViaForge1182 implements VFPlatform {
public ViaForge118() {
public ViaForge1182() {
FMLJavaModLoadingContext.get().getModEventBus().addListener(this::onInit);
}

View File

@ -20,25 +20,22 @@ package de.florianmichael.viaforge.mixin;
import de.florianmichael.viaforge.common.ViaForgeCommon;
import de.florianmichael.viaforge.common.protocoltranslator.netty.VFNetworkManager;
import io.netty.channel.Channel;
import net.minecraft.network.Connection;
import org.spongepowered.asm.mixin.Final;
import io.netty.channel.ChannelHandler;
import io.netty.channel.ChannelPipeline;
import org.spongepowered.asm.mixin.Mixin;
import org.spongepowered.asm.mixin.Mutable;
import org.spongepowered.asm.mixin.injection.At;
import org.spongepowered.asm.mixin.injection.Inject;
import org.spongepowered.asm.mixin.injection.callback.CallbackInfo;
import org.spongepowered.asm.mixin.injection.Redirect;
@Mixin(targets = "net.minecraft.network.Connection$1")
public class MixinConnection_1 {
@Final
@Mutable
Connection val$connection;
@Inject(method = "initChannel", at = @At(value = "TAIL"), remap = false)
private void onInitChannel(Channel channel, CallbackInfo ci) {
ViaForgeCommon.getManager().inject(channel, (VFNetworkManager) val$connection);
@Redirect(method = "initChannel", at = @At(value = "INVOKE", target = "Lio/netty/channel/ChannelPipeline;addLast(Ljava/lang/String;Lio/netty/channel/ChannelHandler;)Lio/netty/channel/ChannelPipeline;"))
private ChannelPipeline hookViaPipeline(ChannelPipeline instance, String s, ChannelHandler channelHandler) {
final ChannelPipeline handler = instance.addLast(s, channelHandler);
if (channelHandler instanceof VFNetworkManager mixinNetworkManager) {
ViaForgeCommon.getManager().inject(instance.channel(), mixinNetworkManager);
}
return handler;
}
}

View File

@ -20,5 +20,5 @@
"injectors": {
"defaultRequire": 1
},
"refmap": "mixins.viaforge-mc119.refmap.json"
"refmap": "mixins.viaforge-mc1182.refmap.json"
}

View File

@ -1,2 +0,0 @@
maven_name=viaforge-mc119
mc_version=1.19.4

View File

@ -0,0 +1,2 @@
maven_name=viaforge-mc1194
mc_version=1.19.4

View File

@ -33,9 +33,9 @@ import java.io.File;
import java.util.function.Supplier;
@Mod("viaforge")
public class ViaForge119 implements VFPlatform {
public class ViaForge1194 implements VFPlatform {
public ViaForge119() {
public ViaForge1194() {
FMLJavaModLoadingContext.get().getModEventBus().addListener(this::onInit);
}

View File

@ -20,25 +20,22 @@ package de.florianmichael.viaforge.mixin;
import de.florianmichael.viaforge.common.ViaForgeCommon;
import de.florianmichael.viaforge.common.protocoltranslator.netty.VFNetworkManager;
import io.netty.channel.Channel;
import net.minecraft.network.Connection;
import org.spongepowered.asm.mixin.Final;
import io.netty.channel.ChannelHandler;
import io.netty.channel.ChannelPipeline;
import org.spongepowered.asm.mixin.Mixin;
import org.spongepowered.asm.mixin.Mutable;
import org.spongepowered.asm.mixin.injection.At;
import org.spongepowered.asm.mixin.injection.Inject;
import org.spongepowered.asm.mixin.injection.callback.CallbackInfo;
import org.spongepowered.asm.mixin.injection.Redirect;
@Mixin(targets = "net.minecraft.network.Connection$1")
public class MixinConnection_1 {
@Final
@Mutable
Connection val$connection;
@Inject(method = "initChannel", at = @At(value = "TAIL"), remap = false)
private void onInitChannel(Channel channel, CallbackInfo ci) {
ViaForgeCommon.getManager().inject(channel, (VFNetworkManager) val$connection);
@Redirect(method = "initChannel", at = @At(value = "INVOKE", target = "Lio/netty/channel/ChannelPipeline;addLast(Ljava/lang/String;Lio/netty/channel/ChannelHandler;)Lio/netty/channel/ChannelPipeline;"))
private ChannelPipeline hookViaPipeline(ChannelPipeline instance, String s, ChannelHandler channelHandler) {
final ChannelPipeline handler = instance.addLast(s, channelHandler);
if (channelHandler instanceof VFNetworkManager mixinNetworkManager) {
ViaForgeCommon.getManager().inject(instance.channel(), mixinNetworkManager);
}
return handler;
}
}

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