Minecraft Blogs / Tutorial

Turning Iron Into Diamonds! Command Block Tutorial.

  • 1,217 views, 3 today
  • 2
  • 1
Brodie The Nerd avatar Brodie The Nerd
Level 38 : Artisan Nerd
12
Those of us who have played skyblock before will be familiar with using Iron Golem Spawners to make lots of money. But why stick with boring iron when you can have diamonds? Well, today I'll be showing you how to turn Iron into Diamonds with only 10 command blocks!

Before we start. if you don't understand what scoreboards are, I suggest checking out this awesome post made by ShelLuser that does a great job of summarising them: www.planetminecraft.com/blog/commands-amp-command-blocks-part-ii-the-scoreboard/

Okay, lets begin!

To start off, type in the following commands in chat:
Chat Commands
/give @p minecraft:lapis_block 1 0 {display:{Name:"Iron-to-Diamond Fusionator",Lore:["All Iron Ingots that touch this block","instantly turn into diamond!"," ","Drop Item on ground to activate"]}}

/scoreboard objectives add I2DTimer dummy
NOTE: If you are making customizations, I suggest putting the first one into a command block with a button, so you can test your moderations without permanently losing the item.

If you want to understand how these commands works to customize them, click the tab below.
Chat Commands explanations
Command 1
/give @p minecraft:lapis_block 1 0 - Tells the console to give the closest player (you) 1 lapis block

{display: - what you want to be displayed when the player hovers their mouse over the item

{Name:"Iron-to-Diamond Fusionator", - Name's the item "Iron-to-Diamond Fusionator"

Lore:["All Iron Ingots that touch this block","instantly turn into diamond!"," ","Drop Item on ground to activate"]}} - The text that appears below the Item's name. NOTE: each time a quote is ended and a new one starts with a comma in the middle, this indicates a new line. Eg "This is a","new line" will become:

This is a
new line

Command 2
/scoreboard objectives add - Tells the console you want to add a scoreboard objective

I2DTimer - The name of the scoreboard objective

dummy - Tells the console scores from this objective can only be changed with commands

Now that you have your item, you need to be able to use it to spawn in the Iron To Diamond Fusionator. To do that, place a 5 command block chain, with the first one being a repeating one set to Always Active. Then type in the following commands into the command blocks.
Iron-to-Diamond Fusionator Spawn Commands
Command Block 1:
/scoreboard players tag @e[type=Item] add IronToDiamond {Item:{tag:{display:{Name:"Iron-to-Diamond Fusionator",Lore:["All Iron Ingots that touch this block","instantly turn into diamond!"," ","Drop Item on ground to activate"]}}}}

Command Block 2:
/scoreboard players add @e[tag=IronToDiamond] I2DTimer 1

Command Block 3:
/execute @e[tag=IronToDiamond,score_I2DTimer_min=60] ~ ~ ~ /summon armor_stand ~ ~0.5 ~ {CustomName:"IronToDiamond",Invisible:1,Invulnerable:1,NoGravity:1}

Command Block 4:
/execute @e[tag=IronToDiamond,type=Item,score_I2DTimer_min=60] ~ ~ ~ /setblock ~ ~ ~ bedrock 0

Command Block 5:
/kill @e[tag=IronToDiamond,type=Item,score_I2DTimer_min=60]

If you want to understand how these commands work to customize them, click the tab below.
Iron-to-Diamond Fusionator Spawn Commands Explanation
Command Block 1
/scoreboard players tag - Instructs the console to work with tags on entities

@e[type=Item] - Tells the console to target all Items

add IronToDiamond - Gives the tag "IronToDiamond" to the targeted entities

{Item:{tag:{display:{Name:"Iron-to-Diamond Fusionator",Lore:["All Iron Ingots that touch this block","instantly turn into diamond!"," ","Drop Item on ground to activate"]}}}} - narrows down the amount of items that get tagged to items with the name "Iron-to-Diamond Fusionator", etc.
Command Block 2
/scoreboard players add - Tells the console to add to a score

@e[tag=IronToDiamond] - targets items with the "IronToDiamond" tag (AKA the Iron-to-Diamond Fusionator Item)

I2DTimer - Adds to the selected item's I2DTimer score

1 - Adds 1 to the selected score
Command Block 3
/execute @e[tag=IronToDiamond,score_I2DTimer_min=60] - finds the location of all entities with the tag "IronToDiamond" and a minimum I2DTimer score of 60. The reason why 60 was chosen is because in command block 2, the score was increased by one each time the command block is powered. This chain (if set up correctly) activates every tick, and there are 20 ticks a second, meaning 60 ticks is equal to three seconds.

~ ~ ~ - uses the exact locations of the locations found

/summon armor_stand ~ ~0.5 ~ - spawns in an armor stand 0.5 blocks higher on the y axis, spawning it half a block higher than the executed item's exact location

{CustomName:"IronToDiamond", - names the armor stand "IronToDiamond" for future reference

Invisible:1 - makes the armor stand invisible

Invulnerable:1 - makes the armor stand impossible to break without commands

NoGravity:1} - makes the armor stand float in place rather than fall to the floor
Command Block 4
/execute @e[tag=IronToDiamond,score_I2DTimer_min=60] - finds the location of all entities with the tag "IronToDiamond" and a minimum I2DTimer score of 60 (for explanation of why I used these values, refer to tab "Command Block 3")

~ ~ ~ - uses the exact locations of all locations found

/setblock ~ ~ ~ - places a block on the exact location found

bedrock 0 - selects bedrock to be placed
Command Block 5
/kill @e[tag=IronToDiamond,score_I2D_min=60] - this deletes all entities with the tag "IronToDiamond" and a minimum I2DTimer score of 60. This is to make sure that the game doesn't lag from billions of armor stands constantly being spawned into the game, but rather just one armor stand.
NOTE: If you customized one of the beginning commands, I strongly suggest going through these commands to change them, so that it is referencing your moderations rather than referencing something that isn't even in your world.

If you drop your item, you should find that nothing happens for three seconds, but then a bedrock block would spawn and the item will be consumed. Next, we want players to know that the Iron-to-Diamond Fusionator actually works. A simple particle effect does this perfectly. To do a particle affect, place a repeating command block, set it to "Always Active", and type in the following command.
Particle Effect Command
/execute @e[type=armor_stand,name=IronToDiamond] ~ ~ ~ /particle magicCrit ~ ~ ~ 0.2 0.7 0.2 0 2

If you want to understand how this command works to customize it, click the tab below.
Particle Effect Command Explanation
/execute @e[type=armor_stand,name=IronToDiamond] - finds the locations of all armor stand entities that are named "IronToDiamond"

~ ~ ~ - uses the exact locations found

/particle magicCrit - spawns the particle effect named "magicCrit"

~ ~ ~ - spawns the particles in the exact locations found beforehand

0.2 0.7 0.2 - lets the particles spawn up to 0.2 blocks away on the x axis, 0.7 block away on the y axis, and 0.2 blocks away on the z axis

0 - the particles move at a speed of 0 (meaning they don't move)

2 - spawns 2 particles at a time
NOTE: If you customized the name of the armor stand, I strongly suggest going through these commands to change them according to the changes you made, so that the console is referencing your moderations rather than something that isn't even in your world.

Finally, but most importantly, we need to make any Iron Ingots that touch the block turn into diamond! (NOTE: I really tried to make the game detect the number of Iron Ingots on top of the bedrock block but that isn't possible without using 63 more command blocks. If you know how to do this in just one command block, please say so down in the comments section.) To do this, create a command block chain (just like at the start) with only 3 command blocks rather than 5. Then copy these commands into the command blocks.
Turning Iron into Diamonds
Command Block 1:
/execute @e[type=armor_stand,name=IronToDiamond] ~ ~ ~ /scoreboard players tag @e[type=Item,dx=1,dy=1,dz=1] add Iron {Item:{id:"minecraft:iron_ingot"}}

Command Block 2:
/execute @e[type=Item,tag=Iron] ~ ~ ~ /summon item ~ ~ ~ {Item:{id:"minecraft:diamond",Count:1b}}

Command Block 3:
/kill @e[tag=Iron]

If you want to understand how these commands work, click the tab below.
Turning Iron into Diamonds Explanation
Command Block 1
/execute @e[type=armor_stand,name=IronToDiamond] - finds the location of all armor stand entities named "IronToDiamond"

~ ~ ~ - uses the exact locations found

/scoreboard players tag - tells the console to tag an entity

@e[type=Item - targets Item entities

dx=1,dy=1,dz=1] - targets entities that are at most 1 block away on the x axis, 1 block away on the y axis, and 1 block away on the z axis

add Iron - adds the tag "Iron"

{Item:{id:"minecraft:iron_ingot"}} - only affects items that are Iron Ingots
Command Block 2
/execute @e[type=Item,tag=Iron] - finds the locations of all Item entities with the tag "Iron"

~ ~ ~ - uses the exact location found

/summon item - spawns an item entity

~ ~ ~ - spawns the entity in the exact position found

{Item:{id:"minecraft:diamond",Count:1b}} - tells the console you want the item to be 1 diamond
Command Block 3
/kill @e[tag=Iron] - deletes all entities with the tag "Iron". This is so the Iron Ingot doesn't spawn hundreds of diamonds before you pick it up, as well as make it seem like the Iron Ingot turned into a diamond, rather than making it look like the Iron Ingot spawned in a diamond
NOTE: If you have customized anything earlier on, I suggest you change these commands relatively so the game is referencing your moderations rather than something that isn't even in your world

Finally, you want to make it so the armor stand is deleted whenever the bedrock block is deleted (just as a convenience for you so you aren't constantly typing "/kill @e[type=armor_stand,name=IronToDiamond"). To do that, place down one more repeating command block, set it to "Always Active", and copy in the following command.
spoiler=Iron-to-Diamond Fusionator Deleter]/execute @e[type=armor_stand,name=IronToDiamond] ~ ~ ~ detect ~ ~ ~ air 0 /kill @s[/spoiler]
If you want to understand how this command works to customize it, click the tab below.
Iron-to-Diamond Fusionator Deleter Explanation
/execute @e[type=armor_stand,name=IronToDiamond] - finds the location of all armor stand entities named "IronToDiamond"

~ ~ ~ - uses the exact location found

detect ~ ~ ~ air 0 - detects if there isn't any block where the armor stand is

/kill @s - deletes the armor stand if the search for the air block is successful
NOTE: If you have made any... ah screw it. You should get the idea by now.

And vuala! You have you very own Iron-to-Diamond Fusionator, turning Iron into Diamond with haste, ease, and zero nuclear waste! If you liked this tutorial or learned something from it, please say so in the comments. This took half an hour to figure out an a good hour and half to type down all the commands and explanations into this tutorial so your support will be nice. Feel free to check out some of my other tutorials, although this one is the most depth I've gone to in any of my tutorials, so don't expect them to be as educational as this one. Also, if you would like to see what I have next, feel free to subscribe to keep updated with the weird but fun ideas I get. :D

CUSTOMIZATION IDEAS!
-You could make the radius larger
-You could make this replace other items or even monsters
-You could prank your friends by making any dropped diamonds be replaced with a stick
Come up with some more in the comments!
Tags

Create an account or sign in to comment.

Planet Minecraft

Website

© 2010 - 2021
www.planetminecraft.com

Welcome