Search in sources :

Example 61 with ItemStack

use of net.minecraft.server.v1_16_R3.ItemStack in project PublicCrafters by BananaPuncher714.

the class CustomInventoryCrafting method splitStack.

@Override
public ItemStack splitStack(int i, int j) {
    ItemStack itemstack = ContainerUtil.a(items, i, j);
    if (!itemstack.isEmpty()) {
        for (Container container : containers) {
            container.a(this);
        }
    }
    // Update the armorstand grid
    display.update();
    return itemstack;
}
Also used : SelfContainer(io.github.bananapuncher714.crafters.implementation.v1_12_R1.ContainerManager_v1_12_R1.SelfContainer) Container(net.minecraft.server.v1_12_R1.Container) CraftItemStack(org.bukkit.craftbukkit.v1_12_R1.inventory.CraftItemStack) ItemStack(net.minecraft.server.v1_12_R1.ItemStack)

Example 62 with ItemStack

use of net.minecraft.server.v1_16_R3.ItemStack in project PublicCrafters by BananaPuncher714.

the class CustomContainerWorkbench method shiftClick.

// Overrides 1.12.2
public ItemStack shiftClick(EntityHuman entityhuman, int i) {
    ItemStack itemstack = ItemStack.a;
    Slot slot = (Slot) theseSlots.get(i);
    if ((slot != null) && (slot.hasItem())) {
        ItemStack itemstack1 = slot.getItem();
        itemstack = itemstack1.cloneItemStack();
        if (i == 0) {
            itemstack1.getItem().b(itemstack1, world, entityhuman);
            if (!a(itemstack1, 10, 46, true)) {
                return ItemStack.a;
            }
            slot.a(itemstack1, itemstack);
        } else if ((i >= 10) && (i < 37)) {
            if (!a(itemstack1, 37, 46, false)) {
                return ItemStack.a;
            }
        } else if ((i >= 37) && (i < 46)) {
            if (!a(itemstack1, 10, 37, false)) {
                return ItemStack.a;
            }
        } else if (!a(itemstack1, 10, 46, false)) {
            return ItemStack.a;
        }
        if (itemstack1.isEmpty()) {
            slot.set(ItemStack.a);
        } else {
            slot.f();
        }
        if (itemstack1.getCount() == itemstack.getCount()) {
            return ItemStack.a;
        }
        ItemStack itemstack2 = slot.a(entityhuman, itemstack1);
        if (i == 0) {
            entityhuman.drop(itemstack2, false);
        }
    }
    return itemstack;
}
Also used : PacketPlayOutSetSlot(net.minecraft.server.v1_13_R1.PacketPlayOutSetSlot) Slot(net.minecraft.server.v1_13_R1.Slot) ItemStack(net.minecraft.server.v1_13_R1.ItemStack)

Example 63 with ItemStack

use of net.minecraft.server.v1_16_R3.ItemStack in project PublicCrafters by BananaPuncher714.

the class CustomInventoryCrafting method setDefaults.

private void setDefaults() {
    try {
        // Set items
        Field field = InventoryCrafting.class.getDeclaredField("items");
        field.setAccessible(true);
        items = (List<ItemStack>) field.get(this);
    } catch (Exception e) {
        e.printStackTrace();
    }
}
Also used : Field(java.lang.reflect.Field) CraftItemStack(org.bukkit.craftbukkit.v1_13_R2.inventory.CraftItemStack) ItemStack(net.minecraft.server.v1_13_R2.ItemStack)

Example 64 with ItemStack

use of net.minecraft.server.v1_16_R3.ItemStack in project PublicCrafters by BananaPuncher714.

the class CustomInventoryCrafting method remove.

@Override
public void remove() {
    display.stop();
    for (ItemStack item : items) {
        org.bukkit.inventory.ItemStack is = CraftItemStack.asBukkitCopy(item);
        if (is.getType() != Material.AIR) {
            bloc.getWorld().dropItem(bloc.clone().add(.5, .9, .5), is);
        }
    }
    items.clear();
}
Also used : ItemStack(net.minecraft.server.v1_15_R1.ItemStack) CraftItemStack(org.bukkit.craftbukkit.v1_15_R1.inventory.CraftItemStack)

Example 65 with ItemStack

use of net.minecraft.server.v1_16_R3.ItemStack in project PublicCrafters by BananaPuncher714.

the class CustomInventoryCrafting method splitStack.

@Override
public ItemStack splitStack(int i, int j) {
    ItemStack itemstack = ContainerUtil.a(items, i, j);
    if (!itemstack.isEmpty()) {
        for (Container container : containers) {
            container.a(this);
        }
    }
    // Update the armorstand grid
    display.update();
    return itemstack;
}
Also used : Container(net.minecraft.server.v1_15_R1.Container) SelfContainer(io.github.bananapuncher714.crafters.implementation.v1_15_R1.ContainerManager_v1_15_R1.SelfContainer) ItemStack(net.minecraft.server.v1_15_R1.ItemStack) CraftItemStack(org.bukkit.craftbukkit.v1_15_R1.inventory.CraftItemStack)

Aggregations

CraftItemStack (org.bukkit.craftbukkit.v1_16_R3.inventory.CraftItemStack)49 ItemStack (net.minecraft.server.v1_12_R1.ItemStack)28 net.minecraft.server.v1_16_R3 (net.minecraft.server.v1_16_R3)28 InvocationTargetException (java.lang.reflect.InvocationTargetException)27 ItemStack (net.minecraft.server.v1_8_R3.ItemStack)27 Pair (com.mojang.datafixers.util.Pair)22 CraftItemStack (org.bukkit.craftbukkit.v1_12_R1.inventory.CraftItemStack)21 ItemStack (net.minecraft.server.v1_16_R3.ItemStack)20 NBTTagCompound (net.minecraft.server.v1_16_R3.NBTTagCompound)20 MyPetApi (de.Keyle.MyPet.MyPetApi)18 EntitySize (de.Keyle.MyPet.api.entity.EntitySize)18 MyPet (de.Keyle.MyPet.api.entity.MyPet)18 IconMenuItem (de.Keyle.MyPet.api.gui.IconMenuItem)18 EntityMyPet (de.Keyle.MyPet.compat.v1_16_R3.entity.EntityMyPet)18 Bukkit (org.bukkit.Bukkit)18 Util (de.Keyle.MyPet.api.Util)17 EquipmentSlot (de.Keyle.MyPet.api.entity.EquipmentSlot)17 Arrays (java.util.Arrays)17 CraftItemStack (org.bukkit.craftbukkit.v1_8_R3.inventory.CraftItemStack)17 ENTITY_LIVING_broadcastItemBreak (de.Keyle.MyPet.compat.v1_16_R3.CompatManager.ENTITY_LIVING_broadcastItemBreak)15