mirror of
https://github.com/ViaVersion/ViaForge.git
synced 2024-11-21 11:55:13 +01:00
Migrate to ViaVersion organisation
This commit is contained in:
parent
61b497aade
commit
548e75d279
@ -1,11 +1,11 @@
|
|||||||
# ViaForge
|
# ViaForge
|
||||||
Clientside Implementation of ViaVersion for Forge
|
Client-side Implementation of ViaVersion for Forge
|
||||||
|
|
||||||
## Contact
|
## Contact
|
||||||
If you encounter any issues, please report them on the
|
If you encounter any issues, please report them on the
|
||||||
[issue tracker](https://github.com/FlorianMichael/ViaForge/issues).
|
[issue tracker](https://github.com/FlorianMichael/ViaForge/issues).
|
||||||
If you just want to talk or need help with ViaForge feel free to join my
|
If you just want to talk or need help with ViaForge feel free to join the ViaVersion
|
||||||
[Discord](https://discord.gg/BwWhCHUKDf).
|
[Discord](https://discord.gg/viaversion).
|
||||||
|
|
||||||
## For users
|
## For users
|
||||||
### Where can I download the latest version?
|
### Where can I download the latest version?
|
||||||
|
@ -5,15 +5,15 @@ org.gradle.daemon=false
|
|||||||
# forge
|
# forge
|
||||||
mod_id=viaforge
|
mod_id=viaforge
|
||||||
mod_name=ViaForge
|
mod_name=ViaForge
|
||||||
mod_version=3.2.1
|
mod_version=3.2.2
|
||||||
mod_base_package=de.florianmichael
|
mod_base_package=de.florianmichael
|
||||||
|
|
||||||
# mixin
|
# mixin
|
||||||
mixin_version=0.8.3
|
mixin_version=0.8.3
|
||||||
|
|
||||||
# via-version
|
# via-version
|
||||||
vialoadingbase_version=ff86e681d7
|
vialoader_version=2.2.5-SNAPSHOT
|
||||||
viaversion_version=4.7.0-23w18a-SNAPSHOT
|
viaversion_version=4.7.0-1.20-pre5-SNAPSHOT
|
||||||
viabackwards_version=4.7.0-23w18a-SNAPSHOT
|
viabackwards_version=4.7.0-1.20-pre5-SNAPSHOT
|
||||||
viarewind_version=2.0.4-SNAPSHOT
|
viarewind_version=2.0.4-SNAPSHOT
|
||||||
snake_yml_version=2.0
|
snake_yml_version=2.0
|
||||||
|
@ -75,9 +75,6 @@ repositories {
|
|||||||
maven {
|
maven {
|
||||||
url = "https://repo.viaversion.com"
|
url = "https://repo.viaversion.com"
|
||||||
}
|
}
|
||||||
maven {
|
|
||||||
url = "https://jitpack.io"
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
configurations {
|
configurations {
|
||||||
@ -91,7 +88,7 @@ def viaLibs = [
|
|||||||
"com.viaversion:viarewind-core:${project.viarewind_version}",
|
"com.viaversion:viarewind-core:${project.viarewind_version}",
|
||||||
"org.yaml:snakeyaml:${project.snake_yml_version}",
|
"org.yaml:snakeyaml:${project.snake_yml_version}",
|
||||||
|
|
||||||
"com.github.FlorianMichael:ViaLoadingBase:${project.vialoadingbase_version}"
|
"net.raphimc:ViaLoader:${project.vialoader_version}"
|
||||||
]
|
]
|
||||||
|
|
||||||
dependencies {
|
dependencies {
|
||||||
|
@ -17,23 +17,27 @@
|
|||||||
*/
|
*/
|
||||||
package de.florianmichael.viaforge;
|
package de.florianmichael.viaforge;
|
||||||
|
|
||||||
import de.florianmichael.vialoadingbase.ViaLoadingBase;
|
|
||||||
import io.netty.channel.DefaultEventLoop;
|
|
||||||
import net.minecraft.client.Minecraft;
|
|
||||||
import net.minecraft.realms.RealmsSharedConstants;
|
|
||||||
import net.minecraftforge.fml.common.Mod;
|
import net.minecraftforge.fml.common.Mod;
|
||||||
import net.minecraftforge.fml.common.event.FMLPreInitializationEvent;
|
import net.minecraftforge.fml.common.event.FMLPreInitializationEvent;
|
||||||
|
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;
|
||||||
|
|
||||||
@Mod(modid = "viaforge", name = "ViaForge", version = "3.0.0")
|
@Mod(modid = "viaforge", name = "ViaForge", version = "3.2.2")
|
||||||
public class ViaForge {
|
public class ViaForge {
|
||||||
|
public final static VersionEnum NATIVE_VERSION = VersionEnum.r1_12_2;
|
||||||
|
|
||||||
|
public static VersionEnum targetVersion = VersionEnum.r1_12_2;
|
||||||
|
|
||||||
@Mod.EventHandler
|
@Mod.EventHandler
|
||||||
public void init(FMLPreInitializationEvent event) {
|
public void init(FMLPreInitializationEvent event) {
|
||||||
ViaLoadingBase.ViaLoadingBaseBuilder.
|
ViaLoader.init(
|
||||||
create().
|
null,
|
||||||
runDirectory(Minecraft.getMinecraft().gameDir).
|
null,
|
||||||
nativeVersion(RealmsSharedConstants.NETWORK_PROTOCOL_VERSION).
|
null,
|
||||||
forceNativeVersionCondition(() -> Minecraft.getMinecraft().isSingleplayer()).
|
null,
|
||||||
build();
|
ViaBackwardsPlatformImpl::new, ViaRewindPlatformImpl::new
|
||||||
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -18,30 +18,42 @@
|
|||||||
package de.florianmichael.viaforge;
|
package de.florianmichael.viaforge;
|
||||||
|
|
||||||
import com.viaversion.viaversion.api.connection.UserConnection;
|
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 class ViaForgeVLLegacyPipeline extends VLLegacyPipeline {
|
||||||
public ViaForgeVLBPipeline(UserConnection info) {
|
|
||||||
super(info);
|
public ViaForgeVLLegacyPipeline(UserConnection user, VersionEnum version) {
|
||||||
|
super(user, version);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public String getDecoderHandlerName() {
|
protected String decompressName() {
|
||||||
return "decoder";
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public String getEncoderHandlerName() {
|
|
||||||
return "encoder";
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public String getDecompressionHandlerName() {
|
|
||||||
return "decompress";
|
return "decompress";
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public String getCompressionHandlerName() {
|
protected String compressName() {
|
||||||
return "compress";
|
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;
|
package de.florianmichael.viaforge.gui;
|
||||||
|
|
||||||
import com.mojang.realmsclient.gui.ChatFormatting;
|
import com.mojang.realmsclient.gui.ChatFormatting;
|
||||||
import com.viaversion.viaversion.api.protocol.version.ProtocolVersion;
|
import de.florianmichael.viaforge.ViaForge;
|
||||||
import de.florianmichael.vialoadingbase.ViaLoadingBase;
|
|
||||||
import net.minecraft.client.Minecraft;
|
import net.minecraft.client.Minecraft;
|
||||||
import net.minecraft.client.gui.GuiButton;
|
import net.minecraft.client.gui.GuiButton;
|
||||||
import net.minecraft.client.gui.GuiScreen;
|
import net.minecraft.client.gui.GuiScreen;
|
||||||
import net.minecraft.client.gui.GuiSlot;
|
import net.minecraft.client.gui.GuiSlot;
|
||||||
|
import net.raphimc.vialoader.util.VersionEnum;
|
||||||
import org.lwjgl.opengl.GL11;
|
import org.lwjgl.opengl.GL11;
|
||||||
|
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
@ -80,12 +80,12 @@ public class GuiProtocolSelector extends GuiScreen {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected int getSize() {
|
protected int getSize() {
|
||||||
return ViaLoadingBase.getProtocols().size();
|
return VersionEnum.SORTED_VERSIONS.size();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected void elementClicked(int i, boolean b, int i1, int i2) {
|
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
|
@Override
|
||||||
@ -100,9 +100,9 @@ public class GuiProtocolSelector extends GuiScreen {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected void drawSlot(int i, int i1, int i2, int i3, int i4, int i5, float v) {
|
protected void drawSlot(int i, int i1, int i2, int i3, int i4, int i5, float v) {
|
||||||
final ProtocolVersion version = ViaLoadingBase.getProtocols().get(i);
|
final VersionEnum version = VersionEnum.SORTED_VERSIONS.get(i);
|
||||||
|
|
||||||
drawCenteredString(mc.fontRenderer,(ViaLoadingBase.getInstance().getTargetVersion().getVersion() == version.getVersion() ? ChatFormatting.GREEN.toString() : ChatFormatting.DARK_RED.toString()) + version.getName(), width / 2, i2, -1);
|
drawCenteredString(mc.fontRenderer,(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;
|
package de.florianmichael.viaforge.mixin.impl;
|
||||||
|
|
||||||
import de.florianmichael.vialoadingbase.netty.event.CompressionReorderEvent;
|
|
||||||
import io.netty.channel.Channel;
|
import io.netty.channel.Channel;
|
||||||
import net.minecraft.network.NetworkManager;
|
import net.minecraft.network.NetworkManager;
|
||||||
|
import net.raphimc.vialoader.netty.CompressionReorderEvent;
|
||||||
import org.spongepowered.asm.mixin.Mixin;
|
import org.spongepowered.asm.mixin.Mixin;
|
||||||
import org.spongepowered.asm.mixin.Shadow;
|
import org.spongepowered.asm.mixin.Shadow;
|
||||||
import org.spongepowered.asm.mixin.injection.At;
|
import org.spongepowered.asm.mixin.injection.At;
|
||||||
@ -33,6 +33,6 @@ public class MixinNetworkManager {
|
|||||||
|
|
||||||
@Inject(method = "setCompressionThreshold", at = @At("RETURN"))
|
@Inject(method = "setCompressionThreshold", at = @At("RETURN"))
|
||||||
public void reOrderPipeline(int p_setCompressionTreshold_1_, CallbackInfo ci) {
|
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.api.connection.UserConnection;
|
||||||
import com.viaversion.viaversion.connection.UserConnectionImpl;
|
import com.viaversion.viaversion.connection.UserConnectionImpl;
|
||||||
import com.viaversion.viaversion.protocol.ProtocolPipelineImpl;
|
import com.viaversion.viaversion.protocol.ProtocolPipelineImpl;
|
||||||
import de.florianmichael.viaforge.ViaForgeVLBPipeline;
|
import de.florianmichael.viaforge.ViaForge;
|
||||||
import de.florianmichael.vialoadingbase.ViaLoadingBase;
|
import de.florianmichael.viaforge.ViaForgeVLLegacyPipeline;
|
||||||
import io.netty.channel.Channel;
|
import io.netty.channel.Channel;
|
||||||
import io.netty.channel.socket.SocketChannel;
|
import io.netty.channel.socket.SocketChannel;
|
||||||
import net.minecraft.realms.RealmsSharedConstants;
|
|
||||||
import org.spongepowered.asm.mixin.Mixin;
|
import org.spongepowered.asm.mixin.Mixin;
|
||||||
import org.spongepowered.asm.mixin.injection.At;
|
import org.spongepowered.asm.mixin.injection.At;
|
||||||
import org.spongepowered.asm.mixin.injection.Inject;
|
import org.spongepowered.asm.mixin.injection.Inject;
|
||||||
@ -35,11 +34,11 @@ public class MixinNetworkManager_5 {
|
|||||||
|
|
||||||
@Inject(method = "initChannel", at = @At(value = "TAIL"), remap = false)
|
@Inject(method = "initChannel", at = @At(value = "TAIL"), remap = false)
|
||||||
private void onInitChannel(Channel channel, CallbackInfo ci) {
|
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);
|
final UserConnection user = new UserConnectionImpl(channel, true);
|
||||||
new ProtocolPipelineImpl(user);
|
new ProtocolPipelineImpl(user);
|
||||||
|
|
||||||
channel.pipeline().addLast(new ViaForgeVLBPipeline(user));
|
channel.pipeline().addLast(new ViaForgeVLLegacyPipeline(user, ViaForge.targetVersion));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -2,7 +2,7 @@
|
|||||||
{
|
{
|
||||||
"modid": "viaforge",
|
"modid": "viaforge",
|
||||||
"name": "ViaForge",
|
"name": "ViaForge",
|
||||||
"description": "Clientside Implementation of ViaVersion for Forge",
|
"description": "Client-side Implementation of ViaVersion for Forge",
|
||||||
"version": "1.0.0",
|
"version": "1.0.0",
|
||||||
"mcversion": "[1.8,1.12.2]",
|
"mcversion": "[1.8,1.12.2]",
|
||||||
"url": "https://github.com/FlorianMichael/ViaForge",
|
"url": "https://github.com/FlorianMichael/ViaForge",
|
||||||
|
Loading…
Reference in New Issue
Block a user