Jump to content

[1.7.10] GUI and Containers Causing Items in Inventory to Jump Around


cjs07

Recommended Posts

So I have a GUI, a Container, a TileEntity, a Block, and everything works well until I attempt to place items into the GUI.

 

To clarify, when I click to interact with the block, the GUI opens, and all the slots appear in the appropriate locations. However, when I go to move an item from within my inventory, just after it is clicked it returns to the slot from which it came. Shift clicking makes the item appear in both the GUI slot and the first slot of my hotbar. It then proceeds to return to the slot from which it came. Additionally, if the GUI is opened with an item in the first hotbar slot it appears in the GUI slot. Removing it from either slot removes it from the other as well, but it returns to both upon returning to the original slot.

 

The GUI that the problem occurs with is the one for the Combustion Generator. Relevant files contain GeneratorCombustion in the file name.

 

It may be three separate issues but I suspect that they are caused by the same problem in the code or very similar problems. All the files can be found in the GitHub repository I linked at the bottom of the post. Thanks in advance for any help you may be able to give.

 

If you need a built copy of the mod in order to better understand the issue, or any other files, just ask for them. I will be glad to provide them.

 

Note that the code is very similar to the Vanilla furnace code as the block I am creating functions almost exactly the same as the fuel slot in the  furnace.

 

GitHub Repository: https://github.com/cjs07/ChemistryCraft/tree/master

Link to comment
Share on other sites

Do I have to call FMLNetworkHandker.openGui(...) in the same if block as player.openGui(...)? Because I thought the onBlockActivated method got called once by the client and once by the server, and you call player.openGui when it's called by the client, and FMLNetworkHandler.openGui when it's called by the server. Is that incorrect?

Link to comment
Share on other sites

Ok so that fixed the problem with the inventory items jumping from slot to slot. Now there's just the problem of the slot in the gui becoming the same as the first slot in the hotbar and vice-versa, but it does not result in duplication. Any ideas on how to fix that?

Link to comment
Share on other sites

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.