Skip to content

Commit 93681c6

Browse files
authored
Disable Furnace Logging (#361)
* only log wildcard in debug * remove logs from furnace
1 parent 266c1dc commit 93681c6

File tree

1 file changed

+8
-26
lines changed
  • src/main/java/com/cleanroommc/groovyscript/compat/vanilla

1 file changed

+8
-26
lines changed

src/main/java/com/cleanroommc/groovyscript/compat/vanilla/Furnace.java

Lines changed: 8 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,6 @@
66
import com.cleanroommc.groovyscript.api.documentation.annotations.*;
77
import com.cleanroommc.groovyscript.helper.SimpleObjectStream;
88
import com.cleanroommc.groovyscript.helper.ingredient.GroovyScriptCodeConverter;
9-
import com.cleanroommc.groovyscript.helper.ingredient.IngredientHelper;
109
import com.cleanroommc.groovyscript.helper.recipe.AbstractRecipeBuilder;
1110
import com.cleanroommc.groovyscript.registry.AbstractReloadableStorage;
1211
import com.cleanroommc.groovyscript.registry.VirtualizedRegistry;
@@ -65,12 +64,6 @@ public boolean remove(Recipe recipe) {
6564

6665
@MethodDescription(example = @Example("item('minecraft:clay:*')"))
6766
public boolean removeByInput(IIngredient input) {
68-
if (GroovyLog.msg("Error adding Minecraft Furnace recipe")
69-
.add(IngredientHelper.isEmpty(input), () -> "Input must not be empty")
70-
.error()
71-
.postIfNotEmpty()) {
72-
return false;
73-
}
7467
if (FurnaceRecipes.instance().getSmeltingList().entrySet().removeIf(entry -> {
7568
if (input.test(entry.getKey())) {
7669
addBackup(Recipe.of(entry.getKey(), entry.getValue()));
@@ -80,40 +73,29 @@ public boolean removeByInput(IIngredient input) {
8073
})) {
8174
return true;
8275
}
83-
var log = GroovyLog.msg("Error removing Minecraft Furnace recipe").error();
84-
log.add("Can't find recipe for input " + input);
76+
//noinspection ConstantValue
8577
if ((Object) input instanceof ItemStack is && is.getMetadata() != OreDictionary.WILDCARD_VALUE) {
8678
var wild = new ItemStack(is.getItem(), 1, OreDictionary.WILDCARD_VALUE);
8779
if (!FurnaceRecipes.instance().getSmeltingResult(wild).isEmpty()) {
88-
log.add("there was no input found for {}, but there was an input matching the wildcard itemstack {}", GroovyScriptCodeConverter.asGroovyCode(is, false), GroovyScriptCodeConverter.asGroovyCode(wild, false));
80+
GroovyLog.msg("Error removing Minecraft Furnace recipe")
81+
.debug()
82+
.add("there was no input found for {}, but there was an input matching the wildcard itemstack {}", GroovyScriptCodeConverter.asGroovyCode(is, false), GroovyScriptCodeConverter.asGroovyCode(wild, false))
83+
.add("did you mean to run furnace.removeByInput({}) instead?", GroovyScriptCodeConverter.asGroovyCode(wild, false))
84+
.post();
8985
}
9086
}
91-
log.post();
9287
return false;
9388
}
9489

9590
@MethodDescription(example = @Example("item('minecraft:brick')"))
9691
public boolean removeByOutput(IIngredient output) {
97-
if (GroovyLog.msg("Error adding Minecraft Furnace recipe")
98-
.add(IngredientHelper.isEmpty(output), () -> "Output must not be empty")
99-
.error()
100-
.postIfNotEmpty()) {
101-
return false;
102-
}
103-
if (FurnaceRecipes.instance().getSmeltingList().entrySet().removeIf(entry -> {
92+
return FurnaceRecipes.instance().getSmeltingList().entrySet().removeIf(entry -> {
10493
if (output.test(entry.getValue())) {
10594
addBackup(Recipe.of(entry.getKey(), entry.getValue()));
10695
return true;
10796
}
10897
return false;
109-
})) {
110-
return true;
111-
}
112-
GroovyLog.msg("Error removing Minecraft Furnace recipe")
113-
.add("Can't find recipe for output " + output)
114-
.error()
115-
.post();
116-
return false;
98+
});
11799
}
118100

119101
@MethodDescription(type = MethodDescription.Type.QUERY)

0 commit comments

Comments
 (0)