cleanLogs rule
This commit is contained in:
1 parent
e759a368b9
commit
046d931770
5 files changed
+56
-3
No files matched your search
@@ -656,4 +656,14 @@ public class CarpetSettings
|
||||
validate = Validator.PROBABILITY.class
|
||||
)
|
||||
public static double creativeFlyDrag = 0.09;
|
||||
|
||||
@Rule(
|
||||
desc = "Removes abnoxious messages from the logs",
|
||||
extra = {
|
||||
"Doesn't display 'Maximum sound pool size 247 reached'",
|
||||
"Which is normal with decent farms and contraptions"
|
||||
},
|
||||
category = {SURVIVAL, CLIENT}
|
||||
)
|
||||
public static boolean cleanLogs = false;
|
||||
}
|
||||
@@ -0,0 +1,20 @@
|
||||
package carpet.mixins;
|
||||
|
||||
import carpet.CarpetSettings;
|
||||
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(targets="net.minecraft.client.sound.SoundEngine$SourceSetImpl")
|
||||
public class SoundEngineInt_cleanLogsMixin
|
||||
{
|
||||
@Redirect(method = "createSource", at = @At(
|
||||
value="INVOKE",
|
||||
target = "Lorg/apache/logging/log4j/Logger;warn(Ljava/lang/String;Ljava/lang/Object;)V"
|
||||
))
|
||||
private void doWarnOrNotWarn(Logger logger, String message, Object p0)
|
||||
{
|
||||
if (!CarpetSettings.cleanLogs) logger.warn(message, p0);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,21 @@
|
||||
package carpet.mixins;
|
||||
|
||||
import carpet.CarpetSettings;
|
||||
import net.minecraft.client.sound.SoundSystem;
|
||||
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(SoundSystem.class)
|
||||
public class SoundSystem_cleanLogsMixin
|
||||
{
|
||||
@Redirect(method = "play(Lnet/minecraft/client/sound/SoundInstance;)V", at = @At(
|
||||
value = "INVOKE",
|
||||
target = "Lorg/apache/logging/log4j/Logger;warn(Ljava/lang/String;)V"
|
||||
))
|
||||
private void toWarnOrNotToWarn(Logger logger, String message)
|
||||
{
|
||||
if (!CarpetSettings.cleanLogs) logger.warn(message);
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user