在线时间:8:00-16:00
迪恩网络APP
随时随地掌握行业动态
扫描二维码
关注迪恩网络微信公众号
开源软件名称(OpenSource Name):bleroy/minecraft.client开源软件地址(OpenSource Url):https://github.com/bleroy/minecraft.client开源编程语言(OpenSource Language):C# 100.0%开源软件介绍(OpenSource Introduction):Decent .NET Minecraft ClientA .NET client library for the original (Java) version of Minecraft. It requires Forge and the Raspberry Jam mod on the Minecraft side. How to use itRequirements: Minecraft (the Java version, not the micro edition or the Windows 10 edition), Forge, and the Raspberry Jam Mod]. Reference the library, then you can open a connection and start scripting the Minecraft world: using (var world = JavaWorld.Connect())
{
world.PostToChat("Hello from C# and .NET Core!");
var originBlock = world.GetBlockType(0, 0, 0);
world.PostToChat($"Origin block is {originBlock}.");
} StatusThis is just a hack at this point: only a minimal number of APIs is implemented, but the general infrastructure is in place, and the code can actually script Minecraft from C#, which is pretty awesome in itself. How does it work?There's a Minecraft mod that enables scripting Minecraft in Python called Raspberry Jam Mod. The way that mod works is with a small Java mod that lives in Minecraft, accepting socket connections from a Python client and then exchanging text-based messages that on the wire look like function calls:
The interesting thing is that there is nothing specific about Python in that protocol: it's just messages getting exchanged over a socket, which .NET will be happy to emulate. What I did is to reverse-engineer the Python client code and re-implement it in C#. Where is this going?Eventually, I'd like to expose the entire Minecraft API with a nice object model, and to be able to start the C# scripts from the Minecraft console. That would effectively make it possible to write mods in C#, with a thin Java driver. CSX support would be nice as well. I also want to be able to run this with Mono (that should actually already work, this is just .NET Standard) on a Raspberry Pi: the protocol that Raspberry Jam implements is natively present on the Raspberry Pi version. Building from sourceThe project must now be built with csproj-based tooling (Visual Studio 2017 with Core tooling or .NET Core CLI Preview 3 or later). Can I help? - Up for grabsSure. Just let me know what you'd like to work on, so we don't duplicate efforts, but yes, hacking is highly encouraged. BlocksThis is an easy contribution. There's a couple hundred blocks to implement. Some of them, such as If you're interested in implementing blocks, look at the existing blocks in the public class Diamond : IBlock {} The block class is only part of the implementation, that is supposed to be a simple data structure
with no knowledge of the communication protocol with Minecraft.
The code that does know about the protocol must be implemented in The static constructor describes how to instantiate the correct block type from data that was passed in. In simple cases, there is no data, and no need to implement construction logic. When blocks have data, the block contruction logic must build the correct block from the wire data: _ctors[Id<Farmland>()] = d => new Farmland(d); In more complex cases, the data must be decomposed and the corresponding properties must be set on the block object. The reverse operation implemented in the The description of the format of the data for each block type that has data can be found in The Minecraft documentation wiki Data values page. EntitiesEntities will be an easy contribution once I've started creating the basic infrastructure. TestsThis is an easy to medium contribution. There are lots of blocks that need testing of their serialization and deserialization logic. We also need tests for infrastructure pieces such as CommandsThis is a medium difficulty contribution. Very few commands are currently implemented: you can echo messages to the chat using New protocolsThis is a difficult contribution. Currently, this library can only talk to the Java implementation of Minecraft, and to the Raspberry
Pi version (hopefully, I haven't verified it yet).
The code is architected so that it should be possible to implement alternative protocols by
reimplementing Tips and tricksIt is useful, while developing scripts, to be able to switch to another application without the game going into pause. This can be done by editing the |
2023-10-27
2022-08-15
2022-08-17
2022-09-23
2022-08-13
请发表评论