MCP cover image
See in Github
2023-05-18

使用Viaversion,Viabackwards和ViaRewind的客户端版本更改器用于MCP

13

Github Watches

10

Github Forks

111

Github Stars

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!

相关推荐

  • https://suefel.com
  • Latest advice and best practices for custom GPT development.

  • Yusuf Emre Yeşilyurt
  • I find academic articles and books for research and literature reviews.

  • https://maiplestudio.com
  • Find Exhibitors, Speakers and more

  • Carlos Ferrin
  • Encuentra películas y series en plataformas de streaming.

  • Joshua Armstrong
  • Confidential guide on numerology and astrology, based of GG33 Public information

  • Emmet Halm
  • Converts Figma frames into front-end code for various mobile frameworks.

  • Alexandru Strujac
  • Efficient thumbnail creator for YouTube videos

  • Elijah Ng Shi Yi
  • Advanced software engineer GPT that excels through nailing the basics.

  • lumpenspace
  • Take an adjectivised noun, and create images making it progressively more adjective!

  • Lists Tailwind CSS classes in monospaced font

  • https://appia.in
  • Siri Shortcut Finder – your go-to place for discovering amazing Siri Shortcuts with ease

  • apappascs
  • 发现市场上最全面,最新的MCP服务器集合。该存储库充当集中式枢纽,提供了广泛的开源和专有MCP服务器目录,并提供功能,文档链接和贡献者。

  • ShrimpingIt
  • MCP系列GPIO Expander的基于Micropython I2C的操作,源自ADAFRUIT_MCP230XX

  • jae-jae
  • MCP服务器使用剧作《无头浏览器》获取网页内容。

  • ravitemer
  • 一个功能强大的Neovim插件,用于管理MCP(模型上下文协议)服务器

  • Mintplex-Labs
  • 带有内置抹布,AI代理,无代理构建器,MCP兼容性等的多合一桌面和Docker AI应用程序。

  • patruff
  • Ollama和MCP服务器之间的桥梁,使本地LLMS可以使用模型上下文协议工具

  • pontusab
  • 光标与风浪冲浪社区,查找规则和MCP

  • WangRongsheng
  • 🧑‍🚀 llm 资料总结(数据处理、模型训练、模型部署、 o1 模型、mcp 、小语言模型、视觉语言模型)|摘要世界上最好的LLM资源。

  • av
  • 毫不费力地使用一个命令运行LLM后端,API,前端和服务。

  • n8n-io
  • 具有本机AI功能的公平代码工作流程自动化平台。将视觉构建与自定义代码,自宿主或云相结合,400+集成。

    Reviews

    3 (1)
    Avatar
    user_hDV9RZ6p
    2025-04-17

    ViaMCP-Reborn is an amazing tool for anyone interested in maintaining backward compatibility in Minecraft. The ease of use and seamless integration make it indispensable. Highly recommend checking it out on GitHub for a better Minecraft experience!