Git Product home page Git Product logo

Comments (10)

Naamloos avatar Naamloos commented on June 1, 2024 4

image
fucken excuse me?!

from obsidian.

Naamloos avatar Naamloos commented on June 1, 2024 1

me too my friend

from obsidian.

Seb-stian avatar Seb-stian commented on June 1, 2024 1

Hello @Mooshua! Thank you for taking interest in contributing.

You already got the gist of it, clearly. There are some important things to keep in mind (that are perhaps, not intuitive):

[Field(0), ActualType(byte)]
public MyEnum MyEnumValue { get; } // although it's an enum, it gets written as a byte
[Field(0), VarLength]
public int VarInt { get; } // gets written as varint

[Field(1), VarLength]
public long VarLong { get; } // gets written as varlong
[Field(0)]
public int[] Values { get; } // first Values.Length gets written as a varint, then the actual Values get written

[Field(1), CountType(typeof(short))]
public int[] Values { get; } // first Values.Length gets written as a short, then the actual Values get written

When there is X, Y and Z coordinates in the packet, you don't have to make them separate fields, you can use Vector or VectorF (for float/double) with [DataFormat(typeof(...))]. So for example if a packet looked like:

Field Type
X float
Y float
Z float

The packet would look like:

[Field(0), DataFormat(typeof(float))]
public VectorF Position { get; }

Sometimes, packet fields are only supposed to be written under some condition. You can use the [Condition] attribute for that.

[Field(0)]
public int ValidChangesCount { get; }

[Field(1), Condition("ValidChangesCount > 0")]
public int[] Changes { get; }

// Generates something like:
// if (ValidChangesCount > 0)
// {
//     WriteIntArray(Changes);
// }

You can view generated sserialization methods in Solution Explorer under Obsidian > Dependencies > Analyzers > Obsidian.SourceGenerators > Obsidian.SourceGenerators.Packets.Serialization.

Happy coding! ⛄

from obsidian.

roxxel avatar roxxel commented on June 1, 2024

нiхуя собi блять

from obsidian.

Naamloos avatar Naamloos commented on June 1, 2024

english?

from obsidian.

roxxel avatar roxxel commented on June 1, 2024

english?

"I'm very surprised at this number of packets" culturally speaking

from obsidian.

Naamloos avatar Naamloos commented on June 1, 2024

Welcome hacktoberfest people! A lot of packets are still unimplemented. Any help is very much welcome!

from obsidian.

Seb-stian avatar Seb-stian commented on June 1, 2024

UPDATE TO MATCH THE NEWEST PROTOCOL!

from obsidian.

Mooshua avatar Mooshua commented on June 1, 2024

Hi—what exactly is needed to implement a packet, from the perspective of a new contributor?

Currently my understanding is client bound packets simply need correct fields & ordering, and serverbound need “handler” functions for updating server state.

Are there any gotchas to contributing a packet that I’m missing?
Thanks.

from obsidian.

Naamloos avatar Naamloos commented on June 1, 2024

Added priority: blocking as this is very important. Help is very much welcome. Will update list with wiki.vg in a bit.

from obsidian.

Related Issues (20)

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.