use of am2.items.ItemFocus in project ArsMagica2 by Mithion.
the class ContainerSummoner method mergeSpecialItems.
private boolean mergeSpecialItems(ItemStack stack, Slot slot) {
if (stack.getItem() instanceof ItemFocus) {
if (stack.getItem() instanceof ItemFocusCharge || stack.getItem() instanceof ItemFocusMana) {
for (int b = 0; b < 3; ++b) {
Slot focusSlot = (Slot) inventorySlots.get(b);
if (focusSlot.getHasStack())
continue;
focusSlot.putStack(new ItemStack(stack.getItem(), 1, stack.getItemDamage()));
focusSlot.onSlotChanged();
stack.stackSize--;
if (stack.stackSize == 0) {
slot.putStack(null);
slot.onSlotChanged();
}
return true;
}
}
} else if (stack.getItem() instanceof ItemSpellBase) {
Slot scrollSlot = (Slot) inventorySlots.get(3);
if (scrollSlot.getHasStack())
return false;
ItemStack castStack = new ItemStack(stack.getItem(), 1, stack.getItemDamage());
if (stack.hasTagCompound()) {
castStack.setTagCompound((NBTTagCompound) stack.stackTagCompound.copy());
}
scrollSlot.putStack(castStack);
scrollSlot.onSlotChanged();
stack.stackSize--;
if (stack.stackSize == 0) {
slot.putStack(null);
slot.onSlotChanged();
}
return true;
}
return false;
}
Aggregations