mirror of
https://github.com/Motschen/Blur.git
synced 2025-12-15 19:25:09 +01:00
Compare commits
48 Commits
v2.4.1
...
fabric-1.2
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
b4efd59322 | ||
|
|
98b398ab6c | ||
|
|
66e0c0408a | ||
|
|
11dde13801 | ||
|
|
3ea75d519c | ||
|
|
ab80391b29 | ||
|
|
a51b02aa04 | ||
|
|
766f30b466 | ||
|
|
77badf3494 | ||
|
|
c868cf1ef7 | ||
|
|
876c5256ae | ||
|
|
0f279a0f91 | ||
|
|
d58cd66cc8 | ||
|
|
44ae96ef50 | ||
|
|
427d453f79 | ||
|
|
521cc15306 | ||
|
|
3528305c93 | ||
|
|
2ad42cf1e9 | ||
|
|
84cc94fba4 | ||
|
|
e139a2319e | ||
|
|
0d90cac688 | ||
|
|
2fb8f29fee | ||
|
|
f69af4c800 | ||
|
|
dc94bd3f5a | ||
|
|
7dd93da833 | ||
|
|
7258cefb5d | ||
|
|
dc7e5bb1e0 | ||
|
|
d42545570e | ||
|
|
9854e97996 | ||
|
|
7b253f50c1 | ||
|
|
8a1824c906 | ||
|
|
f958e43bd1 | ||
|
|
7ab190d697 | ||
|
|
2dc68068e2 | ||
|
|
35635ad633 | ||
|
|
9c4f753fcf | ||
|
|
13d6398de0 | ||
|
|
8e0da73778 | ||
|
|
e668f3fa60 | ||
|
|
6000ba8f64 | ||
|
|
e85231757a | ||
|
|
eca592b646 | ||
|
|
000315bf13 | ||
|
|
fe7229c518 | ||
|
|
b944975c9a | ||
|
|
747188d023 | ||
|
|
a199313682 | ||
|
|
fadf94d9be |
29
.github/workflows/gradle.yml
vendored
Normal file
29
.github/workflows/gradle.yml
vendored
Normal file
@@ -0,0 +1,29 @@
|
||||
on:
|
||||
push:
|
||||
branches: [ "fabric-1.19.3" ]
|
||||
pull_request:
|
||||
branches: [ "fabric-1.19.3" ]
|
||||
|
||||
permissions:
|
||||
contents: read
|
||||
|
||||
jobs:
|
||||
build:
|
||||
runs-on: ubuntu-22.04
|
||||
steps:
|
||||
- uses: actions/checkout@v3
|
||||
- name: Set up JDK 17
|
||||
uses: actions/setup-java@v3
|
||||
with:
|
||||
java-version: '17'
|
||||
distribution: 'temurin'
|
||||
- name: Grant execute permission for gradlew
|
||||
run: chmod +x gradlew
|
||||
- name: Build with Gradle
|
||||
run: ./gradlew build --stacktrace --info
|
||||
- name: Upload a Build Artifact
|
||||
uses: actions/upload-artifact@v3
|
||||
with:
|
||||
name: Blur-Artifact
|
||||
path: build/libs/blur-*.*.jar
|
||||
if-no-files-found: error
|
||||
36
build.gradle
36
build.gradle
@@ -1,5 +1,5 @@
|
||||
plugins {
|
||||
id 'fabric-loom' version '0.10-SNAPSHOT'
|
||||
id 'fabric-loom' version '1.2-SNAPSHOT'
|
||||
id 'maven-publish'
|
||||
}
|
||||
|
||||
@@ -31,10 +31,11 @@ repositories {
|
||||
}
|
||||
|
||||
dependencies {
|
||||
minecraft "com.mojang:minecraft:${minecraft_version}"
|
||||
mappings "net.fabricmc:yarn:${yarn_mappings}"
|
||||
modImplementation "net.fabricmc:fabric-loader:${loader_version}"
|
||||
modImplementation "net.fabricmc.fabric-api:fabric-api:${fabric_version}"
|
||||
minecraft "com.mojang:minecraft:${project.minecraft_version}"
|
||||
mappings "net.fabricmc:yarn:${project.yarn_mappings}:v2"
|
||||
modImplementation "net.fabricmc:fabric-loader:${project.loader_version}"
|
||||
|
||||
modImplementation "net.fabricmc.fabric-api:fabric-api:${project.fabric_version}"
|
||||
modImplementation "io.github.ladysnake:satin:${satin_version}"
|
||||
include "io.github.ladysnake:satin:${satin_version}"
|
||||
|
||||
@@ -51,11 +52,9 @@ processResources {
|
||||
}
|
||||
}
|
||||
|
||||
// ensure that the encoding is set to UTF-8, no matter what the system default is
|
||||
// this fixes some edge cases with special characters not displaying correctly
|
||||
// see http://yodaconditions.net/blog/fix-for-java-file-encoding-problems-with-gradle.html
|
||||
tasks.withType(JavaCompile) {
|
||||
options.encoding = "UTF-8"
|
||||
tasks.withType(JavaCompile).configureEach {
|
||||
// Minecraft 1.18 (1.18-pre2) upwards uses Java 17.
|
||||
it.options.release = 17
|
||||
}
|
||||
|
||||
java {
|
||||
@@ -70,20 +69,7 @@ jar {
|
||||
publishing {
|
||||
publications {
|
||||
mavenJava(MavenPublication) {
|
||||
// add all the jars that should be included when publishing to maven
|
||||
artifact(remapJar) {
|
||||
builtBy remapJar
|
||||
}
|
||||
artifact(sourcesJar) {
|
||||
builtBy remapSourcesJar
|
||||
}
|
||||
from components.java
|
||||
}
|
||||
}
|
||||
|
||||
// select the repositories you want to publish to
|
||||
repositories {
|
||||
// uncomment to publish to the local maven
|
||||
// mavenLocal()
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
@@ -2,18 +2,18 @@
|
||||
org.gradle.jvmargs=-Xmx1G
|
||||
|
||||
# Fabric Properties
|
||||
# check these on https://fabricmc.net/use
|
||||
minecraft_version=1.18
|
||||
yarn_mappings=1.18+build.1
|
||||
loader_version=0.12.8
|
||||
# check these on https://fabricmc.net/develop
|
||||
minecraft_version=1.20
|
||||
yarn_mappings=1.20+build.1
|
||||
loader_version=0.14.21
|
||||
|
||||
# Mod Properties
|
||||
mod_version = 2.4.1
|
||||
maven_group = com.tterrag.blur
|
||||
archives_base_name = blur
|
||||
mod_version=3.1.0
|
||||
maven_group=com.tterrag.blur
|
||||
archives_base_name=blur
|
||||
|
||||
# Dependencies
|
||||
# currently not on the main fabric site, check on the maven: https://maven.fabricmc.net/net/fabricmc/fabric-api/fabric-api
|
||||
fabric_version=0.44.0+1.18
|
||||
satin_version = 1.7.0
|
||||
midnightlib_version=0.3.1
|
||||
fabric_version=0.83.0+1.20
|
||||
satin_version=1.13.0
|
||||
midnightlib_version=1.4.1-fabric
|
||||
|
||||
2
gradle/wrapper/gradle-wrapper.properties
vendored
2
gradle/wrapper/gradle-wrapper.properties
vendored
@@ -1,5 +1,5 @@
|
||||
distributionBase=GRADLE_USER_HOME
|
||||
distributionPath=wrapper/dists
|
||||
distributionUrl=https\://services.gradle.org/distributions/gradle-7.2-bin.zip
|
||||
distributionUrl=https\://services.gradle.org/distributions/gradle-8.1.1-bin.zip
|
||||
zipStoreBase=GRADLE_USER_HOME
|
||||
zipStorePath=wrapper/dists
|
||||
|
||||
178
gradlew.bat
vendored
178
gradlew.bat
vendored
@@ -1,89 +1,89 @@
|
||||
@rem
|
||||
@rem Copyright 2015 the original author or authors.
|
||||
@rem
|
||||
@rem Licensed under the Apache License, Version 2.0 (the "License");
|
||||
@rem you may not use this file except in compliance with the License.
|
||||
@rem You may obtain a copy of the License at
|
||||
@rem
|
||||
@rem https://www.apache.org/licenses/LICENSE-2.0
|
||||
@rem
|
||||
@rem Unless required by applicable law or agreed to in writing, software
|
||||
@rem distributed under the License is distributed on an "AS IS" BASIS,
|
||||
@rem WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
@rem See the License for the specific language governing permissions and
|
||||
@rem limitations under the License.
|
||||
@rem
|
||||
|
||||
@if "%DEBUG%" == "" @echo off
|
||||
@rem ##########################################################################
|
||||
@rem
|
||||
@rem Gradle startup script for Windows
|
||||
@rem
|
||||
@rem ##########################################################################
|
||||
|
||||
@rem Set local scope for the variables with windows NT shell
|
||||
if "%OS%"=="Windows_NT" setlocal
|
||||
|
||||
set DIRNAME=%~dp0
|
||||
if "%DIRNAME%" == "" set DIRNAME=.
|
||||
set APP_BASE_NAME=%~n0
|
||||
set APP_HOME=%DIRNAME%
|
||||
|
||||
@rem Resolve any "." and ".." in APP_HOME to make it shorter.
|
||||
for %%i in ("%APP_HOME%") do set APP_HOME=%%~fi
|
||||
|
||||
@rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
|
||||
set DEFAULT_JVM_OPTS="-Xmx64m" "-Xms64m"
|
||||
|
||||
@rem Find java.exe
|
||||
if defined JAVA_HOME goto findJavaFromJavaHome
|
||||
|
||||
set JAVA_EXE=java.exe
|
||||
%JAVA_EXE% -version >NUL 2>&1
|
||||
if "%ERRORLEVEL%" == "0" goto execute
|
||||
|
||||
echo.
|
||||
echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
|
||||
echo.
|
||||
echo Please set the JAVA_HOME variable in your environment to match the
|
||||
echo location of your Java installation.
|
||||
|
||||
goto fail
|
||||
|
||||
:findJavaFromJavaHome
|
||||
set JAVA_HOME=%JAVA_HOME:"=%
|
||||
set JAVA_EXE=%JAVA_HOME%/bin/java.exe
|
||||
|
||||
if exist "%JAVA_EXE%" goto execute
|
||||
|
||||
echo.
|
||||
echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME%
|
||||
echo.
|
||||
echo Please set the JAVA_HOME variable in your environment to match the
|
||||
echo location of your Java installation.
|
||||
|
||||
goto fail
|
||||
|
||||
:execute
|
||||
@rem Setup the command line
|
||||
|
||||
set CLASSPATH=%APP_HOME%\gradle\wrapper\gradle-wrapper.jar
|
||||
|
||||
|
||||
@rem Execute Gradle
|
||||
"%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" org.gradle.wrapper.GradleWrapperMain %*
|
||||
|
||||
:end
|
||||
@rem End local scope for the variables with windows NT shell
|
||||
if "%ERRORLEVEL%"=="0" goto mainEnd
|
||||
|
||||
:fail
|
||||
rem Set variable GRADLE_EXIT_CONSOLE if you need the _script_ return code instead of
|
||||
rem the _cmd.exe /c_ return code!
|
||||
if not "" == "%GRADLE_EXIT_CONSOLE%" exit 1
|
||||
exit /b 1
|
||||
|
||||
:mainEnd
|
||||
if "%OS%"=="Windows_NT" endlocal
|
||||
|
||||
:omega
|
||||
@rem
|
||||
@rem Copyright 2015 the original author or authors.
|
||||
@rem
|
||||
@rem Licensed under the Apache License, Version 2.0 (the "License");
|
||||
@rem you may not use this file except in compliance with the License.
|
||||
@rem You may obtain a copy of the License at
|
||||
@rem
|
||||
@rem https://www.apache.org/licenses/LICENSE-2.0
|
||||
@rem
|
||||
@rem Unless required by applicable law or agreed to in writing, software
|
||||
@rem distributed under the License is distributed on an "AS IS" BASIS,
|
||||
@rem WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
@rem See the License for the specific language governing permissions and
|
||||
@rem limitations under the License.
|
||||
@rem
|
||||
|
||||
@if "%DEBUG%" == "" @echo off
|
||||
@rem ##########################################################################
|
||||
@rem
|
||||
@rem Gradle startup script for Windows
|
||||
@rem
|
||||
@rem ##########################################################################
|
||||
|
||||
@rem Set local scope for the variables with windows NT shell
|
||||
if "%OS%"=="Windows_NT" setlocal
|
||||
|
||||
set DIRNAME=%~dp0
|
||||
if "%DIRNAME%" == "" set DIRNAME=.
|
||||
set APP_BASE_NAME=%~n0
|
||||
set APP_HOME=%DIRNAME%
|
||||
|
||||
@rem Resolve any "." and ".." in APP_HOME to make it shorter.
|
||||
for %%i in ("%APP_HOME%") do set APP_HOME=%%~fi
|
||||
|
||||
@rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
|
||||
set DEFAULT_JVM_OPTS="-Xmx64m" "-Xms64m"
|
||||
|
||||
@rem Find java.exe
|
||||
if defined JAVA_HOME goto findJavaFromJavaHome
|
||||
|
||||
set JAVA_EXE=java.exe
|
||||
%JAVA_EXE% -version >NUL 2>&1
|
||||
if "%ERRORLEVEL%" == "0" goto execute
|
||||
|
||||
echo.
|
||||
echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
|
||||
echo.
|
||||
echo Please set the JAVA_HOME variable in your environment to match the
|
||||
echo location of your Java installation.
|
||||
|
||||
goto fail
|
||||
|
||||
:findJavaFromJavaHome
|
||||
set JAVA_HOME=%JAVA_HOME:"=%
|
||||
set JAVA_EXE=%JAVA_HOME%/bin/java.exe
|
||||
|
||||
if exist "%JAVA_EXE%" goto execute
|
||||
|
||||
echo.
|
||||
echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME%
|
||||
echo.
|
||||
echo Please set the JAVA_HOME variable in your environment to match the
|
||||
echo location of your Java installation.
|
||||
|
||||
goto fail
|
||||
|
||||
:execute
|
||||
@rem Setup the command line
|
||||
|
||||
set CLASSPATH=%APP_HOME%\gradle\wrapper\gradle-wrapper.jar
|
||||
|
||||
|
||||
@rem Execute Gradle
|
||||
"%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" org.gradle.wrapper.GradleWrapperMain %*
|
||||
|
||||
:end
|
||||
@rem End local scope for the variables with windows NT shell
|
||||
if "%ERRORLEVEL%"=="0" goto mainEnd
|
||||
|
||||
:fail
|
||||
rem Set variable GRADLE_EXIT_CONSOLE if you need the _script_ return code instead of
|
||||
rem the _cmd.exe /c_ return code!
|
||||
if not "" == "%GRADLE_EXIT_CONSOLE%" exit 1
|
||||
exit /b 1
|
||||
|
||||
:mainEnd
|
||||
if "%OS%"=="Windows_NT" endlocal
|
||||
|
||||
:omega
|
||||
|
||||
@@ -1,6 +1,5 @@
|
||||
pluginManagement {
|
||||
repositories {
|
||||
jcenter()
|
||||
maven {
|
||||
name = 'Fabric'
|
||||
url = 'https://maven.fabricmc.net/'
|
||||
|
||||
@@ -1,79 +1,93 @@
|
||||
package com.tterrag.blur;
|
||||
|
||||
import com.tterrag.blur.config.BlurConfig;
|
||||
import eu.midnightdust.lib.util.MidnightColorUtil;
|
||||
import ladysnake.satin.api.event.ShaderEffectRenderCallback;
|
||||
import ladysnake.satin.api.managed.ManagedShaderEffect;
|
||||
import ladysnake.satin.api.managed.ShaderEffectManager;
|
||||
import ladysnake.satin.api.managed.uniform.Uniform1f;
|
||||
import net.fabricmc.api.ClientModInitializer;
|
||||
import net.minecraft.client.MinecraftClient;
|
||||
import net.minecraft.client.gui.screen.ChatScreen;
|
||||
import net.minecraft.client.gui.screen.Screen;
|
||||
import net.minecraft.util.Identifier;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.Objects;
|
||||
|
||||
public class Blur implements ClientModInitializer {
|
||||
|
||||
public static final String MODID = "blur";
|
||||
public static List<String> defaultExclusions = new ArrayList<>();
|
||||
public static final MinecraftClient client = MinecraftClient.getInstance();
|
||||
public static long start;
|
||||
public static String prevScreen;
|
||||
public static boolean screenHasBackground;
|
||||
|
||||
private long start;
|
||||
public int colorFirst, colorSecond;
|
||||
|
||||
private final ManagedShaderEffect blur = ShaderEffectManager.getInstance().manage(new Identifier(MODID, "shaders/post/fade_in_blur.json"),
|
||||
private static final ManagedShaderEffect blur = ShaderEffectManager.getInstance().manage(new Identifier(MODID, "shaders/post/fade_in_blur.json"),
|
||||
shader -> shader.setUniformValue("Radius", (float) BlurConfig.radius));
|
||||
private final Uniform1f blurProgress = blur.findUniform1f("Progress");
|
||||
|
||||
public static final Blur INSTANCE = new Blur();
|
||||
private static final Uniform1f blurProgress = blur.findUniform1f("Progress");
|
||||
|
||||
@Override
|
||||
public void onInitializeClient() {
|
||||
defaultExclusions.add(ChatScreen.class.getName());
|
||||
defaultExclusions.add("com.replaymod.lib.de.johni0702.minecraft.gui.container.AbstractGuiOverlay$UserInputGuiScreen");
|
||||
defaultExclusions.add("ai.arcblroth.projectInception.client.InceptionInterfaceScreen");
|
||||
defaultExclusions.add("net.optifine.gui.GuiChatOF");
|
||||
BlurConfig.init("blur", BlurConfig.class);
|
||||
|
||||
ShaderEffectRenderCallback.EVENT.register((deltaTick) -> {
|
||||
if (start > 0) {
|
||||
blurProgress.set(getProgress());
|
||||
blurProgress.set(getProgress(client.currentScreen != null));
|
||||
blur.render(deltaTick);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
private boolean doFade = false;
|
||||
public void onScreenChange(Screen newGui) {
|
||||
if (MinecraftClient.getInstance().world != null) {
|
||||
boolean excluded = newGui == null || BlurConfig.blurExclusions.contains(newGui.getClass().getName());
|
||||
private static boolean doFade = false;
|
||||
|
||||
public static void onScreenChange(Screen newGui) {
|
||||
if (client.world != null) {
|
||||
boolean excluded = newGui == null || BlurConfig.blurExclusions.stream().anyMatch(exclusion -> newGui.getClass().getName().contains(exclusion));
|
||||
if (!excluded) {
|
||||
screenHasBackground = false;
|
||||
if (BlurConfig.showScreenTitle) System.out.println(newGui.getClass().getName());
|
||||
blur.setUniformValue("Radius", (float) BlurConfig.radius);
|
||||
colorFirst = Integer.parseUnsignedInt(String.valueOf(BlurConfig.gradientStartColor), 16);
|
||||
colorSecond = Integer.parseUnsignedInt(String.valueOf(BlurConfig.gradientEndColor), 16);
|
||||
if (doFade) {
|
||||
start = System.currentTimeMillis();
|
||||
doFade = false;
|
||||
}
|
||||
prevScreen = newGui.getClass().getName();
|
||||
} else if (newGui == null && BlurConfig.fadeOutTimeMillis > 0 && !Objects.equals(prevScreen, "")) {
|
||||
blur.setUniformValue("Radius", (float) BlurConfig.radius);
|
||||
start = System.currentTimeMillis();
|
||||
doFade = true;
|
||||
} else {
|
||||
screenHasBackground = false;
|
||||
start = -1;
|
||||
doFade = true;
|
||||
prevScreen = "";
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private float getProgress() {
|
||||
return Math.min((System.currentTimeMillis() - start) / (float) BlurConfig.fadeTimeMillis, 1);
|
||||
private static float getProgress(boolean fadeIn) {
|
||||
float x;
|
||||
if (fadeIn) {
|
||||
x = Math.min((System.currentTimeMillis() - start) / (float) BlurConfig.fadeTimeMillis, 1);
|
||||
if (BlurConfig.ease) x *= (2 - x); // easeInCubic
|
||||
}
|
||||
else {
|
||||
x = Math.max(1 + (start - System.currentTimeMillis()) / (float) BlurConfig.fadeOutTimeMillis, 0);
|
||||
if (BlurConfig.ease) x *= (2 - x); // easeOutCubic
|
||||
if (x <= 0) {
|
||||
start = 0;
|
||||
screenHasBackground = false;
|
||||
}
|
||||
}
|
||||
return x;
|
||||
}
|
||||
|
||||
public int getBackgroundColor(boolean second) {
|
||||
int color = second ? colorSecond : colorFirst;
|
||||
int a = color >>> 24;
|
||||
int r = (color >> 16) & 0xFF;
|
||||
int b = (color >> 8) & 0xFF;
|
||||
int g = color & 0xFF;
|
||||
float prog = INSTANCE.getProgress();
|
||||
public static int getBackgroundColor(boolean second, boolean fadeIn) {
|
||||
int a = second ? BlurConfig.gradientEndAlpha : BlurConfig.gradientStartAlpha;
|
||||
var col = MidnightColorUtil.hex2Rgb(second ? BlurConfig.gradientEnd : BlurConfig.gradientStart);
|
||||
int r = (col.getRGB() >> 16) & 0xFF;
|
||||
int b = (col.getRGB() >> 8) & 0xFF;
|
||||
int g = col.getRGB() & 0xFF;
|
||||
float prog = getProgress(fadeIn);
|
||||
a *= prog;
|
||||
r *= prog;
|
||||
g *= prog;
|
||||
|
||||
@@ -1,21 +1,39 @@
|
||||
package com.tterrag.blur.config;
|
||||
|
||||
import com.tterrag.blur.Blur;
|
||||
import com.google.common.collect.Lists;
|
||||
import eu.midnightdust.lib.config.MidnightConfig;
|
||||
import net.minecraft.client.gui.screen.ChatScreen;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
public class BlurConfig extends MidnightConfig {
|
||||
@Entry
|
||||
public static List<String> blurExclusions = Blur.defaultExclusions;
|
||||
@Entry(min = 0, max = 5000, width = 4)
|
||||
public static final String style = "style";
|
||||
public static final String screens = "screens";
|
||||
|
||||
|
||||
@Entry(category = screens)
|
||||
public static List<String> blurExclusions = Lists.newArrayList(ChatScreen.class.getName(),
|
||||
"com.replaymod.lib.de.johni0702.minecraft.gui.container.AbstractGuiOverlay$UserInputGuiScreen",
|
||||
"ai.arcblroth.projectInception.client.InceptionInterfaceScreen",
|
||||
"net.optifine.gui.GuiChatOF",
|
||||
"io.github.darkkronicle.advancedchatcore.chat.AdvancedChatScreen",
|
||||
"net.coderbot.iris.gui.screen.ShaderPackScreen");
|
||||
@Entry(category = style, min = 0, max = 5000, width = 4)
|
||||
public static int fadeTimeMillis = 200;
|
||||
@Entry(min = 0, max = 500, width = 3)
|
||||
@Entry(category = style, min = 0, max = 5000, width = 4)
|
||||
public static int fadeOutTimeMillis = 200;
|
||||
@Entry(category = style)
|
||||
public static boolean ease = true;
|
||||
@Entry(category = style, isSlider = true, min = 0, max = 100)
|
||||
public static int radius = 8;
|
||||
@Entry(min = 0, max = 99999999, width = 8)
|
||||
public static int gradientStartColor = 75000000;
|
||||
@Entry(min = 0, max = 99999999, width = 8)
|
||||
public static int gradientEndColor = 75000000;
|
||||
@Entry
|
||||
@Entry(category = style, isColor = true, width = 7, min = 7)
|
||||
public static String gradientStart = "#000000";
|
||||
@Entry(category = style, isSlider = true, min = 0, max = 255)
|
||||
public static int gradientStartAlpha = 75;
|
||||
@Entry(category = style, isColor = true, width = 7, min = 7)
|
||||
public static String gradientEnd = "#000000";
|
||||
@Entry(category = style, isSlider = true, min = 0, max = 255)
|
||||
public static int gradientEndAlpha = 75;
|
||||
@Entry(category = screens)
|
||||
public static boolean showScreenTitle = false;
|
||||
}
|
||||
}
|
||||
27
src/main/java/com/tterrag/blur/mixin/MixinInGameHud.java
Normal file
27
src/main/java/com/tterrag/blur/mixin/MixinInGameHud.java
Normal file
@@ -0,0 +1,27 @@
|
||||
package com.tterrag.blur.mixin;
|
||||
|
||||
import com.mojang.blaze3d.systems.RenderSystem;
|
||||
import com.tterrag.blur.Blur;
|
||||
import com.tterrag.blur.config.BlurConfig;
|
||||
import net.minecraft.client.MinecraftClient;
|
||||
import net.minecraft.client.gui.DrawContext;
|
||||
import net.minecraft.client.gui.hud.InGameHud;
|
||||
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.Inject;
|
||||
import org.spongepowered.asm.mixin.injection.callback.CallbackInfo;
|
||||
|
||||
@Mixin(InGameHud.class)
|
||||
public class MixinInGameHud {
|
||||
@Shadow private int scaledWidth;
|
||||
@Shadow private int scaledHeight;
|
||||
@Final @Shadow private MinecraftClient client;
|
||||
@Inject(at = @At("TAIL"), method = "render")
|
||||
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) {
|
||||
context.fillGradient(0, 0, this.scaledWidth, this.scaledHeight, Blur.getBackgroundColor(false, false), Blur.getBackgroundColor(true, false));
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -19,6 +19,6 @@ public class MixinMinecraftClient {
|
||||
target = "Lnet/minecraft/client/MinecraftClient;currentScreen:Lnet/minecraft/client/gui/screen/Screen;",
|
||||
opcode = Opcodes.PUTFIELD))
|
||||
private void onScreenOpen(Screen newScreen, CallbackInfo info) {
|
||||
Blur.INSTANCE.onScreenChange(newScreen);
|
||||
Blur.onScreenChange(newScreen);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,12 +1,11 @@
|
||||
package com.tterrag.blur.mixin;
|
||||
|
||||
import com.tterrag.blur.config.BlurConfig;
|
||||
import net.minecraft.client.MinecraftClient;
|
||||
import net.minecraft.client.font.TextRenderer;
|
||||
import net.minecraft.client.gui.DrawContext;
|
||||
import net.minecraft.client.util.math.MatrixStack;
|
||||
import net.minecraft.text.TextColor;
|
||||
import net.minecraft.util.Formatting;
|
||||
import net.minecraft.text.Text;
|
||||
import org.jetbrains.annotations.Nullable;
|
||||
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;
|
||||
@@ -19,39 +18,38 @@ import com.tterrag.blur.Blur;
|
||||
import net.minecraft.client.gui.screen.Screen;
|
||||
import org.spongepowered.asm.mixin.injection.callback.CallbackInfo;
|
||||
|
||||
import java.util.Locale;
|
||||
|
||||
@Mixin(Screen.class)
|
||||
public abstract class MixinScreen {
|
||||
|
||||
@Shadow @Nullable protected MinecraftClient client;
|
||||
|
||||
@Shadow protected TextRenderer textRenderer;
|
||||
@Shadow @Final protected Text title;
|
||||
private final Text blurConfig = Text.translatable("blur.midnightconfig.title");
|
||||
|
||||
@Inject(at = @At("HEAD"), method = "tick")
|
||||
private void blur$reloadShader(CallbackInfo ci) {
|
||||
if (this.getClass().toString().toLowerCase(Locale.ROOT).contains("midnightconfigscreen") && this.client != null) {
|
||||
Blur.INSTANCE.onScreenChange(this.client.currentScreen);
|
||||
if (this.client != null && this.title.equals(blurConfig)) {
|
||||
Blur.onScreenChange(this.client.currentScreen);
|
||||
}
|
||||
}
|
||||
@Inject(at = @At("TAIL"), method = "render")
|
||||
private void blur$showScreenTitle(MatrixStack matrixStack, int i, int j, float f, CallbackInfo ci) {
|
||||
if (BlurConfig.showScreenTitle && this.client != null && this.client.currentScreen != null) {
|
||||
this.textRenderer.drawWithShadow(matrixStack, this.client.currentScreen.getClass().getName(), 0, 0, 16777215, true);
|
||||
@Inject(at = @At("HEAD"), method = "renderBackground")
|
||||
public void blur$getBackgroundEnabled(DrawContext context, CallbackInfo ci) {
|
||||
if (this.client != null && this.client.world != null) {
|
||||
Blur.screenHasBackground = true;
|
||||
}
|
||||
}
|
||||
|
||||
@ModifyConstant(
|
||||
method = "renderBackground(Lnet/minecraft/client/util/math/MatrixStack;I)V",
|
||||
method = "renderBackground",
|
||||
constant = @Constant(intValue = -1072689136))
|
||||
private int blur$getFirstBackgroundColor(int color) {
|
||||
return Blur.INSTANCE.getBackgroundColor(false);
|
||||
return Blur.getBackgroundColor(false, true);
|
||||
}
|
||||
|
||||
@ModifyConstant(
|
||||
method = "renderBackground(Lnet/minecraft/client/util/math/MatrixStack;I)V",
|
||||
method = "renderBackground",
|
||||
constant = @Constant(intValue = -804253680))
|
||||
private int blur$getSecondBackgroundColor(int color) {
|
||||
return Blur.INSTANCE.getBackgroundColor(true);
|
||||
return Blur.getBackgroundColor(true, true);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,9 +1,15 @@
|
||||
{
|
||||
"blur.midnightconfig.title": "Blur Konfiguration",
|
||||
"blur.midnightconfig.blurExclusions": "Blur-Ausnahmen",
|
||||
"blur.midnightconfig.category.style": "Stil",
|
||||
"blur.midnightconfig.category.screens": "Bildschirme",
|
||||
"blur.midnightconfig.fadeTimeMillis": "Überblendzeit (in Millisekunden)",
|
||||
"blur.midnightconfig.fadeOutTimeMillis": "Ausblendzeit (in milliseconds)",
|
||||
"blur.midnightconfig.ease": "Geschmeidige Animation",
|
||||
"blur.midnightconfig.radius": "Radius",
|
||||
"blur.midnightconfig.gradientStartColor": "Farbverlauf-Anfangsfarbe",
|
||||
"blur.midnightconfig.gradientEndColor": "Farbverlauf-Endfarbe",
|
||||
"blur.midnightconfig.showScreenTitle": "Zeige Bildschirmtitel"
|
||||
"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"
|
||||
}
|
||||
@@ -1,7 +1,4 @@
|
||||
{
|
||||
"blur.midnightconfig.title": "Blur Config",
|
||||
"blur.midnightconfig.fadeTimeMillis": "Fade Time (in milliseconds)",
|
||||
"blur.midnightconfig.radius": "Radius",
|
||||
"blur.midnightconfig.gradientStartColor": "Gradient Start Colour",
|
||||
"blur.midnightconfig.gradientEndColor": "Gradient End Colour"
|
||||
"blur.midnightconfig.gradientStart": "Gradient Start Colour",
|
||||
"blur.midnightconfig.gradientEnd": "Gradient End Colour"
|
||||
}
|
||||
@@ -1,9 +1,15 @@
|
||||
{
|
||||
"blur.midnightconfig.title": "Blur Config",
|
||||
"blur.midnightconfig.category.style": "Style",
|
||||
"blur.midnightconfig.category.screens": "Screens",
|
||||
"blur.midnightconfig.blurExclusions": "Blur Exclusions",
|
||||
"blur.midnightconfig.fadeTimeMillis": "Fade Time (in milliseconds)",
|
||||
"blur.midnightconfig.fadeOutTimeMillis": "Fade Out Time (in milliseconds)",
|
||||
"blur.midnightconfig.ease": "Ease Animation",
|
||||
"blur.midnightconfig.radius": "Radius",
|
||||
"blur.midnightconfig.gradientStartColor": "Gradient Start Color",
|
||||
"blur.midnightconfig.gradientEndColor": "Gradient End Color",
|
||||
"blur.midnightconfig.showScreenTitle": "Show screen title"
|
||||
"blur.midnightconfig.gradientStart": "Gradient Start Color",
|
||||
"blur.midnightconfig.gradientEnd": "Gradient End Color",
|
||||
"blur.midnightconfig.gradientStartAlpha": "Gradient Start Alpha",
|
||||
"blur.midnightconfig.gradientEndAlpha": "Gradient End Alpha",
|
||||
"blur.midnightconfig.showScreenTitle": "Log screen title"
|
||||
}
|
||||
12
src/main/resources/assets/blur/lang/fr_fr.json
Normal file
12
src/main/resources/assets/blur/lang/fr_fr.json
Normal file
@@ -0,0 +1,12 @@
|
||||
{
|
||||
"blur.midnightconfig.title": "Configuration du flou",
|
||||
"blur.midnightconfig.blurExclusions": "Flouter les exclusions",
|
||||
"blur.midnightconfig.fadeTimeMillis": "Temps de fondu (en millisecondes)",
|
||||
"blur.midnightconfig.ease": "Fluidité de l'animation",
|
||||
"blur.midnightconfig.radius": "Rayon",
|
||||
"blur.midnightconfig.gradientStart": "Couleur de départ du dégradé",
|
||||
"blur.midnightconfig.gradientEnd": "Couleur de fin du dégradé",
|
||||
"blur.midnightconfig.gradientStartAlpha": "Alpha de début du dégradé",
|
||||
"blur.midnightconfig.gradientEndAlpha": "Alpha de fin du dégradé",
|
||||
"blur.midnightconfig.showScreenTitle": "Montrer le titre de l'écran"
|
||||
}
|
||||
11
src/main/resources/assets/blur/lang/ko_kr.json
Normal file
11
src/main/resources/assets/blur/lang/ko_kr.json
Normal file
@@ -0,0 +1,11 @@
|
||||
{
|
||||
"blur.midnightconfig.title": "Blur 설정",
|
||||
"blur.midnightconfig.blurExclusions": "블러 제외",
|
||||
"blur.midnightconfig.fadeTimeMillis": "페이드 시간 (밀리초 단위)",
|
||||
"blur.midnightconfig.radius": "범위",
|
||||
"blur.midnightconfig.gradientStart": "그라디언트 시작 색상",
|
||||
"blur.midnightconfig.gradientEnd": "그라디언트 종료 색상",
|
||||
"blur.midnightconfig.gradientStartAlpha": "그라디언트 시작 알파",
|
||||
"blur.midnightconfig.gradientEndAlpha": "그라디언트 종료 알파",
|
||||
"blur.midnightconfig.showScreenTitle": "화면 타이틀 보기"
|
||||
}
|
||||
@@ -1,8 +1,12 @@
|
||||
{
|
||||
"blur.midnightconfig.title": "Definições de desfoque",
|
||||
"blur.midnightconfig.blurExclusions": "Exclusões de desfoque",
|
||||
"blur.midnightconfig.fadeTimeMillis": "Esmaecimento (em milissegundos)",
|
||||
"blur.midnightconfig.title": "Configuração de desfoque",
|
||||
"blur.midnightconfig.blurExclusions": "Desfocar exclusões",
|
||||
"blur.midnightconfig.fadeTimeMillis": "Tempo de desvanecimento (em milissegundos)",
|
||||
"blur.midnightconfig.ease": "Animação fácil",
|
||||
"blur.midnightconfig.radius": "Raio",
|
||||
"blur.midnightconfig.gradientStartColor": "Cor de início do gradiente",
|
||||
"blur.midnightconfig.gradientEndColor": "Cor de término do gradiente"
|
||||
}
|
||||
"blur.midnightconfig.gradientStart": "Cor inicial do gradiente",
|
||||
"blur.midnightconfig.gradientEnd": "Cor final do gradiente",
|
||||
"blur.midnightconfig.gradientStartAlpha": "Alfa de início gradiente",
|
||||
"blur.midnightconfig.gradientEndAlpha": "Alfa de Gradiente Final",
|
||||
"blur.midnightconfig.showScreenTitle": "Mostrar título da tela"
|
||||
}
|
||||
@@ -3,6 +3,6 @@
|
||||
"blur.midnightconfig.blurExclusions": "Исключения размытия",
|
||||
"blur.midnightconfig.fadeTimeMillis": "Время размытия (в милисекундах)",
|
||||
"blur.midnightconfig.radius": "Радиус размытия",
|
||||
"blur.midnightconfig.gradientStartColor": "Верхний цвет градиента",
|
||||
"blur.midnightconfig.gradientEndColor": "Нижний цвет градиента"
|
||||
"blur.midnightconfig.gradientStart": "Верхний цвет градиента",
|
||||
"blur.midnightconfig.gradientEnd": "Нижний цвет градиента"
|
||||
}
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
"blur.midnightconfig.blurExclusions": "Undantag till Blur",
|
||||
"blur.midnightconfig.fadeTimeMillis": "Toningstid (i millisekunder)",
|
||||
"blur.midnightconfig.radius": "Radie",
|
||||
"blur.midnightconfig.gradientStartColor": "Toningsfärg (start)",
|
||||
"blur.midnightconfig.gradientEndColor": "Toningsfärg (slut)",
|
||||
"blur.midnightconfig.gradientStart": "Toningsfärg (start)",
|
||||
"blur.midnightconfig.gradientEnd": "Toningsfärg (slut)",
|
||||
"blur.midnightconfig.showScreenTitle": "Visa skärmtitel"
|
||||
}
|
||||
12
src/main/resources/assets/blur/lang/uk_ua.json
Normal file
12
src/main/resources/assets/blur/lang/uk_ua.json
Normal file
@@ -0,0 +1,12 @@
|
||||
{
|
||||
"blur.midnightconfig.title": "Конфігурація Blur",
|
||||
"blur.midnightconfig.blurExclusions": "Винятки розмиття",
|
||||
"blur.midnightconfig.fadeTimeMillis": "Час появи розмиття (у мілісекундах)",
|
||||
"blur.midnightconfig.ease": "Пом'якшення анімації",
|
||||
"blur.midnightconfig.radius": "Радіус",
|
||||
"blur.midnightconfig.gradientStart": "Початковий колір градієнта",
|
||||
"blur.midnightconfig.gradientEnd": "Кінцевий колір градієнта",
|
||||
"blur.midnightconfig.gradientStartAlpha": "Початкова прозорість градієнта",
|
||||
"blur.midnightconfig.gradientEndAlpha": "Кінцева прозорість градієнтаa",
|
||||
"blur.midnightconfig.showScreenTitle": "Показати назву екрана"
|
||||
}
|
||||
@@ -1,7 +1,15 @@
|
||||
{
|
||||
"blur.midnightconfig.title": "模糊配置",
|
||||
"blur.midnightconfig.fadeTimeMillis": "淡入时间(毫秒)",
|
||||
"blur.midnightconfig.title": "模糊 (Blur) 配置",
|
||||
"blur.midnightconfig.category.style": "样式",
|
||||
"blur.midnightconfig.category.screens": "屏幕",
|
||||
"blur.midnightconfig.blurExclusions": "模糊排除",
|
||||
"blur.midnightconfig.fadeTimeMillis": "淡入时间(毫秒)",
|
||||
"blur.midnightconfig.fadeOutTimeMillis": "淡出时间(毫秒)",
|
||||
"blur.midnightconfig.ease": "简单动画",
|
||||
"blur.midnightconfig.radius": "半径",
|
||||
"blur.midnightconfig.gradientStartColor": "渐变起始色",
|
||||
"blur.midnightconfig.gradientEndColor": "渐变结束色"
|
||||
"blur.midnightconfig.gradientStart": "渐变起始色",
|
||||
"blur.midnightconfig.gradientEnd": "渐变结束色",
|
||||
"blur.midnightconfig.gradientStartAlpha": "渐变起始阿尔法通道",
|
||||
"blur.midnightconfig.gradientEndAlpha": "渐变结束阿尔法通道",
|
||||
"blur.midnightconfig.showScreenTitle": "显示屏幕标题"
|
||||
}
|
||||
|
||||
@@ -8,20 +8,26 @@
|
||||
"icon": "assets/blur/icon.png",
|
||||
"entrypoints": {
|
||||
"client": [
|
||||
"com.tterrag.blur.Blur::INSTANCE"
|
||||
"com.tterrag.blur.Blur"
|
||||
]
|
||||
},
|
||||
"contact": {
|
||||
"homepage": "https://www.curseforge.com/minecraft/mc-mods/blur-fabric",
|
||||
"homepage": "https://modrinth.com/mod/blur-fabric",
|
||||
"sources": "https://github.com/Motschen/Blur",
|
||||
"issues": "https://github.com/Motschen/Blur/issues"
|
||||
},
|
||||
"authors": [
|
||||
"tterrag1098",
|
||||
"Motschen",
|
||||
"Pyrofab",
|
||||
"Motschen"
|
||||
"backryun",
|
||||
"byquanton"
|
||||
],
|
||||
"description": "Modifies the background behind Minecraft GUIs to have a blur effect",
|
||||
"mixins": [
|
||||
"mixins.blur.json"
|
||||
]
|
||||
],
|
||||
"depends": {
|
||||
"satin": "*"
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,10 +1,12 @@
|
||||
{
|
||||
"required": true,
|
||||
"minVersion": "0.8",
|
||||
"package": "com.tterrag.blur.mixin",
|
||||
"compatibilityLevel": "JAVA_8",
|
||||
"compatibilityLevel": "JAVA_17",
|
||||
"client": [
|
||||
"MixinScreen",
|
||||
"MixinMinecraftClient"
|
||||
"MixinMinecraftClient",
|
||||
"MixinInGameHud"
|
||||
],
|
||||
"injectors": {
|
||||
"defaultRequire": 1
|
||||
|
||||
Reference in New Issue
Block a user