mirror of
https://github.com/ViaVersion/ViaForge.git
synced 2024-11-23 12:15:25 +01:00
updated Via*
This commit is contained in:
parent
50a131bff7
commit
9de262693c
32
build.gradle
32
build.gradle
@ -1,23 +1,10 @@
|
||||
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"
|
||||
}
|
||||
plugins {
|
||||
id "java"
|
||||
id "net.minecraftforge.gradle.forge"
|
||||
id "org.spongepowered.mixin"
|
||||
id "com.github.johnrengelman.shadow" version "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
|
||||
@ -27,10 +14,11 @@ targetCompatibility = JavaVersion.VERSION_1_8
|
||||
compileJava.options.encoding = 'UTF-8'
|
||||
|
||||
repositories {
|
||||
maven { url = "https://repo.viaversion.com" }
|
||||
maven { url = "https://maven.minecraftforge.net/" }
|
||||
mavenLocal()
|
||||
mavenCentral()
|
||||
maven { url = "https://repo.spongepowered.org/repository/maven-public/" }
|
||||
maven { url = "https://jitpack.io/" }
|
||||
maven { url = "https://repo.viaversion.com" }
|
||||
}
|
||||
|
||||
minecraft {
|
||||
@ -57,9 +45,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:1.29",
|
||||
"org.yaml:snakeyaml:${project.snake_yml_version}",
|
||||
|
||||
"com.github.RejectedVia:ViaProtocolHack:${project.viaprotocolhack_version}"
|
||||
"com.github.FlorianMichael:ViaLoadingBase:${project.vialoadingbase_version}"
|
||||
]
|
||||
|
||||
dependencies {
|
||||
|
@ -5,14 +5,17 @@ org.gradle.daemon=false
|
||||
# forge
|
||||
mod_id=viaforge
|
||||
mod_name=ViaForge
|
||||
mod_version=2.0.0
|
||||
mod_version=3.1.0
|
||||
mod_base_package=de.enzaxd
|
||||
forgegradle_version = 1d22621a6b
|
||||
mixingradle_version = ae2a80e
|
||||
|
||||
# mixin
|
||||
mixin_version=0.8.3
|
||||
|
||||
# via-version
|
||||
viaprotocolhack_version=ba5dcf9ce6
|
||||
viaversion_version=4.5.2-SNAPSHOT
|
||||
viabackwards_version=4.5.2-SNAPSHOT
|
||||
viarewind_version=2.0.2-SNAPSHOT
|
||||
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
|
||||
|
2
gradle/wrapper/gradle-wrapper.properties
vendored
2
gradle/wrapper/gradle-wrapper.properties
vendored
@ -1,5 +1,5 @@
|
||||
distributionBase=GRADLE_USER_HOME
|
||||
distributionPath=wrapper/dists
|
||||
distributionUrl=https\://services.gradle.org/distributions/gradle-4.9-all.zip
|
||||
distributionUrl=https\://services.gradle.org/distributions/gradle-5.1-all.zip
|
||||
zipStoreBase=GRADLE_USER_HOME
|
||||
zipStorePath=wrapper/dists
|
||||
|
@ -1,3 +1,26 @@
|
||||
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'
|
||||
|
||||
|
@ -2,7 +2,8 @@ package de.florianmichael.viaforge;
|
||||
|
||||
import com.mojang.realmsclient.gui.ChatFormatting;
|
||||
import com.viaversion.viaversion.api.protocol.version.ProtocolVersion;
|
||||
import de.florianmichael.viaprotocolhack.util.VersionList;
|
||||
import de.florianmichael.vialoadingbase.ViaLoadingBase;
|
||||
import de.florianmichael.vialoadingbase.platform.InternalProtocolList;
|
||||
import net.minecraft.client.Minecraft;
|
||||
import net.minecraft.client.gui.GuiButton;
|
||||
import net.minecraft.client.gui.GuiScreen;
|
||||
@ -68,12 +69,12 @@ public class GuiProtocolSelector extends GuiScreen {
|
||||
|
||||
@Override
|
||||
protected int getSize() {
|
||||
return VersionList.getProtocols().size();
|
||||
return InternalProtocolList.getProtocols().size();
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void elementClicked(int i, boolean b, int i1, int i2) {
|
||||
ViaForge.targetVersion = VersionList.getProtocols().get(i).getVersion();
|
||||
ViaLoadingBase.getClassWrapper().reload(InternalProtocolList.getProtocols().get(i));
|
||||
}
|
||||
|
||||
@Override
|
||||
@ -88,9 +89,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 = VersionList.getProtocols().get(i);
|
||||
final ProtocolVersion version = InternalProtocolList.getProtocols().get(i);
|
||||
|
||||
drawCenteredString(mc.fontRendererObj,(ViaForge.targetVersion == version.getVersion() ? ChatFormatting.GREEN.toString() : ChatFormatting.DARK_RED.toString()) + version.getName(), width / 2, i2, -1);
|
||||
drawCenteredString(mc.fontRendererObj, (ViaLoadingBase.getClassWrapper().getTargetVersion().getVersion() == version.getVersion() ? ChatFormatting.GREEN.toString() : ChatFormatting.DARK_RED.toString()) + version.getName(), width / 2, i2, -1);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -1,63 +1,19 @@
|
||||
package de.florianmichael.viaforge;
|
||||
|
||||
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 de.florianmichael.vialoadingbase.ViaLoadingBase;
|
||||
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 implements INativeProvider {
|
||||
|
||||
public static int targetVersion = RealmsSharedConstants.NETWORK_PROTOCOL_VERSION;
|
||||
public class ViaForge {
|
||||
|
||||
public static void start() {
|
||||
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();
|
||||
ViaLoadingBase.ViaLoadingBaseBuilder.
|
||||
create().
|
||||
runDirectory(Minecraft.getMinecraft().gameDir).
|
||||
nativeVersion(RealmsSharedConstants.NETWORK_PROTOCOL_VERSION).
|
||||
forceNativeVersionCondition(() -> Minecraft.getMinecraft().isSingleplayer()).
|
||||
build();
|
||||
}
|
||||
}
|
||||
|
@ -1,6 +1,6 @@
|
||||
package de.florianmichael.viaforge.mixin.impl;
|
||||
|
||||
import de.florianmichael.viaprotocolhack.event.PipelineReorderEvent;
|
||||
import de.florianmichael.vialoadingbase.event.PipelineReorderEvent;
|
||||
import io.netty.channel.Channel;
|
||||
import net.minecraft.network.NetworkManager;
|
||||
import org.spongepowered.asm.mixin.Mixin;
|
||||
|
@ -4,9 +4,10 @@ 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.viaprotocolhack.netty.CustomViaDecodeHandler;
|
||||
import de.florianmichael.viaprotocolhack.netty.CustomViaEncodeHandler;
|
||||
import de.florianmichael.viaprotocolhack.netty.NettyConstants;
|
||||
import de.florianmichael.vialoadingbase.ViaLoadingBase;
|
||||
import de.florianmichael.vialoadingbase.netty.NettyConstants;
|
||||
import de.florianmichael.vialoadingbase.netty.VLBViaDecodeHandler;
|
||||
import de.florianmichael.vialoadingbase.netty.VLBViaEncodeHandler;
|
||||
import io.netty.channel.Channel;
|
||||
import io.netty.channel.socket.SocketChannel;
|
||||
import net.minecraft.realms.RealmsSharedConstants;
|
||||
@ -20,14 +21,14 @@ public class MixinNetworkManagerSub5 {
|
||||
|
||||
@Inject(method = "initChannel", at = @At(value = "TAIL"), remap = false)
|
||||
private void onInitChannel(Channel channel, CallbackInfo ci) {
|
||||
if (channel instanceof SocketChannel && ViaForge.targetVersion != RealmsSharedConstants.NETWORK_PROTOCOL_VERSION) {
|
||||
if (channel instanceof SocketChannel && ViaLoadingBase.getClassWrapper().getTargetVersion().getVersion() != RealmsSharedConstants.NETWORK_PROTOCOL_VERSION) {
|
||||
|
||||
UserConnection user = new UserConnectionImpl(channel, true);
|
||||
new ProtocolPipelineImpl(user);
|
||||
|
||||
channel.pipeline()
|
||||
.addBefore("encoder", NettyConstants.HANDLER_ENCODER_NAME, new CustomViaEncodeHandler(user))
|
||||
.addBefore("decoder", NettyConstants.HANDLER_DECODER_NAME, new CustomViaDecodeHandler(user));
|
||||
.addBefore("encoder", NettyConstants.HANDLER_ENCODER_NAME, new VLBViaEncodeHandler(user))
|
||||
.addBefore("decoder", NettyConstants.HANDLER_DECODER_NAME, new VLBViaDecodeHandler(user));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user