Search in sources :

Example 21 with Slot

use of net.minecraft.server.v1_11_R1.Slot in project PublicCrafters by BananaPuncher714.

the class CustomContainerAnvil method b.

// Shift click
public ItemStack b(EntityHuman entityhuman, int i) {
    ItemStack itemstack = ItemStack.a;
    Slot slot = (Slot) this.c.get(i);
    if ((slot != null) && (slot.hasItem())) {
        ItemStack itemstack1 = slot.getItem();
        itemstack = itemstack1.cloneItemStack();
        if (i == 2) {
            if (!a(itemstack1, 3, 39, true)) {
                return ItemStack.a;
            }
            slot.a(itemstack1, itemstack);
        } else if ((i != 0) && (i != 1)) {
            if ((i >= 3) && (i < 39) && (!a(itemstack1, 0, 2, false))) {
                return ItemStack.a;
            }
        } else if (!a(itemstack1, 3, 39, false)) {
            return ItemStack.a;
        }
        if (itemstack1.isEmpty()) {
            slot.set(ItemStack.a);
        } else {
            slot.f();
        }
        if (itemstack1.getCount() == itemstack.getCount()) {
            return ItemStack.a;
        }
        slot.a(entityhuman, itemstack1);
    }
    return itemstack;
}
Also used : Slot(net.minecraft.server.v1_11_R1.Slot) ItemStack(net.minecraft.server.v1_11_R1.ItemStack)

Example 22 with Slot

use of net.minecraft.server.v1_11_R1.Slot in project PaperDev by Kamillaova.

the class CraftContainer method setupWorkbench.

private void setupWorkbench(IInventory top, IInventory bottom) {
    // This code copied from ContainerWorkbench
    this.a(new Slot(top, 0, 124, 35));
    int row;
    int col;
    for (row = 0; row < 3; ++row) {
        for (col = 0; col < 3; ++col) {
            this.a(new Slot(top, 1 + col + row * 3, 30 + col * 18, 17 + row * 18));
        }
    }
    for (row = 0; row < 3; ++row) {
        for (col = 0; col < 9; ++col) {
            this.a(new Slot(bottom, col + row * 9 + 9, 8 + col * 18, 84 + row * 18));
        }
    }
    for (col = 0; col < 9; ++col) {
        this.a(new Slot(bottom, col, 8 + col * 18, 142));
    }
// End copy from ContainerWorkbench
}
Also used : Slot(net.minecraft.server.v1_12_R1.Slot)

Aggregations

ItemStack (net.minecraft.server.v1_11_R1.ItemStack)5 Slot (net.minecraft.server.v1_12_R1.Slot)3 CraftItemStack (org.bukkit.craftbukkit.v1_11_R1.inventory.CraftItemStack)3 IconMenuItem (de.Keyle.MyPet.api.gui.IconMenuItem)2 HardwareTokenType (ee.ria.xroad.signer.tokenmanager.token.HardwareTokenType)2 Slot (iaik.pkcs.pkcs11.Slot)2 Slot (net.minecraft.server.v1_11_R1.Slot)2 ItemStack (net.minecraft.server.v1_12_R1.ItemStack)2 FailedNbt (com.ruinscraft.panilla.api.exception.FailedNbt)1 INbtTagCompound (com.ruinscraft.panilla.api.nbt.INbtTagCompound)1 NbtTagCompound (com.ruinscraft.panilla.craftbukkit.v1_12_R1.nbt.NbtTagCompound)1 CustomInventory (de.Keyle.MyPet.compat.v1_11_R1.util.inventory.CustomInventory)1 TokenType (ee.ria.xroad.signer.tokenmanager.token.TokenType)1 PKCS11Exception (iaik.pkcs.pkcs11.wrapper.PKCS11Exception)1 Field (java.lang.reflect.Field)1 ArrayList (java.util.ArrayList)1 HashMap (java.util.HashMap)1 List (java.util.List)1 Nonnull (javax.annotation.Nonnull)1 InventoryClickType (me.devtec.theapi.bukkit.BukkitLoader.InventoryClickType)1