Search in sources :

Example 1 with ItemSkinTemplate

use of riskyken.armourersWorkshop.common.items.ItemSkinTemplate in project Armourers-Workshop by RiskyKen.

the class GuiSkinLibrary method isLoading.

/**
 * Returns true if the player is trying to load and item
 * or false if they are trying to save.
 * @return true = loading, false = saving
 */
private boolean isLoading() {
    Slot slot = (Slot) inventorySlots.inventorySlots.get(36);
    ItemStack stack = slot.getStack();
    if (stack != null && !(stack.getItem() instanceof ItemSkinTemplate)) {
        return false;
    }
    return true;
}
Also used : ItemSkinTemplate(riskyken.armourersWorkshop.common.items.ItemSkinTemplate) Slot(net.minecraft.inventory.Slot) ItemStack(net.minecraft.item.ItemStack)

Example 2 with ItemSkinTemplate

use of riskyken.armourersWorkshop.common.items.ItemSkinTemplate in project Armourers-Workshop by RiskyKen.

the class ContainerArmourLibrary method transferStackInSlot.

@Override
public ItemStack transferStackInSlot(EntityPlayer player, int slotID) {
    Slot slot = getSlot(slotID);
    if (slot != null && slot.getHasStack()) {
        ItemStack stack = slot.getStack();
        ItemStack result = stack.copy();
        if (slotID < 36) {
            if ((stack.getItem() instanceof ItemSkinTemplate & stack.getItemDamage() == 0) | stack.getItem() instanceof ItemSkin) {
                if (!this.mergeItemStack(stack, 36, 37, false)) {
                    return null;
                }
            } else {
                return null;
            }
        } else {
            if (!this.mergeItemStack(stack, 9, 36, false)) {
                if (!this.mergeItemStack(stack, 0, 9, false)) {
                    return null;
                }
            }
        }
        if (stack.stackSize == 0) {
            slot.putStack(null);
        } else {
            slot.onSlotChanged();
        }
        slot.onPickupFromSlot(player, stack);
        return result;
    }
    return null;
}
Also used : ItemSkinTemplate(riskyken.armourersWorkshop.common.items.ItemSkinTemplate) Slot(net.minecraft.inventory.Slot) ItemSkin(riskyken.armourersWorkshop.common.items.ItemSkin) ItemStack(net.minecraft.item.ItemStack)

Example 3 with ItemSkinTemplate

use of riskyken.armourersWorkshop.common.items.ItemSkinTemplate in project Armourers-Workshop by RiskyKen.

the class ContainerArmourer method transferStackInSlot.

@Override
public ItemStack transferStackInSlot(EntityPlayer player, int slotID) {
    Slot slot = getSlot(slotID);
    if (slot != null && slot.getHasStack()) {
        ItemStack stack = slot.getStack();
        ItemStack result = stack.copy();
        if (slotID < 2) {
            if (!this.mergeItemStack(stack, 11, 38, false)) {
                if (!this.mergeItemStack(stack, 2, 11, false)) {
                    return null;
                }
            }
        } else {
            if ((stack.getItem() instanceof ItemSkinTemplate & stack.getItemDamage() == 0) | stack.getItem() instanceof ItemSkin | stack.getItem() instanceof ItemArmourContainerItem) {
                if (!this.mergeItemStack(stack, 0, 1, false)) {
                    return null;
                }
            } else {
                return null;
            }
        }
        if (stack.stackSize == 0) {
            slot.putStack(null);
        } else {
            slot.onSlotChanged();
        }
        slot.onPickupFromSlot(player, stack);
        return result;
    }
    return null;
}
Also used : ItemSkinTemplate(riskyken.armourersWorkshop.common.items.ItemSkinTemplate) Slot(net.minecraft.inventory.Slot) ItemSkin(riskyken.armourersWorkshop.common.items.ItemSkin) ItemStack(net.minecraft.item.ItemStack) ItemArmourContainerItem(riskyken.armourersWorkshop.common.items.ItemArmourContainerItem)

Aggregations

Slot (net.minecraft.inventory.Slot)3 ItemStack (net.minecraft.item.ItemStack)3 ItemSkinTemplate (riskyken.armourersWorkshop.common.items.ItemSkinTemplate)3 ItemSkin (riskyken.armourersWorkshop.common.items.ItemSkin)2 ItemArmourContainerItem (riskyken.armourersWorkshop.common.items.ItemArmourContainerItem)1