Invalidate recipes where part of the input is missing

Otherwise you can craft enderium base with just 2 tin...

re IRC
This commit is contained in:
HenryLoenwind committed 2015-11-22 20:01:18 +01:00
1 parent 4d3d59e4bb
commit 396730becd
2 files changed
+10 -2

No files matched your search

@@ -289,6 +289,8 @@ public class RecipeConfig {
private String name;
private boolean invalidated = false;
private RecipeElement(String name) {
this.name = name;
}
@@ -323,7 +325,7 @@ public class RecipeConfig {
}
public boolean isValid() {
return !inputs.isEmpty() && !outputs.isEmpty();
return !invalidated && !inputs.isEmpty() && !outputs.isEmpty();
}
public float getEnergyRequired() {
@@ -342,9 +344,14 @@ public class RecipeConfig {
this.bonusType = bonusType;
}
public void invalidate() {
invalidated = true;
}
@Override
public String toString() {
return "Recipe [input=" + inputs + ", outputs=" + outputs + ", energyRequired=" + energyRequired + ", bonusType=" + bonusType + "]";
return "Recipe [" + (invalidated ? "INVALID " : "") + "input=" + inputs + ", outputs=" + outputs + ", energyRequired="
+ energyRequired + ", bonusType=" + bonusType + "]";
}
}
@@ -342,6 +342,7 @@ public class RecipeConfigParser extends DefaultHandler {
private void addInputStack(Attributes attributes) {
RecipeInput stack = getItemStack(attributes);
if(stack == null) {
recipe.invalidate();
return;
}
recipe.addInput(stack);