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?

1 Answer 1

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.
1
  • Fun fact: None of my 430 minecraft-java-edition+minecraft-commands answers were made using a command generator. Quite the opposite, this one was turned into a command generator afterwards. I would recommend actually learning the basics instead of using generators to know exactly what you're doing and how it works. That also helps a lot when you want unusual things or the length becomes a problem. Commented Sep 20, 2020 at 14:10

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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