Skip to content

Inventory rewrite#1074

Draft
RoyalMCPE wants to merge 1 commit intodf-mc:masterfrom
RoyalMCPE:inv-rewrite
Draft

Inventory rewrite#1074
RoyalMCPE wants to merge 1 commit intodf-mc:masterfrom
RoyalMCPE:inv-rewrite

Conversation

@RoyalMCPE
Copy link
Copy Markdown
Contributor

@RoyalMCPE RoyalMCPE commented May 25, 2025

This is still very early stages. Panics, item duplication and other bugs are almost guaranteed. You have been warned

This implementation is a complete mess right now and currently doesn't allow opening inventories. I already have ideas on cleanup and improving api, I mostly just wanted to resolve import cycles and compile errors first. If you're looking through this mess key places are world/inventory.go, world/tx.go, block/chest.go, world/world.go.

TODO

  • Migrate Chest/Double Chest
  • Migrate Barrel
  • Migrate Brewing Stand
  • Migrate Ender Chest
  • Migrate Hopper
  • Migrate Furnace/Blast Furnace/Smoker
  • Save/Loading from disk
  • Migrate Player
  • Close inventory related issues
  • Virtual inventories
  • Event handlers
  • Documentation

Goals

  • Have inventories be managed by the world for; better data loading/unloading, general safety, and to align their design with the rest of the dragonfly.
  • Set the ground works to emulate from in a future entity rewrite

Notes

  • The current implementation uses a library I created here based on work from karl-zylinski. I haven't had time to benchmark it, but once I do and the implementation looks good I'll probably just copy pasta it into 'server/internal'.
  • Like *player.Player it's not recommended to store a inventory.Inventory as it could be invalidated without warning. *world.InventoryHandle should be stored instead

Related Issues

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.

1 participant