mirror of
https://github.com/Motschen/Blur.git
synced 2025-12-15 11:15:09 +01:00
Finishing touches
- Correctly scale gradients - Updated German translations
This commit is contained in:
@@ -87,14 +87,14 @@ public class Blur implements ClientModInitializer {
|
||||
if (BlurConfig.rainbowMode) return RainbowColor.rotation;
|
||||
return BlurConfig.gradientRotation;
|
||||
}
|
||||
public static boolean renderRotatedGradient(DrawContext context, int width, int height) {
|
||||
if (getRotation() > 0) {
|
||||
context.getMatrices().peek().getPositionMatrix().rotationZ(Math.toRadians(getRotation()));
|
||||
context.getMatrices().peek().getPositionMatrix().setTranslation(width / 2f, height / 2f, 0); // Make the gradient's center the pivot point
|
||||
context.getMatrices().peek().getPositionMatrix().scale(Math.sqrt((float) width*width + height*height) / height); // 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.getMatrices().peek().getPositionMatrix().rotationZ(0);
|
||||
return true;
|
||||
} return false;
|
||||
public static void renderRotatedGradient(DrawContext context, int width, int height) {
|
||||
float diagonal = Math.sqrt((float) width*width + height*height);
|
||||
int smallestDimension = Math.min(width, height);
|
||||
|
||||
context.getMatrices().peek().getPositionMatrix().rotationZ(Math.toRadians(getRotation()));
|
||||
context.getMatrices().peek().getPositionMatrix().setTranslation(width / 2f, height / 2f, 0); // Make the gradient's center the pivot point
|
||||
context.getMatrices().peek().getPositionMatrix().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.getMatrices().peek().getPositionMatrix().rotationZ(0);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -23,8 +23,7 @@ public class MixinInGameHud {
|
||||
this.client.gameRenderer.renderBlur(delta);
|
||||
this.client.getFramebuffer().beginWrite(false);
|
||||
|
||||
if (Blur.prevScreenHasBackground && !Blur.renderRotatedGradient(context, client.getWindow().getScaledWidth(), client.getWindow().getScaledHeight()))
|
||||
context.fillGradient(0, 0, client.getWindow().getScaledWidth(), client.getWindow().getScaledHeight(), Blur.getBackgroundColor(false), Blur.getBackgroundColor(true));
|
||||
if (Blur.prevScreenHasBackground) Blur.renderRotatedGradient(context, client.getWindow().getScaledWidth(), client.getWindow().getScaledHeight());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -8,9 +8,7 @@ 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.Constant;
|
||||
import org.spongepowered.asm.mixin.injection.Inject;
|
||||
import org.spongepowered.asm.mixin.injection.ModifyConstant;
|
||||
|
||||
import eu.midnightdust.blur.Blur;
|
||||
|
||||
@@ -41,7 +39,7 @@ public abstract class MixinScreen {
|
||||
this.client.gameRenderer.renderBlur(delta);
|
||||
this.client.getFramebuffer().beginWrite(false);
|
||||
|
||||
if (Blur.prevScreenHasBackground && !Blur.renderRotatedGradient(context, width, height)) context.fillGradient(0, 0, width, height, Blur.getBackgroundColor(false), Blur.getBackgroundColor(true));
|
||||
if (Blur.prevScreenHasBackground) Blur.renderRotatedGradient(context, width, height);
|
||||
}
|
||||
Blur.doTest = false; // Set the test state to completed, as tests will happen in the same tick.
|
||||
}
|
||||
@@ -62,22 +60,9 @@ public abstract class MixinScreen {
|
||||
}
|
||||
}
|
||||
|
||||
@ModifyConstant(
|
||||
method = "renderInGameBackground",
|
||||
constant = @Constant(intValue = -1072689136))
|
||||
private int blur$getFirstBackgroundColor(int color) {
|
||||
return Blur.getBackgroundColor(false);
|
||||
}
|
||||
|
||||
@ModifyConstant(
|
||||
method = "renderInGameBackground",
|
||||
constant = @Constant(intValue = -804253680))
|
||||
private int blur$getSecondBackgroundColor(int color) {
|
||||
return Blur.getBackgroundColor(true);
|
||||
}
|
||||
|
||||
@Inject(at = @At("HEAD"), method = "renderInGameBackground", cancellable = true)
|
||||
public void blur$rotatedGradient(DrawContext context, CallbackInfo ci) {
|
||||
if (Blur.renderRotatedGradient(context, width, height)) ci.cancel();
|
||||
public void blur$rotatedGradient(DrawContext context, CallbackInfo ci) { // Replaces the default gradient with our rotated one
|
||||
Blur.renderRotatedGradient(context, width, height);
|
||||
ci.cancel();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -8,7 +8,7 @@ public class RainbowColor {
|
||||
public static float hue;
|
||||
public static float hue2 = 0.35f;
|
||||
|
||||
public static void tick(MinecraftClient client) {
|
||||
public static void tick(MinecraftClient ignoredClient) {
|
||||
if (BlurConfig.rainbowMode) {
|
||||
if (hue >= 1) hue = 0f;
|
||||
hue += 0.01f;
|
||||
|
||||
@@ -1,15 +1,27 @@
|
||||
{
|
||||
"blur.midnightconfig.title": "Blur Konfiguration",
|
||||
"blur.midnightconfig.blurExclusions": "Blur-Ausnahmen",
|
||||
"blur.midnightconfig.title": "Blur+ Konfiguration",
|
||||
"blur.midnightconfig.category.animations": "Animationen",
|
||||
"blur.midnightconfig.category.style": "Stil",
|
||||
"blur.midnightconfig.category.screens": "Bildschirme",
|
||||
"blur.midnightconfig.blurContainers": "Unschärfe in Containern",
|
||||
"blur.midnightconfig.fadeTimeMillis": "Überblendzeit (in Millisekunden)",
|
||||
"blur.midnightconfig.fadeOutTimeMillis": "Ausblendzeit (in milliseconds)",
|
||||
"blur.midnightconfig.ease": "Geschmeidige Animation",
|
||||
"blur.midnightconfig.fadeOutTimeMillis": "Ausblendzeit (in Millisekunden)",
|
||||
"blur.midnightconfig.animationCurve": "Animationskurve",
|
||||
"blur.midnightconfig.enum.Easing.FLAT": "Flach",
|
||||
"blur.midnightconfig.enum.Easing.SINE": "Sinus",
|
||||
"blur.midnightconfig.enum.Easing.QUAD": "Quadriert",
|
||||
"blur.midnightconfig.enum.Easing.CUBIC": "Kubiert",
|
||||
"blur.midnightconfig.enum.Easing.QUART": "Quart",
|
||||
"blur.midnightconfig.enum.Easing.QUINT": "Quint",
|
||||
"blur.midnightconfig.enum.Easing.EXPO": "Expo",
|
||||
"blur.midnightconfig.enum.Easing.CIRC": "Kreis",
|
||||
"blur.midnightconfig.enum.Easing.BACK": "Zurück",
|
||||
"blur.midnightconfig.enum.Easing.ELASTIC": "Elastisch",
|
||||
"blur.midnightconfig.radius": "Radius",
|
||||
"blur.midnightconfig.rainbowMode": "Regenbogenmodus \uD83C\uDF08",
|
||||
"blur.midnightconfig.useGradient": "Farbverlauf im Hintergrund",
|
||||
"blur.midnightconfig.gradientStart": "Farbverlauf-Anfangsfarbe",
|
||||
"blur.midnightconfig.gradientEnd": "Farbverlauf-Endfarbe",
|
||||
"blur.midnightconfig.gradientStartAlpha": "Farbverlauf-Anfangstransparenz",
|
||||
"blur.midnightconfig.gradientEndAlpha": "Farbverlauf-Endstransparenz",
|
||||
"blur.midnightconfig.showScreenTitle": "Logge Bildschirmtitel"
|
||||
"blur.midnightconfig.gradientRotation": "Farbverlauf-Rotation"
|
||||
}
|
||||
@@ -23,11 +23,11 @@
|
||||
"backryun",
|
||||
"byquanton"
|
||||
],
|
||||
"description": "Various Enhancements to the blur effect behind Minecraft GUIs",
|
||||
"description": "Various enhancements for the blur effect behind Minecraft GUIs",
|
||||
"mixins": [
|
||||
"mixins.blur.json"
|
||||
],
|
||||
"depends": {
|
||||
"minecraft": ">1.20.4"
|
||||
"minecraft": ">=1.20.5"
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user