Update to support updated recipe format in reborn core.
This commit is contained in:
parent
d435d5d772
commit
6aa8fde64a
7 changed files with 54 additions and 91 deletions
|
@ -12,6 +12,7 @@ import reborncore.api.recipe.IBaseRecipeType;
|
|||
import reborncore.api.recipe.RecipeHandler;
|
||||
import reborncore.api.tile.IInventoryProvider;
|
||||
import reborncore.common.IWrenchable;
|
||||
import reborncore.common.recipes.RecipeTranslator;
|
||||
import reborncore.common.tile.TileLegacyMachineBase;
|
||||
import reborncore.common.util.Inventory;
|
||||
import reborncore.common.util.ItemUtils;
|
||||
|
@ -124,14 +125,20 @@ public class TileAlloyFurnace extends TileLegacyMachineBase implements IWrenchab
|
|||
if (recipeType == null) {
|
||||
return false;
|
||||
}
|
||||
for (ItemStack input : recipeType.getInputs()) {
|
||||
Boolean hasItem = false;
|
||||
for (Object input : recipeType.getInputs()) {
|
||||
boolean hasItem = false;
|
||||
boolean useOreDict = input instanceof String || recipeType.useOreDic();
|
||||
boolean checkSize = input instanceof ItemStack;
|
||||
for (int inputslot = 0; inputslot < 2; inputslot++) {
|
||||
if (ItemUtils.isItemEqual(input, inventory.getStackInSlot(inputslot), true, true,
|
||||
recipeType.useOreDic()) && inventory.getStackInSlot(inputslot).getCount() >= input.getCount()) {
|
||||
hasItem = true;
|
||||
if (ItemUtils.isInputEqual(input, inventory.getStackInSlot(inputslot), true, true,
|
||||
useOreDict)) {
|
||||
ItemStack stack = RecipeTranslator.getStackFromObject(input);
|
||||
if(!checkSize || inventory.getStackInSlot(inputslot).getCount() >= stack.getCount()){
|
||||
hasItem = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (!hasItem)
|
||||
return false;
|
||||
}
|
||||
|
@ -199,11 +206,16 @@ public class TileAlloyFurnace extends TileLegacyMachineBase implements IWrenchab
|
|||
hasAllRecipes = false;
|
||||
}
|
||||
if (hasAllRecipes) {
|
||||
for (ItemStack input : recipeType.getInputs()) {
|
||||
for (Object input : recipeType.getInputs()) {
|
||||
boolean useOreDict = input instanceof String || recipeType.useOreDic();
|
||||
for (int inputSlot = 0; inputSlot < 2; inputSlot++) {
|
||||
if (ItemUtils.isItemEqual(input, inventory.getStackInSlot(inputSlot), true, true,
|
||||
recipeType.useOreDic())) {
|
||||
inventory.decrStackSize(inputSlot, input.getCount());
|
||||
if (ItemUtils.isInputEqual(input, inventory.getStackInSlot(inputSlot), true, true,
|
||||
useOreDict)) {
|
||||
int count = 1;
|
||||
if(input instanceof ItemStack){
|
||||
count = RecipeTranslator.getStackFromObject(input).getCount();
|
||||
}
|
||||
inventory.decrStackSize(inputSlot, count);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue