mirror of
https://github.com/ViaVersion/ViaForge.git
synced 2024-11-08 10:09:36 +01:00
Migrate to ViaVersion organisation
This commit is contained in:
parent
61b497aade
commit
548e75d279
@ -1,11 +1,11 @@
|
||||
# ViaForge
|
||||
Clientside Implementation of ViaVersion for Forge
|
||||
Client-side Implementation of ViaVersion for Forge
|
||||
|
||||
## Contact
|
||||
If you encounter any issues, please report them on the
|
||||
[issue tracker](https://github.com/FlorianMichael/ViaForge/issues).
|
||||
If you just want to talk or need help with ViaForge feel free to join my
|
||||
[Discord](https://discord.gg/BwWhCHUKDf).
|
||||
If you just want to talk or need help with ViaForge feel free to join the ViaVersion
|
||||
[Discord](https://discord.gg/viaversion).
|
||||
|
||||
## For users
|
||||
### Where can I download the latest version?
|
||||
|
@ -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
|
||||
|
@ -75,9 +75,6 @@ repositories {
|
||||
maven {
|
||||
url = "https://repo.viaversion.com"
|
||||
}
|
||||
maven {
|
||||
url = "https://jitpack.io"
|
||||
}
|
||||
}
|
||||
|
||||
configurations {
|
||||
@ -91,7 +88,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 {
|
||||
|
@ -17,23 +17,27 @@
|
||||
*/
|
||||
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.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 final static VersionEnum NATIVE_VERSION = VersionEnum.r1_12_2;
|
||||
|
||||
public static VersionEnum targetVersion = VersionEnum.r1_12_2;
|
||||
|
||||
@Mod.EventHandler
|
||||
public void init(FMLPreInitializationEvent event) {
|
||||
ViaLoadingBase.ViaLoadingBaseBuilder.
|
||||
create().
|
||||
runDirectory(Minecraft.getMinecraft().gameDir).
|
||||
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;
|
||||
@ -80,12 +80,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
|
||||
@ -100,9 +100,9 @@ public class GuiProtocolSelector extends GuiScreen {
|
||||
|
||||
@Override
|
||||
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;
|
||||
|
||||
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 = "setCompressionThreshold", 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));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -2,7 +2,7 @@
|
||||
{
|
||||
"modid": "viaforge",
|
||||
"name": "ViaForge",
|
||||
"description": "Clientside Implementation of ViaVersion for Forge",
|
||||
"description": "Client-side Implementation of ViaVersion for Forge",
|
||||
"version": "1.0.0",
|
||||
"mcversion": "[1.8,1.12.2]",
|
||||
"url": "https://github.com/FlorianMichael/ViaForge",
|
||||
|
Loading…
Reference in New Issue
Block a user