Added untested OreDictionary support
This commit is contained in:
parent
0bf7af8a84
commit
446f94770d
2 changed files with 20 additions and 4 deletions
|
@ -92,7 +92,7 @@ public class RecipeCrafter {
|
|||
for (IBaseRecipeType recipe : RecipeHanderer.getRecipeClassFromName(recipeName)) {
|
||||
boolean isFullRecipe = false;
|
||||
for (int i = 0; i < inputs; i++) {
|
||||
if (ItemUtils.isItemEqual(inventory.getStackInSlot(inputSlots[i]), recipe.getInputs().get(i), true, true)) {
|
||||
if (ItemUtils.isItemEqual(inventory.getStackInSlot(inputSlots[i]), recipe.getInputs().get(i), true, true, true)) {
|
||||
isFullRecipe = true;
|
||||
} else {
|
||||
isFullRecipe = false;
|
||||
|
@ -105,7 +105,7 @@ public class RecipeCrafter {
|
|||
}
|
||||
} else {
|
||||
for (int i = 0; i < inputs; i++) {
|
||||
if (!ItemUtils.isItemEqual(inventory.getStackInSlot(inputSlots[i]), currentRecipe.getInputs().get(i), true, true)) {
|
||||
if (!ItemUtils.isItemEqual(inventory.getStackInSlot(inputSlots[i]), currentRecipe.getInputs().get(i), true, true, true)) {
|
||||
currentRecipe = null;
|
||||
currentTickTime = 0;
|
||||
return;
|
||||
|
@ -150,7 +150,7 @@ public class RecipeCrafter {
|
|||
if (inventory.getStackInSlot(slot) == null) {
|
||||
return true;
|
||||
}
|
||||
if (ItemUtils.isItemEqual(inventory.getStackInSlot(slot), stack, true, true)) {
|
||||
if (ItemUtils.isItemEqual(inventory.getStackInSlot(slot), stack, true, true, true)) {
|
||||
if (stack.stackSize + inventory.getStackInSlot(slot).stackSize <= stack.getMaxStackSize()) {
|
||||
return true;
|
||||
}
|
||||
|
@ -166,7 +166,7 @@ public class RecipeCrafter {
|
|||
inventory.setInventorySlotContents(slot, stack);
|
||||
return;
|
||||
}
|
||||
if (ItemUtils.isItemEqual(inventory.getStackInSlot(slot), stack, true, true)) {
|
||||
if (ItemUtils.isItemEqual(inventory.getStackInSlot(slot), stack, true, true, true)) {
|
||||
if (stack.stackSize + inventory.getStackInSlot(slot).stackSize <= stack.getMaxStackSize()) {
|
||||
ItemStack newStack = stack.copy();
|
||||
newStack.stackSize = inventory.getStackInSlot(slot).stackSize + stack.stackSize;
|
||||
|
|
|
@ -6,10 +6,13 @@ import net.minecraft.nbt.NBTTagCompound;
|
|||
import net.minecraft.nbt.NBTTagList;
|
||||
import net.minecraftforge.oredict.OreDictionary;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* Created by mark on 12/04/15.
|
||||
*/
|
||||
public class ItemUtils {
|
||||
|
||||
public static boolean isItemEqual(final ItemStack a, final ItemStack b,
|
||||
final boolean matchDamage, final boolean matchNBT)
|
||||
{
|
||||
|
@ -29,6 +32,19 @@ public class ItemUtils {
|
|||
return true;
|
||||
}
|
||||
|
||||
public static boolean isItemEqual(ItemStack a, ItemStack b,
|
||||
boolean matchDamage, boolean matchNBT, boolean useOreDic)
|
||||
{
|
||||
if(isItemEqual(a, b, matchDamage, matchNBT)){
|
||||
return true;
|
||||
}
|
||||
if (a == null || b == null)
|
||||
return false;
|
||||
|
||||
return OreDictionary.itemMatches(a, b, false);
|
||||
}
|
||||
|
||||
|
||||
public static boolean isWildcard(ItemStack stack)
|
||||
{
|
||||
return isWildcard(stack.getItemDamage());
|
||||
|
|
Loading…
Add table
Reference in a new issue