Search in sources :

Example 1 with GenericContainerScreen

use of net.minecraft.client.gui.screen.ingame.GenericContainerScreen in project Client by MatHax.

the class EChestMemory method onOpenScreenEvent.

@EventHandler
private static void onOpenScreenEvent(OpenScreenEvent event) {
    if (echestOpenedState == 1 && event.screen instanceof GenericContainerScreen) {
        echestOpenedState = 2;
        return;
    }
    if (echestOpenedState == 0)
        return;
    if (!(mc.currentScreen instanceof GenericContainerScreen))
        return;
    GenericContainerScreenHandler container = ((GenericContainerScreen) mc.currentScreen).getScreenHandler();
    if (container == null)
        return;
    Inventory inv = container.getInventory();
    for (int i = 0; i < 27; i++) {
        ITEMS.set(i, inv.getStack(i));
    }
    echestOpenedState = 0;
}
Also used : GenericContainerScreen(net.minecraft.client.gui.screen.ingame.GenericContainerScreen) GenericContainerScreenHandler(net.minecraft.screen.GenericContainerScreenHandler) Inventory(net.minecraft.inventory.Inventory) EventHandler(mathax.client.eventbus.EventHandler)

Example 2 with GenericContainerScreen

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

the class EChestMemory method onOpenScreenEvent.

@Subscribe
@AllowConcurrentEvents
private static void onOpenScreenEvent(OpenScreenEvent event) {
    if (echestOpenedState == 1 && event.getScreen() instanceof GenericContainerScreen) {
        echestOpenedState = 2;
        return;
    }
    if (echestOpenedState == 0)
        return;
    if (!(Utils.mc.currentScreen instanceof GenericContainerScreen))
        return;
    GenericContainerScreenHandler container = ((GenericContainerScreen) Utils.mc.currentScreen).getScreenHandler();
    if (container == null)
        return;
    Inventory inv = container.getInventory();
    for (int i = 0; i < 27; i++) {
        ITEMS.set(i, inv.getStack(i));
    }
    echestOpenedState = 0;
}
Also used : GenericContainerScreen(net.minecraft.client.gui.screen.ingame.GenericContainerScreen) GenericContainerScreenHandler(net.minecraft.screen.GenericContainerScreenHandler) Inventory(net.minecraft.inventory.Inventory) AllowConcurrentEvents(com.google.common.eventbus.AllowConcurrentEvents) Subscribe(com.google.common.eventbus.Subscribe)

Example 3 with GenericContainerScreen

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

the class EChestMemory method onOpenScreenEvent.

@EventHandler
private static void onOpenScreenEvent(OpenScreenEvent event) {
    if (echestOpenedState == 1 && event.screen instanceof GenericContainerScreen) {
        echestOpenedState = 2;
        return;
    }
    if (echestOpenedState == 0)
        return;
    if (!(mc.currentScreen instanceof GenericContainerScreen))
        return;
    GenericContainerScreenHandler container = ((GenericContainerScreen) mc.currentScreen).getScreenHandler();
    if (container == null)
        return;
    Inventory inv = container.getInventory();
    for (int i = 0; i < 27; i++) {
        ITEMS.set(i, inv.getStack(i));
    }
    echestOpenedState = 0;
}
Also used : GenericContainerScreen(net.minecraft.client.gui.screen.ingame.GenericContainerScreen) GenericContainerScreenHandler(net.minecraft.screen.GenericContainerScreenHandler) Inventory(net.minecraft.inventory.Inventory) EventHandler(meteordevelopment.orbit.EventHandler)

Aggregations

GenericContainerScreen (net.minecraft.client.gui.screen.ingame.GenericContainerScreen)3 Inventory (net.minecraft.inventory.Inventory)3 GenericContainerScreenHandler (net.minecraft.screen.GenericContainerScreenHandler)3 AllowConcurrentEvents (com.google.common.eventbus.AllowConcurrentEvents)1 Subscribe (com.google.common.eventbus.Subscribe)1 EventHandler (mathax.client.eventbus.EventHandler)1 EventHandler (meteordevelopment.orbit.EventHandler)1