Search in sources :

Example 1 with LecternContainerBridge

use of io.izzel.arclight.common.bridge.inventory.container.LecternContainerBridge 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 LecternContainerBridge

use of io.izzel.arclight.common.bridge.inventory.container.LecternContainerBridge 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)

Aggregations

LecternContainerBridge (io.izzel.arclight.common.bridge.inventory.container.LecternContainerBridge)2 LecternContainer (net.minecraft.inventory.container.LecternContainer)2 ContainerType (net.minecraft.inventory.container.ContainerType)1 Overwrite (org.spongepowered.asm.mixin.Overwrite)1 Inject (org.spongepowered.asm.mixin.injection.Inject)1