Minecraft – Summoned Items Pop Out of Blocks

minecraft-commandsminecraft-java-edition

I'm trying to summon an item inside a glass block (it's not because it's transparent or even glass, I tried with concrete too, an it still happened), but it just jumps out, which defeats the purpose of it being in the block. Does anyone know what I can do to stop this from happening?

Best Answer

You can't do this with normal items, not even NoAI helps. But you can do something very similar: You can summon an invisible armour stand with an item on its head. Example:

/summon armor_stand ~ ~ ~ {Invisible:1,Marker:1,NoGravity:1,ArmorItems:[{},{},{},{id:"stone",Count:1}]}