• This repository has been archived on 17/May/2023
  • Stars
    star
    114
  • Rank 302,197 (Top 7 %)
  • Language
    Java
  • License
    GNU Lesser Genera...
  • Created about 3 years ago
  • Updated about 1 year ago

Reviews

There are no reviews yet. Be the first to send feedback to the community and the maintainers!

Repository Details

Client-side version changer for MCP using ViaVersion, ViaBackwards and ViaRewind

ViaMCP Reborn

This repository is outdated, click here to get to the new one

Client-side version changer for MCP (Originally from https://github.com/LaVache-FR/ViaMCP)

ViaForge Mod: https://github.com/RejectedVia/ViaForge

(CHANGED!) Discord Link - Moved

Exporting without needing ViaMCP in JSON

Optional 1.8.x Block Sound Fixes

1.7.x Protocols

Yes, i know they are not working right now, do not make a pull request to remove them, as i am not going to remove them.

Selecting Version

Choose the version folder that corresponds with your client version

Installation

Firstly, you will need to add the listed libraries into your dependencies in IntelliJ or Eclipse

Dependencies (Included inside libraries folder)

ViaVersion-[ver].jar > ViaVersion > https://github.com/ViaVersion/ViaVersion
ViaBackwards-[ver].jar > ViaBackwards > https://github.com/ViaVersion/ViaBackwards
ViaRewind-[ver].jar > ViaRewind > https://github.com/ViaVersion/ViaRewind
ViaSnakeYaml-[ver].jar > SnakeYaml > https://bitbucket.org/snakeyaml/snakeyaml

Secondly, you need to add code that allows you to actually use ViaMCP

Main Class

Add this to the main class of your client (aka injection function)

try
{
  ViaMCP.getInstance().start();
  
  // Only use one of the following
  ViaMCP.getInstance().initAsyncSlider(); // For top left aligned slider
  ViaMCP.getInstance().initAsyncSlider(x, y, width (min. 110), height (recommended 20)); // For custom position and size slider
}
catch (Exception e)
{
  e.printStackTrace();
}

NetworkManager

You will need to change 2 functions in NetworkManager.java

1: Name may vary, but should be func_181124_a, createNetworkManagerAndConnect or contain (Bootstrap)((Bootstrap)((Bootstrap)(new Bootstrap()).group((EventLoopGroup)lazyloadbase.getValue())

After:

(1.8.x)

p_initChannel_1_.pipeline().addLast((String)"timeout", (ChannelHandler)(new ReadTimeoutHandler(30))).addLast((String)"splitter", (ChannelHandler)(new MessageDeserializer2())).addLast((String)"decoder", (ChannelHandler)(new MessageDeserializer(EnumPacketDirection.CLIENTBOUND))).addLast((String)"prepender", (ChannelHandler)(new MessageSerializer2())).addLast((String)"encoder", (ChannelHandler)(new MessageSerializer(EnumPacketDirection.SERVERBOUND))).addLast((String)"packet_handler", (ChannelHandler)networkmanager);

(1.12.x)

p_initChannel_1_.pipeline().addLast("timeout", new ReadTimeoutHandler(30)).addLast("splitter", new NettyVarint21FrameDecoder()).addLast("decoder", new NettyPacketDecoder(EnumPacketDirection.CLIENTBOUND)).addLast("prepender", new NettyVarint21FrameEncoder()).addLast("encoder", new NettyPacketEncoder(EnumPacketDirection.SERVERBOUND)).addLast("packet_handler", networkmanager);

Add:

if (p_initChannel_1_ instanceof SocketChannel && ViaMCP.getInstance().getVersion() != ViaMCP.PROTOCOL_VERSION)
{
    UserConnection user = new UserConnectionImpl(p_initChannel_1_, true);
    new ProtocolPipelineImpl(user);
    p_initChannel_1_.pipeline().addBefore("encoder", CommonTransformer.HANDLER_ENCODER_NAME, new MCPEncodeHandler(user)).addBefore("decoder", CommonTransformer.HANDLER_DECODER_NAME, new MCPDecodeHandler(user));
}

Which should look like this afterwards (1.8.x for example):

p_initChannel_1_.pipeline().addLast((String)"timeout", (ChannelHandler)(new ReadTimeoutHandler(30))).addLast((String)"splitter", (ChannelHandler)(new MessageDeserializer2())).addLast((String)"decoder", (ChannelHandler)(new MessageDeserializer(EnumPacketDirection.CLIENTBOUND))).addLast((String)"prepender", (ChannelHandler)(new MessageSerializer2())).addLast((String)"encoder", (ChannelHandler)(new MessageSerializer(EnumPacketDirection.SERVERBOUND))).addLast((String)"packet_handler", (ChannelHandler)networkmanager);

if (p_initChannel_1_ instanceof SocketChannel && ViaMCP.getInstance().getVersion() != ViaMCP.PROTOCOL_VERSION)
{
    UserConnection user = new UserConnectionImpl(p_initChannel_1_, true);
    new ProtocolPipelineImpl(user);
    p_initChannel_1_.pipeline().addBefore("encoder", CommonTransformer.HANDLER_ENCODER_NAME, new MCPEncodeHandler(user)).addBefore("decoder", CommonTransformer.HANDLER_DECODER_NAME, new MCPDecodeHandler(user));
}

2: setCompressionTreshold (Yes, minecraft devs cannot spell 'Threshold')

Decoder Switch

Comment out this.channel.pipeline().addBefore("decoder", "decompress", new NettyCompressionDecoder(treshold)); and paste in:

NettyUtil.decodeEncodePlacement(channel.pipeline(), "decoder", "decompress", new NettyCompressionDecoder(treshold));

Encoder Switch

Comment out this.channel.pipeline().addBefore("encoder", "compress", new NettyCompressionEncoder(treshold)) and paste in:

NettyUtil.decodeEncodePlacement(channel.pipeline(), "encoder", "compress", new NettyCompressionEncoder(treshold));

Version Control

You will need to add a button to access the protocol switcher (or alternatively use the version slider under this section)

In addSingleplayerMultiplayerButtons() function add (if in GuiMainMenu):

this.buttonList.add(new GuiButton(69, 5, 5, 90, 20, "Version"));

In actionPerformed() function add:

if (button.id == 69)
{
  this.mc.displayGuiScreen(new GuiProtocolSelector(this));
}

Version Slider

You can also use a version slider to control ViaMCP versions

this.buttonList.add(ViaMCP.getInstance().asyncSlider);

Attack Order Fixes

Class: Minecraft.java

Function: clickMouse()

1.8.x

Replace this.thePlayer.swingItem(); on the 1st line in the if-clause with:

AttackOrder.sendConditionalSwing(this.objectMouseOver);

Replace this.playerController.attackEntity(this.thePlayer, this.objectMouseOver.entityHit); in the switch in case ENTITY with:

AttackOrder.sendFixedAttack(this.thePlayer, this.objectMouseOver.entityHit);

1.12.2

Replace this.player.swingArm(EnumHand.MAIN_HAND); at the last line in the else if-clause with:

AttackOrder.sendConditionalSwing(this.objectMouseOver, EnumHand.MAIN_HAND);

Replace this.playerController.attackEntity(this.player, this.objectMouseOver.entityHit); in the switch in case ENTITY with:

AttackOrder.sendFixedAttack(this.thePlayer, this.objectMouseOver.entityHit, EnumHand.MAIN_HAND);

Block Sound Fixes

Block Placement

Replace all code in onItemUse function in the ItemBlock class with:

return FixedSoundEngine.onItemUse(this, stack, playerIn, worldIn, pos, side, hitX, hitY, hitZ);

Block Breaking

Replace all code in destroyBlock function in the World class with:

return FixedSoundEngine.destroyBlock(this, pos, dropBlock);

Exporting Without JAR Files

  • This should fix most peoples issues with dependencies (usually NoClassDefFoundError or ClassNotFoundException)

1: First export your client normally

2: Open your client .jar file with an archive program (winrar or 7zip for example)

3: Also open all libraries with the selected archive program (ViaBackwards, ViaRewind, ViaSnakeYml and ViaVersion)

4: From ViaBackwards drag and drop assets and com folders to your client .jar

5: From ViaRewind drag and drop assets and de folders to your client .jar

6: From ViaSnakeYaml drag and drop org folder to your client .jar

7: From ViaVersion drag and drop assets, com and us folders to your client .jar

8: Then save and close, now your client should be working correctly ;)

Credits: mordolpl (Discord)

Finishing

You should now be able to use ViaMCP

If you have any problems, DM Hideri#9003 on discord!

More Repositories

1

UI-Utils-Reborn

Fabric mod for testing duplication exploits
Java
28
star
2

ViaMCP

ViaVersion VersionSwitcher for Minecraft Coder Pack (MCP)
Java
25
star
3

DietrichEvents2

One of the fastest Java event systems in the world using compiler optimizations, which still has a lot of features
Java
15
star
4

fabric-imgui-example-mod

Example Fabric mod which includes Dear ImGui
Java
15
star
5

RClasses

Random collection of Java classes and utils in different submodules which together form a commons library
Java
10
star
6

DietrichEvents

A fast and feature rich but still easy to use Event library for Java
Java
6
star
7

CheckHost4J

Java implementation of the check-host.net API
Java
6
star
8

ViaLoadingBase

Universal ViaVersion, ViaBackwards and ViaRewind standalone implementation
Java
5
star
9

Classic4J

Java implementation of the ClassiCube and BetaCraft protocol
Java
4
star
10

ClampClient

My old Minecraft utility mod with many useful functions (Deprecated and development finished).
Java
4
star
11

lwjgl-jg

wrapper for better LWJGL joystick/gamepad Input usage.
Java
4
star
12

WaybackAuthLib

Addon for Mojang's AuthLib to support Yggdrasil authentication again
Java
3
star
13

RMath

Random math functions and features
Java
3
star
14

AsmFabricLoader

A series of cursed Fabric hacks and utilities which break everything.
Java
3
star
15

Public-PartySystem

A Public PartySystem with the Hydra Framework
Java
2
star
16

DStatHud

Fabric mod that shows download and upload speed in F3 menu
Java
1
star
17

Bukkit-Extensions2

Powerful Bukkit API for Plugin Developers v2
Java
1
star
18

Brainfuck4J

Fast Java interpreter for Brainfuck language with optimizations, memory management and multi dialect support
Java
1
star