Search in sources :

Example 1 with InventoryScreen

use of net.minecraft.client.gui.screen.ingame.InventoryScreen in project meteor-client by MeteorDevelopment.

the class EnchantCommand method syncItem.

private void syncItem() {
    mc.setScreen(new InventoryScreen(mc.player));
    mc.setScreen(null);
}
Also used : InventoryScreen(net.minecraft.client.gui.screen.ingame.InventoryScreen)

Example 2 with InventoryScreen

use of net.minecraft.client.gui.screen.ingame.InventoryScreen in project KiwiClient by TangyKiwi.

the class Enchant method syncItem.

private void syncItem() {
    Utils.mc.setScreen(new InventoryScreen(Utils.mc.player));
    Utils.mc.setScreen(null);
}
Also used : InventoryScreen(net.minecraft.client.gui.screen.ingame.InventoryScreen)

Example 3 with InventoryScreen

use of net.minecraft.client.gui.screen.ingame.InventoryScreen in project MasaGadget by plusls.

the class RestockUtil method tryCraftingRestocking.

public static void tryCraftingRestocking(PlayerEntity player, Hand hand, ItemStack itemStack) {
    if (player.isCreative()) {
        return;
    }
    updateRecipes();
    // TODO: Lazy update (on itemscoller's RecipeStorage updated or config changed)
    MinecraftClient mc = MinecraftClient.getInstance();
    HandledScreen<? extends ScreenHandler> gui = new InventoryScreen(player);
    gui.init(MinecraftClient.getInstance(), 0, 0);
    for (RecipePattern recipe : RestockUtil.recipes) {
        if (ItemStack.canCombine(recipe.getResult(), itemStack)) {
            InventoryUtils.tryMoveItemsToFirstCraftingGrid(recipe, gui, false);
            mc.interactionManager.clickSlot(player.playerScreenHandler.syncId, 0, 0, SlotActionType.PICKUP, player);
            if (player.playerScreenHandler.getCursorStack().isItemEqual(itemStack)) {
                mc.interactionManager.clickSlot(player.playerScreenHandler.syncId, hand == Hand.MAIN_HAND ? player.getInventory().selectedSlot + 36 : 45, 0, SlotActionType.PICKUP, player);
                return;
            } else {
                Slot slot = CraftingHandler.getFirstCraftingOutputSlotForGui(gui);
                CraftingHandler.SlotRange range = CraftingHandler.getCraftingGridSlots(gui, slot);
                for (int s = range.getFirst(); s <= range.getLast(); s++) {
                    mc.interactionManager.clickSlot(gui.getScreenHandler().syncId, s, 0, SlotActionType.QUICK_MOVE, mc.player);
                }
            }
        }
    }
}
Also used : RecipePattern(fi.dy.masa.itemscroller.recipes.RecipePattern) MinecraftClient(net.minecraft.client.MinecraftClient) Slot(net.minecraft.screen.slot.Slot) CraftingHandler(fi.dy.masa.itemscroller.recipes.CraftingHandler) InventoryScreen(net.minecraft.client.gui.screen.ingame.InventoryScreen)

Example 4 with InventoryScreen

use of net.minecraft.client.gui.screen.ingame.InventoryScreen in project BleachHack by BleachDrinker420.

the class Freecam method onOpenScreen.

@BleachSubscribe
public void onOpenScreen(EventOpenScreen event) {
    if (getSetting(1).asToggle().getState() && riding instanceof HorseBaseEntity) {
        if (event.getScreen() instanceof InventoryScreen) {
            mc.player.networkHandler.sendPacket(new ClientCommandC2SPacket(mc.player, ClientCommandC2SPacket.Mode.OPEN_INVENTORY));
            event.setCancelled(true);
        }
    }
}
Also used : ClientCommandC2SPacket(net.minecraft.network.packet.c2s.play.ClientCommandC2SPacket) HorseBaseEntity(net.minecraft.entity.passive.HorseBaseEntity) InventoryScreen(net.minecraft.client.gui.screen.ingame.InventoryScreen) BleachSubscribe(org.bleachhack.eventbus.BleachSubscribe)

Example 5 with InventoryScreen

use of net.minecraft.client.gui.screen.ingame.InventoryScreen in project BleachHack by BleachDrinker420.

the class CmdInvPeek method onCommand.

@Override
public void onCommand(String alias, String[] args) throws Exception {
    if (args.length == 0) {
        throw new CmdSyntaxException();
    }
    for (AbstractClientPlayerEntity e : mc.world.getPlayers()) {
        if (e.getDisplayName().getString().equalsIgnoreCase(args[0])) {
            BleachQueue.add(() -> {
                BleachLogger.info("Opened inventory for " + e.getDisplayName().getString());
                mc.setScreen(new InventoryScreen(e) {

                    public boolean mouseClicked(double mouseX, double mouseY, int button) {
                        return false;
                    }

                    protected void drawBackground(MatrixStack matrices, float delta, int mouseX, int mouseY) {
                        RenderSystem.setShader(GameRenderer::getPositionTexShader);
                        RenderSystem.setShaderColor(1.0F, 1.0F, 1.0F, 1.0F);
                        RenderSystem.setShaderTexture(0, BACKGROUND_TEXTURE);
                        this.drawTexture(matrices, x, y, 0, 0, this.backgroundWidth, this.backgroundHeight);
                        drawEntity(x + 51, y + 75, 30, (float) (x + 51) - mouseX, (float) (y + 75 - 50) - mouseY, this.client.player);
                    }
                });
            });
            return;
        }
    }
    BleachLogger.error("Player " + args[0] + " not found!");
}
Also used : CmdSyntaxException(org.bleachhack.command.exception.CmdSyntaxException) MatrixStack(net.minecraft.client.util.math.MatrixStack) AbstractClientPlayerEntity(net.minecraft.client.network.AbstractClientPlayerEntity) InventoryScreen(net.minecraft.client.gui.screen.ingame.InventoryScreen)

Aggregations

InventoryScreen (net.minecraft.client.gui.screen.ingame.InventoryScreen)6 CraftingHandler (fi.dy.masa.itemscroller.recipes.CraftingHandler)1 RecipePattern (fi.dy.masa.itemscroller.recipes.RecipePattern)1 MinecraftClient (net.minecraft.client.MinecraftClient)1 AbstractClientPlayerEntity (net.minecraft.client.network.AbstractClientPlayerEntity)1 MatrixStack (net.minecraft.client.util.math.MatrixStack)1 HorseBaseEntity (net.minecraft.entity.passive.HorseBaseEntity)1 ClientCommandC2SPacket (net.minecraft.network.packet.c2s.play.ClientCommandC2SPacket)1 Slot (net.minecraft.screen.slot.Slot)1 CmdSyntaxException (org.bleachhack.command.exception.CmdSyntaxException)1 BleachSubscribe (org.bleachhack.eventbus.BleachSubscribe)1