mirror of
https://github.com/Motschen/Blur.git
synced 2025-12-17 04:05:10 +01:00
Merge branch 'plus-1.21.1' into backport/1.21.1
This commit is contained in:
@@ -92,12 +92,13 @@ public class Blur {
|
||||
float diagonal = Math.sqrt((float) width*width + height*height);
|
||||
int smallestDimension = Math.min(width, height);
|
||||
|
||||
context.getMatrices().pushMatrix();
|
||||
Matrix3x2f posMatrix = context.getMatrices();
|
||||
posMatrix.rotate(Math.toRadians(getRotation()));
|
||||
posMatrix.setTranslation(width / 2f, height / 2f); // Make the gradient's center the pivot point
|
||||
context.getMatrices().push();
|
||||
Matrix4f posMatrix = context.getMatrices().peek().getPositionMatrix();
|
||||
posMatrix.rotationZ(Math.toRadians(getRotation()));
|
||||
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
|
||||
context.fillGradient(-width / 2, -height / 2, width / 2, height / 2, Blur.getBackgroundColor(false), Blur.getBackgroundColor(true)); // Actually draw the gradient
|
||||
context.getMatrices().popMatrix();
|
||||
posMatrix.rotationZ(0);
|
||||
context.getMatrices().pop();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -28,12 +28,13 @@ public abstract class MixinScreen {
|
||||
@Shadow public int height;
|
||||
@Shadow protected abstract void applyBlur(DrawContext context);
|
||||
|
||||
@Shadow protected abstract void applyBlur(float delta);
|
||||
|
||||
@Inject(at = @At("HEAD"), method = "render")
|
||||
public void blur$processScreenChange(DrawContext context, int mouseX, int mouseY, float delta, CallbackInfo ci) {
|
||||
Blur.onRender();
|
||||
Blur.renderFadeout(context, width, height, client);
|
||||
}
|
||||
|
||||
@Inject(at = @At("HEAD"), method = "applyBlur", cancellable = true)
|
||||
public void blur$getBlurEnabled(CallbackInfo ci) {
|
||||
if (BlurConfig.forceDisabledScreens.contains(this.getClass().getCanonicalName())) {
|
||||
@@ -42,7 +43,6 @@ public abstract class MixinScreen {
|
||||
if (!BlurConfig.excludedScreens.contains(this.getClass().getCanonicalName()))
|
||||
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")
|
||||
private void blur$applyGradient(DrawContext context, Identifier texture, int x, int y, float u, float v, int width, int height, Operation<Void> original) {
|
||||
if (BlurConfig.useGradient) {
|
||||
@@ -58,7 +58,7 @@ public abstract class MixinScreen {
|
||||
private void blur$renderGradient(DrawContext context) {
|
||||
BlurInfo.screenHasBackground = true; // Test if the screen has a background
|
||||
if (BlurConfig.forceEnabledScreens.contains(this.getClass().getCanonicalName()))
|
||||
this.applyBlur(context);
|
||||
this.applyBlur(client.getRenderTickCounter().getTickDelta(true));
|
||||
|
||||
Blur.renderRotatedGradient(context, width, height); // Replaces the default gradient with our rotated one
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user