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[]?

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 at 19:15

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.