Search in sources :

Example 1 with LecternContainer

use of net.minecraft.inventory.container.LecternContainer in project Arclight by IzzelAliz.

the class ContainerTypeMixin method arclight$replaceLectern.

@Inject(method = "register", cancellable = true, at = @At("HEAD"))
private static <T extends Container> void arclight$replaceLectern(String key, ContainerType.IFactory<T> factory, CallbackInfoReturnable<ContainerType<T>> cir) {
    if (key.equals("lectern")) {
        cir.setReturnValue(Registry.register(Registry.MENU, key, new ContainerType<>((i, inv) -> {
            LecternContainer container = new LecternContainer(i);
            ((LecternContainerBridge) container).bridge$setPlayerInventory(inv);
            return (T) container;
        })));
    }
}
Also used : ContainerType(net.minecraft.inventory.container.ContainerType) LecternContainer(net.minecraft.inventory.container.LecternContainer) LecternContainerBridge(io.izzel.arclight.common.bridge.inventory.container.LecternContainerBridge) Inject(org.spongepowered.asm.mixin.injection.Inject)

Example 2 with LecternContainer

use of net.minecraft.inventory.container.LecternContainer in project Magma-1.16.x by magmafoundation.

the class CraftContainer method setupSlots.

private void setupSlots(IInventory top, PlayerInventory bottom, PlayerEntity entityhuman) {
    int windowId = -1;
    switch(cachedType) {
        case CREATIVE:
            // TODO: This should be an error?
            break;
        case PLAYER:
        case CHEST:
        case ENDER_CHEST:
        case BARREL:
            delegate = new ChestContainer(ContainerType.GENERIC_9x3, windowId, bottom, top, top.getContainerSize() / 9);
            break;
        case DISPENSER:
        case DROPPER:
            delegate = new DispenserContainer(windowId, bottom, top);
            break;
        case FURNACE:
            delegate = new FurnaceContainer(windowId, bottom, top, new IntArray(4));
            break;
        // TODO: This should be an error?
        case CRAFTING:
        case WORKBENCH:
            // SPIGOT-3812 - manually set up slots so we can use the delegated inventory and not the automatically created one
            setupWorkbench(top, bottom);
            break;
        case ENCHANTING:
            delegate = new EnchantmentContainer(windowId, bottom);
            break;
        case BREWING:
            delegate = new BrewingStandContainer(windowId, bottom, top, new IntArray(2));
            break;
        case HOPPER:
            delegate = new HopperContainer(windowId, bottom, top);
            break;
        case ANVIL:
            delegate = new RepairContainer(windowId, bottom);
            break;
        case SMITHING:
            delegate = new SmokerContainer(windowId, bottom);
            break;
        case BEACON:
            delegate = new BeaconContainer(windowId, bottom);
            break;
        case SHULKER_BOX:
            delegate = new ShulkerBoxContainer(windowId, bottom, top);
            break;
        case BLAST_FURNACE:
            delegate = new BlastFurnaceContainer(windowId, bottom, top, new IntArray(4));
            break;
        case LECTERN:
            delegate = new LecternContainer(windowId, top, new IntArray(1), bottom);
            break;
        case SMOKER:
            delegate = new SmokerContainer(windowId, bottom, top, new IntArray(4));
            break;
        case LOOM:
            delegate = new LoomContainer(windowId, bottom);
            break;
        case CARTOGRAPHY:
            delegate = new CartographyContainer(windowId, bottom);
            break;
        case GRINDSTONE:
            delegate = new GrindstoneContainer(windowId, bottom);
            break;
        case STONECUTTER:
            delegate = new StonecutterContainer(windowId, bottom);
            break;
        case MERCHANT:
            delegate = new MerchantContainer(windowId, bottom);
            break;
    }
    if (delegate != null) {
        this.lastSlots = delegate.lastSlots;
        this.slots = delegate.slots;
    }
    // SPIGOT-4598 - we should still delegate the shift click handler
    if (cachedType == InventoryType.WORKBENCH) {
        delegate = new WorkbenchContainer(windowId, bottom);
    }
}
Also used : HopperContainer(net.minecraft.inventory.container.HopperContainer) BlastFurnaceContainer(net.minecraft.inventory.container.BlastFurnaceContainer) FurnaceContainer(net.minecraft.inventory.container.FurnaceContainer) DispenserContainer(net.minecraft.inventory.container.DispenserContainer) BrewingStandContainer(net.minecraft.inventory.container.BrewingStandContainer) EnchantmentContainer(net.minecraft.inventory.container.EnchantmentContainer) BeaconContainer(net.minecraft.inventory.container.BeaconContainer) LoomContainer(net.minecraft.inventory.container.LoomContainer) BlastFurnaceContainer(net.minecraft.inventory.container.BlastFurnaceContainer) GrindstoneContainer(net.minecraft.inventory.container.GrindstoneContainer) WorkbenchContainer(net.minecraft.inventory.container.WorkbenchContainer) ShulkerBoxContainer(net.minecraft.inventory.container.ShulkerBoxContainer) MerchantContainer(net.minecraft.inventory.container.MerchantContainer) StonecutterContainer(net.minecraft.inventory.container.StonecutterContainer) ChestContainer(net.minecraft.inventory.container.ChestContainer) CartographyContainer(net.minecraft.inventory.container.CartographyContainer) IntArray(net.minecraft.util.IntArray) RepairContainer(net.minecraft.inventory.container.RepairContainer) LecternContainer(net.minecraft.inventory.container.LecternContainer) SmokerContainer(net.minecraft.inventory.container.SmokerContainer)

Example 3 with LecternContainer

use of net.minecraft.inventory.container.LecternContainer in project Arclight by IzzelAliz.

the class LecternTileEntityMixin method createMenu.

/**
 * @author IzzelAliz
 * @reason
 */
@Overwrite
public Container createMenu(int i, PlayerInventory playerInventory, PlayerEntity entity) {
    LecternContainer container = new LecternContainer(i, this.inventory, this.field_214049_b);
    ((LecternContainerBridge) container).bridge$setPlayerInventory(playerInventory);
    return container;
}
Also used : LecternContainer(net.minecraft.inventory.container.LecternContainer) LecternContainerBridge(io.izzel.arclight.common.bridge.inventory.container.LecternContainerBridge) Overwrite(org.spongepowered.asm.mixin.Overwrite)

Example 4 with LecternContainer

use of net.minecraft.inventory.container.LecternContainer in project LoliServer by Loli-Server.

the class CraftContainer method setupSlots.

private void setupSlots(IInventory top, PlayerInventory bottom, PlayerEntity entityhuman) {
    int windowId = -1;
    switch(cachedType) {
        case CREATIVE:
            // TODO: This should be an error?
            break;
        case PLAYER:
        case CHEST:
        case ENDER_CHEST:
        case BARREL:
            delegate = new ChestContainer(ContainerType.GENERIC_9x3, windowId, bottom, top, top.getContainerSize() / 9);
            break;
        case DISPENSER:
        case DROPPER:
            delegate = new DispenserContainer(windowId, bottom, top);
            break;
        case FURNACE:
            delegate = new FurnaceContainer(windowId, bottom, top, new IntArray(4));
            break;
        // TODO: This should be an error?
        case CRAFTING:
        case WORKBENCH:
            // SPIGOT-3812 - manually set up slots so we can use the delegated inventory and not the automatically created one
            setupWorkbench(top, bottom);
            break;
        case ENCHANTING:
            delegate = new EnchantmentContainer(windowId, bottom);
            break;
        case BREWING:
            delegate = new BrewingStandContainer(windowId, bottom, top, new IntArray(2));
            break;
        case HOPPER:
            delegate = new HopperContainer(windowId, bottom, top);
            break;
        case ANVIL:
            delegate = new RepairContainer(windowId, bottom);
            break;
        case SMITHING:
            delegate = new SmokerContainer(windowId, bottom);
            break;
        case BEACON:
            delegate = new BeaconContainer(windowId, bottom);
            break;
        case SHULKER_BOX:
            delegate = new ShulkerBoxContainer(windowId, bottom, top);
            break;
        case BLAST_FURNACE:
            delegate = new BlastFurnaceContainer(windowId, bottom, top, new IntArray(4));
            break;
        case LECTERN:
            delegate = new LecternContainer(windowId, top, new IntArray(1), bottom);
            break;
        case SMOKER:
            delegate = new SmokerContainer(windowId, bottom, top, new IntArray(4));
            break;
        case LOOM:
            delegate = new LoomContainer(windowId, bottom);
            break;
        case CARTOGRAPHY:
            delegate = new CartographyContainer(windowId, bottom);
            break;
        case GRINDSTONE:
            delegate = new GrindstoneContainer(windowId, bottom);
            break;
        case STONECUTTER:
            delegate = new StonecutterContainer(windowId, bottom);
            break;
        case MERCHANT:
            delegate = new MerchantContainer(windowId, bottom);
            break;
    }
    if (delegate != null) {
        this.lastSlots = delegate.lastSlots;
        this.slots = delegate.slots;
    }
    // SPIGOT-4598 - we should still delegate the shift click handler
    if (cachedType == InventoryType.WORKBENCH) {
        delegate = new WorkbenchContainer(windowId, bottom);
    }
}
Also used : HopperContainer(net.minecraft.inventory.container.HopperContainer) BlastFurnaceContainer(net.minecraft.inventory.container.BlastFurnaceContainer) FurnaceContainer(net.minecraft.inventory.container.FurnaceContainer) DispenserContainer(net.minecraft.inventory.container.DispenserContainer) BrewingStandContainer(net.minecraft.inventory.container.BrewingStandContainer) EnchantmentContainer(net.minecraft.inventory.container.EnchantmentContainer) BeaconContainer(net.minecraft.inventory.container.BeaconContainer) LoomContainer(net.minecraft.inventory.container.LoomContainer) BlastFurnaceContainer(net.minecraft.inventory.container.BlastFurnaceContainer) GrindstoneContainer(net.minecraft.inventory.container.GrindstoneContainer) WorkbenchContainer(net.minecraft.inventory.container.WorkbenchContainer) ShulkerBoxContainer(net.minecraft.inventory.container.ShulkerBoxContainer) MerchantContainer(net.minecraft.inventory.container.MerchantContainer) StonecutterContainer(net.minecraft.inventory.container.StonecutterContainer) ChestContainer(net.minecraft.inventory.container.ChestContainer) CartographyContainer(net.minecraft.inventory.container.CartographyContainer) IntArray(net.minecraft.util.IntArray) RepairContainer(net.minecraft.inventory.container.RepairContainer) LecternContainer(net.minecraft.inventory.container.LecternContainer) SmokerContainer(net.minecraft.inventory.container.SmokerContainer)

Aggregations

LecternContainer (net.minecraft.inventory.container.LecternContainer)4 LecternContainerBridge (io.izzel.arclight.common.bridge.inventory.container.LecternContainerBridge)2 BeaconContainer (net.minecraft.inventory.container.BeaconContainer)2 BlastFurnaceContainer (net.minecraft.inventory.container.BlastFurnaceContainer)2 BrewingStandContainer (net.minecraft.inventory.container.BrewingStandContainer)2 CartographyContainer (net.minecraft.inventory.container.CartographyContainer)2 ChestContainer (net.minecraft.inventory.container.ChestContainer)2 DispenserContainer (net.minecraft.inventory.container.DispenserContainer)2 EnchantmentContainer (net.minecraft.inventory.container.EnchantmentContainer)2 FurnaceContainer (net.minecraft.inventory.container.FurnaceContainer)2 GrindstoneContainer (net.minecraft.inventory.container.GrindstoneContainer)2 HopperContainer (net.minecraft.inventory.container.HopperContainer)2 LoomContainer (net.minecraft.inventory.container.LoomContainer)2 MerchantContainer (net.minecraft.inventory.container.MerchantContainer)2 RepairContainer (net.minecraft.inventory.container.RepairContainer)2 ShulkerBoxContainer (net.minecraft.inventory.container.ShulkerBoxContainer)2 SmokerContainer (net.minecraft.inventory.container.SmokerContainer)2 StonecutterContainer (net.minecraft.inventory.container.StonecutterContainer)2 WorkbenchContainer (net.minecraft.inventory.container.WorkbenchContainer)2 IntArray (net.minecraft.util.IntArray)2