mirror of
https://github.com/Motschen/Blur.git
synced 2025-12-16 19:55:10 +01:00
Compare commits
5 Commits
fabric-1.1
...
fabric-1.2
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
f9a54f936d | ||
|
|
bd3b58adcb | ||
|
|
d8b6a14e7f | ||
|
|
d726e20410 | ||
|
|
b4efd59322 |
12
build.gradle
12
build.gradle
@@ -1,5 +1,5 @@
|
|||||||
plugins {
|
plugins {
|
||||||
id 'fabric-loom' version '1.2-SNAPSHOT'
|
id 'fabric-loom' version '1.3-SNAPSHOT'
|
||||||
id 'maven-publish'
|
id 'maven-publish'
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -13,10 +13,10 @@ group = project.maven_group
|
|||||||
repositories {
|
repositories {
|
||||||
maven {
|
maven {
|
||||||
name = 'Ladysnake Mods'
|
name = 'Ladysnake Mods'
|
||||||
url = 'https://ladysnake.jfrog.io/artifactory/mods'
|
url = 'https://maven.ladysnake.org/releases'
|
||||||
content {
|
content {
|
||||||
includeGroup 'io.github.ladysnake'
|
includeGroup 'org.ladysnake'
|
||||||
includeGroupByRegex 'io\\.github\\.onyxstudios.*'
|
includeGroupByRegex 'dev\\.onyxstudios.*'
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
maven {
|
maven {
|
||||||
@@ -36,8 +36,8 @@ dependencies {
|
|||||||
modImplementation "net.fabricmc:fabric-loader:${project.loader_version}"
|
modImplementation "net.fabricmc:fabric-loader:${project.loader_version}"
|
||||||
|
|
||||||
modImplementation "net.fabricmc.fabric-api:fabric-api:${project.fabric_version}"
|
modImplementation "net.fabricmc.fabric-api:fabric-api:${project.fabric_version}"
|
||||||
modImplementation "io.github.ladysnake:satin:${satin_version}"
|
modImplementation "org.ladysnake:satin:${satin_version}"
|
||||||
include "io.github.ladysnake:satin:${satin_version}"
|
include "org.ladysnake:satin:${satin_version}"
|
||||||
|
|
||||||
implementation 'com.google.code.findbugs:jsr305:3.0.2'
|
implementation 'com.google.code.findbugs:jsr305:3.0.2'
|
||||||
modImplementation "maven.modrinth:midnightlib:${project.midnightlib_version}"
|
modImplementation "maven.modrinth:midnightlib:${project.midnightlib_version}"
|
||||||
|
|||||||
@@ -1,19 +1,20 @@
|
|||||||
# Done to increase the memory available to gradle.
|
# Done to increase the memory available to gradle.
|
||||||
org.gradle.jvmargs=-Xmx1G
|
org.gradle.jvmargs=-Xmx1G
|
||||||
|
org.gradle.parallel=true
|
||||||
|
|
||||||
# Fabric Properties
|
# Fabric Properties
|
||||||
# check these on https://fabricmc.net/develop
|
# check these on https://fabricmc.net/develop
|
||||||
minecraft_version=1.19.4
|
minecraft_version=1.20.2
|
||||||
yarn_mappings=1.19.4+build.2
|
yarn_mappings=1.20.2+build.1
|
||||||
loader_version=0.14.19
|
loader_version=0.14.22
|
||||||
|
|
||||||
# Mod Properties
|
# Mod Properties
|
||||||
mod_version=3.0.1
|
mod_version=3.1.1
|
||||||
maven_group=com.tterrag.blur
|
maven_group=com.tterrag.blur
|
||||||
archives_base_name=blur
|
archives_base_name=blur
|
||||||
|
|
||||||
# Dependencies
|
# Dependencies
|
||||||
# currently not on the main fabric site, check on the maven: https://maven.fabricmc.net/net/fabricmc/fabric-api/fabric-api
|
# currently not on the main fabric site, check on the maven: https://maven.fabricmc.net/net/fabricmc/fabric-api/fabric-api
|
||||||
fabric_version=0.79.0+1.19.4
|
fabric_version=0.89.1+1.20.2
|
||||||
satin_version=1.11.0
|
satin_version=1.14.0
|
||||||
midnightlib_version=1.2.1-fabric
|
midnightlib_version=1.5.0-fabric
|
||||||
|
|||||||
6
gradle/wrapper/gradle-wrapper.properties
vendored
6
gradle/wrapper/gradle-wrapper.properties
vendored
@@ -1,5 +1,7 @@
|
|||||||
distributionBase=GRADLE_USER_HOME
|
distributionBase=GRADLE_USER_HOME
|
||||||
distributionPath=wrapper/dists
|
distributionPath=wrapper/dists
|
||||||
distributionUrl=https\://services.gradle.org/distributions/gradle-8.1.1-bin.zip
|
distributionUrl=https\://services.gradle.org/distributions/gradle-8.3-bin.zip
|
||||||
|
networkTimeout=10000
|
||||||
|
validateDistributionUrl=true
|
||||||
zipStoreBase=GRADLE_USER_HOME
|
zipStoreBase=GRADLE_USER_HOME
|
||||||
zipStorePath=wrapper/dists
|
zipStorePath=wrapper/dists
|
||||||
@@ -4,6 +4,7 @@ pluginManagement {
|
|||||||
name = 'Fabric'
|
name = 'Fabric'
|
||||||
url = 'https://maven.fabricmc.net/'
|
url = 'https://maven.fabricmc.net/'
|
||||||
}
|
}
|
||||||
|
mavenCentral()
|
||||||
gradlePluginPortal()
|
gradlePluginPortal()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -11,6 +11,8 @@ import net.minecraft.client.MinecraftClient;
|
|||||||
import net.minecraft.client.gui.screen.Screen;
|
import net.minecraft.client.gui.screen.Screen;
|
||||||
import net.minecraft.util.Identifier;
|
import net.minecraft.util.Identifier;
|
||||||
|
|
||||||
|
import java.util.Objects;
|
||||||
|
|
||||||
public class Blur implements ClientModInitializer {
|
public class Blur implements ClientModInitializer {
|
||||||
|
|
||||||
public static final String MODID = "blur";
|
public static final String MODID = "blur";
|
||||||
@@ -39,7 +41,7 @@ public class Blur implements ClientModInitializer {
|
|||||||
|
|
||||||
public static void onScreenChange(Screen newGui) {
|
public static void onScreenChange(Screen newGui) {
|
||||||
if (client.world != null) {
|
if (client.world != null) {
|
||||||
boolean excluded = newGui == null || BlurConfig.blurExclusions.stream().anyMatch(exclusion -> newGui.getClass().getName().contains(exclusion));
|
boolean excluded = newGui == null || BlurConfig.blurExclusions.stream().anyMatch(exclusion -> newGui.getClass().getName().startsWith(exclusion));
|
||||||
if (!excluded) {
|
if (!excluded) {
|
||||||
screenHasBackground = false;
|
screenHasBackground = false;
|
||||||
if (BlurConfig.showScreenTitle) System.out.println(newGui.getClass().getName());
|
if (BlurConfig.showScreenTitle) System.out.println(newGui.getClass().getName());
|
||||||
@@ -49,7 +51,7 @@ public class Blur implements ClientModInitializer {
|
|||||||
doFade = false;
|
doFade = false;
|
||||||
}
|
}
|
||||||
prevScreen = newGui.getClass().getName();
|
prevScreen = newGui.getClass().getName();
|
||||||
} else if (newGui == null && BlurConfig.fadeOutTimeMillis > 0 && !BlurConfig.blurExclusions.contains(prevScreen)) {
|
} else if (newGui == null && BlurConfig.fadeOutTimeMillis > 0 && !Objects.equals(prevScreen, "")) {
|
||||||
blur.setUniformValue("Radius", (float) BlurConfig.radius);
|
blur.setUniformValue("Radius", (float) BlurConfig.radius);
|
||||||
start = System.currentTimeMillis();
|
start = System.currentTimeMillis();
|
||||||
doFade = true;
|
doFade = true;
|
||||||
@@ -57,25 +59,26 @@ public class Blur implements ClientModInitializer {
|
|||||||
screenHasBackground = false;
|
screenHasBackground = false;
|
||||||
start = -1;
|
start = -1;
|
||||||
doFade = true;
|
doFade = true;
|
||||||
|
prevScreen = "";
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private static float getProgress(boolean fadeIn) {
|
private static float getProgress(boolean fadeIn) {
|
||||||
|
float x;
|
||||||
if (fadeIn) {
|
if (fadeIn) {
|
||||||
float x = Math.min((System.currentTimeMillis() - start) / (float) BlurConfig.fadeTimeMillis, 1);
|
x = Math.min((System.currentTimeMillis() - start) / (float) BlurConfig.fadeTimeMillis, 1);
|
||||||
if (BlurConfig.ease) x *= (2 - x); // easeInCubic
|
if (BlurConfig.ease) x *= (2 - x); // easeInCubic
|
||||||
return x;
|
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
float x = Math.max(1+(start - System.currentTimeMillis()) / (float) BlurConfig.fadeOutTimeMillis, 0);
|
x = Math.max(1 + (start - System.currentTimeMillis()) / (float) BlurConfig.fadeOutTimeMillis, 0);
|
||||||
if (BlurConfig.ease) x *= (2 - x); // easeOutCubic
|
if (BlurConfig.ease) x *= (2 - x); // easeOutCubic
|
||||||
if (x <= 0) {
|
if (x <= 0) {
|
||||||
start = 0;
|
start = 0;
|
||||||
screenHasBackground = false;
|
screenHasBackground = false;
|
||||||
}
|
}
|
||||||
return x;
|
|
||||||
}
|
}
|
||||||
|
return x;
|
||||||
}
|
}
|
||||||
|
|
||||||
public static int getBackgroundColor(boolean second, boolean fadeIn) {
|
public static int getBackgroundColor(boolean second, boolean fadeIn) {
|
||||||
|
|||||||
@@ -7,33 +7,34 @@ import net.minecraft.client.gui.screen.ChatScreen;
|
|||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
public class BlurConfig extends MidnightConfig {
|
public class BlurConfig extends MidnightConfig {
|
||||||
public static final String style = "style";
|
public static final String STYLE = "style";
|
||||||
public static final String screens = "screens";
|
public static final String SCREENS = "screens";
|
||||||
|
|
||||||
|
@Entry(category = SCREENS)
|
||||||
@Entry(category = screens)
|
|
||||||
public static List<String> blurExclusions = Lists.newArrayList(ChatScreen.class.getName(),
|
public static List<String> blurExclusions = Lists.newArrayList(ChatScreen.class.getName(),
|
||||||
"com.replaymod.lib.de.johni0702.minecraft.gui.container.AbstractGuiOverlay$UserInputGuiScreen",
|
"com.replaymod.lib.de.johni0702.minecraft.gui.container.AbstractGuiOverlay$UserInputGuiScreen",
|
||||||
"ai.arcblroth.projectInception.client.InceptionInterfaceScreen",
|
"ai.arcblroth.projectInception.client.InceptionInterfaceScreen",
|
||||||
"net.optifine.gui.GuiChatOF",
|
"net.optifine.gui.GuiChatOF",
|
||||||
|
"baritone.",
|
||||||
"io.github.darkkronicle.advancedchatcore.chat.AdvancedChatScreen",
|
"io.github.darkkronicle.advancedchatcore.chat.AdvancedChatScreen",
|
||||||
"net.coderbot.iris.gui.screen.ShaderPackScreen");
|
"net.coderbot.iris.gui.screen.ShaderPackScreen",
|
||||||
@Entry(category = style, min = 0, max = 5000, width = 4)
|
"eu.midnightdust.midnightcontrols.client.gui.TouchscreenOverlay");
|
||||||
|
@Entry(category = STYLE, min = 0, max = 5000, width = 4)
|
||||||
public static int fadeTimeMillis = 200;
|
public static int fadeTimeMillis = 200;
|
||||||
@Entry(category = style, min = 0, max = 5000, width = 4)
|
@Entry(category = STYLE, min = 0, max = 5000, width = 4)
|
||||||
public static int fadeOutTimeMillis = 0;
|
public static int fadeOutTimeMillis = 200;
|
||||||
@Entry(category = style)
|
@Entry(category = STYLE)
|
||||||
public static boolean ease = true;
|
public static boolean ease = true;
|
||||||
@Entry(category = style, isSlider = true, min = 0, max = 100)
|
@Entry(category = STYLE, isSlider = true, min = 0, max = 100)
|
||||||
public static int radius = 8;
|
public static int radius = 8;
|
||||||
@Entry(category = style, isColor = true, width = 7, min = 7)
|
@Entry(category = STYLE, isColor = true, width = 7, min = 7)
|
||||||
public static String gradientStart = "#000000";
|
public static String gradientStart = "#000000";
|
||||||
@Entry(category = style, isSlider = true, min = 0, max = 255)
|
@Entry(category = STYLE, isSlider = true, min = 0, max = 255)
|
||||||
public static int gradientStartAlpha = 75;
|
public static int gradientStartAlpha = 75;
|
||||||
@Entry(category = style, isColor = true, width = 7, min = 7)
|
@Entry(category = STYLE, isColor = true, width = 7, min = 7)
|
||||||
public static String gradientEnd = "#000000";
|
public static String gradientEnd = "#000000";
|
||||||
@Entry(category = style, isSlider = true, min = 0, max = 255)
|
@Entry(category = STYLE, isSlider = true, min = 0, max = 255)
|
||||||
public static int gradientEndAlpha = 75;
|
public static int gradientEndAlpha = 75;
|
||||||
@Entry(category = screens)
|
@Entry(category = SCREENS)
|
||||||
public static boolean showScreenTitle = false;
|
public static boolean showScreenTitle = false;
|
||||||
}
|
}
|
||||||
@@ -3,9 +3,8 @@ package com.tterrag.blur.mixin;
|
|||||||
import com.tterrag.blur.Blur;
|
import com.tterrag.blur.Blur;
|
||||||
import com.tterrag.blur.config.BlurConfig;
|
import com.tterrag.blur.config.BlurConfig;
|
||||||
import net.minecraft.client.MinecraftClient;
|
import net.minecraft.client.MinecraftClient;
|
||||||
import net.minecraft.client.gui.DrawableHelper;
|
import net.minecraft.client.gui.DrawContext;
|
||||||
import net.minecraft.client.gui.hud.InGameHud;
|
import net.minecraft.client.gui.hud.InGameHud;
|
||||||
import net.minecraft.client.util.math.MatrixStack;
|
|
||||||
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;
|
||||||
@@ -14,14 +13,14 @@ import org.spongepowered.asm.mixin.injection.Inject;
|
|||||||
import org.spongepowered.asm.mixin.injection.callback.CallbackInfo;
|
import org.spongepowered.asm.mixin.injection.callback.CallbackInfo;
|
||||||
|
|
||||||
@Mixin(InGameHud.class)
|
@Mixin(InGameHud.class)
|
||||||
public class MixinInGameHud extends DrawableHelper {
|
public class MixinInGameHud {
|
||||||
@Shadow private int scaledWidth;
|
@Shadow private int scaledWidth;
|
||||||
@Shadow private int scaledHeight;
|
@Shadow private int scaledHeight;
|
||||||
@Final @Shadow private MinecraftClient client;
|
@Final @Shadow private MinecraftClient client;
|
||||||
@Inject(at = @At(value = "INVOKE", target = "Lcom/mojang/blaze3d/systems/RenderSystem;setShaderTexture(ILnet/minecraft/util/Identifier;)V", ordinal = 0, shift = At.Shift.BEFORE), method = "render")
|
@Inject(at = @At("TAIL"), method = "render")
|
||||||
public void blur$onRender(MatrixStack matrices, float tickDelta, CallbackInfo ci) {
|
public void blur$onRender(DrawContext context, float tickDelta, CallbackInfo ci) {
|
||||||
if (client.currentScreen == null && client.world != null && Blur.start > 0 && !BlurConfig.blurExclusions.contains(Blur.prevScreen) && Blur.screenHasBackground) {
|
if (client.currentScreen == null && client.world != null && Blur.start > 0 && BlurConfig.blurExclusions.stream().noneMatch(exclusion -> Blur.prevScreen.startsWith(exclusion)) && Blur.screenHasBackground) {
|
||||||
fillGradient(matrices, 0, 0, this.scaledWidth, this.scaledHeight, Blur.getBackgroundColor(false, false), Blur.getBackgroundColor(true, false));
|
context.fillGradient(0, 0, this.scaledWidth, this.scaledHeight, Blur.getBackgroundColor(false, false), Blur.getBackgroundColor(true, false));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
package com.tterrag.blur.mixin;
|
package com.tterrag.blur.mixin;
|
||||||
|
|
||||||
import net.minecraft.client.MinecraftClient;
|
import net.minecraft.client.MinecraftClient;
|
||||||
import net.minecraft.client.util.math.MatrixStack;
|
import net.minecraft.client.gui.DrawContext;
|
||||||
import net.minecraft.text.Text;
|
import net.minecraft.text.Text;
|
||||||
import org.jetbrains.annotations.Nullable;
|
import org.jetbrains.annotations.Nullable;
|
||||||
import org.spongepowered.asm.mixin.Final;
|
import org.spongepowered.asm.mixin.Final;
|
||||||
@@ -32,21 +32,21 @@ public abstract class MixinScreen {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
@Inject(at = @At("HEAD"), method = "renderBackground")
|
@Inject(at = @At("HEAD"), method = "renderBackground")
|
||||||
public void blur$getBackgroundEnabled(MatrixStack matrices, CallbackInfo ci) {
|
public void blur$getBackgroundEnabled(DrawContext context, int mouseX, int mouseY, float delta, CallbackInfo ci) {
|
||||||
if (this.client != null && this.client.world != null) {
|
if (this.client != null && this.client.world != null) {
|
||||||
Blur.screenHasBackground = true;
|
Blur.screenHasBackground = true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ModifyConstant(
|
@ModifyConstant(
|
||||||
method = "renderBackground",
|
method = "renderInGameBackground",
|
||||||
constant = @Constant(intValue = -1072689136))
|
constant = @Constant(intValue = -1072689136))
|
||||||
private int blur$getFirstBackgroundColor(int color) {
|
private int blur$getFirstBackgroundColor(int color) {
|
||||||
return Blur.getBackgroundColor(false, true);
|
return Blur.getBackgroundColor(false, true);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ModifyConstant(
|
@ModifyConstant(
|
||||||
method = "renderBackground",
|
method = "renderInGameBackground",
|
||||||
constant = @Constant(intValue = -804253680))
|
constant = @Constant(intValue = -804253680))
|
||||||
private int blur$getSecondBackgroundColor(int color) {
|
private int blur$getSecondBackgroundColor(int color) {
|
||||||
return Blur.getBackgroundColor(true, true);
|
return Blur.getBackgroundColor(true, true);
|
||||||
|
|||||||
Binary file not shown.
|
Before Width: | Height: | Size: 18 KiB After Width: | Height: | Size: 7.8 KiB |
Reference in New Issue
Block a user