InventoryManager Taking Items from wrong slots
Bhavik1712 opened this issue ยท 7 comments
Describe
Tried getting the top 3 to be removed by Inventory Manager. Removes hotbar and all other rows except 6 from 3rd row from top.
Steps to reproduce
- Use Following Code
- Type"dump"
Multiplayer?
Yes
Version
1.20.1-0.7.38r (Latest 1.20.1)
Minecraft, Forge and maybe other related mods versions
Chosen's Modded Adventure Forge 47.2.20
Screenshots or Videos
No response
Crashlog/log
No response
The script you shared is outdated. removeItemFromPlayer only removes one item at a time or all items until the target inventory is full or the player inventory is empty. whichever comes first. The second parameter of removeItemFromPlayer takes a table with information about the item to remove using the filter format, since your filter is invalid it removes everything it can, That's why your inventory got almost entirely cleared, everything got removed until the target inventory was full.
Assuming that I understood your intention correctly, which I interpreted as you want to clear the first row/9 Slots of your inventory, what you actually want to do is something like this:
local cb = peripheral.find("chatBox")
local im = peripheral.find("inventoryManager")
if im == nil then error("Inventory Manager not found!") end
if cb == nil then error("Chatbox not found!") end
term.clear()
term.setCursorPos(1, 1)
print("Running Dumper...")
while true do
local e, player, msg = os.pullEvent("chat")
if msg == "dump" and player == "Bhavik_OwO" then
print("Dumping Slots...")
for i = 9, 17 do
im.removeItemFromPlayer("up", { fromSlot = i })
end
end
end
Oh okay, I was looking for a solution but couldn't find one. Thank you so much for the help and information.
Would you mind copying/uploading the code so we don't have to type it off the image?
Nevermind, I already typed the core part of the image. And your code doesn't really make sense, especially the line im.removeItemFromPlayer("up",foo)
since you've added the entire inventory to foo and therefore remove everything the player has. The reason why some items are still in your inventory is most likely that the storage on top of the inventory manager can't fit everything inside.
So sorry, was away from PC. I had copied this code. Whenever I tried running it, I would run into an error. I tried looking at documentation or videos and couldn't find anything except for the change in the im.removeItemFromPlayer()
. which is why I tried with foo instead of v,k
I'm unable to share pastebin as the server I'm on doesn't have the http service enabled in cc config enabled