Talk:Tutorials/Command blocks and functions

From Minecraft Wiki
Jump to: navigation, search

This is the new area for submitting ideas, as it is more appropriate.

1. Use the me command, command blocks can dump custom map related flavour directly into the player's chat box. This can be combined with repeaters to give delays or make sure all the text arrives in order.

2. XP for Item Shops. Use give command in combination with a filter to exchange XP for Items. Inspired by MrABgaming and SethBling.

Two Command blocks stacked, with a repeater on a single block.

Top Block Command code: xp -1l @p[lm=5]

Bottom Block Command code give @p[lm=5] 256 1

This gives an Iron Shovel for 1 xp level, provided you have a minimum of 5 levels.

example video:

  • admins, please review, many thanks

3. A "dispense <direction>" command, to make command blocks drop or shot items like dispensers do, so you can obtain an infinite dispenser.

4. Some form of conditional statements. (EX: Command checks to see if player has a specific item (named using the anvil) and performs an action if the player has that item) or the block could maybe detect time of day as well.

5. Add colored text options without the need for mods or plugins.


A link to this other tutorial would be useful, I would reccomend adding

Spawning Mobs using command blocks?[edit]

One thing that has occurred to me recently is that Adventure Map makers have been using command blocks to spawn mobs, more specifically mobs that have custom loot, such as a renamed Iron Sword with Sharpness II and Smite I. This example can be seen on Hypixel's Adventure Map "Herobrine's Mansion".

What the Minecraft Wiki needs to do is add a section on how to spawn mobs with custom loot as described above. Mordakai95 22:30, 1 December 2012 (UTC)

This is using spawners, not command blocks. MrRedstone 21:47, 9 December 2012 (UTC)

MrRedstone, you are aware that Hypixel used command blocks, not spawners. If Hypixel used spawners, he used them for the more common mobs such as zombies wearing skulls. Not bosses. Mordakai95 09:16, 11 December 2012 (UTC)

You can get Command Blocks by typing in the ID number in this: /give @p [ID] (Im not giving the ID. find it to be worthy of it) -Josh_Duke 20:28, 3 April 2013 (UTC)

This article needs to say how to do things, not what things can be done. How do I get a command block? how do i set up vanilla minecraft client to be able to use command blocks? There should be a trouble-shooting section.

Read this article Command Block

XP Shop Multiplayer[edit]

I created a XP shop on a private server that I run and got a buddy to come test it out with me. We ran into a problem very quickly.

Since I use the @p (nearest player) variable, if the person pushing the button does not have the levels it will take the nearest players levels and give them the item.

With this setup, anyone could join and drain a user of levels by giving them random items like cobble stone.

Is there anyway around this?

Throex TALK|CONT 02:11, 25 April 2013 (UTC)

A bit of a guess here, but try setting the arguments to set the search center to the location of the button, with a small maximum search radius (3 blocks or so). That should keep it from affecting any player who isn't close enough to have pushed the button. -- Orthotope 03:24, 25 April 2013 (UTC)


So If I put a radius of 3 in there, then it would only search 3 blocks around the command block. This way the only way to get around it and drain a persons levels would be to stand next to them? Throex TALK|CONT 20:31, 25 April 2013 (UTC)
The x/y/z arguments let you choose which point it will search around, which doesn't need to be the command block itself. But yes, the idea is that the only way to make it affect anyone else is if they're right next to the person who pushed the button. -- Orthotope 01:03, 26 April 2013 (UTC)
I think you should have a command block programmed with that function for every player who will ever visit your world. That way, they will press the command block that charges then the xp. You can use a structure block to copy the block, and then place it with signs indicating who that command block was for. Or, you could have a search radius of only one block, right in front of the button. That way, players would have to literally be on top of each other. --Herobrine 13:31, 2 March 2019 (UTC)


Is there a way to make it take other things like emeralds because on my sever the money is emeralds due to thats what villagers use and i dont want to change it to xp

placing command blocks with commands pre-enterd[edit]

i want to know how i can use a /placeblock ~ ~ ~ minecraft:command_block 0 replace (i need help here->)(command:/placeblock ~ ~-11 ~ minecraft:wood 0 place) because i am trying to make many command blocks with the same command.please help –Preceding unsigned comment was added by (talk) 01:06, 31 October 2013‎(UTC). Please sign your posts with ~~~~

Try /setblock ~ ~ ~ minecraft:command_block 0 replace {Command: "setblock ~ ~-11 ~ minecraft:log 0" }. Command names, block ids, use of curly braces and capitalization of NBT tags must all be correct. -- Orthotopetalk 01:51, 31 October 2013 (UTC)

Wireless Redstone[edit]

I'm confused please just send me video about wireless redstone and tell me how please thankyou --Hhawa (talk) 14:10, 20 January 2014 (UTC)

It uses /setblock or /scoreboard, SethBling does many videos using this concept. --KnightMiner (talk|contribs) 14:59, 20 January 2014 (UTC)
I prefer setblock myself. Teleport a redstone block in, teleport it back out after x number of seconds. Both sides need to be in loaded chunks of course. WildBluntHickok (talk) 09:18, 31 January 2014 (UTC)
Using the Setblock is my preferred method, and I make the redstone block dissapear (if necessary) by simply putting an additional command block near your setblock destination. For example, if my commend block says: /setblock 0 30 0 redstone_block then I place another command block one block above 30 with the following command: /setblock ~ ~-1 ~ air and as soon as the redstone block appears, it is removed and the system is ready for another input! It is a long enough pulse to power anything I've tried so far, which I was worried about when I started using this method. But you need to add a commend block somewhere to remove the redstone block, so it keeps my "wiring" area clean without the need for repeaters (and it's one less lighting update because there's no repeater). MonkeyDKS (talk) 21:53, 16 June 2014 (UTC)
That is the most cogent and useful thing said on this topic. I've been looking for months for a practical answer to the question "How to simulate pressing a button from a distance?" and this is the best, simplest solution. Please consider moving it to the main page! Beckypitter (talk) 00:55, 6 November 2016 (UTC)

How to write a complete data value in a specific case.[edit]

Hello, I want to get a spawner which spawns monsters with a pufferfish in their hand. I write : "/setblock ~0 ~-1 ~0 mob_spawner 0 replace {EntityId:Skeleton,SpawnData:{Equipment:[{id:349,Count:1},{},{},{},{}]}}" to get raw fish. Then I tried : "id:3493" , "id:349,3" , "id:349 3" , "id:349_3" , "id:349,type:3" , "id:349,Type:3" , "id:fish3" , "id:fish:3" , "id:fish_3" , "id:fish 3" , None of these work. Can you please help me ? Cordially,

-- 13:17, 8 June 2015 (UTC)

I checked out Tutorials/Command NBT tags#Items, and I haven't tried it, but have you tried {id:349,Count:1,Damage:3} ? – Sealbudsman (Aaron) SealbudsmanFace.png t/c 14:53, 8 June 2015 (UTC)

Yes it works ! Thanks a lot ! :) -- 15:24, 8 June 2015 (UTC)

Woo hoo! – Sealbudsman (Aaron) SealbudsmanFace.png t/c 15:31, 8 June 2015 (UTC)

Moving Tutorials/Use a map item as a scroll to this page[edit]

Shouldn't Tutorials/Use a map item as a scroll be located on this page? That page is actually a command block use itself, and I feel that it would fit better on this page than in its current location. Commandblockguy (talk) 02:46, 24 June 2015 (UTC)

I agree it would make sense to merge since Tutorials/Use a map item as a scroll is a short article. I would suggest placing {{merge}} on that article for a few days to see if anyone disagrees before moving it. KnightMiner t/c 02:48, 24 June 2015 (UTC)
Also  Support. — Agent NickTheRed37 (talk) 12:48, 24 June 2015 (UTC)
 Agree. –LauraFi - talk 16:15, 24 June 2015 (UTC)

Merge Tutorials/Mini me's with this page[edit]

Tutorials/Mini me's is basically about a mechanism that can be made using command blocks. Therefore, is there any reason it can't be merged with this page, Tutorials/Command blocks? If not, I will add a template to request to merge Tutorials/Mini me's with this page. --Madminecrafter12 (talk) 15:37, 15 December 2017 (UTC)