Advanced Peripherals

Advanced Peripherals

29M Downloads

InventoryManager - removeItemFromPlayer Armor Issue

Kreynolds4142 opened this issue ยท 2 comments

commented

Describe

Attempting to remove armor using removeItemFromPlayer() has unexpected results, depending on how it is called.

  • Calling removeItemFromPlayer() and specifying a slot does nothing
  • Calling removeItemFromPlayer() and passing -1 in for the slot, with a name removes all items in inventory slots with values less than the specified item.
    Ex. Player is wearing a full set of armor. Calling removeItemFromPlayer() and providing the helmet item name causes all items in the inventory to be removed, except the helmet. Calling removeItemFromPlayer() and providing the pants item name causes all items in the main inventory and boots to be removed, while pants, chest, and helmet are still equipped.

I assume there may be some relation to #406

Steps to reproduce

local player = peripheral.find("inventoryManager")

function unequipWithSlot()
	for k,v in pairs(player.getArmor()) do
		player.removeItemFromPlayer("BACK", 1, v.slot, v.name)
	end
end

function unequipWithoutSlot()
	for k,v in pairs(player.getArmor()) do
		player.removeItemFromPlayer("BACK", 1, -1, v.name)
	end
end

unequipWithSlot()  -- Does nothing
unequipWithoutSlot()  --Removes all items except helmet

Multiplayer?

Yes

Version

1.19.2-0.7.22b (Latest 1.19)

Minecraft, Forge and maybe other related mods versions

Forge 43.2.3 Minecraft 1.19.2 CC: Tweaked 1.101.1 (Direwolf20 1.19 modpack, v1.1.1)

Screenshots or Videos

No response

Crashlog/log

No response

commented

Priority is high since I remake some systems to be more reliable which can be used for multiple peripherals at once to remove the extra inventory stuff for every peripheral which does something with inventories.

commented

Currently working on refining that!
Every item transferring related block now uses the same system.
Adding new filters and eliminating bugs.

This is the video I posted on discord

2023-02-04_03-17-47.mp4