Obsidian icon indicating copy to clipboard operation
Obsidian copied to clipboard

Implement all packets

Open Seb-stian opened this issue 4 years ago • 10 comments

A checklist of packets that are yet to be implemented on master (ordered as on wiki.vg):

Clientbound

  • [x] #222
  • [x] Spawn Painting
  • [x] Statistics
  • [x] Block Entity Data
  • [x] Server Difficulty
  • [x] Set Cooldown
  • [x] Explosion
  • [ ] Tab Complete
  • [x] Window Property
  • [x] Disconnect
  • [x] Entity Status
  • [ ] Open Horse Window
  • [x] Effect
  • [x] #67
  • [ ] Map Data
  • [ ] Trade List
  • [ ] Vehicle Move
  • [ ] Open Book
  • [ ] Open Sign Editor
  • [ ] Player Abilities
  • [x] Combat Event
  • [x] Face Player
  • [x] Player Position And Look
  • [ ] Remove Entity Effect
  • [ ] Resource Pack Send
  • [x] Respawn
  • [x] Entity Head Look
  • [ ] Multi Block Change
  • [ ] Select Advancement Tab
  • [ ] World Border
  • [ ] Camera
  • [x] Held Item Change
  • [ ] Update View Distance
  • [ ] Attach Entity
  • [x] Set Experience
  • [x] Update Health
  • [ ] Set Passengers
  • [x] Teams
  • [x] Time Update
  • [x] Title
  • [x] Entity Sound Effect
  • [ ] Stop Sound
  • [ ] NBT Query Response
  • [x] Advancements
  • [x] Entity Properties
  • [x] Entity Effect
  • [x] Declare Recipes

Serverbound

  • [ ] Query Block NBT
  • [ ] Query Entity NBT
  • [ ] Set Difficulty
  • [x] Client Status
  • [ ] Tab Complete
  • [ ] Edit Book
  • [x] Interact Entity
  • [ ] Generate Structure
  • [ ] Lock Difficulty
  • [X] Player Position And Rotation
  • [X] Player Movement
  • [ ] Vehicle Move
  • [ ] Steer Boat
  • [ ] Player Abilities
  • [ ] Steer Vehicle
  • [ ] Set Recipe Book State
  • [ ] Resource Pack Status
  • [ ] Advancement Tab
  • [ ] Select Trade
  • [ ] Set Beacon Effect
  • [x] Held Item Change
  • [ ] Update Command Block
  • [ ] Update Command Block Minecart
  • [ ] Update Jigsaw Puzzle
  • [ ] Update Structure Block
  • [ ] Update Sign
  • [ ] Spectate
  • [x] Use Item

Login

  • [ ] Login Plugin Request
  • [ ] Login Plugin Response

Seb-stian avatar Feb 07 '21 15:02 Seb-stian

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

roxxel avatar Feb 07 '21 15:02 roxxel

english?

Naamloos avatar Feb 07 '21 15:02 Naamloos

english?

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

roxxel avatar Feb 07 '21 15:02 roxxel

me too my friend

Naamloos avatar Feb 07 '21 15:02 Naamloos

image fucken excuse me?!

Naamloos avatar Mar 09 '21 17:03 Naamloos

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

Naamloos avatar Oct 23 '21 20:10 Naamloos

UPDATE TO MATCH THE NEWEST PROTOCOL!

Seb-stian avatar Dec 21 '21 23:12 Seb-stian

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.

Mooshua avatar Dec 24 '21 05:12 Mooshua

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! ⛄

Seb-stian avatar Dec 24 '21 08:12 Seb-stian

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

Naamloos avatar Jan 09 '22 19:01 Naamloos