Started by
Etecka
on
Topic category: Help with Minecraft modding (Java Edition)
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?
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.
Thanks!