1

Ok so what I'm doing is making "magic blocks" Whereas if you are standing on a specific block it gives you a potion effect like speed, instant health, strength, etc. The only problem is while trying to make it survival friendly I want the player to have to rename a diamond block to the certain name to make the potion effects work. /execute @a ~ ~ ~ detect ~ ~-1 ~ minecraft:diamond_block 0 /effect @a minecraft:strength 5 30 So that's what I use currently but is there an NBT tag that makes it so the detect part can testfor a diamond block that's been named in an anvil?

  • 1
    Once placed, the block loses its custom name – Universal Electricity Jun 2 '15 at 9:50
  • If you are okay with it, maybe use two command blocks with a hopper clock, then I can certainly help. That won't hurt, since you are making an adventure map. So mention me here, and I'll reply ASAP – Rajat Jain Jun 2 '15 at 15:23
  • Rajat Jain 4 I'm actually not making it in an adventure map just a concept but it could definitely be used in adventure maps. But what do you mean by 2 command blocks running off a hopper clock? – Veritas025 Jun 2 '15 at 20:01
1

When you place a named block, it loses its name tag, making it impossible to detect if it was ever named. What you can do, however, is set a custom data value:

/setblock ~ ~ ~ diamond_block 1

Then, replace detect ~ ~-1 ~ diamond_block 0 with diamond_block 1. You can use values 1 through 15, but values above 15 are not supported.

Note: In some versions of the game (and possibly the latest updates), blocks with custom data may have a missing texture, and the custom data may not be saved properly. You'll have to look into this yourself as I can't test it at the moment.

  • I am aware that this is an option, but as I said I'm trying to make it survival friendly so is it possible to give a data value to a block in survival? – Veritas025 Jun 1 '15 at 22:30
  • Nevermind I have an Idea, I can have fill clock doing /execute @e[type=Item,name=CUSTOM_NAME] /setblock ~ ~ ~ diamond_block 1 So that way I can have a custom named block and press q and throw it on the ground as an item and then it will do the /setblock with custom data value – Veritas025 Jun 1 '15 at 22:43
  • As far as I know, custom metadata was broken with the introduction of block states. – vpzomtrrfrt Jun 4 '15 at 2:02
1

Blocks cannot have names. If you use an anvil, that only renames the item stack. Instead of trying to detect the block, try spawning an invisible marker armor stand with a custom name. e.g. /summon ArmorStand ~ ~-1 ~ {Invisible:1, Marker: 1, CustomName: "Magic Block"}. You could then use the execute command to do things based on that armor stand.

  • Since it is supposed to be survival friendly, you would still need to detect the use of a renamed item to summon the armor stand in the first place. – MrLemon Jun 4 '15 at 8:38

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.