How to detect minecraft item (any fern) in correct item frame and in correct rotation (1.13)

How to detect minecraft item (any fern) in correct item frame and in correct rotation (1.13) - Modern glasses on transparent shelf in optical shop with various lenses and rims

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



Best Answer

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




Pictures about "How to detect minecraft item (any fern) in correct item frame and in correct rotation (1.13)"

How to detect minecraft item (any fern) in correct item frame and in correct rotation (1.13) - From above of fashion spectacles for vision with golden and silver metal shells placed on white table
How to detect minecraft item (any fern) in correct item frame and in correct rotation (1.13) - Top view of fashion spectacles with transparent optical lenses in golden metal shell placed on white table
How to detect minecraft item (any fern) in correct item frame and in correct rotation (1.13) - Stylish round eyeglasses with optical lenses



How do you rotate an item frame in Minecraft?

Usage
  • Players can place items in the frame by using the item. ...
  • Item frames can be placed on the lid of a shulker box that is positioned horizontally, but pop off when the lid is opened.\u200c [JavaEditiononly]
  • The displayed item can then be rotated by right-clicking the frame.


  • How do you identify an item in Minecraft?

    Players on Minecraft's Java Edition have a simple command that will enable them to get invisible item frames. All they need to do is open their chat console and type "/give @p item_frame{EntityTag:{Invisible:1b}}" which should place the item within the player's inventory, allowing them to place it wherever they wish.



    Minecraft : Come Fare Un Item Frame Invisibile




    More answers regarding how to detect minecraft item (any fern) in correct item frame and in correct rotation (1.13)

    Answer 2

    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.

    Sources: Stack Exchange - This article follows the attribution requirements of Stack Exchange and is licensed under CC BY-SA 3.0.

    Images: Ksenia Chernaya, Karolina Grabowska, Karolina Grabowska, Karolina Grabowska