Suppress exception stacktraces for datapack reloads by default
This commit is contained in:
parent
cc77da1027
commit
af63b3ed11
|
|
@ -41,6 +41,7 @@ public class ModernFixEarlyConfig {
|
|||
this.addMixinRule("perf.cache_blockstate_cache_arrays", true);
|
||||
this.addMixinRule("perf.faster_baking", true);
|
||||
this.addMixinRule("perf.cache_model_materials", true);
|
||||
this.addMixinRule("perf.datapack_reload_exceptions", true);
|
||||
/* Keep this off if JEI isn't installed to prevent breaking vanilla gameplay */
|
||||
this.addMixinRule("perf.blast_search_trees", FMLLoader.getLoadingModList().getModFileById("jei") != null);
|
||||
this.addMixinRule("safety", true);
|
||||
|
|
|
|||
|
|
@ -0,0 +1,16 @@
|
|||
package org.embeddedt.modernfix.mixin.perf.datapack_reload_exceptions;
|
||||
|
||||
import net.minecraft.loot.LootTableManager;
|
||||
import org.apache.logging.log4j.Logger;
|
||||
import org.spongepowered.asm.mixin.Mixin;
|
||||
import org.spongepowered.asm.mixin.injection.At;
|
||||
import org.spongepowered.asm.mixin.injection.Redirect;
|
||||
|
||||
@Mixin(LootTableManager.class)
|
||||
public class LootTableManagerMixin {
|
||||
@Redirect(method = "*(Lnet/minecraft/resources/IResourceManager;Lcom/google/common/collect/ImmutableMap$Builder;Lnet/minecraft/util/ResourceLocation;Lcom/google/gson/JsonElement;)V",
|
||||
at = @At(value = "INVOKE", target = "Lorg/apache/logging/log4j/Logger;error(Ljava/lang/String;Ljava/lang/Object;Ljava/lang/Object;)V"))
|
||||
private void logWithoutStacktrace(Logger instance, String s, Object location, Object exc) {
|
||||
instance.error(s + ": {}", location, exc.toString());
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,15 @@
|
|||
package org.embeddedt.modernfix.mixin.perf.datapack_reload_exceptions;
|
||||
|
||||
import net.minecraft.item.crafting.RecipeManager;
|
||||
import org.apache.logging.log4j.Logger;
|
||||
import org.spongepowered.asm.mixin.Mixin;
|
||||
import org.spongepowered.asm.mixin.injection.At;
|
||||
import org.spongepowered.asm.mixin.injection.Redirect;
|
||||
|
||||
@Mixin(RecipeManager.class)
|
||||
public class RecipeManagerMixin {
|
||||
@Redirect(method = "apply(Ljava/util/Map;Lnet/minecraft/resources/IResourceManager;Lnet/minecraft/profiler/IProfiler;)V", at = @At(value = "INVOKE", target = "Lorg/apache/logging/log4j/Logger;error(Ljava/lang/String;Ljava/lang/Object;Ljava/lang/Object;)V"))
|
||||
private void silenceException(Logger instance, String s, Object location, Object exc) {
|
||||
instance.error(s + ": {}", location, exc.toString());
|
||||
}
|
||||
}
|
||||
|
|
@ -25,6 +25,8 @@
|
|||
"perf.compress_biome_container.MixinBiomeContainer",
|
||||
"perf.nuke_empty_chunk_sections.MixinChunk",
|
||||
"perf.cache_blockstate_cache_arrays.AbstractBlockStateCacheMixin",
|
||||
"perf.datapack_reload_exceptions.LootTableManagerMixin",
|
||||
"perf.datapack_reload_exceptions.RecipeManagerMixin",
|
||||
"feature.measure_time.BootstrapMixin"
|
||||
],
|
||||
"client": [
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user