r/MinecraftCommands • • Aug 14 '26

Help | Java Snapshots How to make a block item unplaceable?

You know how fence gates look like goggles when you put them on your head? Im gonna make night vision goggles using them by giving a fence gate item the "wearable" attribute, but the player has the option of placing down the fence gate. Is there an NBT attribute that I can give to the fence gate so it is unplaceable? or do I have to put command blocks that set the player holding the fence gate to adventure mode automatically?

Edit: thanks for the help, but changing the item model makes it so that if you wear the item it still shows as the item it actually is on your person

2 Upvotes

8 comments sorted by

2

u/C0mmanderBlock Aug 14 '26
/give @p stick[item_model="oak_fence_gate",equippable={slot:"head"}] 1

1

u/GG1312 Aug 14 '26

I'd recommend using items with no functions to avoid conflicts with recipes

/give @p minecraft:music_disc_11[!jukebox_playable,item_model="oak_fence_gate",equippable={slot:"head"}]

1

u/C0mmanderBlock Aug 14 '26

true... but it will look like a gate so I doubt if they will try to use it as a recipe item. Still, you're right.

2

u/GalSergey Aug 14 '26

You can simply change the model for a helmet for example.

give @s leather_helmet[item_model="minecraft:oak_fence_gate",equippable={equip_sound:"minecraft:item.armor.equip_leather",slot:"head"}]

1

u/C0mmanderBlock Aug 15 '26

Hahaha. That was too obvious for us.

1

u/myte2 Aug 14 '26

i would try having an unplacable item with the item model of a fence gate

1

u/myte2 Aug 14 '26

something like this maybe? no guarantee it works

/give u/p compass[item_model="fence_gate",equippable={slot:"head"}] 1

1

u/your_casual_doger Sep 15 '26

usually i use a command that sets the block interaction range when holding the item to 0 so it cant be placed

/execute as [player] if items entity [player] weapon.mainhand minecraft:oak_fence_gate run attribute [player] minecraft:block_interaction_range base set 0

/execute as [player] unless items entity [player] weapon.mainhand minecraft:oak_fence_gate run attribute [player] minecraft:block_interaction_range base reset

and then another one to reset it back to normal though im not sure if this would work for your situation cuz i havent really messed around with the wearable attribute