mirror of
https://github.com/ViaVersion/ViaForge.git
synced 2024-11-23 12:15:25 +01:00
Updated changes from master branch
This commit is contained in:
parent
b30baced5f
commit
bcf2e96a50
@ -38,7 +38,7 @@ repositories {
|
||||
minecraft {
|
||||
version = "1.8.9-11.15.1.2318-1.8.9"
|
||||
runDir = "run"
|
||||
mappings = "stable_22"
|
||||
mappings = "stable_20"
|
||||
makeObfSourceJar = false
|
||||
clientJvmArgs += ["-Dfml.coreMods.load=de.florianmichael.viaforge.mixin.MixinLoader"]
|
||||
}
|
||||
@ -60,7 +60,7 @@ def viaLibs = [
|
||||
"com.viaversion:viarewind-core:${project.viarewind_version}",
|
||||
"org.yaml:snakeyaml:${project.snake_yml_version}",
|
||||
|
||||
"com.github.FlorianMichael:ViaLoadingBase:${project.vialoadingbase_version}"
|
||||
"net.raphimc:ViaLoader:${project.vialoader_version}"
|
||||
]
|
||||
|
||||
dependencies {
|
||||
|
@ -5,15 +5,15 @@ org.gradle.daemon=false
|
||||
# forge
|
||||
mod_id=viaforge
|
||||
mod_name=ViaForge
|
||||
mod_version=3.2.1
|
||||
mod_version=3.2.2
|
||||
mod_base_package=de.florianmichael
|
||||
|
||||
# mixin
|
||||
mixin_version=0.8.3
|
||||
|
||||
# via-version
|
||||
vialoadingbase_version=ff86e681d7
|
||||
viaversion_version=4.7.0-23w18a-SNAPSHOT
|
||||
viabackwards_version=4.7.0-23w18a-SNAPSHOT
|
||||
vialoader_version=2.2.5-SNAPSHOT
|
||||
viaversion_version=4.7.0-1.20-pre5-SNAPSHOT
|
||||
viabackwards_version=4.7.0-1.20-pre5-SNAPSHOT
|
||||
viarewind_version=2.0.4-SNAPSHOT
|
||||
snake_yml_version=2.0
|
||||
|
@ -17,18 +17,23 @@
|
||||
*/
|
||||
package de.florianmichael.viaforge;
|
||||
|
||||
import de.florianmichael.vialoadingbase.ViaLoadingBase;
|
||||
import net.minecraft.client.Minecraft;
|
||||
import net.minecraft.realms.RealmsSharedConstants;
|
||||
import net.raphimc.vialoader.ViaLoader;
|
||||
import net.raphimc.vialoader.impl.platform.ViaBackwardsPlatformImpl;
|
||||
import net.raphimc.vialoader.impl.platform.ViaRewindPlatformImpl;
|
||||
import net.raphimc.vialoader.util.VersionEnum;
|
||||
|
||||
public class ViaForge {
|
||||
public final static VersionEnum NATIVE_VERSION = VersionEnum.r1_12_2;
|
||||
|
||||
public static VersionEnum targetVersion = VersionEnum.r1_12_2;
|
||||
|
||||
public static void start() {
|
||||
ViaLoadingBase.ViaLoadingBaseBuilder.
|
||||
create().
|
||||
runDirectory(Minecraft.getMinecraft().mcDataDir).
|
||||
nativeVersion(RealmsSharedConstants.NETWORK_PROTOCOL_VERSION).
|
||||
forceNativeVersionCondition(() -> Minecraft.getMinecraft().isSingleplayer()).
|
||||
build();
|
||||
ViaLoader.init(
|
||||
null,
|
||||
null,
|
||||
null,
|
||||
null,
|
||||
ViaBackwardsPlatformImpl::new, ViaRewindPlatformImpl::new
|
||||
);
|
||||
}
|
||||
}
|
||||
|
@ -18,30 +18,42 @@
|
||||
package de.florianmichael.viaforge;
|
||||
|
||||
import com.viaversion.viaversion.api.connection.UserConnection;
|
||||
import de.florianmichael.vialoadingbase.netty.VLBPipeline;
|
||||
import net.raphimc.vialoader.netty.VLLegacyPipeline;
|
||||
import net.raphimc.vialoader.util.VersionEnum;
|
||||
|
||||
public class ViaForgeVLBPipeline extends VLBPipeline {
|
||||
public ViaForgeVLBPipeline(UserConnection info) {
|
||||
super(info);
|
||||
public class ViaForgeVLLegacyPipeline extends VLLegacyPipeline {
|
||||
|
||||
public ViaForgeVLLegacyPipeline(UserConnection user, VersionEnum version) {
|
||||
super(user, version);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getDecoderHandlerName() {
|
||||
return "decoder";
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getEncoderHandlerName() {
|
||||
return "encoder";
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getDecompressionHandlerName() {
|
||||
protected String decompressName() {
|
||||
return "decompress";
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getCompressionHandlerName() {
|
||||
protected String compressName() {
|
||||
return "compress";
|
||||
}
|
||||
|
||||
@Override
|
||||
protected String packetDecoderName() {
|
||||
return "decoder";
|
||||
}
|
||||
|
||||
@Override
|
||||
protected String packetEncoderName() {
|
||||
return "encoder";
|
||||
}
|
||||
|
||||
@Override
|
||||
protected String lengthSplitterName() {
|
||||
return "splitter";
|
||||
}
|
||||
|
||||
@Override
|
||||
protected String lengthPrependerName() {
|
||||
return "prepender";
|
||||
}
|
||||
}
|
@ -18,12 +18,12 @@
|
||||
package de.florianmichael.viaforge.gui;
|
||||
|
||||
import com.mojang.realmsclient.gui.ChatFormatting;
|
||||
import com.viaversion.viaversion.api.protocol.version.ProtocolVersion;
|
||||
import de.florianmichael.vialoadingbase.ViaLoadingBase;
|
||||
import de.florianmichael.viaforge.ViaForge;
|
||||
import net.minecraft.client.Minecraft;
|
||||
import net.minecraft.client.gui.GuiButton;
|
||||
import net.minecraft.client.gui.GuiScreen;
|
||||
import net.minecraft.client.gui.GuiSlot;
|
||||
import net.raphimc.vialoader.util.VersionEnum;
|
||||
import org.lwjgl.opengl.GL11;
|
||||
|
||||
import java.io.IOException;
|
||||
@ -85,12 +85,12 @@ public class GuiProtocolSelector extends GuiScreen {
|
||||
|
||||
@Override
|
||||
protected int getSize() {
|
||||
return ViaLoadingBase.getProtocols().size();
|
||||
return VersionEnum.SORTED_VERSIONS.size();
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void elementClicked(int i, boolean b, int i1, int i2) {
|
||||
ViaLoadingBase.getInstance().reload(ViaLoadingBase.getProtocols().get(i));
|
||||
ViaForge.targetVersion = VersionEnum.SORTED_VERSIONS.get(i);
|
||||
}
|
||||
|
||||
@Override
|
||||
@ -105,9 +105,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 = ViaLoadingBase.getProtocols().get(i);
|
||||
final VersionEnum version = VersionEnum.SORTED_VERSIONS.get(i);
|
||||
|
||||
drawCenteredString(mc.fontRendererObj, (ViaLoadingBase.getInstance().getTargetVersion().getVersion() == version.getVersion() ? ChatFormatting.GREEN.toString() : ChatFormatting.DARK_RED.toString()) + version.getName(), width / 2, i2, -1);
|
||||
drawCenteredString(mc.fontRendererObj, (ViaForge.targetVersion.getVersion() == version.getVersion() ? ChatFormatting.GREEN.toString() : ChatFormatting.DARK_RED.toString()) + version.getName(), width / 2, i2, -1);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -17,9 +17,9 @@
|
||||
*/
|
||||
package de.florianmichael.viaforge.mixin.impl;
|
||||
|
||||
import de.florianmichael.vialoadingbase.netty.event.CompressionReorderEvent;
|
||||
import io.netty.channel.Channel;
|
||||
import net.minecraft.network.NetworkManager;
|
||||
import net.raphimc.vialoader.netty.CompressionReorderEvent;
|
||||
import org.spongepowered.asm.mixin.Mixin;
|
||||
import org.spongepowered.asm.mixin.Shadow;
|
||||
import org.spongepowered.asm.mixin.injection.At;
|
||||
@ -33,6 +33,6 @@ public class MixinNetworkManager {
|
||||
|
||||
@Inject(method = "setCompressionTreshold", at = @At("RETURN"))
|
||||
public void reOrderPipeline(int p_setCompressionTreshold_1_, CallbackInfo ci) {
|
||||
channel.pipeline().fireUserEventTriggered(new CompressionReorderEvent());
|
||||
channel.pipeline().fireUserEventTriggered(CompressionReorderEvent.INSTANCE);
|
||||
}
|
||||
}
|
||||
|
@ -20,11 +20,10 @@ package de.florianmichael.viaforge.mixin.impl;
|
||||
import com.viaversion.viaversion.api.connection.UserConnection;
|
||||
import com.viaversion.viaversion.connection.UserConnectionImpl;
|
||||
import com.viaversion.viaversion.protocol.ProtocolPipelineImpl;
|
||||
import de.florianmichael.viaforge.ViaForgeVLBPipeline;
|
||||
import de.florianmichael.vialoadingbase.ViaLoadingBase;
|
||||
import de.florianmichael.viaforge.ViaForge;
|
||||
import de.florianmichael.viaforge.ViaForgeVLLegacyPipeline;
|
||||
import io.netty.channel.Channel;
|
||||
import io.netty.channel.socket.SocketChannel;
|
||||
import net.minecraft.realms.RealmsSharedConstants;
|
||||
import org.spongepowered.asm.mixin.Mixin;
|
||||
import org.spongepowered.asm.mixin.injection.At;
|
||||
import org.spongepowered.asm.mixin.injection.Inject;
|
||||
@ -35,11 +34,11 @@ public class MixinNetworkManager_5 {
|
||||
|
||||
@Inject(method = "initChannel", at = @At(value = "TAIL"), remap = false)
|
||||
private void onInitChannel(Channel channel, CallbackInfo ci) {
|
||||
if (channel instanceof SocketChannel && ViaLoadingBase.getInstance().getTargetVersion().getVersion() != RealmsSharedConstants.NETWORK_PROTOCOL_VERSION) {
|
||||
if (channel instanceof SocketChannel && ViaForge.targetVersion != ViaForge.NATIVE_VERSION) {
|
||||
final UserConnection user = new UserConnectionImpl(channel, true);
|
||||
new ProtocolPipelineImpl(user);
|
||||
|
||||
channel.pipeline().addLast(new ViaForgeVLBPipeline(user));
|
||||
channel.pipeline().addLast(new ViaForgeVLLegacyPipeline(user, ViaForge.targetVersion));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user