Skip to content

Commit

Permalink
Remove MixinInGameHud mixin (#9)
Browse files Browse the repository at this point in the history
  • Loading branch information
dima-dencep committed Nov 27, 2023
1 parent 5397ab1 commit 5a985b6
Show file tree
Hide file tree
Showing 4 changed files with 17 additions and 32 deletions.
7 changes: 6 additions & 1 deletion src/main/java/com/tterrag/blur/Blur.java
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
import net.minecraft.client.MinecraftClient;
import net.minecraft.client.gui.screen.Screen;
import net.minecraft.util.Identifier;
import net.minecraftforge.client.event.RenderGuiEvent;
import net.minecraftforge.client.event.ScreenEvent;
import net.minecraftforge.common.MinecraftForge;
import net.minecraftforge.fml.common.Mod;
Expand Down Expand Up @@ -37,7 +38,11 @@ public Blur() {
blur.render(event.tickDelta);
}
});

MinecraftForge.EVENT_BUS.<RenderGuiEvent.Post>addListener(event -> {
if (client.currentScreen == null && client.world != null && Blur.start > 0 && BlurConfig.INSTANCE.blurExclusions.get().stream().noneMatch(exclusion -> Blur.prevScreen.startsWith(exclusion)) && Blur.screenHasBackground) {
event.getGuiGraphics().fillGradient(0, 0, event.getWindow().getScaledWidth(), event.getWindow().getScaledHeight(), Blur.getBackgroundColor(false, false), Blur.getBackgroundColor(true, false));
}
});
MinecraftForge.EVENT_BUS.<ScreenEvent.BackgroundRendered>addListener(event -> Blur.screenHasBackground = true);
MinecraftForge.EVENT_BUS.<ScreenEvent.Opening>addListener(event -> {
if (event.getCurrentScreen() != null) {
Expand Down
27 changes: 0 additions & 27 deletions src/main/java/com/tterrag/blur/mixin/MixinInGameHud.java

This file was deleted.

12 changes: 10 additions & 2 deletions src/main/java/com/tterrag/blur/mixin/MixinScreen.java
Original file line number Diff line number Diff line change
Expand Up @@ -12,14 +12,22 @@
public abstract class MixinScreen {
@ModifyConstant(
method = "renderBackground",
constant = @Constant(intValue = -1072689136))
constant = @Constant(
intValue = -1072689136
),
require = 0
)
private int blur$getFirstBackgroundColor(int color) {
return Blur.getBackgroundColor(false, true);
}

@ModifyConstant(
method = "renderBackground",
constant = @Constant(intValue = -804253680))
constant = @Constant(
intValue = -804253680
),
require = 0
)
private int blur$getSecondBackgroundColor(int color) {
return Blur.getBackgroundColor(true, true);
}
Expand Down
3 changes: 1 addition & 2 deletions src/main/resources/mixins.blur.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,7 @@
"package": "com.tterrag.blur.mixin",
"compatibilityLevel": "JAVA_17",
"client": [
"MixinScreen",
"MixinInGameHud"
"MixinScreen"
],
"injectors": {
"defaultRequire": 1
Expand Down

0 comments on commit 5a985b6

Please sign in to comment.