Well, I am working on a puzzle map. And the player gets an item which can be used to break certain blocks. the thing is when you break a block it does not have any tags or whatsoever. So my question is: How can I make it so that when a block gets broken it gets replaced with the same block but with tags like: canbreak/canplaceon. etc?

Thanks

you'd have to entitydata the resulting item. For that you run the entitydata command on all items without a tag and then tag those items. Here is an example for stone:

/scoreboard players tag @e[type=item,tag=!processed] add stone {Item:{id:"minecraft:stone"}}
/execute @e[type=item,tag=stone] ~ ~ ~ /entitydata @s[type=item,tag=!processed] {Item:{tag:{CanPlaceOn:["minecraft:dirt","minecraft:stone"]}}}
/scoreboard players tag @e[type=item,tag=stone] add processed

this way the resulting item entity will be changed instantly and will have the CanPlaceOn Tag already when the player picks it up.

  • Is it also possible to get the given item a colored name? or just a name? – Thodebo Oct 29 '17 at 11:05
  • Or.. Can you replace items in the players inventory? :p – Thodebo Oct 29 '17 at 11:18
  • Coloured name? Sure, also any other NBT. Replace item? Yes, but if you want it in the same spot, you need a lot of commands to detect the amount and slot. – Fabian Röling Oct 29 '17 at 11:58
  • And how would you do that? :p – Thodebo Oct 29 '17 at 12:14
  • that is a whole nother question. please create a new one (or even better, search for it first) if you want help with that. – Plagiatus Oct 29 '17 at 20:45

Your Answer

 

By clicking "Post Your Answer", you acknowledge that you have read our updated terms of service, privacy policy and cookie policy, and that your continued use of the website is subject to these policies.

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