2

In Minecraft Java Edition, I am experimenting with using CanPlaceOn and CanDestroy NBT tags in items to control which blocks that the player can place their items on.

Now I am making a troll map, where nothing is what it seems, and everything is tricking you into going off-track from the right answer. One of the ways I plan on tricking players is by making it seem like an item can be placed on red wool, when really it can be placed on lime wool instead.

I am already aware that by manipulation of the HideFlags tag, some aspects of an item can be hidden. For example, I can hide the fact that the item can be placed on lime wool. This means the player will think the item is useless, but really it can be placed on lime wool.

But, I am stumped on how I can do the second part to this gimmick: add a fake item to the list displayed on the item's hover text. For this part, I want to make the item look like it can be placed on red wool, when really it can't.

How can I accomplish this?

3

1.14 makes this possible without having to modify the language files.

The answer lies in the item's lore.

The lore text is displayed on the item's hover text. And with 1.14, you can now style your lore text using JSON text components, meaning you can make your lore text look just like the CanPlaceOn list.


For these advanced commands, I recommend using a command generator to get your command right and avoid NBT syntax errors.

  1. Set the HideFlags NBT tag to hide AttributeModifiers, Unbreakable, and the CanPlaceOn and CanDestroy list. These items will be shown below the lore if not hidden.
    The number you need is 30 to hide just these four.
  2. Set the Lore tag to the following lines:
    1. An empty line. This empty line needs to be in place so that a space is displayed between the item name and the fake block list for CanPlaceOn. This is because this space appears when genuinely using the real l.ist.

    2. The heading for the CanPlaceOn list.

      [{"text":"Can be placed on:","color":"gray","italic":false}]
      
    3. Your first fake list item. Replace Stone with the block name.

      [{"text":"Stone","color":"dark_gray","italic":false}]
      
    4. Your second fake list item. Repeat with any other items you want to add to the fake list.

      [{"text":"Gold Block","color":"dark_gray","italic":false}]
      
  3. Add the real items to the CanPlaceOn list using the normal tags. Don't worry about it showing, because you already hid it using step 1.
| improve this answer | |

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.