How to make GUI that will be only accessable by one player (mod meant to be used for multiplayer)

Started by Gamemaster2022 on

Topic category: Help with Minecraft modding (Java Edition)

Joined Apr 2021
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • MCreator plugins:
  • Comments:
How to make GUI that will be only accessable by one player (mod meant to be used for multiplayer)

Hello, I am trying to make GUI that will be only available for one player. I mean when are two players joined to server and one from them will click on a block with GUI. It will open to him but if other player try to click on it like the first player it will do nothing. It is the same effect like vanilla villager GUI - if trade one player, the other one can not - on the same villager.

 

I am not afraid of coding. Every idea is welcome. Thanks

Joined Jul 2021
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • MCreator plugins:
  • Comments:
You can make a variable…
Thu, 07/08/2021 - 07:21

You can make a variable called GUIopened and set it to false by default and in the gui triggers add a when gui opens and when gui closes

 

In when gui opens set the variable to true

In when gui closes set it to false

And whereever u put the procedure to open it add a if guiopened = true