This commit is contained in:
Raoul Van den Berge
2016-09-13 02:41:25 +02:00
parent 7ac1b6bafe
commit 83b4eccbd1
2 changed files with 9 additions and 6 deletions

View File

@@ -20,11 +20,11 @@ public interface ISoldererRegistry {
/**
* Returns a solderer recipe from the rows.
*
* @param row an item handler, where slots 0 - 2 are the rows
* @param rows an item handler, where slots 0 - 2 are the rows
* @return the {@link ISoldererRecipe}, or null if no recipe was found
*/
@Nullable
ISoldererRecipe getRecipe(@Nonnull IItemHandler row);
ISoldererRecipe getRecipe(@Nonnull IItemHandler rows);
/**
* @return a list with all the solderer recipes, do NOT modify

View File

@@ -1,5 +1,6 @@
package refinedstorage.apiimpl.solderer;
import net.minecraft.item.ItemStack;
import net.minecraftforge.items.IItemHandler;
import refinedstorage.api.solderer.ISoldererRecipe;
import refinedstorage.api.solderer.ISoldererRegistry;
@@ -20,17 +21,19 @@ public class SoldererRegistry implements ISoldererRegistry {
@Override
@Nullable
public ISoldererRecipe getRecipe(@Nonnull IItemHandler row) {
public ISoldererRecipe getRecipe(@Nonnull IItemHandler rows) {
for (ISoldererRecipe recipe : recipes) {
boolean found = true;
for (int i = 0; i < 3; ++i) {
if (!CompareUtils.compareStackNoQuantity(recipe.getRow(i), row.getStackInSlot(i)) && !CompareUtils.compareStackOreDict(recipe.getRow(i), row.getStackInSlot(i))) {
if (!CompareUtils.compareStackNoQuantity(recipe.getRow(i), rows.getStackInSlot(i)) && !CompareUtils.compareStackOreDict(recipe.getRow(i), rows.getStackInSlot(i))) {
found = false;
}
if (row.getStackInSlot(i) != null && recipe.getRow(i) != null) {
if (row.getStackInSlot(i).stackSize < recipe.getRow(i).stackSize) {
ItemStack row = recipe.getRow(i);
if (rows.getStackInSlot(i) != null && row != null) {
if (rows.getStackInSlot(i).stackSize < row.stackSize) {
found = false;
}
}