Search in sources :

Example 11 with ScreenHandler

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

the class AutoSteal method onOpenScreen.

@BleachSubscribe
public void onOpenScreen(EventOpenScreen event) {
    currentSyncId = -1;
    if (mc.player != null) {
        if (event.getScreen() instanceof HandledScreen) {
            ScreenHandler handler = ((HandledScreen<?>) event.getScreen()).getScreenHandler();
            if (handler instanceof GenericContainerScreenHandler) {
                currentSyncId = handler.syncId;
                lastOpen = currentTime;
                if (getSetting(0).asMode().getMode() >= 1) {
                    event.setCancelled(true);
                }
            } else {
                currentItems = null;
                mc.player.networkHandler.sendPacket(new CloseHandledScreenC2SPacket(currentSyncId));
            }
        } else {
            currentItems = null;
            mc.player.networkHandler.sendPacket(new CloseHandledScreenC2SPacket(currentSyncId));
        }
    }
}
Also used : HandledScreen(net.minecraft.client.gui.screen.ingame.HandledScreen) GenericContainerScreenHandler(net.minecraft.screen.GenericContainerScreenHandler) ScreenHandler(net.minecraft.screen.ScreenHandler) GenericContainerScreenHandler(net.minecraft.screen.GenericContainerScreenHandler) CloseHandledScreenC2SPacket(net.minecraft.network.packet.c2s.play.CloseHandledScreenC2SPacket) BleachSubscribe(org.bleachhack.eventbus.BleachSubscribe)

Example 12 with ScreenHandler

use of net.minecraft.screen.ScreenHandler in project Biome-Makeover by Lemonszz.

the class S2C_HandleWitchQuests method receive.

@Override
public void receive(MinecraftClient client, ClientPlayNetworkHandler handler, PacketByteBuf buf, PacketSender responseSender) {
    int syncId = buf.readVarInt();
    WitchQuestList witchQuests = new WitchQuestList(buf);
    client.execute(() -> {
        ScreenHandler screenHandler = MinecraftClient.getInstance().player.currentScreenHandler;
        if (syncId == screenHandler.syncId && screenHandler instanceof WitchScreenHandler) {
            ((WitchScreenHandler) screenHandler).setQuests(witchQuests);
        }
    });
}
Also used : WitchQuestList(party.lemons.biomemakeover.crafting.witch.WitchQuestList) WitchScreenHandler(party.lemons.biomemakeover.crafting.witch.screen.WitchScreenHandler) ScreenHandler(net.minecraft.screen.ScreenHandler) WitchScreenHandler(party.lemons.biomemakeover.crafting.witch.screen.WitchScreenHandler)

Example 13 with ScreenHandler

use of net.minecraft.screen.ScreenHandler in project Paradise-Lost by devs-immortal.

the class SheepuffEntity method createDyeMixingCraftingInventory.

private static CraftingInventory createDyeMixingCraftingInventory(DyeColor parentColor, DyeColor mateColor) {
    CraftingInventory craftingInventory_1 = new CraftingInventory(new ScreenHandler(null, -1) {

        @Override
        public boolean canUse(PlayerEntity playerIn) {
            return false;
        }
    }, 2, 1);
    craftingInventory_1.setStack(0, new ItemStack(DyeItem.byColor(parentColor)));
    craftingInventory_1.setStack(1, new ItemStack(DyeItem.byColor(mateColor)));
    return craftingInventory_1;
}
Also used : CraftingInventory(net.minecraft.inventory.CraftingInventory) ScreenHandler(net.minecraft.screen.ScreenHandler) PlayerEntity(net.minecraft.entity.player.PlayerEntity)

Aggregations

ScreenHandler (net.minecraft.screen.ScreenHandler)13 Identifier (net.minecraft.util.Identifier)5 ItemStack (net.minecraft.item.ItemStack)4 AbstractCompatibilityModule (top.theillusivec4.polymorph.common.integration.AbstractCompatibilityModule)4 ForgingScreenHandler (net.minecraft.screen.ForgingScreenHandler)3 GenericContainerScreenHandler (net.minecraft.screen.GenericContainerScreenHandler)3 PlayerEntity (net.minecraft.entity.player.PlayerEntity)2 ShulkerBoxScreenHandler (net.minecraft.screen.ShulkerBoxScreenHandler)2 Extensions (com.kahzerx.kahzerxmod.Extensions)1 ExtensionSettings (com.kahzerx.kahzerxmod.extensions.ExtensionSettings)1 GenericExtension (com.kahzerx.kahzerxmod.extensions.GenericExtension)1 CommandDispatcher (com.mojang.brigadier.CommandDispatcher)1 CommandSyntaxException (com.mojang.brigadier.exceptions.CommandSyntaxException)1 SlotReference (dev.emi.trinkets.api.SlotReference)1 TrinketRenderer (dev.emi.trinkets.api.client.TrinketRenderer)1 Int2ObjectArrayMap (it.unimi.dsi.fastutil.ints.Int2ObjectArrayMap)1 SortedSet (java.util.SortedSet)1 GunTableScreenHandler (mod.azure.doom.client.gui.GunTableScreenHandler)1 BroomEntityModel (moriyashiine.bewitchment.api.client.model.BroomEntityModel)1 BroomEntity (moriyashiine.bewitchment.api.entity.BroomEntity)1