Skip to content

Commit

Permalink
Blur 3.1.1 - 1.20.2 & New excluded screens
Browse files Browse the repository at this point in the history
- Port to 1.20.2 by @TheMrEngMan & @backryun
- Exclude MidnightControls' touchscreen overlay and Baritone click screen by default (closes #75)
- Miscellaneous fixes
  • Loading branch information
Motschen committed Sep 30, 2023
1 parent d8b6a14 commit bd3b58a
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 17 deletions.
2 changes: 1 addition & 1 deletion src/main/java/com/tterrag/blur/Blur.java
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ public void onInitializeClient() {

public static void onScreenChange(Screen newGui) {
if (client.world != null) {
boolean excluded = newGui == null || BlurConfig.blurExclusions.stream().anyMatch(exclusion -> newGui.getClass().getName().contains(exclusion));
boolean excluded = newGui == null || BlurConfig.blurExclusions.stream().anyMatch(exclusion -> newGui.getClass().getName().startsWith(exclusion));
if (!excluded) {
screenHasBackground = false;
if (BlurConfig.showScreenTitle) System.out.println(newGui.getClass().getName());
Expand Down
29 changes: 15 additions & 14 deletions src/main/java/com/tterrag/blur/config/BlurConfig.java
Original file line number Diff line number Diff line change
Expand Up @@ -7,33 +7,34 @@
import java.util.List;

public class BlurConfig extends MidnightConfig {
public static final String style = "style";
public static final String screens = "screens";
public static final String STYLE = "style";
public static final String SCREENS = "screens";


@Entry(category = screens)
@Entry(category = SCREENS)
public static List<String> blurExclusions = Lists.newArrayList(ChatScreen.class.getName(),
"com.replaymod.lib.de.johni0702.minecraft.gui.container.AbstractGuiOverlay$UserInputGuiScreen",
"ai.arcblroth.projectInception.client.InceptionInterfaceScreen",
"net.optifine.gui.GuiChatOF",
"baritone.",
"io.github.darkkronicle.advancedchatcore.chat.AdvancedChatScreen",
"net.coderbot.iris.gui.screen.ShaderPackScreen");
@Entry(category = style, min = 0, max = 5000, width = 4)
"net.coderbot.iris.gui.screen.ShaderPackScreen",
"eu.midnightdust.midnightcontrols.client.gui.TouchscreenOverlay");
@Entry(category = STYLE, min = 0, max = 5000, width = 4)
public static int fadeTimeMillis = 200;
@Entry(category = style, min = 0, max = 5000, width = 4)
@Entry(category = STYLE, min = 0, max = 5000, width = 4)
public static int fadeOutTimeMillis = 200;
@Entry(category = style)
@Entry(category = STYLE)
public static boolean ease = true;
@Entry(category = style, isSlider = true, min = 0, max = 100)
@Entry(category = STYLE, isSlider = true, min = 0, max = 100)
public static int radius = 8;
@Entry(category = style, isColor = true, width = 7, min = 7)
@Entry(category = STYLE, isColor = true, width = 7, min = 7)
public static String gradientStart = "#000000";
@Entry(category = style, isSlider = true, min = 0, max = 255)
@Entry(category = STYLE, isSlider = true, min = 0, max = 255)
public static int gradientStartAlpha = 75;
@Entry(category = style, isColor = true, width = 7, min = 7)
@Entry(category = STYLE, isColor = true, width = 7, min = 7)
public static String gradientEnd = "#000000";
@Entry(category = style, isSlider = true, min = 0, max = 255)
@Entry(category = STYLE, isSlider = true, min = 0, max = 255)
public static int gradientEndAlpha = 75;
@Entry(category = screens)
@Entry(category = SCREENS)
public static boolean showScreenTitle = false;
}
3 changes: 1 addition & 2 deletions src/main/java/com/tterrag/blur/mixin/MixinInGameHud.java
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
package com.tterrag.blur.mixin;

import com.mojang.blaze3d.systems.RenderSystem;
import com.tterrag.blur.Blur;
import com.tterrag.blur.config.BlurConfig;
import net.minecraft.client.MinecraftClient;
Expand All @@ -20,7 +19,7 @@ public class MixinInGameHud {
@Final @Shadow private MinecraftClient client;
@Inject(at = @At("TAIL"), method = "render")
public void blur$onRender(DrawContext context, float tickDelta, CallbackInfo ci) {
if (client.currentScreen == null && client.world != null && Blur.start > 0 && !BlurConfig.blurExclusions.contains(Blur.prevScreen) && Blur.screenHasBackground) {
if (client.currentScreen == null && client.world != null && Blur.start > 0 && BlurConfig.blurExclusions.stream().noneMatch(exclusion -> Blur.prevScreen.startsWith(exclusion)) && Blur.screenHasBackground) {
context.fillGradient(0, 0, this.scaledWidth, this.scaledHeight, Blur.getBackgroundColor(false, false), Blur.getBackgroundColor(true, false));
}
}
Expand Down

0 comments on commit bd3b58a

Please sign in to comment.