TransWikia.com

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

Arqade Asked by Shirazmatas on January 18, 2021

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

2 Answers

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.

Answered by aytimothy on January 18, 2021

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

Answered by QmegaMax on January 18, 2021

Add your own answers!

Ask a Question

Get help from others!

© 2024 TransWikia.com. All rights reserved. Sites we Love: PCI Database, UKBizDB, Menu Kuliner, Sharing RPP