0

I would like some help in the use of command block on my adventure map. I would like to know the "execute if" command needed to detect if a fern placed at a item frame at a specific position is pointing rightways. And if it is detected emits a redstone signal

0

2 Answers 2

1

Command:

/execute if entity @e[type=minecraft:item_frame,nbt={ItemRotation:0b,Item:{id:"minecraft:fern"}}] run say hi

If you want redstone output then put this command in repeating command block and place a comparator There are 8 possible rotations

-1

You can select Item Frames with specific items with the NBT selector:

/testfor @e[type=item_frame] {Item: {id: <Insert named ID here> }}

You can test for the rotation of items in an Item Frame with the NBT selector too:

/testfor @e[type=item_frame] {ItemRotation: <Number that fits into a byte; number of 45 degree rotations>}

Alternatively, it outputs redstone power via a comparator equal to the number of rotations, being 0 is upright.


You can test for the orientation of an Item Frame with the NBT selector (also):

/testfor @e[type=item_frame] {Facing: <Direction 0-3> }

Where 0 is south, 1 is west, 2 is north, and 3 is east.

1
  • This question is for version 1.13 of minecraft. /testfor doesn't exist in that version.
    – pppery
    Jul 13, 2019 at 14:24

You must log in to answer this question.

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