Disable item interaction on open gui

Started by Fresfries on

Topic category: Help with Minecraft modding (Java Edition)

Joined Nov 2021
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • MCreator plugins:
  • Comments:
Disable item interaction on open gui

I'm stuck with this problem on trying people not to be able to toss the item that opens a container, lets say a backpack, out of the main hand, without the gui closing.
I tried a workaround by checking if the item is in the inventory, but not in the main hand & if so, close the gui. But rather than closing it crashes and you have to kill yourself

because otherwise the gui isn't fully closed.

This is what I've tried, which clearly doesn't work:

screenshot

 

The best solution would be to make the slot of the backpack, if the gui is opened, not interactable but I don't know how.

Joined Oct 2020
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • MCreator plugins:
  • Comments:
on your slot make it not be…
Sun, 11/14/2021 - 18:55

on your slot make it not be able to insert hoppers

Joined Nov 2021
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • MCreator plugins:
  • Comments:
Sorry, either I don't get…
Sun, 11/14/2021 - 19:09

Sorry, either I don't get what you're saying, or I explained my issue wrong.
screenshot

So if the hopper opens this gui, how do I make it so you cant move the hopper around, no matter where in the inventory/gui, as long as this gui is opened?
 

Joined Nov 2021
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • MCreator plugins:
  • Comments:
Or make it so, if the gui is…
Sun, 11/14/2021 - 19:12

Or make it so, if the gui is opened by right clicking the hopper, if you move the hopper the gui closes, that would also work.
but right now it only closes if I throw the hopper out of the inventory.

Joined Oct 2020
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • MCreator plugins:
  • Comments:
gui open tick if not event…
Sun, 11/14/2021 - 19:25

gui open tick

if not event target entity has HOPPER in main inventory

do close gui for event target entity 

 

Joined Nov 2021
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • MCreator plugins:
  • Comments:
Thanks, that worked perfectly
Sun, 11/14/2021 - 19:40

Thanks, that worked perfectly