How to check which player placed down the block.

Started by Etecka on

Topic category: Help with modding (Java Edition)

Last seen on 22:34, 9. Jul 2024
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?

Last seen on 22:53, 18. Jul 2024
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.

Last seen on 22:34, 9. Jul 2024
Joined Nov 2023
Points:

User statistics:

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

Thanks!