public void load(Player p) {
PlayerInventory playerInventory = p.getInventory().query
(PlayerInventory.class);
// Err1: ArmorEquipable can not get it
ArmorEquipable armorEquipable = playerInventory.getEquipment()
.getCarrier().get();
GridInventory gridInventory = playerInventory.getMain();
// Err2: set() not working
gridInventory.set(0, 0, ItemStack.builder().itemType(ItemTypes
.GRASS).build());
Hotbar hotbar = playerInventory.getHotbar();
// Err3: set() not working
hotbar.set(SlotIndex.of(0), ItemStack.builder().itemType(ItemTypes
.GRASS).build());
}
I don’t think you should be querying for the inventory and then casting it to a player inventory. You shouldn’t even be querying
Many features of the InventoryAPI are not implemented yet. I’m still waiting on the implementation of Slot#getProperty(SlotPos.class, null)
which blocks me a lot in the progress of my plugin
1 Like
Slots don’t even properly set their item, they just set it for their slot and the rest of the slots of a higher number. Quite a bit needs to be done, heh.
it working on SpongeAPI 4.1.0
but not SpongeAPI 5.0.0
Then make an issue for it on GitHub somewhere. Darn regression bugs
If the InventoryAPI are not implemented.
Why not mark it.
what?
#what?
wot