Coder Social home page Coder Social logo

mcproto-rs's Introduction

mcproto-rs

This is an implementation of serialization and deserialization of the minecraft protocol.

This crate can be used to implement any version of the minecraft protocol, and has an example implementation of version 1.15.2 included as module v1_15_2.

To implement your own protocol, consult this example, and use the macros to define a protocol to your heart's content!

More documentation to come, just dumping the code since I finished it.

Usage:

[dependencies]
mcproto-rs = "0.2.0"

#![no_std]

You can use this crate without the standard library (but requiring alloc) by setting default-features = false in your Cargo.toml. This will only disable the UUID4::random() function, which requires OsRandom to generate a random UUID.

mcproto-rs's People

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

mcproto-rs's Issues

Can't build with stable release channel

error[E0554]: `#![feature]` may not be used on the stable release channel
 --> src/lib.rs:1:40
  |
1 | #![cfg_attr(feature = "bench", feature(test))]
  |                                        ^^^^

For more information about this error, try `rustc --explain E0554`.
error: could not compile `mcproto-rs` due to previous error

Using the stable-x86_64-unknown-linux-gnu channel with cargo 1.62.1 (a748cf5a3 2022-06-08) and rustc 1.62.1 (e092d0b6b 2022-07-16)

Issue with chat decoding

Hi, I'm having an error as a client trying to decode chat messages.

First of all, I'm running it on 1.16.5 minecraft server (there is a change in protocol version but I did not see any change in protocol, so I'm not sure if it is not from there).

On my code I used dbg!() on `` and I get this :

[src/engine.rs:51] err = PacketErr {
    err: failed to deserialize packet: failed to deserialize json: "failed to deserialize chat from JSON '{\"translate\":\"chat.type.text\",\"with\":[{\"insertion\":\"nicoxxl\",\"clickEvent\":{\"action\":\"suggest_command\",\"value\":\"/tell nicoxxl \"},\"hoverEvent\":{\"action\":\"show_entity\",\"contents\":{\"type\":\"minecraft:player\",\"id\":\"665fbf7d-d38f-3fa1-80a3-3a9a2c7d7220\",\"name\":{\"text\":\"nicoxxl\"}}},\"text\":\"nicoxxl\"},\"Hello BillyBob :)\"]}' :: Error(\"unable to parse one of the translation with entries :: unexpected key in event contents\", line: 1, column: 314)",
}

The formatted JSON looks like that :

{
  "translate": "chat.type.text",
  "with": [
    {
      "clickEvent": {
        "action": "suggest_command",
        "value": "/tell nicoxxl "
      },
      "hoverEvent": {
        "action": "show_entity",
        "contents": {
          "id": "665fbf7d-d38f-3fa1-80a3-3a9a2c7d7220",
          "name": {
            "text": "nicoxxl"
          },
          "type": "minecraft:player"
        }
      },
      "insertion": "nicoxxl",
      "text": "nicoxxl"
    },
    "Hello BillyBob :)"
  ]
}

In the code I saw this :

#[derive(Serialize, Clone, Debug, PartialEq)]
pub struct BaseComponent {
    // Cut some fields above
    #[serde(skip_serializing_if = "Option::is_none")]
    pub click_event: Option<ChatClickEvent>,
    #[serde(skip_serializing_if = "Option::is_none")]
    pub hover_event: Option<ChatHoverEvent>,
    // Cut some field below
}

You did not used #[serde(rename = "name")] to swith to camelCase, is that an error or the protocol changed ?

VarInt doesn't take parameters

Hey, I just started reading through the 1.15 example to create an 1.8 protocol. I pasted it into my IDE, and it told me that VarInt doesn't take arguments. Do you know why, since it's the example from the repository?
image

Releases / docs

Just wondering if there will be any releases published to crates.io, which would also have the added benefit of documentation being automatically available at docs.rs.

This question of course also applies to mctokio

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.