Jump to content

Container not pulling items from their corresponding spots.


Recommended Posts

Posted

Video demonstration of the problem: https://www.youtube.com/watch?time_continue=14&v=f7BUdXHRMqQ

Github repo

 

I've tried a bunch of stuff to resolve this issue, and check what getSlot and slotClick returns, and they seem fine (if i click on a dirt block in my container both of them return that the itemstack contains dirt)

But after those functions get called it grabs from ContainerPlayers inventorySlots, and there the first 9 slots are for armor and crafting, and I'm clueless to the flow and why this is happening.

 

Container class

Proxy

Posted

What version of Forge are you using? (I looked at your main repo and I'm guessing 1.11.2)

the inventory class used for players PlayerInventory has sub lists inside it "mainInventory", "offHandInventory", and "armorInventory". Try pulling from mainInventory.
Now I haven't worked with the Slot class for a bit, so I'm not sure if the constructor would accept that, if that's the case you will have to create an offset of the index so it skips past the armor indexes

Posted

Yeah an offset was what I was thinking as well but I don't know where to apply it since I don't know which function uses the inventoryslots in ContainerPlayer. I've used breakpoints in most of the functions in the Container class but came up empty handed. Thank you for your input.

Posted (edited)

https://github.com/xt9/DeepMobLearner/blob/master/src/main/java/xt9/deepmoblearning/common/items/ItemDeepLearner.java#L24

No, you must open a container on both the server and the client. Opening it on the client only leads to all kinds of bugs including the one you are experiencing. How would a container be opened on client only if the server needs to know about inventory changes? Remove the isRemote check and everything will work fine.

Edited by V0idWa1k3r
  • Like 1

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Unfortunately, your content contains terms that we do not allow. Please edit your content to remove the highlighted words below.
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Announcements



×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use.