Search in sources :

Example 41 with EntityHuman

use of net.minecraft.server.v1_13_R2.EntityHuman 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_R2.PacketPlayOutSetSlot) Slot(net.minecraft.server.v1_13_R2.Slot) ItemStack(net.minecraft.server.v1_13_R2.ItemStack)

Example 42 with EntityHuman

use of net.minecraft.server.v1_13_R2.EntityHuman 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)

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 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_13_R2.EntityLiving)2 EntityLiving (net.minecraft.server.v1_15_R1.EntityLiving)2 EntityHuman (net.minecraft.server.v1_16_R3.EntityHuman)2