Blur 2.4.0 - Ingame-Configurable Exclusions & Fixes

- Made Blur exclusions configurable in-game
- ReplayMod and ProjectInception screens are excluded by default
- Update to MidnightLib 3.0.0
- Fix version in fabric.mod.json
This commit is contained in:
Motschen
2021-10-31 16:20:23 +01:00
parent 895448b13d
commit f792d34295
15 changed files with 208 additions and 148 deletions

View File

@@ -1,7 +1,11 @@
package com.tterrag.blur.mixin;
import com.tterrag.blur.config.BlurConfig;
import net.minecraft.client.MinecraftClient;
import net.minecraft.client.font.TextRenderer;
import net.minecraft.client.util.math.MatrixStack;
import net.minecraft.text.TextColor;
import net.minecraft.util.Formatting;
import org.jetbrains.annotations.Nullable;
import org.spongepowered.asm.mixin.Mixin;
import org.spongepowered.asm.mixin.Shadow;
@@ -22,24 +26,32 @@ public abstract class MixinScreen {
@Shadow @Nullable protected MinecraftClient client;
@Inject(at = @At("HEAD"), method = "render")
private void reloadShader(MatrixStack matrixStack, int i, int j, float f, CallbackInfo ci) {
if (this.getClass().toString().toLowerCase(Locale.ROOT).contains("midnight") && this.client != null) {
@Shadow protected TextRenderer textRenderer;
@Inject(at = @At("HEAD"), method = "tick")
private void blur$reloadShader(CallbackInfo ci) {
if (this.getClass().toString().toLowerCase(Locale.ROOT).contains("midnightconfigscreen") && this.client != null) {
Blur.INSTANCE.onScreenChange(this.client.currentScreen);
}
}
@Inject(at = @At("TAIL"), method = "render")
private void blur$showScreenTitle(MatrixStack matrixStack, int i, int j, float f, CallbackInfo ci) {
if (BlurConfig.showScreenTitle && this.client != null && this.client.currentScreen != null) {
this.textRenderer.drawWithShadow(matrixStack, this.client.currentScreen.getClass().getName(), 0, 0, 16777215, true);
}
}
@ModifyConstant(
method = "renderBackground(Lnet/minecraft/client/util/math/MatrixStack;I)V",
constant = @Constant(intValue = -1072689136))
private int getFirstBackgroundColor(int color) {
private int blur$getFirstBackgroundColor(int color) {
return Blur.INSTANCE.getBackgroundColor(false);
}
@ModifyConstant(
method = "renderBackground(Lnet/minecraft/client/util/math/MatrixStack;I)V",
constant = @Constant(intValue = -804253680))
private int getSecondBackgroundColor(int color) {
private int blur$getSecondBackgroundColor(int color) {
return Blur.INSTANCE.getBackgroundColor(true);
}
}