Skip to content

Network packet rework - #40

Open
ImaMapleTree wants to merge 14 commits into
GTNewHorizons:masterfrom
ImaMapleTree:packet-rework
Open

Network packet rework#40
ImaMapleTree wants to merge 14 commits into
GTNewHorizons:masterfrom
ImaMapleTree:packet-rework

Conversation

@ImaMapleTree

@ImaMapleTree ImaMapleTree commented Apr 5, 2026

Copy link
Copy Markdown

Depends on #39 (Maybe just review this one?)

A large-scale architectural overhaul of the network synchronization, inventory management, and card data pipeline

This PR contains breaking changes (listed above) and thus requires a subsequent PR to GT5u which I've already prepared

BREAKING CHANGES

  • ICardWrapper has been removed, thus the following API signatures have changed:
    • IPanelDataSource.update(TileEntity/World panel, ICardWrapper, int maxRange) -> update(TileEntity/World panel, IndexedItem<?> card, NBTCardLayout layout, int maxRange)
    • IPanelDataSource.getStringData(int displaySettings, ICardWrapper card, boolean showLabels) -> List getStringData(int displaySettings, IndexedItem<?> card, NBTCardLayout layout, boolean showLabels)
    • Additionally, IPanelDataSource now requires getLayout() method

Key points:

  • Reworked dirty / entity update logic, both client and server can send packets in the entity update loop- however, the server is responsible for actually processing card updates
  • Created inventory abstraction, and could be walked back
  • Added in card cache and hard-typed card nbt data types via layout which allows for lazy cache eviction

Additional minor changes:

  • Removed auto focus on panel opening (maybe just a me thing, but it was annoying)
  • Reintroduced labels in simple panel on cards with less than 5 settings
  • Moving from on-load powered state checking to tile entity NBT data
  • Implemented ISidedPanel so (limited) hopper interactions now work very useful

Not addressed:

There are still large parts of the code that are messy, however, since NC is being deprecated in favor of Display-Panels I opted to not change anything more than what I felt was beneficial for the user/developer experience. It should be noted that rendering is still fairly inefficient and that spamming panels, while not creating additional memory allocations, still may cause FPS to drop due to the poor draw code.

I've attached screenshots of my allocations with a 15x21 array of individual panels- a screen of this same size (using extenders) has no FPS impact after my changes; but I don't show this in the screenshots. My apologies.

Note that FPS remains the same due to the issues I mentioned above

Before:
image

After:
image

remove block NBT tag 'powered' and fix broken textures
improve tag accessors in NBTLayout to handle null values gracefully
replace `ItemCardBase` with `IPanelDataSource` for improved type generalization in inventory and panel code
restored array cards with new NBT system
migrate inventory classes to API package and update imports
@ImaMapleTree
ImaMapleTree marked this pull request as ready for review April 7, 2026 01:37
@PLASMAchicken

Copy link
Copy Markdown
Member

did you apply spotless correctly in the last commit?

@ImaMapleTree

Copy link
Copy Markdown
Author

I thought so but I guess not..?

@PLASMAchicken

Copy link
Copy Markdown
Member

The Server seems to crash due to client methodes beeing loaded on the Server Side....

@PLASMAchicken

PLASMAchicken commented Apr 9, 2026

Copy link
Copy Markdown
Member

Please make sure to test in Multiplayer and Singleplayer, especially for such large scale PRs

@ImaMapleTree

Copy link
Copy Markdown
Author

Apologies- I went back and tested to the best of my ability and managed to fix a few remaining things, everything seems to be working fine for me at this point

@PLASMAchicken
PLASMAchicken requested a review from a team April 10, 2026 22:55
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.

3 participants