use of am2.items.ItemFocusCharge in project ArsMagica2 by Mithion.
the class ContainerArcaneReconstructor method mergeSpecialItems.
private boolean mergeSpecialItems(ItemStack stack, Slot slot) {
if (stack.getItem() instanceof ItemFocusCharge) {
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().isRepairable() && stack.isItemDamaged()) {
for (int b = 4; b < 10; ++b) {
Slot repairSlot = (Slot) inventorySlots.get(b);
if (repairSlot.getHasStack())
continue;
ItemStack input = new ItemStack(stack.getItem(), 1, stack.getItemDamage());
if (stack.stackTagCompound != null) {
input.setTagCompound((NBTTagCompound) stack.stackTagCompound.copy());
}
repairSlot.putStack(input);
repairSlot.onSlotChanged();
stack.stackSize--;
if (stack.stackSize == 0) {
slot.putStack(null);
slot.onSlotChanged();
}
return true;
}
}
return false;
}
use of am2.items.ItemFocusCharge in project ArsMagica2 by Mithion.
the class ContainerArcaneDeconstructor method mergeSpecialItems.
private boolean mergeSpecialItems(ItemStack stack, Slot slot) {
if (stack.getItem() instanceof ItemFocusCharge) {
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;
}
}
return false;
}
use of am2.items.ItemFocusCharge in project ArsMagica2 by Mithion.
the class ContainerCalefactor method mergeSpecialItems.
private boolean mergeSpecialItems(ItemStack stack, Slot slot) {
if (stack.getItem() instanceof ItemFocusCharge || stack.getItem() instanceof ItemFocusMana) {
for (int b = 2; b < 5; ++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 (FurnaceRecipes.smelting().getSmeltingResult(stack) != null) {
Slot focusSlot = (Slot) inventorySlots.get(0);
boolean b = mergeItemStack(stack, 0, 1, false);
if (stack.stackSize == 0) {
slot.putStack(null);
slot.onSlotChanged();
}
return b;
}
return false;
}
use of am2.items.ItemFocusCharge 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