diff --git a/src/main/java/meteordevelopment/meteorclient/commands/commands/PeekCommand.java b/src/main/java/meteordevelopment/meteorclient/commands/commands/PeekCommand.java index 28d589165d..52e9761622 100644 --- a/src/main/java/meteordevelopment/meteorclient/commands/commands/PeekCommand.java +++ b/src/main/java/meteordevelopment/meteorclient/commands/commands/PeekCommand.java @@ -10,12 +10,13 @@ import meteordevelopment.meteorclient.commands.Command; import meteordevelopment.meteorclient.utils.Utils; import net.minecraft.command.CommandSource; +import net.minecraft.entity.decoration.ItemFrameEntity; import net.minecraft.item.ItemStack; import net.minecraft.text.Text; public class PeekCommand extends Command { private static final ItemStack[] ITEMS = new ItemStack[27]; - private static final SimpleCommandExceptionType NOT_HOLDING_SHULKER_BOX = new SimpleCommandExceptionType(Text.literal("You must be holding a storage block with items in it.")); + private static final SimpleCommandExceptionType CANT_PEEK = new SimpleCommandExceptionType(Text.literal("You must be holding a storage block or looking at an item frame.")); public PeekCommand() { super("peek", "Lets you see what's inside storage block items."); @@ -26,7 +27,10 @@ public void build(LiteralArgumentBuilder builder) { builder.executes(context -> { if (Utils.openContainer(mc.player.getMainHandStack(), ITEMS, true)) return SINGLE_SUCCESS; else if (Utils.openContainer(mc.player.getOffHandStack(), ITEMS, true)) return SINGLE_SUCCESS; - else throw NOT_HOLDING_SHULKER_BOX.create(); + else if (mc.targetedEntity instanceof ItemFrameEntity && + Utils.openContainer(((ItemFrameEntity) mc.targetedEntity).getHeldItemStack(), ITEMS, true) + ) return SINGLE_SUCCESS; + else throw CANT_PEEK.create(); }); } }