Search in sources :

Example 6 with SelfContainer

use of io.github.bananapuncher714.crafters.implementation.v1_17_1.ContainerManager_v1_17_1.SelfContainer in project PublicCrafters by BananaPuncher714.

the class CustomTileEntityContainerWorkbench method createMenu.

/**
 * This is an ITileEntityContainer method that returns a new container for whatever tile entity
 */
@Override
public Container createMenu(int id, PlayerInventory inv, EntityHuman ent) {
    CustomInventoryCrafting crafting = manager.benches.get(bloc);
    if (crafting == null) {
        crafting = new CustomInventoryCrafting(bloc, manager, new SelfContainer(id), 3, 3);
        manager.put(bloc, crafting);
    }
    IInventory inventory = crafting.resultInventory;
    InventoryCraftResult result;
    if (inventory instanceof InventoryCraftResult || inventory == null) {
        result = new InventoryCraftResult();
        crafting.resultInventory = result;
    } else {
        result = (InventoryCraftResult) inventory;
    }
    Container container = new CustomContainerWorkbench(id, ent.getBukkitEntity(), bloc, crafting, result);
    crafting.addContainer(container);
    return container;
}
Also used : IInventory(net.minecraft.server.v1_16_R1.IInventory) ITileEntityContainer(net.minecraft.server.v1_16_R1.ITileEntityContainer) Container(net.minecraft.server.v1_16_R1.Container) SelfContainer(io.github.bananapuncher714.crafters.implementation.v1_16_R1.ContainerManager_v1_16_R1.SelfContainer) SelfContainer(io.github.bananapuncher714.crafters.implementation.v1_16_R1.ContainerManager_v1_16_R1.SelfContainer) InventoryCraftResult(net.minecraft.server.v1_16_R1.InventoryCraftResult)

Example 7 with SelfContainer

use of io.github.bananapuncher714.crafters.implementation.v1_17_1.ContainerManager_v1_17_1.SelfContainer in project PublicCrafters by BananaPuncher714.

the class CustomTileEntityContainerWorkbench method createMenu.

/**
 * This is an ITileEntityContainer method that returns a new container for whatever tile entity
 */
@Override
public Container createMenu(int id, PlayerInventory inv, EntityHuman ent) {
    CustomInventoryCrafting crafting = manager.benches.get(bloc);
    if (crafting == null) {
        crafting = new CustomInventoryCrafting(bloc, manager, new SelfContainer(id), 3, 3);
        manager.put(bloc, crafting);
    }
    IInventory inventory = crafting.resultInventory;
    InventoryCraftResult result;
    if (inventory instanceof InventoryCraftResult || inventory == null) {
        result = new InventoryCraftResult();
        crafting.resultInventory = result;
    } else {
        result = (InventoryCraftResult) inventory;
    }
    Container container = new CustomContainerWorkbench(id, ent.getBukkitEntity(), bloc, crafting, result);
    crafting.addContainer(container);
    return container;
}
Also used : IInventory(net.minecraft.server.v1_16_R2.IInventory) SelfContainer(io.github.bananapuncher714.crafters.implementation.v1_16_R2.ContainerManager_v1_16_R2.SelfContainer) Container(net.minecraft.server.v1_16_R2.Container) ITileEntityContainer(net.minecraft.server.v1_16_R2.ITileEntityContainer) SelfContainer(io.github.bananapuncher714.crafters.implementation.v1_16_R2.ContainerManager_v1_16_R2.SelfContainer) InventoryCraftResult(net.minecraft.server.v1_16_R2.InventoryCraftResult)

Example 8 with SelfContainer

use of io.github.bananapuncher714.crafters.implementation.v1_17_1.ContainerManager_v1_17_1.SelfContainer in project PublicCrafters by BananaPuncher714.

the class CustomTileEntityContainerWorkbench method createMenu.

/**
 * This is an ITileEntityContainer method that returns a new container for whatever tile entity
 */
@Override
public Container createMenu(int id, PlayerInventory inv, EntityHuman ent) {
    CustomInventoryCrafting crafting = manager.benches.get(bloc);
    if (crafting == null) {
        crafting = new CustomInventoryCrafting(bloc, manager, new SelfContainer(id), 3, 3);
        manager.put(bloc, crafting);
    }
    IInventory inventory = crafting.resultInventory;
    InventoryCraftResult result;
    if (inventory instanceof InventoryCraftResult || inventory == null) {
        result = new InventoryCraftResult();
        crafting.resultInventory = result;
    } else {
        result = (InventoryCraftResult) inventory;
    }
    Container container = new CustomContainerWorkbench(id, ent.getBukkitEntity(), bloc, crafting, result);
    crafting.addContainer(container);
    return container;
}
Also used : IInventory(net.minecraft.world.IInventory) ITileEntityContainer(net.minecraft.world.inventory.ITileEntityContainer) SelfContainer(io.github.bananapuncher714.crafters.implementation.v1_17_R1.ContainerManager_v1_17_R1.SelfContainer) Container(net.minecraft.world.inventory.Container) SelfContainer(io.github.bananapuncher714.crafters.implementation.v1_17_R1.ContainerManager_v1_17_R1.SelfContainer) InventoryCraftResult(net.minecraft.world.inventory.InventoryCraftResult)

Example 9 with SelfContainer

use of io.github.bananapuncher714.crafters.implementation.v1_17_1.ContainerManager_v1_17_1.SelfContainer in project PublicCrafters by BananaPuncher714.

the class CustomTileEntityContainerWorkbench method createContainer.

/**
 * This is an ITileEntityContainer method that returns a new container for whatever tile entity
 */
@Override
public Container createContainer(PlayerInventory paramPlayerInventory, EntityHuman ent) {
    CustomInventoryCrafting crafting = manager.benches.get(bloc);
    if (crafting == null) {
        crafting = new CustomInventoryCrafting(bloc, manager, new SelfContainer(), 3, 3);
        manager.put(bloc, crafting);
    }
    IInventory inventory = crafting.resultInventory;
    InventoryCraftResult result;
    if (inventory instanceof InventoryCraftResult || inventory == null) {
        result = new InventoryCraftResult();
        crafting.resultInventory = result;
    } else {
        result = (InventoryCraftResult) inventory;
    }
    Container container = new CustomContainerWorkbench(ent.getBukkitEntity(), bloc, crafting, result);
    crafting.addContainer(container);
    return container;
}
Also used : IInventory(net.minecraft.server.v1_13_R2.IInventory) SelfContainer(io.github.bananapuncher714.crafters.implementation.v1_13_R2.ContainerManager_v1_13_R2.SelfContainer) ITileEntityContainer(net.minecraft.server.v1_13_R2.ITileEntityContainer) Container(net.minecraft.server.v1_13_R2.Container) SelfContainer(io.github.bananapuncher714.crafters.implementation.v1_13_R2.ContainerManager_v1_13_R2.SelfContainer) InventoryCraftResult(net.minecraft.server.v1_13_R2.InventoryCraftResult)

Example 10 with SelfContainer

use of io.github.bananapuncher714.crafters.implementation.v1_17_1.ContainerManager_v1_17_1.SelfContainer in project PublicCrafters by BananaPuncher714.

the class CustomTileEntityContainerWorkbench method createMenu.

/**
 * This is an ITileEntityContainer method that returns a new container for whatever tile entity
 */
@Override
public Container createMenu(int id, PlayerInventory inv, EntityHuman ent) {
    CustomInventoryCrafting crafting = manager.benches.get(bloc);
    if (crafting == null) {
        crafting = new CustomInventoryCrafting(bloc, manager, new SelfContainer(id), 3, 3);
        manager.put(bloc, crafting);
    }
    IInventory inventory = crafting.resultInventory;
    InventoryCraftResult result;
    if (inventory instanceof InventoryCraftResult || inventory == null) {
        result = new InventoryCraftResult();
        crafting.resultInventory = result;
    } else {
        result = (InventoryCraftResult) inventory;
    }
    Container container = new CustomContainerWorkbench(id, ent.getBukkitEntity(), bloc, crafting, result);
    crafting.addContainer(container);
    return container;
}
Also used : IInventory(net.minecraft.world.IInventory) ITileEntityContainer(net.minecraft.world.inventory.ITileEntityContainer) Container(net.minecraft.world.inventory.Container) SelfContainer(io.github.bananapuncher714.crafters.implementation.v1_18_R2.ContainerManager_v1_18_R2.SelfContainer) SelfContainer(io.github.bananapuncher714.crafters.implementation.v1_18_R2.ContainerManager_v1_18_R2.SelfContainer) InventoryCraftResult(net.minecraft.world.inventory.InventoryCraftResult)

Aggregations

IInventory (net.minecraft.world.IInventory)4 Container (net.minecraft.world.inventory.Container)4 ITileEntityContainer (net.minecraft.world.inventory.ITileEntityContainer)4 InventoryCraftResult (net.minecraft.world.inventory.InventoryCraftResult)4 SelfContainer (io.github.bananapuncher714.crafters.implementation.v1_10_R1.ContainerManager_v1_10_R1.SelfContainer)1 SelfContainer (io.github.bananapuncher714.crafters.implementation.v1_11_R1.ContainerManager_v1_11_R1.SelfContainer)1 SelfContainer (io.github.bananapuncher714.crafters.implementation.v1_12_R1.ContainerManager_v1_12_R1.SelfContainer)1 SelfContainer (io.github.bananapuncher714.crafters.implementation.v1_13_R1.ContainerManager_v1_13_R1.SelfContainer)1 SelfContainer (io.github.bananapuncher714.crafters.implementation.v1_13_R2.ContainerManager_v1_13_R2.SelfContainer)1 SelfContainer (io.github.bananapuncher714.crafters.implementation.v1_14_R1.ContainerManager_v1_14_R1.SelfContainer)1 SelfContainer (io.github.bananapuncher714.crafters.implementation.v1_15_R1.ContainerManager_v1_15_R1.SelfContainer)1 SelfContainer (io.github.bananapuncher714.crafters.implementation.v1_16_R1.ContainerManager_v1_16_R1.SelfContainer)1 SelfContainer (io.github.bananapuncher714.crafters.implementation.v1_16_R2.ContainerManager_v1_16_R2.SelfContainer)1 SelfContainer (io.github.bananapuncher714.crafters.implementation.v1_16_R3.ContainerManager_v1_16_R3.SelfContainer)1 SelfContainer (io.github.bananapuncher714.crafters.implementation.v1_17_1.ContainerManager_v1_17_1.SelfContainer)1 SelfContainer (io.github.bananapuncher714.crafters.implementation.v1_17_R1.ContainerManager_v1_17_R1.SelfContainer)1 SelfContainer (io.github.bananapuncher714.crafters.implementation.v1_18_R1.ContainerManager_v1_18_R1.SelfContainer)1 SelfContainer (io.github.bananapuncher714.crafters.implementation.v1_18_R2.ContainerManager_v1_18_R2.SelfContainer)1 SelfContainer (io.github.bananapuncher714.crafters.implementation.v1_8_R3.ContainerManager_v1_8_R3.SelfContainer)1 SelfContainer (io.github.bananapuncher714.crafters.implementation.v1_9_R2.ContainerManager_v1_9_R2.SelfContainer)1