2 Commits

Author SHA1 Message Date
Motschen
b944975c9a Blur 2.5.0 - Update to 1.19, Better Exclusions & Colors 2022-06-11 23:28:55 +02:00
byquanton
747188d023 1.19 Update (#45) 2022-06-11 19:40:09 +00:00
17 changed files with 146 additions and 160 deletions

View File

@@ -1,5 +1,5 @@
plugins {
id 'fabric-loom' version '0.11-SNAPSHOT'
id 'fabric-loom' version '0.12-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()
}
}
}

View File

@@ -2,18 +2,18 @@
org.gradle.jvmargs=-Xmx1G
# Fabric Properties
# check these on https://fabricmc.net/use
minecraft_version=1.18.2
yarn_mappings=1.18.2+build.1
loader_version=0.13.3
# check these on https://fabricmc.net/develop
minecraft_version=1.19
yarn_mappings=1.19+build.1
loader_version=0.14.6
# Mod Properties
mod_version = 2.4.2
mod_version = 2.5.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.47.9+1.18.2
satin_version = 1.7.2
midnightlib_version=0.4.0
fabric_version=0.55.1+1.19
satin_version = 1.8.0
midnightlib_version=0.5.2

View File

@@ -1,5 +1,5 @@
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-7.3.3-bin.zip
distributionUrl=https\://services.gradle.org/distributions/gradle-7.4.2-bin.zip
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists

178
gradlew.bat vendored
View File

@@ -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

View File

@@ -1,6 +1,5 @@
pluginManagement {
repositories {
jcenter()
maven {
name = 'Fabric'
url = 'https://maven.fabricmc.net/'

View File

@@ -1,6 +1,7 @@
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;
@@ -20,7 +21,6 @@ public class Blur implements ClientModInitializer {
public static List<String> defaultExclusions = new ArrayList<>();
private long start;
public int colorFirst, colorSecond;
private final ManagedShaderEffect blur = ShaderEffectManager.getInstance().manage(new Identifier(MODID, "shaders/post/fade_in_blur.json"),
shader -> shader.setUniformValue("Radius", (float) BlurConfig.radius));
@@ -48,11 +48,10 @@ public class Blur implements ClientModInitializer {
private boolean doFade = false;
public void onScreenChange(Screen newGui) {
if (MinecraftClient.getInstance().world != null) {
boolean excluded = newGui == null || BlurConfig.blurExclusions.contains(newGui.getClass().getName());
boolean excluded = newGui == null || BlurConfig.blurExclusions.stream().anyMatch(exclusion -> newGui.getClass().getName().contains(exclusion));
if (!excluded) {
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;
@@ -69,11 +68,11 @@ public class Blur implements ClientModInitializer {
}
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;
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 = INSTANCE.getProgress();
a *= prog;
r *= prog;

View File

@@ -12,10 +12,14 @@ public class BlurConfig extends MidnightConfig {
public static int fadeTimeMillis = 200;
@Entry(min = 0, max = 500, width = 3)
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(isColor = true, width = 7, min = 7)
public static String gradientStart = "#000000";
@Entry(min = 0, max = 255)
public static int gradientStartAlpha = 75;
@Entry(isColor = true, width = 7, min = 7)
public static String gradientEnd = "#000000";
@Entry(min = 0, max = 255)
public static int gradientEndAlpha = 75;
@Entry
public static boolean showScreenTitle = false;
}

View File

@@ -34,12 +34,6 @@ public abstract class MixinScreen {
Blur.INSTANCE.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);
}
}
@ModifyConstant(
method = "renderBackground(Lnet/minecraft/client/util/math/MatrixStack;I)V",

View File

@@ -5,5 +5,7 @@
"blur.midnightconfig.radius": "Radius",
"blur.midnightconfig.gradientStartColor": "Farbverlauf-Anfangsfarbe",
"blur.midnightconfig.gradientEndColor": "Farbverlauf-Endfarbe",
"blur.midnightconfig.gradientStartAlpha": "Farbverlauf-Anfangstransparenz",
"blur.midnightconfig.gradientEndAlpha": "Farbverlauf-Endstransparenz",
"blur.midnightconfig.showScreenTitle": "Zeige Bildschirmtitel"
}

View File

@@ -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"
}

View File

@@ -3,7 +3,9 @@
"blur.midnightconfig.blurExclusions": "Blur Exclusions",
"blur.midnightconfig.fadeTimeMillis": "Fade Time (in milliseconds)",
"blur.midnightconfig.radius": "Radius",
"blur.midnightconfig.gradientStartColor": "Gradient Start Color",
"blur.midnightconfig.gradientEndColor": "Gradient End Color",
"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": "Show screen title"
}

View File

@@ -3,6 +3,6 @@
"blur.midnightconfig.blurExclusions": "Exclusões de desfoque",
"blur.midnightconfig.fadeTimeMillis": "Esmaecimento (em milissegundos)",
"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 de início do gradiente",
"blur.midnightconfig.gradientEnd": "Cor de término do gradiente"
}

View File

@@ -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": "Нижний цвет градиента"
}

View File

@@ -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"
}

View File

@@ -2,6 +2,6 @@
"blur.midnightconfig.title": "模糊配置",
"blur.midnightconfig.fadeTimeMillis": "淡入时间(毫秒)",
"blur.midnightconfig.radius": "半径",
"blur.midnightconfig.gradientStartColor": "渐变起始色",
"blur.midnightconfig.gradientEndColor": "渐变结束色"
"blur.midnightconfig.gradientStart": "渐变起始色",
"blur.midnightconfig.gradientEnd": "渐变结束色"
}

View File

@@ -13,13 +13,15 @@
},
"contact": {
"homepage": "https://www.curseforge.com/minecraft/mc-mods/blur-fabric",
"sources": "https://github.com/Motschen/Blur",
"issues": "https://github.com/Motschen/Blur/issues"
},
"authors": [
"tterrag1098",
"Pyrofab",
"Motschen",
"backryun"
"backryun",
"byquanton"
],
"description": "Modifies the background behind Minecraft GUIs to have a blur effect",
"mixins": [

View File

@@ -1,7 +1,8 @@
{
"required": true,
"minVersion": "0.8",
"package": "com.tterrag.blur.mixin",
"compatibilityLevel": "JAVA_8",
"compatibilityLevel": "JAVA_17",
"client": [
"MixinScreen",
"MixinMinecraftClient"