use of com.mrcrayfish.furniture.api.RecipeData in project MrCrayfishFurnitureMod by MrCrayfish.
the class ContainerOven method transferStackInSlot.
@Override
public ItemStack transferStackInSlot(EntityPlayer player, int slotNum) {
ItemStack itemCopy = ItemStack.EMPTY;
Slot slot = this.inventorySlots.get(slotNum);
if (slot != null && slot.getHasStack()) {
ItemStack item = slot.getStack();
itemCopy = item.copy();
RecipeData data = RecipeAPI.getOvenRecipeFromInput(item);
if (slotNum < 18) {
if (!this.mergeItemStack(item, 18, this.inventorySlots.size(), true)) {
return ItemStack.EMPTY;
}
} else if (data != null) {
if (!this.mergeItemStack(item, 0, 9, false)) {
return ItemStack.EMPTY;
}
} else if (slotNum >= 18 && slotNum < this.inventorySlots.size() - 9) {
if (!this.mergeItemStack(item, this.inventorySlots.size() - 9, this.inventorySlots.size(), false)) {
return ItemStack.EMPTY;
}
} else if (slotNum >= this.inventorySlots.size() - 9 && slotNum < this.inventorySlots.size()) {
if (!this.mergeItemStack(item, 18, this.inventorySlots.size() - 9, false)) {
return ItemStack.EMPTY;
}
}
if (item.getCount() == 0) {
slot.putStack(ItemStack.EMPTY);
} else {
slot.onSlotChanged();
}
}
return itemCopy;
}
use of com.mrcrayfish.furniture.api.RecipeData in project MrCrayfishFurnitureMod by MrCrayfish.
the class ContainerPrinter method transferStackInSlot.
@Override
public ItemStack transferStackInSlot(EntityPlayer player, int slotNum) {
ItemStack itemCopy = ItemStack.EMPTY;
Slot slot = this.inventorySlots.get(slotNum);
if (slot != null && slot.getHasStack()) {
ItemStack item = slot.getStack();
itemCopy = item.copy();
if (slotNum == 2) {
if (!this.mergeItemStack(item, 3, 39, true)) {
return ItemStack.EMPTY;
}
slot.onSlotChange(item, itemCopy);
} else if (slotNum != 1 && slotNum != 0) {
RecipeData data = RecipeAPI.getPrinterRecipeFromInput(new ItemStack(itemCopy.getItem()));
if (data != null) {
if (!this.mergeItemStack(item, 0, 1, false)) {
return ItemStack.EMPTY;
}
} else if (TileEntityPrinter.isItemFuel(item)) {
if (!this.mergeItemStack(item, 1, 2, false)) {
return ItemStack.EMPTY;
}
} else if (slotNum >= 3 && slotNum < 30) {
if (!this.mergeItemStack(item, 30, 39, false)) {
return ItemStack.EMPTY;
}
} else if (slotNum >= 30 && slotNum < 39 && !this.mergeItemStack(item, 3, 30, false)) {
return ItemStack.EMPTY;
}
} else if (!this.mergeItemStack(item, 3, 39, false)) {
return ItemStack.EMPTY;
}
if (item.getCount() == 0) {
slot.putStack(ItemStack.EMPTY);
} else {
slot.onSlotChanged();
}
if (item.getCount() == itemCopy.getCount()) {
return null;
}
slot.onTake(player, item);
}
return itemCopy;
}
use of com.mrcrayfish.furniture.api.RecipeData in project MrCrayfishFurnitureMod by MrCrayfish.
the class ContainerDishwasher method transferStackInSlot.
@Override
public ItemStack transferStackInSlot(EntityPlayer player, int slotNum) {
ItemStack itemCopy = ItemStack.EMPTY;
Slot slot = this.inventorySlots.get(slotNum);
if (slot != null && slot.getHasStack()) {
ItemStack item = slot.getStack();
itemCopy = item.copy();
if (slotNum <= 6) {
if (!this.mergeItemStack(item, 7, this.inventorySlots.size(), false)) {
return ItemStack.EMPTY;
}
} else if (slotNum > 6) {
RecipeData data = RecipeAPI.getDishwasherRecipeFromInput(item);
if (data != null) {
int corroSlot = toolToSlot(item);
if (!this.mergeItemStack(item, corroSlot, corroSlot + 1, true)) {
return ItemStack.EMPTY;
}
} else if (item.getItem() == FurnitureItems.SOAPY_WATER | item.getItem() == FurnitureItems.SUPER_SOAPY_WATER) {
if (!this.mergeItemStack(item, 6, 7, false)) {
return ItemStack.EMPTY;
}
} else if (slotNum > 6 && slotNum < this.inventorySlots.size() - 9) {
if (!this.mergeItemStack(item, this.inventorySlots.size() - 9, this.inventorySlots.size(), false)) {
return ItemStack.EMPTY;
}
} else if (slotNum >= this.inventorySlots.size() - 9 && slotNum < this.inventorySlots.size()) {
if (!this.mergeItemStack(item, 7, this.inventorySlots.size() - 9, false)) {
return ItemStack.EMPTY;
}
}
}
if (item.getCount() == 0) {
slot.putStack(ItemStack.EMPTY);
} else {
slot.onSlotChanged();
}
}
return itemCopy;
}
Aggregations