Revert "updated Via*"

This reverts commit 9de262693c.
This commit is contained in:
FlorianMichael 2023-04-20 18:25:34 +02:00
parent 9de262693c
commit 419e0d996d
8 changed files with 92 additions and 64 deletions

View File

@ -1,10 +1,23 @@
plugins {
id "java"
id "net.minecraftforge.gradle.forge"
id "org.spongepowered.mixin"
id "com.github.johnrengelman.shadow" version "4.0.4"
buildscript {
repositories {
maven { url = "https://repo.viaversion.com" }
maven { url = "https://maven.minecraftforge.net/" }
maven { url = "https://repo.spongepowered.org/repository/maven-public/" }
maven { url = "https://jitpack.io/" }
}
dependencies {
classpath "net.minecraftforge.gradle:ForgeGradle:2.1-SNAPSHOT"
classpath "org.spongepowered:mixingradle:0.6-SNAPSHOT"
classpath "com.github.johnrengelman:shadow:4.0.4"
}
}
apply plugin: "net.minecraftforge.gradle.forge"
apply plugin: "org.spongepowered.mixin"
apply plugin: "com.github.johnrengelman.shadow"
apply plugin: "java"
version = "1.8.9-${mod_version}"
group = "${mod_base_package}.${mod_id}"
archivesBaseName = mod_id
@ -14,11 +27,10 @@ targetCompatibility = JavaVersion.VERSION_1_8
compileJava.options.encoding = 'UTF-8'
repositories {
mavenLocal()
mavenCentral()
maven { url = "https://repo.viaversion.com" }
maven { url = "https://maven.minecraftforge.net/" }
maven { url = "https://repo.spongepowered.org/repository/maven-public/" }
maven { url = "https://jitpack.io/" }
maven { url = "https://repo.viaversion.com" }
}
minecraft {
@ -45,9 +57,9 @@ def viaLibs = [
"com.viaversion:viaversion:${project.viaversion_version}",
"com.viaversion:viabackwards:${project.viabackwards_version}",
"com.viaversion:viarewind-core:${project.viarewind_version}",
"org.yaml:snakeyaml:${project.snake_yml_version}",
"org.yaml:snakeyaml:1.29",
"com.github.FlorianMichael:ViaLoadingBase:${project.vialoadingbase_version}"
"com.github.RejectedVia:ViaProtocolHack:${project.viaprotocolhack_version}"
]
dependencies {

View File

@ -5,17 +5,14 @@ org.gradle.daemon=false
# forge
mod_id=viaforge
mod_name=ViaForge
mod_version=3.1.0
mod_version=2.0.0
mod_base_package=de.enzaxd
forgegradle_version = 1d22621a6b
mixingradle_version = ae2a80e
# mixin
mixin_version=0.8.3
# via-version
vialoadingbase_version=6dad0a2561
viaversion_version=4.6.2-SNAPSHOT
viabackwards_version=4.6.2-SNAPSHOT
viarewind_version=2.0.4-SNAPSHOT
snake_yml_version=2.0
viaprotocolhack_version=ba5dcf9ce6
viaversion_version=4.5.2-SNAPSHOT
viabackwards_version=4.5.2-SNAPSHOT
viarewind_version=2.0.2-SNAPSHOT

View File

@ -1,5 +1,5 @@
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-5.1-all.zip
distributionUrl=https\://services.gradle.org/distributions/gradle-4.9-all.zip
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists

View File

@ -1,26 +1,3 @@
pluginManagement {
repositories {
mavenCentral()
gradlePluginPortal()
maven { url = "https://maven.minecraftforge.net/" }
maven { url = "https://jitpack.io/" }
maven { url = "https://repo.spongepowered.org/repository/maven-public/" }
maven { url = "https://repo.viaversion.com" }
}
resolutionStrategy {
eachPlugin {
switch (requested.id.id) {
case "net.minecraftforge.gradle.forge":
useModule("com.github.ccbluex:ForgeGradle:${forgegradle_version}")
break
case "org.spongepowered.mixin":
useModule("com.github.xcfrg:mixingradle:${mixingradle_version}")
break
}
}
}
}
rootProject.name = "ViaForge"
include 'mc1122'

View File

@ -2,8 +2,7 @@ package de.florianmichael.viaforge;
import com.mojang.realmsclient.gui.ChatFormatting;
import com.viaversion.viaversion.api.protocol.version.ProtocolVersion;
import de.florianmichael.vialoadingbase.ViaLoadingBase;
import de.florianmichael.vialoadingbase.platform.InternalProtocolList;
import de.florianmichael.viaprotocolhack.util.VersionList;
import net.minecraft.client.Minecraft;
import net.minecraft.client.gui.GuiButton;
import net.minecraft.client.gui.GuiScreen;
@ -69,12 +68,12 @@ public class GuiProtocolSelector extends GuiScreen {
@Override
protected int getSize() {
return InternalProtocolList.getProtocols().size();
return VersionList.getProtocols().size();
}
@Override
protected void elementClicked(int i, boolean b, int i1, int i2) {
ViaLoadingBase.getClassWrapper().reload(InternalProtocolList.getProtocols().get(i));
ViaForge.targetVersion = VersionList.getProtocols().get(i).getVersion();
}
@Override
@ -89,9 +88,9 @@ public class GuiProtocolSelector extends GuiScreen {
@Override
protected void drawSlot(int i, int i1, int i2, int i3, int i4, int i5) {
final ProtocolVersion version = InternalProtocolList.getProtocols().get(i);
final ProtocolVersion version = VersionList.getProtocols().get(i);
drawCenteredString(mc.fontRendererObj, (ViaLoadingBase.getClassWrapper().getTargetVersion().getVersion() == version.getVersion() ? ChatFormatting.GREEN.toString() : ChatFormatting.DARK_RED.toString()) + version.getName(), width / 2, i2, -1);
drawCenteredString(mc.fontRendererObj,(ViaForge.targetVersion == version.getVersion() ? ChatFormatting.GREEN.toString() : ChatFormatting.DARK_RED.toString()) + version.getName(), width / 2, i2, -1);
}
}
}

View File

@ -1,19 +1,63 @@
package de.florianmichael.viaforge;
import de.florianmichael.vialoadingbase.ViaLoadingBase;
import com.viaversion.viaversion.libs.gson.JsonObject;
import de.florianmichael.viaprotocolhack.INativeProvider;
import de.florianmichael.viaprotocolhack.ViaProtocolHack;
import io.netty.channel.EventLoop;
import io.netty.channel.local.LocalEventLoopGroup;
import net.minecraft.client.Minecraft;
import net.minecraft.realms.RealmsSharedConstants;
import java.io.File;
import java.util.concurrent.ExecutorService;
import java.util.concurrent.ThreadFactory;
public class ViaForge {
public class ViaForge implements INativeProvider {
public static int targetVersion = RealmsSharedConstants.NETWORK_PROTOCOL_VERSION;
public static void start() {
ViaLoadingBase.ViaLoadingBaseBuilder.
create().
runDirectory(Minecraft.getMinecraft().gameDir).
nativeVersion(RealmsSharedConstants.NETWORK_PROTOCOL_VERSION).
forceNativeVersionCondition(() -> Minecraft.getMinecraft().isSingleplayer()).
build();
try {
ViaProtocolHack.instance().init(new ViaForge(), () -> System.out.println("ViaProtocolHack loaded successfully"));
} catch (Exception ignored) {
}
}
@Override
public boolean isSinglePlayer() {
return Minecraft.getMinecraft().isSingleplayer();
}
@Override
public int nativeVersion() {
return RealmsSharedConstants.NETWORK_PROTOCOL_VERSION;
}
@Override
public int targetVersion() {
return targetVersion;
}
@Override
public String[] nettyOrder() {
return new String[] {
"decompress",
"compress"
};
}
@Override
public File run() {
return Minecraft.getMinecraft().mcDataDir;
}
@Override
public JsonObject createDump() {
return new JsonObject();
}
@Override
public EventLoop eventLoop(ThreadFactory threadFactory, ExecutorService executorService) {
return new LocalEventLoopGroup(1, threadFactory).next();
}
}

View File

@ -1,6 +1,6 @@
package de.florianmichael.viaforge.mixin.impl;
import de.florianmichael.vialoadingbase.event.PipelineReorderEvent;
import de.florianmichael.viaprotocolhack.event.PipelineReorderEvent;
import io.netty.channel.Channel;
import net.minecraft.network.NetworkManager;
import org.spongepowered.asm.mixin.Mixin;

View File

@ -4,10 +4,9 @@ import com.viaversion.viaversion.api.connection.UserConnection;
import com.viaversion.viaversion.connection.UserConnectionImpl;
import com.viaversion.viaversion.protocol.ProtocolPipelineImpl;
import de.florianmichael.viaforge.ViaForge;
import de.florianmichael.vialoadingbase.ViaLoadingBase;
import de.florianmichael.vialoadingbase.netty.NettyConstants;
import de.florianmichael.vialoadingbase.netty.VLBViaDecodeHandler;
import de.florianmichael.vialoadingbase.netty.VLBViaEncodeHandler;
import de.florianmichael.viaprotocolhack.netty.CustomViaDecodeHandler;
import de.florianmichael.viaprotocolhack.netty.CustomViaEncodeHandler;
import de.florianmichael.viaprotocolhack.netty.NettyConstants;
import io.netty.channel.Channel;
import io.netty.channel.socket.SocketChannel;
import net.minecraft.realms.RealmsSharedConstants;
@ -21,14 +20,14 @@ public class MixinNetworkManagerSub5 {
@Inject(method = "initChannel", at = @At(value = "TAIL"), remap = false)
private void onInitChannel(Channel channel, CallbackInfo ci) {
if (channel instanceof SocketChannel && ViaLoadingBase.getClassWrapper().getTargetVersion().getVersion() != RealmsSharedConstants.NETWORK_PROTOCOL_VERSION) {
if (channel instanceof SocketChannel && ViaForge.targetVersion != RealmsSharedConstants.NETWORK_PROTOCOL_VERSION) {
UserConnection user = new UserConnectionImpl(channel, true);
new ProtocolPipelineImpl(user);
channel.pipeline()
.addBefore("encoder", NettyConstants.HANDLER_ENCODER_NAME, new VLBViaEncodeHandler(user))
.addBefore("decoder", NettyConstants.HANDLER_DECODER_NAME, new VLBViaDecodeHandler(user));
.addBefore("encoder", NettyConstants.HANDLER_ENCODER_NAME, new CustomViaEncodeHandler(user))
.addBefore("decoder", NettyConstants.HANDLER_DECODER_NAME, new CustomViaDecodeHandler(user));
}
}
}