How to check which player placed down the block.

Started by Etecka on

Topic category: Help with Minecraft modding (Java Edition)

Joined Nov 2023
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • MCreator plugins:
  • Comments:
How to check which player placed down the block.

So I was trying to make a safe in my mod and when a player opens it, if the player isn't the original player that placed it down, I want it to not let them open it, but I have no idea how to do that. Is there anyone who could give me a detailed explanation on how to do that?

Joined Nov 2023
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • MCreator plugins:
  • Comments:
You can give the block a…
Mon, 11/20/2023 - 18:46

You can give the block a text nbt tag equal to the player's display name, and whenever a player right clicks, check if what they're right clicking on is the safe, and if it is, check if they have the same name of the safe's owner, and if not, cancel the right click event.

Joined Nov 2023
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • MCreator plugins:
  • Comments:
Thanks!  
Tue, 11/21/2023 - 19:20

Thanks!