12 Commits

Author SHA1 Message Date
Martin Prokoph
fd1a2d5545 Merge pull request #133 from Motschen/backport/1.21.1
backport: Blur+ v5.2.2 for 1.21.1
2025-07-15 18:44:25 +02:00
Martin Prokoph
06876d98e4 backport: adjust for 1.21.1
phew...
2025-07-15 18:43:59 +02:00
Martin Prokoph
0fd10408ca Merge branch 'plus-1.21.1' into backport/1.21.1 2025-07-15 17:46:05 +02:00
Martin Prokoph
7d207e8197 port: Chase the Skies (1.21.6)
Surprising amount of changes – even more surprised I got this working so fast :)
2025-06-17 19:13:41 +02:00
Martin Prokoph
5e4f4abd3b feat: use MidnightLib's new widget API for radius slider 2025-05-14 10:14:01 +02:00
Martin Prokoph
97c3a1c2ac Merge pull request #125 from Texaliuz/patch-1
Translation to Argentine Spanish (es_ar) for the Blur+ mod
2025-05-03 20:21:12 +02:00
Texaliuz
bc62322743 Create es_ar.json
Translation to Argentine Spanish (es_ar) for the Blur+ mod
2025-04-28 13:28:55 -03:00
Martin Prokoph
fa6fd82e4d fix: move gradient z-coordinate further back 2025-04-23 10:18:55 +02:00
Martin Prokoph
9d5b02bd0a fix: gradient breaking various mod screens 2025-04-19 10:43:57 +02:00
Martin Prokoph
528958fa8c fix: improve gradient handling 2025-04-19 09:58:54 +02:00
Martin Prokoph
552f1e619e feat: improve config screen with comments 2025-03-29 19:30:38 +01:00
Martin Prokoph
c9c630ac11 fix: less invasive gradient injection
- Should fix various compatibility issues with other mods
2025-03-29 18:45:19 +01:00
20 changed files with 200 additions and 130 deletions

View File

@@ -3,7 +3,7 @@ import groovy.json.JsonOutput
plugins { plugins {
id "architectury-plugin" version "3.4-SNAPSHOT" id "architectury-plugin" version "3.4-SNAPSHOT"
id "dev.architectury.loom" version "1.7-SNAPSHOT" apply false id "dev.architectury.loom" version "1.10-SNAPSHOT" apply false
id "me.shedaniel.unified-publishing" version "0.1.+" apply false id "me.shedaniel.unified-publishing" version "0.1.+" apply false
id 'com.github.johnrengelman.shadow' version '8.1.1' apply false id 'com.github.johnrengelman.shadow' version '8.1.1' apply false
} }

View File

@@ -23,21 +23,21 @@ public class Blur {
public static boolean doFade = false; public static boolean doFade = false;
static float lastDelta; public static void onRender() {
public static void onRender(DrawContext context, int width, int height, MinecraftClient client, float delta) {
if (!BlurInfo.doTest && BlurInfo.screenChanged) { // After the tests for blur and background color have been completed if (!BlurInfo.doTest && BlurInfo.screenChanged) { // After the tests for blur and background color have been completed
Blur.onScreenChange(); Blur.onScreenChange();
BlurInfo.screenChanged = false; BlurInfo.screenChanged = false;
} }
if (BlurInfo.start >= 0 && !BlurInfo.screenHasBlur && BlurInfo.prevScreenHasBlur) { // Fade out in non-blurred screens
client.gameRenderer.renderBlur();
if (BlurInfo.prevScreenHasBackground && BlurConfig.useGradient && lastDelta != delta) Blur.renderRotatedGradient(context, width, height);
lastDelta = delta;
}
BlurInfo.doTest = false; // Set the test state to completed, as tests will happen in the same tick. BlurInfo.doTest = false; // Set the test state to completed, as tests will happen in the same tick.
} }
public static void renderFadeout(DrawContext context, int width, int height, MinecraftClient client) {
if (BlurInfo.start >= 0 && !BlurInfo.screenHasBlur && BlurInfo.prevScreenHasBlur) { // Fade out in non-blurred screens
client.gameRenderer.renderBlur(client.getRenderTickCounter().getTickDelta(true));
client.getFramebuffer().beginWrite(false);
if (BlurInfo.prevScreenHasBackground && BlurConfig.useGradient) Blur.renderRotatedGradient(context, width, height);
}
}
public static void onScreenChange() { public static void onScreenChange() {
if (screenHasBlur) { if (screenHasBlur) {
@@ -79,7 +79,10 @@ public class Blur {
int b = (col.getRGB() >> 8) & 0xFF; int b = (col.getRGB() >> 8) & 0xFF;
int g = col.getRGB() & 0xFF; int g = col.getRGB() & 0xFF;
float prog = progress; float prog = progress;
a *= prog; r *= prog; g *= prog; b *= prog; a = (int) (prog * a);
r = (int) (prog * r);
g = (int) (prog * g);
b = (int) (prog * b);
return a << 24 | r << 16 | b << 8 | g; return a << 24 | r << 16 | b << 8 | g;
} }
public static int getRotation() { public static int getRotation() {
@@ -90,11 +93,13 @@ public class Blur {
float diagonal = Math.sqrt((float) width*width + height*height); float diagonal = Math.sqrt((float) width*width + height*height);
int smallestDimension = Math.min(width, height); int smallestDimension = Math.min(width, height);
context.getMatrices().push();
Matrix4f posMatrix = context.getMatrices().peek().getPositionMatrix(); Matrix4f posMatrix = context.getMatrices().peek().getPositionMatrix();
posMatrix.rotationZ(Math.toRadians(getRotation())); posMatrix.rotationZ(Math.toRadians(getRotation()));
posMatrix.setTranslation(width / 2f, height / 2f, 0); // Make the gradient's center the pivot point posMatrix.setTranslation(width / 2f, height / 2f, -1000); // Make the gradient's center the pivot point
posMatrix.scale(diagonal / smallestDimension); // Scales the gradient to the maximum diagonal value needed posMatrix.scale(diagonal / smallestDimension); // Scales the gradient to the maximum diagonal value needed
context.fillGradient(-width / 2, -height / 2, width / 2, height / 2, Blur.getBackgroundColor(false), Blur.getBackgroundColor(true)); // Actually draw the gradient context.fillGradient(-width / 2, -height / 2, width / 2, height / 2, Blur.getBackgroundColor(false), Blur.getBackgroundColor(true)); // Actually draw the gradient
posMatrix.rotationZ(0); posMatrix.rotationZ(0);
context.getMatrices().pop();
} }
} }

View File

@@ -1,10 +1,18 @@
package eu.midnightdust.blur.config; package eu.midnightdust.blur.config;
import com.google.common.collect.Lists; import com.google.common.collect.Lists;
import eu.midnightdust.blur.Blur;
import eu.midnightdust.lib.config.MidnightConfig; import eu.midnightdust.lib.config.MidnightConfig;
import net.minecraft.client.MinecraftClient; import net.minecraft.client.MinecraftClient;
import net.minecraft.client.gui.widget.SliderWidget;
import net.minecraft.client.gui.widget.TextIconButtonWidget;
import net.minecraft.client.option.GameOptions;
import net.minecraft.text.Text;
import net.minecraft.util.Identifier;
import java.lang.annotation.Annotation;
import java.util.List; import java.util.List;
import java.util.Objects;
import java.util.function.Function; import java.util.function.Function;
import static java.lang.Math.*; import static java.lang.Math.*;
@@ -15,6 +23,8 @@ public class BlurConfig extends MidnightConfig {
public static final String SCREENS = "screens"; public static final String SCREENS = "screens";
@Entry @Hidden public static int configVersion = 2; @Entry @Hidden public static int configVersion = 2;
@Comment(category = SCREENS, centered = true)
public static Comment _general;
@Entry(category = SCREENS) @Entry(category = SCREENS)
public static boolean blurContainers = true; public static boolean blurContainers = true;
@Entry(category = SCREENS) @Entry(category = SCREENS)
@@ -22,14 +32,17 @@ public class BlurConfig extends MidnightConfig {
@Condition(requiredOption = "blurTitleScreen", visibleButLocked = true) @Condition(requiredOption = "blurTitleScreen", visibleButLocked = true)
@Entry(category = SCREENS) @Entry(category = SCREENS)
public static boolean darkenTitleScreen = false; public static boolean darkenTitleScreen = false;
@Entry(category = ANIMATIONS, min = 0, max = 2000, isSlider = true) @Comment(category = SCREENS, centered = true)
public static int fadeTimeMillis = 300; public static Comment _advanced;
@Entry(category = ANIMATIONS, min = 0, max = 2000, isSlider = true) @Entry(category = SCREENS) // Screens where Blur+ should not apply transition effects (mostly dynamically blurred screens)
public static int fadeOutTimeMillis = 300; public static List<String> excludedScreens = Lists.newArrayList("net.irisshaders.iris.gui.screen.ShaderPackScreen");
@Entry(category = ANIMATIONS) @Entry(category = SCREENS) // Screens where the vanilla blur effect should be force enabled
public static BlurConfig.Easing animationCurve = Easing.FLAT; public static List<String> forceEnabledScreens = Lists.newArrayList("dev.emi.emi.screen.RecipeScreen");
@Entry(category = STYLE, isSlider = true, min = 0, max = 20) @Entry(category = SCREENS) // Screens where the vanilla blur effect should be force disabled
public static int radius = 5; public static List<String> forceDisabledScreens = Lists.newArrayList();
@Comment(category = STYLE, centered = true)
public static Comment _gradient;
@Entry(category = STYLE) @Entry(category = STYLE)
public static boolean useGradient = true; public static boolean useGradient = true;
@Condition(requiredOption = "useGradient", visibleButLocked = true) @Condition(requiredOption = "useGradient", visibleButLocked = true)
@@ -49,19 +62,15 @@ public class BlurConfig extends MidnightConfig {
public static int gradientRotation = 0; public static int gradientRotation = 0;
@Entry(category = STYLE) @Entry(category = STYLE)
public static boolean rainbowMode = false; public static boolean rainbowMode = false;
@Entry(category = SCREENS) // Screens where Blur+ should not apply transition effects (mostly dynamically blurred screens)
public static List<String> excludedScreens = Lists.newArrayList("net.irisshaders.iris.gui.screen.ShaderPackScreen");
@Entry(category = SCREENS) // Screens where the vanilla blur effect should be force enabled
public static List<String> forceEnabledScreens = Lists.newArrayList("dev.emi.emi.screen.RecipeScreen");
@Entry(category = SCREENS) // Screens where the vanilla blur effect should be force disabled
public static List<String> forceDisabledScreens = Lists.newArrayList();
@Override @Comment(category = ANIMATIONS, centered = true)
public void writeChanges(String modid) { public static Comment _animations;
super.writeChanges(modid); @Entry(category = ANIMATIONS, min = 0, max = 2000, isSlider = true)
if (MinecraftClient.getInstance().options != null) public static int fadeTimeMillis = 300;
MinecraftClient.getInstance().options.getMenuBackgroundBlurriness().setValue(radius); @Entry(category = ANIMATIONS, min = 0, max = 2000, isSlider = true)
} public static int fadeOutTimeMillis = 300;
@Entry(category = ANIMATIONS)
public static BlurConfig.Easing animationCurve = Easing.FLAT;
public enum Easing { public enum Easing {
// Based on https://gist.github.com/dev-hydrogen/21a66f83f0386123e0c0acf107254843 // Based on https://gist.github.com/dev-hydrogen/21a66f83f0386123e0c0acf107254843
@@ -90,4 +99,51 @@ public class BlurConfig extends MidnightConfig {
return functionOut.apply(x).doubleValue(); return functionOut.apply(x).doubleValue();
} }
} }
private static GameOptions options;
@Override
public void onTabInit(String tabName, MidnightConfigListWidget list, MidnightConfigScreen screen) {
options = MinecraftClient.getInstance().options;
if (Objects.equals(tabName, STYLE)) {
EntryInfo centered = new EntryInfo(null, Blur.MOD_ID);
centered.comment = new Comment(){
@Override
public boolean centered() {
return true;
}
public Class<? extends Annotation> annotationType() {return null;}
public String category() {return "";}
public String name() {return "";}
public String url() {return "";}
public String requiredMod() {return "";}
};
RadiusSliderWidget slider = new RadiusSliderWidget(screen.width - 185, 0, 150, 20);
TextIconButtonWidget resetButton = TextIconButtonWidget.builder(Text.translatable("controls.reset"), (button -> {
options.getMenuBackgroundBlurriness().setValue(5);
screen.updateList();
}), true).texture(Identifier.of("midnightlib","icon/reset"), 12, 12).dimension(20, 20).build();
resetButton.setPosition(screen.width - 205 + 150 + 25, 0);
slider.resetButton = resetButton;
slider.updateMessage();
list.addButton(Lists.newArrayList(), Text.translatable("blur.midnightconfig._blur"), centered);
list.addButton(Lists.newArrayList(slider, resetButton), Text.translatable("blur.midnightconfig.radius"), new EntryInfo(null, Blur.MOD_ID));
}
}
public static class RadiusSliderWidget extends SliderWidget {
TextIconButtonWidget resetButton;
public RadiusSliderWidget(int x, int y, int width, int height) {
super(x, y, width, height, Text.empty(), options.getMenuBackgroundBlurrinessValue() / 20d);
}
public void updateMessage() {
this.setMessage(Text.of(String.valueOf(options.getMenuBackgroundBlurrinessValue())));
if (resetButton != null) resetButton.active = options.getMenuBackgroundBlurrinessValue() != 5;
}
public void applyValue() {
options.getMenuBackgroundBlurriness().setValue(Double.valueOf(this.value * 20).intValue());
}
}
} }

View File

@@ -9,7 +9,7 @@ import org.spongepowered.asm.mixin.injection.ModifyVariable;
@Mixin(GameRenderer.class) @Mixin(GameRenderer.class)
public class MixinGameRenderer { public class MixinGameRenderer {
@ModifyVariable(method = "renderBlur", at = @At("STORE"), ordinal = 0) @ModifyVariable(method = "renderBlur", at = @At("STORE"), ordinal = 1)
private float blur$modifyRadius(float radius) { // Modify the radius based on the animation progress private float blur$modifyRadius(float radius) { // Modify the radius based on the animation progress
if (!BlurInfo.screenChanged && BlurInfo.start >= 0) // Only update the progress after all tests have been completed if (!BlurInfo.screenChanged && BlurInfo.start >= 0) // Only update the progress after all tests have been completed
Blur.updateProgress(BlurInfo.screenHasBlur); Blur.updateProgress(BlurInfo.screenHasBlur);

View File

@@ -19,11 +19,11 @@ public class MixinHandledScreen extends Screen {
} }
@Inject(method = "renderBackground", at = @At(value = "INVOKE", target = "Lnet/minecraft/client/gui/screen/ingame/HandledScreen;drawBackground(Lnet/minecraft/client/gui/DrawContext;FII)V", shift = At.Shift.BEFORE)) @Inject(method = "renderBackground", at = @At(value = "INVOKE", target = "Lnet/minecraft/client/gui/screen/ingame/HandledScreen;drawBackground(Lnet/minecraft/client/gui/DrawContext;FII)V", shift = At.Shift.BEFORE))
private void blur$renderContainerBlur(DrawContext context, int mouseX, int mouseY, float delta, CallbackInfo ci) { // Applies the blur effect in containers (Inventory, Chest, etc.) private void blur$renderContainerBlur(DrawContext context, int mouseX, int mouseY, float tickDelta, CallbackInfo ci) { // Applies the blur effect in containers (Inventory, Chest, etc.)
if (BlurConfig.blurContainers) this.applyBlur(); if (BlurConfig.blurContainers) this.applyBlur(tickDelta);
} }
@Inject(at = @At("HEAD"), method = "render") @Inject(at = @At("HEAD"), method = "render")
public void blur$processScreenChange(DrawContext context, int mouseX, int mouseY, float delta, CallbackInfo ci) { public void blur$processScreenChange(DrawContext context, int mouseX, int mouseY, float delta, CallbackInfo ci) {
if (PlatformFunctions.getPlatformName().equals("neoforge")) Blur.onRender(context, width, height, this.client, delta); if (PlatformFunctions.getPlatformName().equals("neoforge")) Blur.onRender();
} }
} }

View File

@@ -22,7 +22,8 @@ public class MixinInGameHud {
if (client.currentScreen == null && client.world != null && BlurInfo.start >= 0 && BlurInfo.prevScreenHasBlur) { if (client.currentScreen == null && client.world != null && BlurInfo.start >= 0 && BlurInfo.prevScreenHasBlur) {
BlurInfo.doTest = false; BlurInfo.doTest = false;
BlurInfo.screenChanged = false; BlurInfo.screenChanged = false;
this.client.gameRenderer.renderBlur(); this.client.gameRenderer.renderBlur(tickCounter.getTickDelta(true));
this.client.getFramebuffer().beginWrite(false);
if (BlurInfo.prevScreenHasBackground) Blur.renderRotatedGradient(context, client.getWindow().getScaledWidth(), client.getWindow().getScaledHeight()); if (BlurInfo.prevScreenHasBackground) Blur.renderRotatedGradient(context, client.getWindow().getScaledWidth(), client.getWindow().getScaledHeight());
} }

View File

@@ -1,26 +0,0 @@
package eu.midnightdust.blur.mixin;
import eu.midnightdust.blur.Blur;
import eu.midnightdust.lib.config.MidnightConfig;
import net.minecraft.client.MinecraftClient;
import org.spongepowered.asm.mixin.Final;
import org.spongepowered.asm.mixin.Mixin;
import org.spongepowered.asm.mixin.Shadow;
import org.spongepowered.asm.mixin.injection.At;
import org.spongepowered.asm.mixin.injection.Inject;
import org.spongepowered.asm.mixin.injection.callback.CallbackInfo;
import java.util.Objects;
@Mixin(value = MidnightConfig.EntryInfo.class, remap = false)
public abstract class MixinMidnightConfig$EntryInfo {
@Shadow @Final public String modid;
@Shadow @Final public String fieldName;
@Shadow Object value;
@Inject(at = @At(value = "TAIL"), method = "updateFieldValue")
private void blur$instantlyApplyRadius(CallbackInfo ci) {
if (Objects.equals(modid, Blur.MOD_ID) && Objects.equals(fieldName, "radius"))
MinecraftClient.getInstance().options.getMenuBackgroundBlurriness().setValue((int) value);
}
}

View File

@@ -1,17 +0,0 @@
package eu.midnightdust.blur.mixin;
import eu.midnightdust.blur.config.BlurConfig;
import eu.midnightdust.lib.config.MidnightConfig;
import net.minecraft.client.MinecraftClient;
import org.spongepowered.asm.mixin.Mixin;
import org.spongepowered.asm.mixin.injection.At;
import org.spongepowered.asm.mixin.injection.Inject;
import org.spongepowered.asm.mixin.injection.callback.CallbackInfo;
@Mixin(MidnightConfig.class)
public abstract class MixinMidnightConfig {
@Inject(at = @At(value = "INVOKE", target = "Lcom/google/gson/Gson;fromJson(Ljava/io/Reader;Ljava/lang/Class;)Ljava/lang/Object;", shift = At.Shift.AFTER), remap = false, method = "loadValuesFromJson")
private static void blur$syncRadius(CallbackInfo ci) {
BlurConfig.radius = MinecraftClient.getInstance().options.getMenuBackgroundBlurrinessValue();
}
}

View File

@@ -1,13 +1,17 @@
package eu.midnightdust.blur.mixin; package eu.midnightdust.blur.mixin;
import com.llamalad7.mixinextras.injector.wrapoperation.Operation;
import com.llamalad7.mixinextras.injector.wrapoperation.WrapOperation;
import eu.midnightdust.blur.BlurInfo; import eu.midnightdust.blur.BlurInfo;
import eu.midnightdust.blur.config.BlurConfig; import eu.midnightdust.blur.config.BlurConfig;
import net.minecraft.client.MinecraftClient; import net.minecraft.client.MinecraftClient;
import net.minecraft.client.gui.DrawContext; import net.minecraft.client.gui.DrawContext;
import net.minecraft.text.Text; import net.minecraft.text.Text;
import net.minecraft.util.Identifier;
import org.spongepowered.asm.mixin.Final; import org.spongepowered.asm.mixin.Final;
import org.spongepowered.asm.mixin.Mixin; import org.spongepowered.asm.mixin.Mixin;
import org.spongepowered.asm.mixin.Shadow; import org.spongepowered.asm.mixin.Shadow;
import org.spongepowered.asm.mixin.Unique;
import org.spongepowered.asm.mixin.injection.At; import org.spongepowered.asm.mixin.injection.At;
import org.spongepowered.asm.mixin.injection.Inject; import org.spongepowered.asm.mixin.injection.Inject;
@@ -20,17 +24,14 @@ import org.spongepowered.asm.mixin.injection.callback.CallbackInfo;
public abstract class MixinScreen { public abstract class MixinScreen {
@Shadow @Final protected Text title; @Shadow @Final protected Text title;
@Shadow protected MinecraftClient client; @Shadow protected MinecraftClient client;
@Shadow public abstract void renderInGameBackground(DrawContext context);
@Shadow public int width; @Shadow public int width;
@Shadow public int height; @Shadow public int height;
@Shadow protected abstract void applyBlur(float delta);
@Inject(at = @At("HEAD"), method = "render") @Inject(at = @At("HEAD"), method = "render")
public void blur$processScreenChange(DrawContext context, int mouseX, int mouseY, float delta, CallbackInfo ci) { public void blur$processScreenChange(DrawContext context, int mouseX, int mouseY, float delta, CallbackInfo ci) {
Blur.onRender(context, width, height, this.client, delta); Blur.onRender();
} Blur.renderFadeout(context, width, height, client);
@Inject(at = @At("HEAD"), method = "renderInGameBackground")
public void blur$getBackgroundEnabled(DrawContext context, CallbackInfo ci) {
BlurInfo.screenHasBackground = true; // Test if the screen has a background
} }
@Inject(at = @At("HEAD"), method = "applyBlur", cancellable = true) @Inject(at = @At("HEAD"), method = "applyBlur", cancellable = true)
public void blur$getBlurEnabled(CallbackInfo ci) { public void blur$getBlurEnabled(CallbackInfo ci) {
@@ -40,21 +41,23 @@ public abstract class MixinScreen {
if (!BlurConfig.excludedScreens.contains(this.getClass().getCanonicalName())) if (!BlurConfig.excludedScreens.contains(this.getClass().getCanonicalName()))
BlurInfo.screenHasBlur = true; // Test if the screen has blur BlurInfo.screenHasBlur = true; // Test if the screen has blur
} }
@WrapOperation(at = @At(value = "INVOKE", target = "Lnet/minecraft/client/gui/screen/Screen;renderBackgroundTexture(Lnet/minecraft/client/gui/DrawContext;Lnet/minecraft/util/Identifier;IIFFII)V"), method = "renderDarkening(Lnet/minecraft/client/gui/DrawContext;IIII)V")
@Inject(at = @At("HEAD"), method = "renderDarkening(Lnet/minecraft/client/gui/DrawContext;IIII)V", cancellable = true) private void blur$applyGradient(DrawContext context, Identifier texture, int x, int y, float u, float v, int width, int height, Operation<Void> original) {
public void blur$applyGradient(DrawContext context, int x, int y, int width, int height, CallbackInfo ci) { if (BlurConfig.useGradient) {
if (BlurConfig.useGradient) { // Replaces the background texture with a gradient blur$renderGradient(context); // Replaces the background texture with a gradient
renderInGameBackground(context); } else original.call(context, texture, x, y, u, v, width, height);
ci.cancel();
}
} }
@Inject(at = @At("HEAD"), method = "renderInGameBackground", cancellable = true) @WrapOperation(at = @At(value = "INVOKE", target = "Lnet/minecraft/client/gui/DrawContext;fillGradient(IIIIII)V"), method = "renderInGameBackground")
public void blur$rotatedGradient(DrawContext context, CallbackInfo ci) { public void blur$rotatedGradient(DrawContext context, int startX, int startY, int endX, int endY, int colorStart, int colorEnd, Operation<Void> original) {
blur$renderGradient(context);
}
@Unique
private void blur$renderGradient(DrawContext context) {
BlurInfo.screenHasBackground = true; // Test if the screen has a background
if (BlurConfig.forceEnabledScreens.contains(this.getClass().getCanonicalName())) if (BlurConfig.forceEnabledScreens.contains(this.getClass().getCanonicalName()))
((ScreenAccessor)this).forceApplyBlur(); this.applyBlur(client.getRenderTickCounter().getTickDelta(true));
Blur.renderRotatedGradient(context, width, height); // Replaces the default gradient with our rotated one Blur.renderRotatedGradient(context, width, height); // Replaces the default gradient with our rotated one
ci.cancel();
} }
} }

View File

@@ -17,11 +17,11 @@ public abstract class MixinTitleScreen extends Screen {
super(title); super(title);
} }
@Inject(method = "renderPanoramaBackground", at = @At("TAIL")) @Inject(method = "render", at = @At(value = "INVOKE", target = "Lnet/minecraft/client/gui/screen/TitleScreen;renderPanoramaBackground(Lnet/minecraft/client/gui/DrawContext;F)V", shift = At.Shift.AFTER))
private void blur$renderTitleBlur(DrawContext context, float delta, CallbackInfo ci) { // Applies the blur effect in containers (Inventory, Chest, etc.) private void blur$renderTitleBlur(DrawContext context, int mouseX, int mouseY, float delta, CallbackInfo ci) {
if (BlurConfig.blurTitleScreen) { if (BlurConfig.blurTitleScreen) {
Blur.updateProgress(true); Blur.updateProgress(true);
this.applyBlur(); this.applyBlur(delta);
if (BlurConfig.darkenTitleScreen) this.renderDarkening(context); if (BlurConfig.darkenTitleScreen) this.renderDarkening(context);
} }
} }

View File

@@ -1,11 +0,0 @@
package eu.midnightdust.blur.mixin;
import net.minecraft.client.gui.screen.Screen;
import org.spongepowered.asm.mixin.Mixin;
import org.spongepowered.asm.mixin.gen.Invoker;
@Mixin(Screen.class)
public interface ScreenAccessor {
@Invoker("applyBlur")
void forceApplyBlur();
}

View File

@@ -1,6 +1,7 @@
{ {
"blur.midnightconfig.title": "Blur+ Konfiguration", "blur.midnightconfig.title": "Blur+ Konfiguration",
"blur.midnightconfig.category.animations": "Animationen", "blur.midnightconfig.category.animations": "Animationen",
"blur.midnightconfig.category.screens": "Bildschirme",
"blur.midnightconfig.category.style": "Stil", "blur.midnightconfig.category.style": "Stil",
"blur.midnightconfig.blurContainers": "Unschärfe in Containern", "blur.midnightconfig.blurContainers": "Unschärfe in Containern",
"blur.midnightconfig.blurTitleScreen": "Unschärfe im Titelbildschirm", "blur.midnightconfig.blurTitleScreen": "Unschärfe im Titelbildschirm",
@@ -26,5 +27,10 @@
"blur.midnightconfig.gradientStartAlpha": "Farbverlauf-Anfangstransparenz", "blur.midnightconfig.gradientStartAlpha": "Farbverlauf-Anfangstransparenz",
"blur.midnightconfig.gradientEndAlpha": "Farbverlauf-Endstransparenz", "blur.midnightconfig.gradientEndAlpha": "Farbverlauf-Endstransparenz",
"blur.midnightconfig.gradientRotation": "Farbverlauf-Rotation", "blur.midnightconfig.gradientRotation": "Farbverlauf-Rotation",
"blur.midnightconfig.excludedScreens": "Ausgeschlossene Bildschirme" "blur.midnightconfig.excludedScreens": "Ausgeschlossene Bildschirme",
"blur.midnightconfig._general": "⛏ Generell",
"blur.midnightconfig._advanced": "⚒ Fortgeschritten",
"blur.midnightconfig._blur": "▒ Unschärfe",
"blur.midnightconfig._gradient": "\uD83D\uDFE2 Farbverlauf",
"blur.midnightconfig._animations": "\uD83D\uDCFD Animationen"
} }

View File

@@ -33,5 +33,10 @@
"blur.midnightconfig.forceEnabledScreens": "Force-enabled Screens", "blur.midnightconfig.forceEnabledScreens": "Force-enabled Screens",
"blur.midnightconfig.forceEnabledScreens.tooltip": "Screens where the vanilla blur effect should be force-enabled\nMight not work 100% of the time", "blur.midnightconfig.forceEnabledScreens.tooltip": "Screens where the vanilla blur effect should be force-enabled\nMight not work 100% of the time",
"blur.midnightconfig.forceDisabledScreens": "Force-disabled Screens", "blur.midnightconfig.forceDisabledScreens": "Force-disabled Screens",
"blur.midnightconfig.forceDisabledScreens.tooltip": "Screens where the vanilla blur effect should be force-disabled" "blur.midnightconfig.forceDisabledScreens.tooltip": "Screens where the vanilla blur effect should be force-disabled",
"blur.midnightconfig._general": "⛏ General",
"blur.midnightconfig._advanced": "⚒ Advanced",
"blur.midnightconfig._blur": "▒ Blur",
"blur.midnightconfig._gradient": "\uD83D\uDFE2 Gradient",
"blur.midnightconfig._animations": "\uD83D\uDCFD Animations"
} }

View File

@@ -0,0 +1,41 @@
{
"blur.midnightconfig.title": "Configuración de Blur+",
"blur.midnightconfig.category.animations": "Animaciones",
"blur.midnightconfig.category.style": "Estilo",
"blur.midnightconfig.category.screens": "Pantallas",
"blur.midnightconfig.blurContainers": "Aplicar Desenfoque a Contenedores",
"blur.midnightconfig.fadeTimeMillis": "Tiempo de Aparición (en milisegundos)",
"blur.midnightconfig.fadeOutTimeMillis": "Tiempo de Desaparición (en milisegundos)",
"blur.midnightconfig.animationCurve": "Curva de Animación",
"blur.midnightconfig.enum.Easing.FLAT": "Plano",
"blur.midnightconfig.enum.Easing.SINE": "Seno",
"blur.midnightconfig.enum.Easing.QUAD": "Cuadrática",
"blur.midnightconfig.enum.Easing.CUBIC": "Cúbica",
"blur.midnightconfig.enum.Easing.QUART": "Cuártica",
"blur.midnightconfig.enum.Easing.QUINT": "Quíntica",
"blur.midnightconfig.enum.Easing.EXPO": "Exponencial",
"blur.midnightconfig.enum.Easing.CIRC": "Circular",
"blur.midnightconfig.enum.Easing.BACK": "Retroceso",
"blur.midnightconfig.enum.Easing.ELASTIC": "Elástica",
"blur.midnightconfig.radius": "Radio",
"blur.midnightconfig.rainbowMode": "Modo Arcoíris \ud83c\udf08",
"blur.midnightconfig.useGradient": "Usar Gradiente como Fondo",
"blur.midnightconfig.gradientStart": "Color Inicial del Gradiente",
"blur.midnightconfig.gradientEnd": "Color Final del Gradiente",
"blur.midnightconfig.gradientStartAlpha": "Transparencia Inicial del Gradiente",
"blur.midnightconfig.gradientEndAlpha": "Transparencia Final del Gradiente",
"blur.midnightconfig.gradientRotation": "Rotación del Gradiente",
"blur.midnightconfig.excludedScreens": "Pantallas Excluidas",
"blur.midnightconfig.excludedScreens.tooltip": "Pantallas donde Blur+ no debería animar",
"blur.midnightconfig.forceEnabledScreens": "Pantallas con Blur Forzado",
"blur.midnightconfig.forceEnabledScreens.tooltip": "Pantallas donde el desenfoque vanilla debería forzarse habilitado\nPuede que no funcione siempre al 100%",
"blur.midnightconfig.forceDisabledScreens": "Pantallas con Blur Deshabilitado",
"blur.midnightconfig.forceDisabledScreens.tooltip": "Pantallas donde el desenfoque vanilla debería forzarse deshabilitado"
}

View File

@@ -8,12 +8,9 @@
"MixinGameRenderer", "MixinGameRenderer",
"MixinHandledScreen", "MixinHandledScreen",
"MixinInGameHud", "MixinInGameHud",
"MixinMidnightConfig",
"MixinMidnightConfig$EntryInfo",
"MixinMinecraftClient", "MixinMinecraftClient",
"MixinScreen", "MixinScreen",
"MixinTitleScreen", "MixinTitleScreen"
"ScreenAccessor"
], ],
"injectors": { "injectors": {
"defaultRequire": 1 "defaultRequire": 1

View File

@@ -22,7 +22,9 @@
"authors": [ "authors": [
"Motschen", "Motschen",
"tterrag1098", "tterrag1098",
"Pyrofab", "Pyrofab"
],
"contributors": [
"backryun", "backryun",
"byquanton" "byquanton"
], ],
@@ -31,6 +33,7 @@
"blur.mixins.json" "blur.mixins.json"
], ],
"depends": { "depends": {
"minecraft": ">=1.21.2" "minecraft": ">=1.21",
"midnightlib": ">=1.7.5"
} }
} }

View File

@@ -2,13 +2,13 @@
org.gradle.jvmargs=-Xmx2G org.gradle.jvmargs=-Xmx2G
org.gradle.parallel=true org.gradle.parallel=true
minecraft_version=1.21.4 minecraft_version=1.21.1
supported_versions=1.21.5 supported_versions=1.21
yarn_mappings=1.21.4+build.1 yarn_mappings=1.21.1+build.3
enabled_platforms=fabric,neoforge enabled_platforms=fabric,neoforge
# Mod Properties # Mod Properties
mod_version=5.2.0 mod_version=5.2.2+1.21.1
maven_group=eu.midnightdust.blur maven_group=eu.midnightdust.blur
archives_base_name=blur archives_base_name=blur
release_type=release release_type=release
@@ -16,12 +16,12 @@ curseforge_id=393563
modrinth_id=NK39zBp2 modrinth_id=NK39zBp2
# Modloaders # Modloaders
fabric_loader_version=0.16.9 fabric_loader_version=0.16.13
fabric_api_version=0.111.0+1.21.4 fabric_api_version=0.115.4+1.21.1
neoforge_version=21.4.10-beta neoforge_version=21.1.192
yarn_mappings_patch_neoforge_version = 1.21+build.4 yarn_mappings_patch_neoforge_version = 1.21+build.4
# Libraries # Libraries
midnightlib_version = 1.7.0+1.21.4 midnightlib_version = 1.7.5+1.21.1
modmenu_version = 11.0.2 modmenu_version = 11.0.2

View File

@@ -1,6 +1,6 @@
distributionBase=GRADLE_USER_HOME distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists distributionPath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-8.9-bin.zip distributionUrl=https\://services.gradle.org/distributions/gradle-8.14.2-bin.zip
networkTimeout=10000 networkTimeout=10000
validateDistributionUrl=true validateDistributionUrl=true
zipStoreBase=GRADLE_USER_HOME zipStoreBase=GRADLE_USER_HOME

View File

@@ -14,7 +14,7 @@ public class BlurNeoForge {
Blur.init(); Blur.init();
} }
@EventBusSubscriber(modid = Blur.MOD_ID, bus = EventBusSubscriber.Bus.GAME, value = Dist.CLIENT) @EventBusSubscriber(modid = Blur.MOD_ID, value = Dist.CLIENT)
public static class ClientGameEvents { public static class ClientGameEvents {
@SubscribeEvent @SubscribeEvent
public static void endClientTick(ClientTickEvent.Post event) { public static void endClientTick(ClientTickEvent.Post event) {

View File

@@ -26,6 +26,13 @@ side = "CLIENT"
[[dependencies.blur]] [[dependencies.blur]]
modId = "minecraft" modId = "minecraft"
mandatory = true mandatory = true
versionRange = "[1.21.2,)" versionRange = "[1.21,1.21.1]"
ordering = "NONE"
side = "CLIENT"
[[dependencies.blur]]
modId = "midnightlib"
mandatory = true
versionRange = "[1.7.5,)"
ordering = "NONE" ordering = "NONE"
side = "CLIENT" side = "CLIENT"