How to lock a vanilla Chest or Door with custom Key Item ?

Started by Toibithieunang on

Topic category: Help with Minecraft modding (Java Edition)

Joined Mar 2022
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • MCreator plugins:
  • Comments:
How to lock a vanilla Chest or Door with custom Key Item ?

Hi there

I have an idea to lock a vanilla chest or door with my mod's key.

Basically, the key will store a value (NBT tags or varibale)

When user right click on an un-regestered openable block, it will put a "lock" into it (like setting the same value that stored in key)

When user shift-right click on a locked/registered block, it will turn into "Locked" ( Cannot be interacted by hoppers or other users) or "Unlocked" (can be interacted)

 

Thanks in advance