This commit is contained in:
Nedelosk committed 2017-01-05 16:16:10 +01:00
1 parent 1bdbb7e9f8
commit c210886400
6 files changed
+15 -18

No files matched your search

@@ -26,7 +26,7 @@ public interface IWoodProvider {
* @return A stack of wood from the tree to craft wood pile's or other things.
*/
ItemStack getWoodStack();
/**
* The amount of charcoal dropped from a charcoal pile of this wood.
*/
@@ -262,13 +262,10 @@ public abstract class RecipeUtil {
}
private static boolean checkIngredientMatch(@Nullable NonNullList<ItemStack> recipeIngredient, ItemStack resource) {
if (recipeIngredient == null) {
if (recipeIngredient == null || recipeIngredient.isEmpty()) {
return resource.isEmpty();
}
for (ItemStack item : recipeIngredient) {
if(item.isEmpty() && resource.isEmpty()){
return true;
}
if (ItemStackUtil.isCraftingEquivalent(item, resource)) {
return true;
}
@@ -119,13 +119,12 @@ public class ShapedRecipeCustom extends ShapedOreRecipe implements IDescriptiveR
for (char chr : shape.toCharArray()) {
NonNullList<ItemStack> stacks = itemMap.get(chr);
if (stacks != null) {
input.set(x++, stacks);
input.set(x, stacks);
if(oreMap.get(chr) != null){
oreDicts.set(x-1, oreMap.get(chr));
oreDicts.set(x, oreMap.get(chr));
}
}else{
input.set(x++, NonNullList.withSize(1, ItemStack.EMPTY));
}
x++;
}
}
@@ -184,7 +183,7 @@ public class ShapedRecipeCustom extends ShapedOreRecipe implements IDescriptiveR
ItemStack stackInSlot = inv.getStackInRowAndColumn(x, y);
if (target != null) {
if (target != null && !target.isEmpty()) {
boolean matched = false;
Iterator<ItemStack> itr = target.iterator();
@@ -299,7 +299,7 @@ public abstract class InventoryUtil {
return ItemStack.EMPTY;
}
private static ItemStack removeStack(IInventory inventory, ItemStack stackToRemove, String oreDictOfStack, @Nullable EntityPlayer player, boolean stowContainer, boolean craftingTools) {
private static ItemStack removeStack(IInventory inventory, ItemStack stackToRemove, @Nullable String oreDictOfStack, @Nullable EntityPlayer player, boolean stowContainer, boolean craftingTools) {
for (int j = 0; j < inventory.getSizeInventory(); j++) {
ItemStack stackInSlot = inventory.getStackInSlot(j);
if (!stackInSlot.isEmpty()) {
@@ -335,8 +335,8 @@ public abstract class ItemStackUtil {
* Compare two item stacks for crafting equivalency.
*/
public static boolean isCraftingEquivalent(ItemStack base, ItemStack comparison, boolean oreDictionary, boolean craftingTools) {
if (!isCraftingEquivalent(base, comparison, craftingTools)) {
return false;
if (isCraftingEquivalent(base, comparison, craftingTools)) {
return true;
}
if (oreDictionary) {
@@ -357,6 +357,7 @@ public abstract class ItemStackUtil {
return true;
}
}
return false;
}
return false;
@@ -365,12 +366,12 @@ public abstract class ItemStackUtil {
/**
* Compare two item stacks for crafting equivalency.
*/
public static boolean isCraftingEquivalent(ItemStack base, ItemStack comparison, String oreDict, boolean craftingTools) {
if(!isCraftingEquivalent(base, comparison, craftingTools)){
return false;
public static boolean isCraftingEquivalent(ItemStack base, ItemStack comparison, @Nullable String oreDict, boolean craftingTools) {
if(isCraftingEquivalent(base, comparison, craftingTools)){
return true;
}
if (!oreDict.isEmpty()) {
if (oreDict != null && !oreDict.isEmpty()) {
int[] baseIds = OreDictionary.getOreIDs(base);
int validID = OreDictionary.getOreID(oreDict);
@@ -204,7 +204,7 @@ public abstract class SlotUtil {
int max = Math.min(stackToShift.getMaxStackSize(), slot.getSlotStackLimit());
stackInSlot = stackToShift.copy();
stackInSlot.setCount(Math.min(stackToShift.getCount(), max));
stackInSlot.shrink(stackInSlot.getCount());
stackToShift.shrink(stackInSlot.getCount());
slot.putStack(stackInSlot);
slot.onSlotChanged();
changed = true;