3

I'm trying to /minecraft:give myself an item_frame item that has some sort of special id/name that I can later use /data (or /execute then data) on in order to switch specifically those item frames to being invisible (or visible).

That is to say, I should later on be able to run a command, and that specific set of item frames should react to it, leaving all "normal" frames intact. I'm doing this mostly because it can be difficult to tract down accidentally placed invisible item frames.

I can't find a way to get the placed Item Frame entity to retain the name of the item, nor how to add such data to the item that will be passed along.

My latest effort was this: /minecraft:give @s minecraft:item_frame{display:{Name:"\"Invisible Frame\""},EntityTag:{Invisible:1b,CustomName:{"text":"InvisibleFrame"},CustomNameVisible:0b}} 1

Only the Invisible:1b is passed to the item frame entity, the rest doesn't make it through. i have checked this with /data get.

What to do from here? And once I do have a custom name on it, how can I pick up that custom name with a specifier in @e[]?

1 Answer 1

2

Your current data:

{
  EntityTag: {
    Invisible: 1b,
    CustomName: {
      text: "InvisibleFrame"
    }
  }
}

The correct data:

{
  EntityTag: {
    Invisible: 1b,
    CustomName: '{"text": "InvisibleFrame"}'
  }
}

The JSON text component is a String tag inside of NBT containing JSON. You therefore need to surround it in apostrophes.

In addition, you should never target an entity by its name. Give it a tag instead:

{
  EntityTag: {
    Invisible: 1b,
    CustomName: '{"text": "InvisibleFrame"}',
    Tags: ["invis"]
  }
}

@e[type=minecraft:item_frame,tag=invis]
1
  • Fantastic, worked perfectly. Thanks for the suggestion about tags as well! much easier to use.
    – ch4rl1e97
    May 6, 2021 at 19:15

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .