[HELP] Prevent block placement [1.20.1]
So I am trying to make a data pack for 1.20.1, and I want to use a container block like a chest as a custom item — mainly because (well, this might be a good time to say I am a complete beginner when it comes to data pack making or Minecraft commands in general), as per my knowledge, we can get the data of items stored in each slot.
I want to use that to perform custom actions depending on what item is in each slot. But my problem is that chests can be placed as blocks, and of course, I can't let that happen.
Also, I can't just put the player in Adventure Mode when they have that custom chest item in hand, because that would make them unable to break blocks too.
I saw a suggestion in a Minecraft forum post about immediately breaking the block after it's placed and refunding it back to the player. I personally think that could work, but I feel like preventing the placement in the first place might be a cleaner solution.
That being said, I'm looking for a way to prevent them from placing it — or in general, just doing anything ( with the item, means like if they hold the item in offhand they still should be able to use the main hand item as intended ) other than holding the item in hand and dropping it.
I think I said everything needed. If you need any more info, happy to provide it!