Minecraft – How to make a spawner that summons Items

minecraft-commandsminecraft-java-edition

I've been playing around with command blocks, and I'm trying to create a spawner that will summon an item of my choosing every random amount of time (between 4-7 seconds)

I tried using command generators, but none allow using ITEMS as the mob.

I then tried using command generators to spawn a slime with 1 heart and 5-second fire and drops an item of my choosing every x seconds.

Then the mobs didn't spawn at all, yes I had it on hard and It was dark.

So I'm a bit confused as to why my spawner is failing to spawn mobs, or why I can't seem to find item spawners anywhere on the internet.

I've seen people make spawners in servers that spawn emeralds or diamonds (they even have the little emerald swirling around inside the spawner)

Could anyone help me out here? I am using 1.14.

Best Answer

You can use this command to /setblock a spawner at the position where you are currently standing that will summon diamonds:

/setblock ~ ~ ~ minecraft:spawner{SpawnData:{id:"minecraft:item",Item:{id:"minecraft:diamond",Count:1b},Weight:1}}