Dismiss Notice
Wynncraft, the Minecraft MMORPG. Play it now on your Minecraft client at (IP): play.wynncraft.com. No mods required! Click here for more info...

Using /execute For Item Detection In Chests Or Hoppers

Discussion in 'Minecraft' started by Hyakuren, Apr 9, 2020.

Thread Status:
Not open for further replies.
  1. Hyakuren

    Hyakuren Travelled Adventurer

    Messages:
    12
    Likes Received:
    3
    Trophy Points:
    10
    Guild:
    Minecraft:
    Any idea how to do this?

    I understand that this is an if-then command, and that I can correctly identify the chest/hopper the item is inside. The problem arises where the item isn't identified inside the chest/hopper.

    /execute if x y z chest{item:[{id:"minecraft_stone", count:2, slot:0}]} run msg hyakuren test

    The bolded part is the problem, I think. I'm not sure. But, this command says that if there is a chest at x, y, z with 2 stone in its top left-hand corner slot, it will message Hyakuren "test". It should. It doesn't.
     
  2. Violet Knight

    Violet Knight Aspiring front-end developer

    Messages:
    2,544
    Likes Received:
    7,656
    Trophy Points:
    207
    Minecraft:
    Do /data get block x y z on the chest, and check if what the execute command is looking for matches the chest's data. If not, retype the command to make sure you've got it right. If that doesn't work, I'd suggest making a post on the official Minecraft Forums, you're more likely to get a good answer there.
     
  3. Hyakuren

    Hyakuren Travelled Adventurer

    Messages:
    12
    Likes Received:
    3
    Trophy Points:
    10
    Guild:
    Minecraft:
    Thanks for the advice! It did work.

    /execute if block 233 4 41 hopper{Items:[{Slot:0b, id: "minecraft:iron_sword", Count: 1b, tag:{Damage: 0}}]} run msg hyakuren testing
     
    Violet Knight likes this.
Thread Status:
Not open for further replies.