Skip to content

Commit

Permalink
fix odd validate calls (#241)
Browse files Browse the repository at this point in the history
* dont include validate as 0 when can be assumed

* use validateCustom to standardize gas
  • Loading branch information
WaitingIdly authored Oct 2, 2024
1 parent ea07ef5 commit 93297dd
Show file tree
Hide file tree
Showing 11 changed files with 16 additions and 16 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,7 @@ public String getErrorMsg() {

@Override
public void validate(GroovyLog.Msg msg) {
validateFluids(msg, 0, 0, 0, 0);
validateFluids(msg);
validateItems(msg, 1, 20, 1, 1);
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -162,8 +162,8 @@ public String getErrorMsg() {

@Override
public void validate(GroovyLog.Msg msg) {
validateItems(msg, 0, 0, 0, 0);
validateFluids(msg, 0, 0, 0, 0);
validateItems(msg);
validateFluids(msg);
msg.add(key == null, "key must be defined");
msg.add(BotaniaAPI.brewMap.containsKey(key), "must have a unique key for brew, got " + key);
msg.add(cost < 1, "cost must be at least 1, got " + cost);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,7 @@ public String getErrorMsg() {

@Override
public void validate(GroovyLog.Msg msg) {
validateFluids(msg, 0, 0, 0, 0);
validateFluids(msg);
validateItems(msg, 1, 99, 1, 99);
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -398,8 +398,8 @@ public String getErrorMsg() {

@Override
public void validate(GroovyLog.Msg msg) {
validateFluids(msg, 0, 0, 0, 0);
validateItems(msg, 0, 0, 0, 0);
validateFluids(msg);
validateItems(msg);
msg.add(name == null, "expected a valid name, got " + name);
msg.add(pages.size() < 1, "entry must have at least 1 page, got " + pages.size());
msg.add(category == null, "expected a valid category, got " + category);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -119,7 +119,7 @@ public String getErrorMsg() {

@Override
public void validate(GroovyLog.Msg msg) {
validateFluids(msg, 0, 0, 0, 0);
validateFluids(msg);
validateItems(msg, 1, 1, 1, 1);
msg.add(mana < 1, "Mana amount must be at least 1, got " + mana);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -141,8 +141,8 @@ public String getErrorMsg() {

@Override
public void validate(GroovyLog.Msg msg) {
validateItems(msg, 0, 0, 0, 0);
validateFluids(msg, 0, 0, 0, 0);
validateItems(msg);
validateFluids(msg);
msg.add(time < 0, "time must be at least 1, got " + time);
msg.add(output == null, "output must be defined");
msg.add(input == null || !(input instanceof String || input instanceof IBlockState), "expected IBlockState or String input, got {}", input);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -95,7 +95,7 @@ public String getErrorMsg() {

@Override
public void validate(GroovyLog.Msg msg) {
validateFluids(msg, 0, 0, 0, 0);
validateFluids(msg);
validateItems(msg, 1, 20, 1, 1);
msg.add(input.stream().anyMatch(x -> x.test(new ItemStack(Item.getItemFromBlock(ModBlocks.livingrock), 1, 0))),
"input cannot contain a livingrock item");
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -112,7 +112,7 @@ public String getErrorMsg() {

@Override
public void validate(GroovyLog.Msg msg) {
validateFluids(msg, 0, 0, 0, 0);
validateFluids(msg);
validateItems(msg, 1, 1, 0, 0);
msg.add(outputs.isEmpty() || outputs.size() > 9, "Must have 1 - 9 outputs. got {}.", outputs.size());
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,7 @@ public String getErrorMsg() {

@Override
public void validate(GroovyLog.Msg msg) {
validateFluids(msg, 0, 0, 0, 0);
validateFluids(msg);
validateItems(msg, 1, 1, 1, 1);
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,7 @@ public String getErrorMsg() {

@Override
public void validate(GroovyLog.Msg msg) {
validateItems(msg, 0, 0, 0, 0);
validateItems(msg);
validateFluids(msg, 1, 1, 1, 1);
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -63,12 +63,12 @@ public GasRecipeBuilder<T> gasOutput(GasStack... gases) {
public void validateGases(GroovyLog.Msg msg, int minInput, int maxInput, int minOutput, int maxOutput) {
gasInput.trim();
gasOutput.trim();
msg.add(gasInput.size() < minInput || gasInput.size() > maxInput, () -> getRequiredString(minInput, maxInput, "gas input") + ", but found " + gasInput.size());
msg.add(gasOutput.size() < minOutput || gasOutput.size() > maxOutput, () -> getRequiredString(minOutput, maxOutput, "gas output") + ", but found " + gasOutput.size());
validateCustom(msg, gasInput, minInput, maxInput, "gas input");
validateCustom(msg, gasOutput, minOutput, maxOutput, "gas output");
}

public void validateGases(GroovyLog.Msg msg) {
validateItems(msg, 0, 0, 0, 0);
validateGases(msg, 0, 0, 0, 0);
}

}

0 comments on commit 93297dd

Please sign in to comment.