MineColonies

MineColonies

57M Downloads

Migrate Citizen Inventories to Capabilities [$25 awarded]

Liguma opened this issue ยท 8 comments

commented

[email protected]

[11:00:00] [Server thread/WARN] [Sponge]: Opening fallback ContainerChest for inventory 'com.minecolonies.coremod.inventory.InventoryCitizen@4a3debe7'. Most API inventory methods will not be supported


The $25 bounty on this issue has been claimed at Bountysource.

commented

Seems like we need to migrate to capabilities there...

commented

How big a migration are you interested in? Adopting the codebase in general to use IItemHandler over IInventory, or just simple wrapping?

commented

To ensure we are compatible with future versions of minecraft and forge, I suggest we overhaul our inventory codes to generally use the inventory caps. Wrapping would just delay the problem.

commented

Kostronor, you could go for a combined solution. Make your own version of IInventory and create a wrapper for IItemHandler.

commented

Well, if IInventory is deprecated, there is no use in supporting it anymore, right? We have a good alternative.

commented

@Kostronor It's deprecated for use in tile entities and entities, yes, but I am also moving your own entity/helper/etc. code over to IItemHandler as it generally simplifies the code greatly due to the availability of helpers built into Forge.

commented

I have sent an initial proposal of the IItemHandler refactor as proof of work. It is not yet completed, however, and I will continue working on it to (a) fix the rough edges and (b) prepare the code for compatibility with more IItemHandlers than the mod's own/TileEntityChest's in the future.

commented

Bugs in rewrite:

  • When taking out any item stack from a Builder's Hut, the shovel will not be removed from the Hut.
  • When using multiple shovels in an inventory, both shovels will lose durability. (Perhaps due to some odd stack duplication?) - Can no longer reproduce, might have been fixed elsewhere.