port: Chase the Skies (1.21.6)

Surprising amount of changes – even more surprised I got this working so fast :)
This commit is contained in:
Martin Prokoph
2025-06-17 19:13:41 +02:00
parent 5e4f4abd3b
commit 7d207e8197
12 changed files with 32 additions and 41 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

@@ -6,7 +6,7 @@ import eu.midnightdust.lib.util.MidnightColorUtil;
import net.minecraft.client.MinecraftClient; import net.minecraft.client.MinecraftClient;
import net.minecraft.client.gui.DrawContext; import net.minecraft.client.gui.DrawContext;
import org.joml.Math; import org.joml.Math;
import org.joml.Matrix4f; import org.joml.Matrix3x2f;
import java.awt.Color; import java.awt.Color;
import java.lang.Double; import java.lang.Double;
@@ -92,12 +92,12 @@ 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(); context.getMatrices().pushMatrix();
Matrix4f posMatrix = context.getMatrices().peek().getPositionMatrix(); Matrix3x2f posMatrix = context.getMatrices();
posMatrix.rotationZ(Math.toRadians(getRotation())); posMatrix.rotate(Math.toRadians(getRotation()));
posMatrix.setTranslation(width / 2f, height / 2f, -1000); // Make the gradient's center the pivot point posMatrix.setTranslation(width / 2f, height / 2f); // 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
context.getMatrices().pop(); context.getMatrices().popMatrix();
} }
} }

View File

@@ -13,7 +13,7 @@ public abstract class MixinGameOptions {
@Shadow @Final private SimpleOption<Integer> menuBackgroundBlurriness; @Shadow @Final private SimpleOption<Integer> menuBackgroundBlurriness;
@Shadow @Final private SimpleOption<Double> chatLineSpacing; @Shadow @Final private SimpleOption<Double> chatLineSpacing;
@Redirect(method = "<init>", at = @At(value = "NEW", target = "net/minecraft/client/option/SimpleOption$ValidatingIntSliderCallbacks", ordinal = 2)) @Redirect(method = "<init>", at = @At(value = "NEW", target = "net/minecraft/client/option/SimpleOption$ValidatingIntSliderCallbacks", ordinal = 3))
private SimpleOption.ValidatingIntSliderCallbacks blur$increaseMaxBlurriness(int minInclusive, int maxInclusive) { private SimpleOption.ValidatingIntSliderCallbacks blur$increaseMaxBlurriness(int minInclusive, int maxInclusive) {
if (this.menuBackgroundBlurriness == null && this.chatLineSpacing != null) if (this.menuBackgroundBlurriness == null && this.chatLineSpacing != null)
return new SimpleOption.ValidatingIntSliderCallbacks(minInclusive, 20); return new SimpleOption.ValidatingIntSliderCallbacks(minInclusive, 20);

View File

@@ -1,18 +1,21 @@
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.Blur; import eu.midnightdust.blur.Blur;
import eu.midnightdust.blur.BlurInfo; import eu.midnightdust.blur.BlurInfo;
import net.minecraft.client.option.GameOptions;
import net.minecraft.client.render.GameRenderer; import net.minecraft.client.render.GameRenderer;
import org.spongepowered.asm.mixin.Mixin; import org.spongepowered.asm.mixin.Mixin;
import org.spongepowered.asm.mixin.injection.At; import org.spongepowered.asm.mixin.injection.At;
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) @WrapOperation(method = "render", at = @At(value = "INVOKE", target = "Lnet/minecraft/client/option/GameOptions;getMenuBackgroundBlurrinessValue()I"))
private float blur$modifyRadius(float radius) { // Modify the radius based on the animation progress private int blur$modifyRadius(GameOptions instance, Operation<Integer> original) {
int radius = instance.getMenuBackgroundBlurrinessValue();
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);
return radius * BlurInfo.progress; return (int) (radius * BlurInfo.progress);
} }
} }

View File

@@ -20,7 +20,7 @@ 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 delta, CallbackInfo ci) { // Applies the blur effect in containers (Inventory, Chest, etc.)
if (BlurConfig.blurContainers) this.applyBlur(); if (BlurConfig.blurContainers) this.applyBlur(context);
} }
@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) {

View File

@@ -22,7 +22,7 @@ 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(); context.applyBlur();
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

@@ -26,7 +26,7 @@ public abstract class MixinScreen {
@Shadow protected MinecraftClient client; @Shadow protected MinecraftClient client;
@Shadow public int width; @Shadow public int width;
@Shadow public int height; @Shadow public int height;
@Shadow protected abstract void applyBlur(); @Shadow protected abstract void applyBlur(DrawContext context);
@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) {
@@ -58,7 +58,7 @@ public abstract class MixinScreen {
private void blur$renderGradient(DrawContext context) { private void blur$renderGradient(DrawContext context) {
BlurInfo.screenHasBackground = true; // Test if the screen has a background BlurInfo.screenHasBackground = true; // Test if the screen has a background
if (BlurConfig.forceEnabledScreens.contains(this.getClass().getCanonicalName())) if (BlurConfig.forceEnabledScreens.contains(this.getClass().getCanonicalName()))
this.applyBlur(); this.applyBlur(context);
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
} }

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"))
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 deltaTicks, CallbackInfo ci) {
if (BlurConfig.blurTitleScreen) { if (BlurConfig.blurTitleScreen) {
Blur.updateProgress(true); Blur.updateProgress(true);
this.applyBlur(); this.applyBlur(context);
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

@@ -10,8 +10,7 @@
"MixinInGameHud", "MixinInGameHud",
"MixinMinecraftClient", "MixinMinecraftClient",
"MixinScreen", "MixinScreen",
"MixinTitleScreen", "MixinTitleScreen"
"ScreenAccessor"
], ],
"injectors": { "injectors": {
"defaultRequire": 1 "defaultRequire": 1

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.6
supported_versions=1.21.5 supported_versions=
yarn_mappings=1.21.4+build.1 yarn_mappings=1.21.6+build.1
enabled_platforms=fabric,neoforge enabled_platforms=fabric,neoforge
# Mod Properties # Mod Properties
mod_version=5.2.1 mod_version=5.2.2
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.14
fabric_api_version=0.111.0+1.21.4 fabric_api_version=0.127.0+1.21.6
neoforge_version=21.4.10-beta neoforge_version=21.6.0-beta
yarn_mappings_patch_neoforge_version = 1.21+build.4 yarn_mappings_patch_neoforge_version = 1.21+build.4
# Libraries # Libraries
midnightlib_version = 1.7.3+1.21.4 midnightlib_version = 1.7.4+1.21.6
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