use of riskyken.armourersWorkshop.common.items.ItemSkin 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;
}
use of riskyken.armourersWorkshop.common.items.ItemSkin in project Armourers-Workshop by RiskyKen.
the class ContainerSkinWardrobe 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 < skinSlots) {
// Moving item to main inv
if (!this.mergeItemStack(stack, skinSlots + 9, skinSlots + 36, false)) {
// Moving item to hotbar
if (!this.mergeItemStack(stack, skinSlots, skinSlots + 9, false)) {
return null;
}
}
} else {
if (stack.getItem() instanceof ItemSkin & SkinNBTHelper.stackHasSkinData(stack)) {
boolean slotted = false;
for (int i = 0; i < skinSlots; i++) {
Slot targetSlot = getSlot(i);
if (targetSlot.isItemValid(stack)) {
if (this.mergeItemStack(stack, i, i + 1, false)) {
slotted = true;
break;
}
}
}
if (!slotted) {
return null;
}
} else {
return null;
}
}
if (stack.stackSize == 0) {
slot.putStack(null);
} else {
slot.onSlotChanged();
}
slot.onPickupFromSlot(player, stack);
return result;
}
return null;
}
Aggregations