How can I make an item display fake CanPlaceOn/CanDestroy data?
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.
- Set the
HideFlags
NBT tag to hideAttributeModifiers
,Unbreakable
, and theCanPlaceOn
andCanDestroy
list. These items will be shown below the lore if not hidden.
The number you need is30
to hide just these four. - Set the
Lore
tag to the following lines:-
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. -
The heading for the CanPlaceOn list.
[{"text":"Can be placed on:","color":"gray","italic":false}]
-
Your first fake list item. Replace
Stone
with the block name.[{"text":"Stone","color":"dark_gray","italic":false}]
-
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}]
-
- 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.