Search in sources :

Example 41 with EntityHuman

use of net.minecraft.server.v1_15_R1.EntityHuman in project PublicCrafters by BananaPuncher714.

the class CustomContainerWorkbench method shiftClick.

// Overrides 1.15.1
@Override
public ItemStack shiftClick(EntityHuman entityhuman, int i) {
    ItemStack itemstack = ItemStack.a;
    Slot slot = (Slot) this.slots.get(i);
    if (slot != null && slot.hasItem()) {
        ItemStack itemstack1 = slot.getItem();
        itemstack = itemstack1.cloneItemStack();
        if (i == 0) {
            this.containerAccess.a((world, blockposition) -> {
                itemstack1.getItem().b(itemstack1, world, entityhuman);
            });
            if (!this.a(itemstack1, 10, 46, true)) {
                return ItemStack.a;
            }
            slot.a(itemstack1, itemstack);
        } else if (i >= 10 && i < 46 ? !this.a(itemstack1, 1, 10, false) && (i < 37 ? !this.a(itemstack1, 37, 46, false) : !this.a(itemstack1, 10, 37, false)) : !this.a(itemstack1, 10, 46, false)) {
            return ItemStack.a;
        }
        if (itemstack1.isEmpty()) {
            slot.set(ItemStack.a);
        } else {
            slot.d();
        }
        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 : Slot(net.minecraft.server.v1_15_R1.Slot) ItemStack(net.minecraft.server.v1_15_R1.ItemStack)

Aggregations

LivingEntity (org.bukkit.entity.LivingEntity)15 EntityHuman (net.minecraft.server.v1_11_R1.EntityHuman)7 EntityHuman (net.minecraft.server.v1_12_R1.EntityHuman)6 EntityHuman (net.minecraft.server.v1_8_R3.EntityHuman)6 NPCHolder (net.citizensnpcs.npc.ai.NPCHolder)5 SkinnableEntity (net.citizensnpcs.npc.skin.SkinnableEntity)5 EntityHuman (net.minecraft.server.v1_15_R1.EntityHuman)5 EntityHuman (net.minecraft.server.v1_10_R1.EntityHuman)4 EntityHuman (net.minecraft.server.v1_13_R2.EntityHuman)4 Entity (net.minecraft.server.v1_11_R1.Entity)3 EntityLiving (net.minecraft.server.v1_11_R1.EntityLiving)3 EntityLiving (net.minecraft.server.v1_12_R1.EntityLiving)3 EntityHuman (net.minecraft.server.v1_16_R3.EntityHuman)3 CoreStateInitException (com.solinia.solinia.Exceptions.CoreStateInitException)2 SoliniaItemException (com.solinia.solinia.Exceptions.SoliniaItemException)2 ISoliniaLivingEntity (com.solinia.solinia.Interfaces.ISoliniaLivingEntity)2 ISoliniaPlayer (com.solinia.solinia.Interfaces.ISoliniaPlayer)2 Entity (net.minecraft.server.v1_12_R1.Entity)2 EntityLiving (net.minecraft.server.v1_15_R1.EntityLiving)2 Entity (net.minecraft.server.v1_9_R1.Entity)2