Advanced Peripherals

Advanced Peripherals

29M Downloads

Inventory Manager api, slot argument behaviour is assumedly incorrect.

jebjordan opened this issue · 10 comments

commented

Description

The Inventory Manager api is dumb/broken.

addItemToPlayer slot designation does not choose where to place an item and instead chooses from which slot to take the item in the originating inventory/chest.
This functionality is stupid because in the alternative function, removeItemFromPlayer, the slot designation chooses the slot in the inventory to take the item from. Thus, I assume the intended behaviour is for addItemToPlayer to also designate a slot in the player inventory to place it.

The api wiki also seems to suggest this is the case, so I assume something went horribly wrong and the behaviour was implemented incorrectly. please fix.

Steps to reproduce

  1. place down computer
  2. make lua script to place an item in player inventory via inventory manager.
    manager.addItemToPlayer("UP", 1, 4, "minecraft:dirt")
  3. notice that instead of placing the dirt in slot 4, (in the hotbar according to removeItemFromPlayer), it instead takes the dirt from slot 4 from the chest, and places it in the first empty slot in your inventory.

-- > correct behaviour should be to take from any random slot with the item, or anything if no item designated, and to place said item into slot 4 of the inventory, or return an error if said slot is full/occupied. -1 slot designation should place it in the first empty slot in your inventory.

Multiplayer?

Yes

Version

0.7.2r (Latest)

Minecraft, Forge and maybe other related mods versions

Forge 36.2.6, Minecraft 1.16.5

Screenshots or Videos

No response

Crashlog/log

No response

commented

Please fix, lol.
And if this is intended behaviour, then please add a separate function to actually addItemToPlayer and rename this one to "retrieveFromChest" or something, since that would better suit the current incorrect behaviour of the arguments relating to the chest and not the player.

commented

So the only thing you want to change is the destination of the slot from addItemToPlayer

I assume something went horribly wrong

Yes, the slot parameter should be the slot of the player, not the chest

commented

Yes, that is correct.

Was I wrong to report a small bug such as this?

Thanks for making this mod by the way, quite love it.

commented

Was I wrong to report a small bug such as this?

Nope, a bug report is never wrong (:
I will fix this in 0.7.2

commented

@Seniorendi just did a bit of testing and this still doesn't seem to work.
it now ignores the inventory slot of the from inventory, but still does nothing with the slot id.

manager.addItemToPlayer("UP", 1, 24)
and
manager.addItemToPlayer("UP", 1, 5)

Do the exact same thing, (ignore the slot and just place the item in the first empty slot.)
(even using 1 as the slot on both calls does the same. Just ignores slot and places in first empty slot, (and in case of two calls, two empty slots))

So it would appear it wasn't fixed. please re-open.

commented

@MrNaru300 Just a ping if you want to look at this(You made the PR)
I will take a look tomorrow

commented

Accidental click in the app.

Ugh. This darn app.

commented

@MrNaru300 just a reminder since I didn't ping you

commented

I'm really sorry.
Now this PR should fix the bug.

commented

Fixed/added in 0.7.4r