Skip to content

Commit ab5dc2f

Browse files
authored
Fix + move recipe condition docs (#3919)
1 parent 13bb2a0 commit ab5dc2f

File tree

1 file changed

+10
-3
lines changed

1 file changed

+10
-3
lines changed

docs/content/Modpacks/Other-Topics/Recipe-Conditions.md renamed to docs/content/Modpacks/Recipes/Recipe-Conditions.md

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -52,6 +52,10 @@ public class ExampleCondition extends RecipeCondition {
5252

5353
public ExampleCondition(int height) {
5454
this(false, height);
55+
}
56+
57+
public ExampleCondition() {
58+
this(false, 0);
5559
}
5660

5761
@Override
@@ -61,7 +65,7 @@ public class ExampleCondition extends RecipeCondition {
6165

6266
@Override
6367
public Component getTooltips() {
64-
return Component.literal("Should be ran at least at height %d", height);
68+
return Component.literal(String.format("Should be ran at least at height %d", height));
6569
}
6670

6771
@Override
@@ -87,7 +91,7 @@ Starting with:
8791

8892
@Override
8993
public Component getTooltips() {
90-
return Component.literal("Should be ran at least at height %d", height);
94+
return Component.literal(String.format("Should be ran at least at height %d", height));
9195
}
9296
```
9397
This part is quite simple, and just returns the type and tooltip for the condition. The tooltip is what gets added in the recipe viewer's screen if this condition is present.
@@ -102,8 +106,11 @@ This part is quite simple, and just returns the type and tooltip for the conditi
102106
this(false, height);
103107
}
104108
109+
public ExampleCondition() {
110+
this(false, 0);
111+
}
105112
```
106-
These are the constructors. We need the `isReverse`, as it is part of the overarching `RecipeCondition` type. `isReverse` means that if the condition is met, your recipe won't be run.
113+
These are the constructors. We need the `isReverse`, as it is part of the overarching `RecipeCondition` type. `isReverse` means that if the condition is met, your recipe won't be run. Furthermore, a no-arg constructor is required for (de)serialization.
107114

108115
```java
109116
@Override

0 commit comments

Comments
 (0)