Skip to content

Implement new packets, extend API for logging, add config#3

Merged
ImBit merged 23 commits intoImBit:masterfrom
MesterMan03:master
Mar 27, 2026
Merged

Implement new packets, extend API for logging, add config#3
ImBit merged 23 commits intoImBit:masterfrom
MesterMan03:master

Conversation

@MesterMan03
Copy link
Copy Markdown
Contributor

@MesterMan03 MesterMan03 commented Mar 25, 2026

This PR implements new packet handlers, massively overhauls the PacketInfoBundle API without breaking compatibility and adds configuration via Cloth Config and Mod Menu (also re-enables the previously disabled packet delay feature that triggered the config TODO).

Packets implemented:

  • CommandSuggestionsResponse/Request
  • PlayerInfoRemove/Update
  • SetCursorItem

Overhauled PacketInfoBundle:

  • PacketInfoBundle now accepts a list of PacketInfoRow objects using PacketInfoBundle.ofRows(PacketType type, Component name, List<? extends PacketInfoRow> rows).
  • PacketInfoBundle.of(PacketType type, Component name, List<PacketInfoSegment> segments) is kept as-is for backwards compatibility, but it internally uses the ofRows constructor.
  • 2 new elements are added:
    • PacketInfoList for list-like data, it accepts a list of PacketInfoListElement objects (implemented by PacketInfoSegment and PacketInfoValue, so no list of lists yet)
    • PacketInfoValue for value-only data (best combined with a list, where you don't always want a key-value pair)
  • PacketInfoRow is implemented by PacketInfoSegment, PacketInfoList and PacketInfoValue, meaning they can be freely mixed inside a PacketInfoBundle.

Some previous handlers were updated to reflect the changes in PacketInfoBundle:

  • ContainerSetContent
  • RemoveEntities
  • SetPassengers
  • SetPlayerTeam

Added configuration via Cloth Config + Mod Menu:

  • Currently only one setting is supported: packetDelayMs, which is now enabled in PacketLogger.
  • Configuration file is stored in config/packetninja.json.

Misc:

  • Marked mod as explicitely client-only in fabric.mod.json

…Cloth Config + Mod Menu

- New packets: implement PlayerInfoUpdate, PlayerInfoRemove, SetCursorItem, CommandSuggestionsRequest/Response
- Logging API: add PacketInfoList and PacketInfoValue to allow handles to log list-like values and pure values without a key-value pairing.
- Config: implement Cloth Config and Mod Menu to control the packet delay setting which is now enabled. The config file is stored in config/packetninja.json.
- Updated formatting: update the formatting of many packets which use list-like values (ContainerSetContent, RemoveEntities, SetPassengers, SetPlayerTeam)
- Misc: added AGENTS.md for GitHub Copilot users
@MesterMan03
Copy link
Copy Markdown
Contributor Author

MesterMan03 commented Mar 25, 2026

@ImBit I'm still debugging a disconnect error in PlayerInfoUpdate, but I thought you might be interested already, so I opened a draft PR

lmk if you find anything

@MesterMan03 MesterMan03 marked this pull request as ready for review March 25, 2026 12:23
@MesterMan03
Copy link
Copy Markdown
Contributor Author

I think this PR deserves a 0.1.0 version bump, but of course I'll let you decide that.

@ImBit
Copy link
Copy Markdown
Owner

ImBit commented Mar 25, 2026

Great, will have a look when i get the chance :)

@MesterMan03
Copy link
Copy Markdown
Contributor Author

MesterMan03 commented Mar 25, 2026

@ImBit with the move towards build.gradle.kts, is there also a Kotlin-rewrite of the mod in mind? I've also readded the reflections library to the build script as the mod wasn't compiling without it, not sure why it was removed during the switch.

Btw in my opinion the build workflow should be separated into a pure build and a publish workflow for automatic builds in PRs and commits, while keeping the publish as a manually activated workflow or for commits on master.

@ImBit
Copy link
Copy Markdown
Owner

ImBit commented Mar 26, 2026

@MesterMan03 my bad with removing reflections, I planned on adding a classpath util as a replacement, never got round to it, will fix and push asap! a ClassGraph utility has now been included!

I do not have intentions of a kotlin rewrite at the moment. I believe @BenTechDev was planning on migrating to Kotlin when they get the time, along with adding some SheepLib functionality.

Not too sure what you mean with the second part of the build workflow, feel free to draft up something if you feel it would fit.

@MesterMan03
Copy link
Copy Markdown
Contributor Author

MesterMan03 commented Mar 26, 2026

@ImBit right, so I basically renamed the old build.yml to publish.yml and created a new build.yml that only builds and uploads the artifacts to GitHub without publishing to Modrinth. It should already be working in this PR.

Anyway, unless you find something problematic, the PR should be ready to be merged.

ImBit added 2 commits March 26, 2026 11:05
…ster

# Conflicts:
#	.github/workflows/publish.yml
#	build.gradle.kts
#	gradle.properties
@ImBit ImBit self-requested a review March 26, 2026 11:14
Copy link
Copy Markdown
Owner

@ImBit ImBit left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Mostly looks good, please work on the above changes, then I can make a release :)

@MesterMan03 MesterMan03 requested a review from ImBit March 26, 2026 14:26
Copy link
Copy Markdown
Owner

@ImBit ImBit left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Happy with this, will bump to 0.1.0 and release :)

@ImBit ImBit merged commit a3283db into ImBit:master Mar 27, 2026
1 check passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants