Search in sources :

Example 11 with IInventory

use of net.minecraft.server.v1_16_R2.IInventory 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 result = crafting.resultInventory;
    if (result == null) {
        result = new InventoryCraftResult();
        crafting.resultInventory = result;
    }
    Container container = new CustomContainerWorkbench(ent.getBukkitEntity(), bloc, crafting, result);
    crafting.addContainer(container);
    return container;
}
Also used : IInventory(net.minecraft.server.v1_8_R3.IInventory) ITileEntityContainer(net.minecraft.server.v1_8_R3.ITileEntityContainer) Container(net.minecraft.server.v1_8_R3.Container) SelfContainer(io.github.bananapuncher714.crafters.implementation.v1_8_R3.ContainerManager_v1_8_R3.SelfContainer) SelfContainer(io.github.bananapuncher714.crafters.implementation.v1_8_R3.ContainerManager_v1_8_R3.SelfContainer) InventoryCraftResult(net.minecraft.server.v1_8_R3.InventoryCraftResult)

Example 12 with IInventory

use of net.minecraft.server.v1_16_R2.IInventory 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 result = crafting.resultInventory;
    if (result == null) {
        result = new InventoryCraftResult();
        crafting.resultInventory = result;
    }
    Container container = new CustomContainerWorkbench(ent.getBukkitEntity(), bloc, crafting, result);
    crafting.addContainer(container);
    return container;
}
Also used : IInventory(net.minecraft.server.v1_9_R2.IInventory) Container(net.minecraft.server.v1_9_R2.Container) SelfContainer(io.github.bananapuncher714.crafters.implementation.v1_9_R2.ContainerManager_v1_9_R2.SelfContainer) ITileEntityContainer(net.minecraft.server.v1_9_R2.ITileEntityContainer) SelfContainer(io.github.bananapuncher714.crafters.implementation.v1_9_R2.ContainerManager_v1_9_R2.SelfContainer) InventoryCraftResult(net.minecraft.server.v1_9_R2.InventoryCraftResult)

Example 13 with IInventory

use of net.minecraft.server.v1_16_R2.IInventory 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 result = crafting.resultInventory;
    if (result == null) {
        result = new InventoryCraftResult();
        crafting.resultInventory = result;
    }
    Container container = new CustomContainerWorkbench(ent.getBukkitEntity(), bloc, crafting, result);
    crafting.addContainer(container);
    return container;
}
Also used : IInventory(net.minecraft.server.v1_10_R1.IInventory) ITileEntityContainer(net.minecraft.server.v1_10_R1.ITileEntityContainer) Container(net.minecraft.server.v1_10_R1.Container) SelfContainer(io.github.bananapuncher714.crafters.implementation.v1_10_R1.ContainerManager_v1_10_R1.SelfContainer) SelfContainer(io.github.bananapuncher714.crafters.implementation.v1_10_R1.ContainerManager_v1_10_R1.SelfContainer) InventoryCraftResult(net.minecraft.server.v1_10_R1.InventoryCraftResult)

Example 14 with IInventory

use of net.minecraft.server.v1_16_R2.IInventory in project PaperDev by Kamillaova.

the class CraftContainer method c.

@Override
public boolean c(EntityHuman entityhuman) {
    if (cachedType == view.getType() && cachedSize == getSize() && cachedTitle.equals(view.getTitle())) {
        return true;
    }
    // If the window type has changed for some reason, update the player
    // This method will be called every tick or something, so it's
    // as good a place as any to put something like this.
    boolean typeChanged = (cachedType != view.getType());
    cachedType = view.getType();
    cachedTitle = view.getTitle();
    if (view.getPlayer() instanceof CraftPlayer) {
        CraftPlayer player = (CraftPlayer) view.getPlayer();
        String type = getNotchInventoryType(cachedType);
        IInventory top = ((CraftInventory) view.getTopInventory()).getInventory();
        PlayerInventory bottom = (PlayerInventory) ((CraftInventory) view.getBottomInventory()).getInventory();
        this.items.clear();
        this.slots.clear();
        if (typeChanged) {
            setupSlots(top, bottom, player.getHandle());
        }
        int size = getSize();
        player.getHandle().playerConnection.sendPacket(new PacketPlayOutOpenWindow(this.windowId, type, new ChatComponentText(cachedTitle), size));
        player.updateInventory();
    }
    return true;
}
Also used : IInventory(net.minecraft.server.v1_12_R1.IInventory) CraftPlayer(org.bukkit.craftbukkit.v1_12_R1.entity.CraftPlayer) PlayerInventory(net.minecraft.server.v1_12_R1.PlayerInventory) PacketPlayOutOpenWindow(net.minecraft.server.v1_12_R1.PacketPlayOutOpenWindow) ChatComponentText(net.minecraft.server.v1_12_R1.ChatComponentText)

Aggregations

IInventory (net.minecraft.server.v1_12_R1.IInventory)3 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_8_R3.ContainerManager_v1_8_R3.SelfContainer)1 SelfContainer (io.github.bananapuncher714.crafters.implementation.v1_9_R2.ContainerManager_v1_9_R2.SelfContainer)1 Container (net.minecraft.server.v1_10_R1.Container)1 IInventory (net.minecraft.server.v1_10_R1.IInventory)1 ITileEntityContainer (net.minecraft.server.v1_10_R1.ITileEntityContainer)1 InventoryCraftResult (net.minecraft.server.v1_10_R1.InventoryCraftResult)1 Container (net.minecraft.server.v1_11_R1.Container)1 IInventory (net.minecraft.server.v1_11_R1.IInventory)1 ITileEntityContainer (net.minecraft.server.v1_11_R1.ITileEntityContainer)1