Search in sources :

Example 1 with ShulkerBoxScreenHandler

use of net.minecraft.screen.ShulkerBoxScreenHandler in project BleachHack by BleachDrinker420.

the class CmdPeek method onCommand.

@Override
public void onCommand(String alias, String[] args) throws Exception {
    ItemStack item = mc.player.getInventory().getMainHandStack();
    if (item.getItem() instanceof BlockItem) {
        Block block = ((BlockItem) item.getItem()).getBlock();
        if (!(block instanceof ShulkerBoxBlock || block instanceof ChestBlock || block instanceof DispenserBlock || block instanceof HopperBlock)) {
            BleachLogger.error("Must be holding a containter to peek.");
            return;
        }
    } else if (item.getItem() != Items.BUNDLE) {
        BleachLogger.error("Must be holding a containter to peek.");
        return;
    }
    List<ItemStack> items = ItemContentUtils.getItemsInContainer(item);
    SimpleInventory inv = new SimpleInventory(items.toArray(new ItemStack[27]));
    BleachQueue.add(() -> mc.setScreen(new PeekShulkerScreen(new ShulkerBoxScreenHandler(420, mc.player.getInventory(), inv), mc.player.getInventory(), item.getName())));
}
Also used : ShulkerBoxScreenHandler(net.minecraft.screen.ShulkerBoxScreenHandler) ItemStack(net.minecraft.item.ItemStack) BlockItem(net.minecraft.item.BlockItem) SimpleInventory(net.minecraft.inventory.SimpleInventory)

Example 2 with ShulkerBoxScreenHandler

use of net.minecraft.screen.ShulkerBoxScreenHandler in project KiwiClient by TangyKiwi.

the class Dupe method packetSent.

public static void packetSent(Packet<?> p) {
    if (shouldDupe() && p instanceof PlayerActionC2SPacket) {
        PlayerActionC2SPacket packet = (PlayerActionC2SPacket) p;
        if (packet.getAction() == PlayerActionC2SPacket.Action.STOP_DESTROY_BLOCK) {
            ScreenHandler var3 = MinecraftClient.getInstance().player.currentScreenHandler;
            if (var3 instanceof ShulkerBoxScreenHandler) {
                ShulkerBoxScreenHandler screenHandler = (ShulkerBoxScreenHandler) var3;
                Int2ObjectArrayMap<ItemStack> stack = new Int2ObjectArrayMap();
                stack.put(0, screenHandler.getSlot(0).getStack());
                ClickSlotC2SPacket cs = new ClickSlotC2SPacket(screenHandler.syncId, 0, 0, 0, SlotActionType.PICKUP, screenHandler.getSlot(0).getStack(), stack);
                MinecraftClient.getInstance().getNetworkHandler().sendPacket(cs);
                actuallyPullThrough = false;
                preDoDupe = false;
            }
        }
    }
}
Also used : PlayerActionC2SPacket(net.minecraft.network.packet.c2s.play.PlayerActionC2SPacket) ShulkerBoxScreenHandler(net.minecraft.screen.ShulkerBoxScreenHandler) Int2ObjectArrayMap(it.unimi.dsi.fastutil.ints.Int2ObjectArrayMap) ScreenHandler(net.minecraft.screen.ScreenHandler) ShulkerBoxScreenHandler(net.minecraft.screen.ShulkerBoxScreenHandler) ItemStack(net.minecraft.item.ItemStack) ClickSlotC2SPacket(net.minecraft.network.packet.c2s.play.ClickSlotC2SPacket)

Example 3 with ShulkerBoxScreenHandler

use of net.minecraft.screen.ShulkerBoxScreenHandler in project EdenClient by HahaOO7.

the class ContainerInfo method onInventoryChange.

private void onInventoryChange(PlayerInventory playerInventory) {
    ScreenHandler sh = playerInventory.player.currentScreenHandler;
    if (!(sh instanceof ShulkerBoxScreenHandler) && !(sh instanceof GenericContainerScreenHandler)) {
        lastInteractedBlock = null;
        return;
    }
    List<ItemStack> items = sh.getStacks();
    items = items.subList(0, items.size() - 36);
    if (items.isEmpty())
        lastInteractedBlock = null;
    else
        onOpenInventory(items);
}
Also used : ShulkerBoxScreenHandler(net.minecraft.screen.ShulkerBoxScreenHandler) GenericContainerScreenHandler(net.minecraft.screen.GenericContainerScreenHandler) ScreenHandler(net.minecraft.screen.ScreenHandler) ShulkerBoxScreenHandler(net.minecraft.screen.ShulkerBoxScreenHandler) GenericContainerScreenHandler(net.minecraft.screen.GenericContainerScreenHandler) ItemStack(net.minecraft.item.ItemStack)

Aggregations

ItemStack (net.minecraft.item.ItemStack)3 ShulkerBoxScreenHandler (net.minecraft.screen.ShulkerBoxScreenHandler)3 ScreenHandler (net.minecraft.screen.ScreenHandler)2 Int2ObjectArrayMap (it.unimi.dsi.fastutil.ints.Int2ObjectArrayMap)1 SimpleInventory (net.minecraft.inventory.SimpleInventory)1 BlockItem (net.minecraft.item.BlockItem)1 ClickSlotC2SPacket (net.minecraft.network.packet.c2s.play.ClickSlotC2SPacket)1 PlayerActionC2SPacket (net.minecraft.network.packet.c2s.play.PlayerActionC2SPacket)1 GenericContainerScreenHandler (net.minecraft.screen.GenericContainerScreenHandler)1