mirror of
https://github.com/Motschen/Blur.git
synced 2025-12-15 19:25:09 +01:00
Compare commits
5 Commits
1.0.5-1.14
...
v2.0.0-1.1
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
432934b056 | ||
|
|
f8a4dd71fd | ||
|
|
d117c98de2 | ||
|
|
fd84d68897 | ||
|
|
7e8194a529 |
18
build.gradle
18
build.gradle
@@ -3,8 +3,8 @@ plugins {
|
||||
id 'maven-publish'
|
||||
id 'idea'
|
||||
id 'eclipse'
|
||||
id 'com.matthewprenger.cursegradle' version '1.0.9'
|
||||
id 'fabric-loom' version '0.2.5-SNAPSHOT'
|
||||
id 'com.matthewprenger.cursegradle' version '1.4.0'
|
||||
id 'fabric-loom' version '0.4-SNAPSHOT'
|
||||
}
|
||||
|
||||
boolean dev = System.getenv('RELEASE') == null || System.getenv('RELEASE').equals('false');
|
||||
@@ -12,7 +12,7 @@ ext.buildnumber = System.getenv().BUILD_NUMBER ?: 'custom';
|
||||
|
||||
group = 'com.tterrag.blur'
|
||||
archivesBaseName = "Blur"
|
||||
version = "${mod_version}-${minecraft_version}[fabric]"
|
||||
version = "${mod_version}-${minecraft_version}+fabric"
|
||||
|
||||
sourceCompatibility = '1.8'
|
||||
targetCompatibility = '1.8'
|
||||
@@ -21,7 +21,7 @@ minecraft {
|
||||
}
|
||||
|
||||
repositories {
|
||||
maven { url 'https://jitpack.io' }
|
||||
jcenter()
|
||||
}
|
||||
|
||||
dependencies {
|
||||
@@ -29,8 +29,14 @@ dependencies {
|
||||
mappings "net.fabricmc:yarn:${mappings_version}"
|
||||
modCompile "net.fabricmc:fabric-loader:${fabric_loader_version}"
|
||||
modCompile "net.fabricmc.fabric-api:fabric-api:${fabric_version}"
|
||||
modCompile "com.github.Ladysnake:Satin:${satin_version}"
|
||||
include "com.github.Ladysnake:Satin:${satin_version}"
|
||||
modCompile "io.github.ladysnake:Satin:${satin_version}"
|
||||
include "io.github.ladysnake:Satin:${satin_version}"
|
||||
|
||||
modImplementation ("me.sargunvohra.mcmods:autoconfig1u:${project.auto_config_version}")
|
||||
include ("me.sargunvohra.mcmods:autoconfig1u:${project.auto_config_version}")
|
||||
modImplementation ("me.shedaniel.cloth:config-2:${project.cloth_config_version}")
|
||||
include ("me.shedaniel.cloth:config-2:${project.cloth_config_version}")
|
||||
modImplementation ("io.github.prospector:modmenu:${project.mod_menu_version}")
|
||||
|
||||
implementation 'com.google.code.findbugs:jsr305:3.0.2'
|
||||
}
|
||||
|
||||
@@ -1,13 +1,17 @@
|
||||
minecraft_version=19w34a
|
||||
minecraft_version=1.16.2
|
||||
|
||||
mod_version=1.0.5
|
||||
mod_version=2.0.0
|
||||
|
||||
fabric_loader_version=0.5.0+build.162
|
||||
fabric_version=0.3.1+build.208
|
||||
mappings_version=19w34a+build.10
|
||||
fabric_loader_version=0.9.1+build.205
|
||||
fabric_version=0.18.0+build.397-1.16
|
||||
mappings_version=1.16.2+build.19
|
||||
|
||||
auto_config_version = 3.2.0-unstable
|
||||
cloth_config_version = 4.7.0-unstable
|
||||
mod_menu_version = 1.14.6+build.31
|
||||
|
||||
# Satin library
|
||||
satin_version = 1.15-SNAPSHOT
|
||||
satin_version = 1.5.1
|
||||
|
||||
project_id=268324
|
||||
release_type=release
|
||||
|
||||
2
gradle/wrapper/gradle-wrapper.properties
vendored
2
gradle/wrapper/gradle-wrapper.properties
vendored
@@ -2,4 +2,4 @@ distributionBase=GRADLE_USER_HOME
|
||||
distributionPath=wrapper/dists
|
||||
zipStoreBase=GRADLE_USER_HOME
|
||||
zipStorePath=wrapper/dists
|
||||
distributionUrl=https\://services.gradle.org/distributions/gradle-5.5.1-all.zip
|
||||
distributionUrl=https\://services.gradle.org/distributions/gradle-6.5-all.zip
|
||||
|
||||
Binary file not shown.
|
Before Width: | Height: | Size: 58 KiB |
Binary file not shown.
|
Before Width: | Height: | Size: 62 KiB |
Binary file not shown.
|
Before Width: | Height: | Size: 60 KiB |
Binary file not shown.
|
Before Width: | Height: | Size: 63 KiB |
@@ -1,67 +0,0 @@
|
||||
{
|
||||
"targets": [
|
||||
"swap"
|
||||
],
|
||||
"passes": [
|
||||
{
|
||||
"name": "fade_in_blur",
|
||||
"intarget": "minecraft:main",
|
||||
"outtarget": "swap",
|
||||
"uniforms": [
|
||||
{
|
||||
"name": "BlurDir",
|
||||
"values": [ 1.0, 0.0 ]
|
||||
},
|
||||
{
|
||||
"name": "Radius",
|
||||
"values": [ @radius@.0 ]
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"name": "fade_in_blur",
|
||||
"intarget": "swap",
|
||||
"outtarget": "minecraft:main",
|
||||
"uniforms": [
|
||||
{
|
||||
"name": "BlurDir",
|
||||
"values": [ 0.0, 1.0 ]
|
||||
},
|
||||
{
|
||||
"name": "Radius",
|
||||
"values": [ @radius@.0 ]
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"name": "fade_in_blur",
|
||||
"intarget": "minecraft:main",
|
||||
"outtarget": "swap",
|
||||
"uniforms": [
|
||||
{
|
||||
"name": "BlurDir",
|
||||
"values": [ 1.0, 0.0 ]
|
||||
},
|
||||
{
|
||||
"name": "Radius",
|
||||
"values": [ @radius@.0 ]
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"name": "fade_in_blur",
|
||||
"intarget": "swap",
|
||||
"outtarget": "minecraft:main",
|
||||
"uniforms": [
|
||||
{
|
||||
"name": "BlurDir",
|
||||
"values": [ 0.0, 1.0 ]
|
||||
},
|
||||
{
|
||||
"name": "Radius",
|
||||
"values": [ @radius@.0 ]
|
||||
}
|
||||
]
|
||||
}
|
||||
]
|
||||
}
|
||||
@@ -1,7 +0,0 @@
|
||||
{
|
||||
"pack": {
|
||||
"_comment": "This pack was made for Blur version @mod_version@",
|
||||
"pack_format": @pack_version@,
|
||||
"description": "@description@"
|
||||
}
|
||||
}
|
||||
@@ -1,22 +0,0 @@
|
||||
{
|
||||
"ultra_lite": {
|
||||
"name": "Ultra Lite",
|
||||
"radius": 2,
|
||||
"description": "Least passes, weakest effect, greatest performance. It's like having a smudge on your glasses."
|
||||
},
|
||||
"lite": {
|
||||
"name": "Lite",
|
||||
"radius": 8,
|
||||
"description": "Less passes, weaker effect, greater performance."
|
||||
},
|
||||
"strong": {
|
||||
"name": "Strong",
|
||||
"radius": 32,
|
||||
"description" : "More passes, stronger effect, lesser performance."
|
||||
},
|
||||
"ultra_strong": {
|
||||
"name": "Ultra Strong",
|
||||
"radius": 64,
|
||||
"description": "Too many passes, strongest effect, worst performance. It's like having Vaseline in your eyes."
|
||||
}
|
||||
}
|
||||
@@ -1,42 +1,25 @@
|
||||
package com.tterrag.blur;
|
||||
|
||||
import com.google.gson.Gson;
|
||||
import com.google.gson.GsonBuilder;
|
||||
import com.tterrag.blur.config.BlurConfig;
|
||||
import ladysnake.satin.api.event.ShaderEffectRenderCallback;
|
||||
import ladysnake.satin.api.experimental.managed.Uniform1f;
|
||||
import ladysnake.satin.api.managed.ManagedShaderEffect;
|
||||
import ladysnake.satin.api.managed.ShaderEffectManager;
|
||||
import ladysnake.satin.api.managed.uniform.Uniform1f;
|
||||
import me.sargunvohra.mcmods.autoconfig1u.AutoConfig;
|
||||
import me.sargunvohra.mcmods.autoconfig1u.serializer.JanksonConfigSerializer;
|
||||
import net.fabricmc.api.ClientModInitializer;
|
||||
import net.fabricmc.loader.api.FabricLoader;
|
||||
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 org.apache.commons.lang3.ArrayUtils;
|
||||
|
||||
import java.io.File;
|
||||
import java.io.FileReader;
|
||||
import java.io.IOException;
|
||||
import java.nio.file.Files;
|
||||
import java.nio.file.StandardOpenOption;
|
||||
|
||||
public class Blur implements ClientModInitializer {
|
||||
public static BlurConfig BLUR_CONFIG;
|
||||
|
||||
public static final String MODID = "blur";
|
||||
public static final String MOD_NAME = "Blur";
|
||||
public static final String VERSION = "@VERSION@";
|
||||
|
||||
static class ConfigJson {
|
||||
String[] blurExclusions = new String[]{ ChatScreen.class.getName() };
|
||||
int fadeTimeMillis = 200;
|
||||
int radius = 8;
|
||||
String gradientStartColor = "75000000";
|
||||
String gradientEndColor = "75000000";
|
||||
}
|
||||
|
||||
private long start;
|
||||
|
||||
public ConfigJson configs = new ConfigJson();
|
||||
public int colorFirst, colorSecond;
|
||||
|
||||
private final ManagedShaderEffect blur = ShaderEffectManager.getInstance().manage(new Identifier(MODID, "shaders/post/fade_in_blur.json"),
|
||||
@@ -47,19 +30,9 @@ public class Blur implements ClientModInitializer {
|
||||
|
||||
@Override
|
||||
public void onInitializeClient() {
|
||||
File configFile = new File(FabricLoader.getInstance().getConfigDirectory(), Blur.MODID + ".json");
|
||||
try {
|
||||
if (!configFile.exists()) {
|
||||
configFile.getParentFile().mkdirs();
|
||||
Files.write(configFile.toPath(), new GsonBuilder().setPrettyPrinting().create().toJson(configs).getBytes(), StandardOpenOption.CREATE_NEW);
|
||||
} else {
|
||||
configs = new Gson().fromJson(new FileReader(configFile), ConfigJson.class);
|
||||
}
|
||||
} catch (IOException e) {
|
||||
throw new RuntimeException(e);
|
||||
}
|
||||
colorFirst = Integer.parseUnsignedInt(configs.gradientStartColor, 16);
|
||||
colorSecond = Integer.parseUnsignedInt(configs.gradientEndColor, 16);
|
||||
AutoConfig.register(BlurConfig.class, JanksonConfigSerializer::new);
|
||||
BLUR_CONFIG = AutoConfig.getConfigHolder(BlurConfig.class).getConfig();
|
||||
|
||||
ShaderEffectRenderCallback.EVENT.register((deltaTick) -> {
|
||||
if (start > 0) {
|
||||
blurProgress.set(getProgress());
|
||||
@@ -68,23 +41,31 @@ public class Blur implements ClientModInitializer {
|
||||
});
|
||||
}
|
||||
|
||||
private boolean doFade = false;
|
||||
public void onScreenChange(Screen newGui) {
|
||||
if (MinecraftClient.getInstance().world != null) {
|
||||
boolean excluded = newGui == null || ArrayUtils.contains(configs.blurExclusions, newGui.getClass().getName());
|
||||
boolean excluded = newGui == null || ArrayUtils.contains(BLUR_CONFIG.blurExclusions, newGui.getClass().getName());
|
||||
if (!excluded) {
|
||||
start = System.currentTimeMillis();
|
||||
blur.setUniformValue("Radius", (float) getRadius());
|
||||
colorFirst = Integer.parseUnsignedInt(BLUR_CONFIG.gradientStartColor, 16);
|
||||
colorSecond = Integer.parseUnsignedInt(BLUR_CONFIG.gradientEndColor, 16);
|
||||
if (doFade == true) {
|
||||
start = System.currentTimeMillis();
|
||||
doFade = false;
|
||||
}
|
||||
} else {
|
||||
start = -1;
|
||||
doFade = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public int getRadius() {
|
||||
return configs.radius;
|
||||
return BLUR_CONFIG.radius;
|
||||
}
|
||||
|
||||
private float getProgress() {
|
||||
return Math.min((System.currentTimeMillis() - start) / (float) configs.fadeTimeMillis, 1);
|
||||
return Math.min((System.currentTimeMillis() - start) / (float) BLUR_CONFIG.fadeTimeMillis, 1);
|
||||
}
|
||||
|
||||
public int getBackgroundColor(boolean second) {
|
||||
|
||||
26
src/main/java/com/tterrag/blur/config/BlurConfig.java
Normal file
26
src/main/java/com/tterrag/blur/config/BlurConfig.java
Normal file
@@ -0,0 +1,26 @@
|
||||
package com.tterrag.blur.config;
|
||||
|
||||
import com.sun.org.apache.xerces.internal.xs.StringList;
|
||||
import me.sargunvohra.mcmods.autoconfig1u.ConfigData;
|
||||
import me.sargunvohra.mcmods.autoconfig1u.ConfigHolder;
|
||||
import me.sargunvohra.mcmods.autoconfig1u.ConfigManager;
|
||||
import me.sargunvohra.mcmods.autoconfig1u.annotation.Config;
|
||||
import me.sargunvohra.mcmods.autoconfig1u.annotation.ConfigEntry;
|
||||
import me.sargunvohra.mcmods.autoconfig1u.gui.registry.DefaultGuiRegistryAccess;
|
||||
import me.shedaniel.clothconfig2.api.ConfigScreen;
|
||||
import net.minecraft.client.gui.screen.ChatScreen;
|
||||
import net.minecraft.util.Identifier;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
@Config(name = "blur")
|
||||
@SuppressWarnings("No GUI provider registered")
|
||||
public class BlurConfig implements ConfigData {
|
||||
@ConfigEntry.Gui.Excluded
|
||||
public String[] blurExclusions = new String[]{ ChatScreen.class.getName() };
|
||||
public int fadeTimeMillis = 200;
|
||||
public int radius = 8;
|
||||
public String gradientStartColor = "75000000";
|
||||
public String gradientEndColor = "75000000";
|
||||
}
|
||||
@@ -0,0 +1,17 @@
|
||||
package com.tterrag.blur.config;
|
||||
|
||||
import io.github.prospector.modmenu.api.ConfigScreenFactory;
|
||||
import io.github.prospector.modmenu.api.ModMenuApi;
|
||||
import me.sargunvohra.mcmods.autoconfig1u.AutoConfig;
|
||||
import net.fabricmc.api.EnvType;
|
||||
import net.fabricmc.api.Environment;
|
||||
|
||||
@Environment(EnvType.CLIENT)
|
||||
@SuppressWarnings("No GUI provider registered")
|
||||
public class ModMenuIntegration implements ModMenuApi {
|
||||
|
||||
@Override
|
||||
public ConfigScreenFactory<?> getModConfigScreenFactory() {
|
||||
return parent -> AutoConfig.getConfigScreen(BlurConfig.class, parent).get();
|
||||
}
|
||||
}
|
||||
@@ -20,7 +20,7 @@ public class MixinMinecraftClient {
|
||||
at = @At(value = "FIELD",
|
||||
target = "Lnet/minecraft/client/MinecraftClient;currentScreen:Lnet/minecraft/client/gui/screen/Screen;",
|
||||
opcode = Opcodes.PUTFIELD))
|
||||
public void onScreenOpen(Screen newScreen, CallbackInfo info) {
|
||||
private void onScreenOpen(Screen newScreen, CallbackInfo info) {
|
||||
Blur.INSTANCE.onScreenChange(newScreen);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -12,16 +12,16 @@ import net.minecraft.client.gui.screen.Screen;
|
||||
public class MixinScreen {
|
||||
|
||||
@ModifyConstant(
|
||||
method = "renderBackground(I)V",
|
||||
method = "renderBackground(Lnet/minecraft/client/util/math/MatrixStack;I)V",
|
||||
constant = @Constant(intValue = -1072689136))
|
||||
public int getFirstBackgroundColor(int color) {
|
||||
private int getFirstBackgroundColor(int color) {
|
||||
return Blur.INSTANCE.getBackgroundColor(false);
|
||||
}
|
||||
|
||||
@ModifyConstant(
|
||||
method = "renderBackground(I)V",
|
||||
method = "renderBackground(Lnet/minecraft/client/util/math/MatrixStack;I)V",
|
||||
constant = @Constant(intValue = -804253680))
|
||||
public int getSecondBackgroundColor(int color) {
|
||||
private int getSecondBackgroundColor(int color) {
|
||||
return Blur.INSTANCE.getBackgroundColor(true);
|
||||
}
|
||||
}
|
||||
|
||||
Binary file not shown.
|
Before Width: | Height: | Size: 182 KiB After Width: | Height: | Size: 18 KiB |
7
src/main/resources/assets/blur/lang/de_de.json
Normal file
7
src/main/resources/assets/blur/lang/de_de.json
Normal file
@@ -0,0 +1,7 @@
|
||||
{
|
||||
"text.autoconfig.blur.title": "Blur Konfiguration",
|
||||
"text.autoconfig.blur.option.fadeTimeMillis": "Überblendzeit (in Millisekunden)",
|
||||
"text.autoconfig.blur.option.radius": "Radius",
|
||||
"text.autoconfig.blur.option.gradientStartColor": "Farbverlauf-Anfangsfarbe",
|
||||
"text.autoconfig.blur.option.gradientEndColor": "Farbverlauf-Endfarbe"
|
||||
}
|
||||
7
src/main/resources/assets/blur/lang/en_gb.json
Normal file
7
src/main/resources/assets/blur/lang/en_gb.json
Normal file
@@ -0,0 +1,7 @@
|
||||
{
|
||||
"text.autoconfig.blur.title": "Blur Config",
|
||||
"text.autoconfig.blur.option.fadeTimeMillis": "Fade Time (in milliseconds)",
|
||||
"text.autoconfig.blur.option.radius": "Radius",
|
||||
"text.autoconfig.blur.option.gradientStartColor": "Gradient Start Colour",
|
||||
"text.autoconfig.blur.option.gradientEndColor": "Gradient End Colour"
|
||||
}
|
||||
@@ -1,3 +1,7 @@
|
||||
{
|
||||
"blur.config.title": "Blur Config"
|
||||
"text.autoconfig.blur.title": "Blur Config",
|
||||
"text.autoconfig.blur.option.fadeTimeMillis": "Fade Time (in milliseconds)",
|
||||
"text.autoconfig.blur.option.radius": "Radius",
|
||||
"text.autoconfig.blur.option.gradientStartColor": "Gradient Start Color",
|
||||
"text.autoconfig.blur.option.gradientEndColor": "Gradient End Color"
|
||||
}
|
||||
@@ -1,28 +1,30 @@
|
||||
{
|
||||
"schemaVersion": 1,
|
||||
"id": "blur",
|
||||
"name": "Blur",
|
||||
"version": "$version",
|
||||
"name": "Blur (Fabric)",
|
||||
"version": "2.0.0",
|
||||
"environment": "client",
|
||||
"license": "MIT",
|
||||
"icon": "assets/blur/icon.png",
|
||||
"entrypoints": {
|
||||
"client": [
|
||||
"com.tterrag.blur.Blur::INSTANCE"
|
||||
],
|
||||
"modmenu": [
|
||||
"com.tterrag.blur.config.ModMenuIntegration"
|
||||
]
|
||||
},
|
||||
"contact": {
|
||||
"homepage": "https://minecraft.curseforge.com/projects/blur",
|
||||
"issues": "https://github.com/tterrag1098/Blur/issues"
|
||||
"homepage": "https://www.curseforge.com/minecraft/mc-mods/blur-fabric",
|
||||
"issues": "https://github.com/Motschen/Blur/issues"
|
||||
},
|
||||
"authors": [
|
||||
"tterrag1098"
|
||||
"tterrag1098",
|
||||
"Pyrofab",
|
||||
"Motschen"
|
||||
],
|
||||
"description": "Modifies the background behind Minecraft GUIs to have a blur effect",
|
||||
"mixins": [
|
||||
"mixins.blur.json"
|
||||
],
|
||||
"custom": {
|
||||
"modmenu:clientsideOnly": true
|
||||
}
|
||||
]
|
||||
}
|
||||
Reference in New Issue
Block a user