How do I make permanent floating items?

I am making a (bad) adventure map, and I do want to display items like this. I need them to be floating and to not despawn or be able to be picked up.

Edit: I forgot to mention, i'm playing version 1.15


Solution 1:

This is normally done using invisible armor stands, which have the item in their 'hand'.

Armor stands are hugely useful for doing this, and you can also use lots of commands to pose them - just throw on some armor and a player head, and you can fill your scenes with non-moving NPCs.

Some useful armor stand commands - these all use @e[r=5] to target the nearest armor stand in a 5-block radius, so make sure you are standing closest to the armor stand you want to edit:

Summon an armor stand with something in it's hand

summon ArmorStand ~ ~ ~ {ShowArms:1,Rotation:[180f],Equipment:[{id:minecraft:iron_sword}]}

Entity Edit:

  • /entitydata @e[type=ArmorStand,r=5] {}
  • /entitydata @e[type=ArmorStand,r=5] {ShowArms:1}
  • /entitydata @e[type=ArmorStand,r=5] {NoBasePlate:1}
  • /entitydata @e[type=ArmorStand,r=5] {NoGravity:1}
  • /entitydata @e[type=ArmorStand,r=5] {Invisible:1}
  • /tp @e[type=ArmorStand,r=5] ~ ~ ~

Posing:

  • Body Rotation: /entitydata @e[type=ArmorStand,r=5] {Rotation:[0f,0f]}
  • Head Posing: /entitydata @e[type=ArmorStand,r=5] {Pose:{Head:[0f,0f,0f]}}
  • RArm: /entitydata @e[type=ArmorStand,r=5] {Pose:{RightArm:[0f,0f,0f]}}
  • LArm: /entitydata @e[type=ArmorStand,r=5] {Pose:{LeftArm:[0f,0f,0f]}}
  • LLeg: /entitydata @e[type=ArmorStand,r=5] {Pose:{LeftLeg:[0f,0f,0f]}}
  • RLeg: /entitydata @e[type=ArmorStand,r=5] {Pose:{RightLeg:[0f,0f,0f]}}
  • Body: /entitydata @e[type=ArmorStand,r=5] {Pose:{Body:[0f,0f,0f]}}

Obviously, in all the posing commands above, change the zero values to whatever you wish the angle to be. At first, it will take a lot of time, fiddling and practise to get it right, but the more you do it, the easier it gets...

Solution 2:

You can either summon an item like this:

/summon item ~ ~ ~ {Item:{id:"stone",Count:1},Age:-32768}

Or modify an existing item like this:

/data merge entity @e[type=item,sort=nearest,limit=1] {Age:-32768}

Normally the "Age" tag of items ticks up once every game tick (0.05 seconds), but the value -32768 is specially handled to never increase, so this item will not just last 32 minutes, but forever.