mirror of
https://github.com/Motschen/Blur.git
synced 2025-12-16 19:55:10 +01:00
Compare commits
5 Commits
plus-1.21.
...
plus-1.21.
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
fd1a2d5545 | ||
|
|
06876d98e4 | ||
|
|
0fd10408ca | ||
|
|
7d207e8197 | ||
|
|
9d5b02bd0a |
@@ -3,7 +3,7 @@ import groovy.json.JsonOutput
|
||||
|
||||
plugins {
|
||||
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 'com.github.johnrengelman.shadow' version '8.1.1' apply false
|
||||
}
|
||||
|
||||
@@ -32,7 +32,8 @@ public class Blur {
|
||||
}
|
||||
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.gameRenderer.renderBlur(client.getRenderTickCounter().getTickDelta(true));
|
||||
client.getFramebuffer().beginWrite(false);
|
||||
|
||||
if (BlurInfo.prevScreenHasBackground && BlurConfig.useGradient) Blur.renderRotatedGradient(context, width, height);
|
||||
}
|
||||
@@ -98,6 +99,7 @@ public class Blur {
|
||||
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
|
||||
posMatrix.rotationZ(0);
|
||||
context.getMatrices().pop();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -9,7 +9,7 @@ import org.spongepowered.asm.mixin.injection.ModifyVariable;
|
||||
|
||||
@Mixin(GameRenderer.class)
|
||||
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
|
||||
if (!BlurInfo.screenChanged && BlurInfo.start >= 0) // Only update the progress after all tests have been completed
|
||||
Blur.updateProgress(BlurInfo.screenHasBlur);
|
||||
|
||||
@@ -19,8 +19,8 @@ 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))
|
||||
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();
|
||||
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(tickDelta);
|
||||
}
|
||||
@Inject(at = @At("HEAD"), method = "render")
|
||||
public void blur$processScreenChange(DrawContext context, int mouseX, int mouseY, float delta, CallbackInfo ci) {
|
||||
|
||||
@@ -22,7 +22,8 @@ public class MixinInGameHud {
|
||||
if (client.currentScreen == null && client.world != null && BlurInfo.start >= 0 && BlurInfo.prevScreenHasBlur) {
|
||||
BlurInfo.doTest = 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());
|
||||
}
|
||||
|
||||
@@ -26,14 +26,13 @@ public abstract class MixinScreen {
|
||||
@Shadow protected MinecraftClient client;
|
||||
@Shadow public int width;
|
||||
@Shadow public int height;
|
||||
@Shadow protected abstract void applyBlur();
|
||||
@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 +41,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 +56,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();
|
||||
this.applyBlur(client.getRenderTickCounter().getTickDelta(true));
|
||||
|
||||
Blur.renderRotatedGradient(context, width, height); // Replaces the default gradient with our rotated one
|
||||
}
|
||||
|
||||
@@ -17,11 +17,11 @@ public abstract class MixinTitleScreen extends Screen {
|
||||
super(title);
|
||||
}
|
||||
|
||||
@Inject(method = "renderPanoramaBackground", at = @At("TAIL"))
|
||||
private void blur$renderTitleBlur(DrawContext context, float delta, CallbackInfo ci) { // Applies the blur effect in containers (Inventory, Chest, etc.)
|
||||
@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, int mouseX, int mouseY, float delta, CallbackInfo ci) {
|
||||
if (BlurConfig.blurTitleScreen) {
|
||||
Blur.updateProgress(true);
|
||||
this.applyBlur();
|
||||
this.applyBlur(delta);
|
||||
if (BlurConfig.darkenTitleScreen) this.renderDarkening(context);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -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();
|
||||
}
|
||||
@@ -10,8 +10,7 @@
|
||||
"MixinInGameHud",
|
||||
"MixinMinecraftClient",
|
||||
"MixinScreen",
|
||||
"MixinTitleScreen",
|
||||
"ScreenAccessor"
|
||||
"MixinTitleScreen"
|
||||
],
|
||||
"injectors": {
|
||||
"defaultRequire": 1
|
||||
|
||||
@@ -33,7 +33,7 @@
|
||||
"blur.mixins.json"
|
||||
],
|
||||
"depends": {
|
||||
"minecraft": ">=1.21.2",
|
||||
"midnightlib": ">=1.7.3"
|
||||
"minecraft": ">=1.21",
|
||||
"midnightlib": ">=1.7.5"
|
||||
}
|
||||
}
|
||||
|
||||
@@ -2,13 +2,13 @@
|
||||
org.gradle.jvmargs=-Xmx2G
|
||||
org.gradle.parallel=true
|
||||
|
||||
minecraft_version=1.21.4
|
||||
supported_versions=1.21.5
|
||||
yarn_mappings=1.21.4+build.1
|
||||
minecraft_version=1.21.1
|
||||
supported_versions=1.21
|
||||
yarn_mappings=1.21.1+build.3
|
||||
enabled_platforms=fabric,neoforge
|
||||
|
||||
# Mod Properties
|
||||
mod_version=5.2.1
|
||||
mod_version=5.2.2+1.21.1
|
||||
maven_group=eu.midnightdust.blur
|
||||
archives_base_name=blur
|
||||
release_type=release
|
||||
@@ -16,12 +16,12 @@ curseforge_id=393563
|
||||
modrinth_id=NK39zBp2
|
||||
|
||||
# Modloaders
|
||||
fabric_loader_version=0.16.9
|
||||
fabric_api_version=0.111.0+1.21.4
|
||||
fabric_loader_version=0.16.13
|
||||
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
|
||||
|
||||
# Libraries
|
||||
midnightlib_version = 1.7.3+1.21.4
|
||||
midnightlib_version = 1.7.5+1.21.1
|
||||
modmenu_version = 11.0.2
|
||||
|
||||
2
gradle/wrapper/gradle-wrapper.properties
vendored
2
gradle/wrapper/gradle-wrapper.properties
vendored
@@ -1,6 +1,6 @@
|
||||
distributionBase=GRADLE_USER_HOME
|
||||
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
|
||||
validateDistributionUrl=true
|
||||
zipStoreBase=GRADLE_USER_HOME
|
||||
|
||||
@@ -14,7 +14,7 @@ public class BlurNeoForge {
|
||||
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 {
|
||||
@SubscribeEvent
|
||||
public static void endClientTick(ClientTickEvent.Post event) {
|
||||
|
||||
@@ -26,13 +26,13 @@ side = "CLIENT"
|
||||
[[dependencies.blur]]
|
||||
modId = "minecraft"
|
||||
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.3,)"
|
||||
versionRange = "[1.7.5,)"
|
||||
ordering = "NONE"
|
||||
side = "CLIENT"
|
||||
Reference in New Issue
Block a user