mirror of
https://github.com/Motschen/Blur.git
synced 2025-12-15 11:15:09 +01:00
Architectury port, EMI compat
This commit is contained in:
47
.gitignore
vendored
47
.gitignore
vendored
@@ -1,29 +1,20 @@
|
|||||||
/download
|
build/
|
||||||
/eclipseBin
|
*.ipr
|
||||||
|
run/
|
||||||
|
*.iws
|
||||||
|
out/
|
||||||
|
*.iml
|
||||||
|
.gradle/
|
||||||
|
output/
|
||||||
|
bin/
|
||||||
|
libs/
|
||||||
|
|
||||||
## gradle
|
.classpath
|
||||||
/.gradle
|
.project
|
||||||
/build
|
.idea/
|
||||||
|
classes/
|
||||||
## ForgeGradle
|
.metadata
|
||||||
/run
|
.vscode
|
||||||
/*.launch
|
.settings
|
||||||
|
*.launch
|
||||||
## eclipse
|
.architectury-transformer/debug.log
|
||||||
/eclipse
|
|
||||||
/.settings
|
|
||||||
/.metadata
|
|
||||||
/.classpath
|
|
||||||
/.project
|
|
||||||
/bin
|
|
||||||
|
|
||||||
## intellij
|
|
||||||
/out
|
|
||||||
/.idea
|
|
||||||
/*.iml
|
|
||||||
/*.ipr
|
|
||||||
/*.iws
|
|
||||||
/atlassian-ide-plugin.xml
|
|
||||||
|
|
||||||
## gedit
|
|
||||||
*~
|
|
||||||
|
|||||||
170
build.gradle
170
build.gradle
@@ -1,131 +1,73 @@
|
|||||||
|
import groovy.json.JsonSlurper
|
||||||
|
import groovy.json.JsonOutput
|
||||||
|
|
||||||
plugins {
|
plugins {
|
||||||
id 'fabric-loom' version '1.6-SNAPSHOT'
|
id "architectury-plugin" version "3.4-SNAPSHOT"
|
||||||
id 'maven-publish'
|
id "dev.architectury.loom" version "1.7-SNAPSHOT" apply false
|
||||||
id "me.shedaniel.unified-publishing" version "0.1.+"
|
id "me.shedaniel.unified-publishing" version "0.1.+" apply false
|
||||||
|
id 'com.github.johnrengelman.shadow' version '8.1.1' apply false
|
||||||
}
|
}
|
||||||
|
|
||||||
sourceCompatibility = JavaVersion.VERSION_21
|
architectury {
|
||||||
targetCompatibility = JavaVersion.VERSION_21
|
minecraft = rootProject.minecraft_version
|
||||||
|
}
|
||||||
|
|
||||||
archivesBaseName = project.archives_base_name
|
subprojects {
|
||||||
version = project.mod_version
|
apply plugin: "dev.architectury.loom"
|
||||||
group = project.maven_group
|
repositories {
|
||||||
|
maven {
|
||||||
repositories {
|
url = "https://api.modrinth.com/maven"
|
||||||
maven {
|
|
||||||
name = 'Ladysnake Mods'
|
|
||||||
url = 'https://maven.ladysnake.org/releases'
|
|
||||||
content {
|
|
||||||
includeGroup 'org.ladysnake'
|
|
||||||
includeGroupByRegex 'dev\\.onyxstudios.*'
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
maven {
|
|
||||||
url = 'https://maven.terraformersmc.com/releases'
|
|
||||||
content {
|
|
||||||
includeGroup 'com.terraformersmc'
|
|
||||||
}
|
|
||||||
}
|
|
||||||
maven {
|
|
||||||
url = "https://api.modrinth.com/maven"
|
|
||||||
}
|
|
||||||
flatDir {
|
|
||||||
dirs("localMaven")
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
dependencies {
|
dependencies {
|
||||||
minecraft "com.mojang:minecraft:${project.minecraft_version}"
|
minecraft "com.mojang:minecraft:${rootProject.minecraft_version}"
|
||||||
mappings "net.fabricmc:yarn:${project.yarn_mappings}:v2"
|
// The following line declares the yarn mappings you may select this one as well.
|
||||||
modImplementation "net.fabricmc:fabric-loader:${project.loader_version}"
|
mappings loom.layered {
|
||||||
|
it.mappings("net.fabricmc:yarn:$rootProject.yarn_mappings:v2")
|
||||||
modImplementation "net.fabricmc.fabric-api:fabric-api:${project.fabric_version}"
|
it.mappings("dev.architectury:yarn-mappings-patch-neoforge:$rootProject.yarn_mappings_patch_neoforge_version")
|
||||||
//modImplementation "org.ladysnake:satin:${satin_version}"
|
|
||||||
//include "org.ladysnake:satin:${satin_version}"
|
|
||||||
|
|
||||||
implementation 'com.google.code.findbugs:jsr305:3.0.2'
|
|
||||||
modImplementation "maven.modrinth:midnightlib:${project.midnightlib_version}"
|
|
||||||
include "maven.modrinth:midnightlib:${project.midnightlib_version}"
|
|
||||||
}
|
|
||||||
|
|
||||||
processResources {
|
|
||||||
inputs.property "version", project.version
|
|
||||||
|
|
||||||
filesMatching("fabric.mod.json") {
|
|
||||||
expand "version": project.version
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
tasks.withType(JavaCompile).configureEach {
|
|
||||||
// Minecraft 1.20.5 upwards uses Java 21.
|
|
||||||
it.options.release = 21
|
|
||||||
}
|
|
||||||
|
|
||||||
java {
|
|
||||||
withSourcesJar()
|
|
||||||
}
|
|
||||||
|
|
||||||
jar {
|
|
||||||
from "LICENSE"
|
|
||||||
}
|
|
||||||
|
|
||||||
// configure the maven publication
|
|
||||||
publishing {
|
|
||||||
publications {
|
|
||||||
mavenJava(MavenPublication) {
|
|
||||||
from components.java
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
ext {
|
allprojects {
|
||||||
releaseChangelog = {
|
apply plugin: "java"
|
||||||
def changes = new StringBuilder()
|
apply plugin: "architectury-plugin"
|
||||||
changes << "## Blur+ v$project.version for $project.minecraft_version\n[View the changelog](https://www.github.com/Motschen/Blur/commits/)"
|
apply plugin: "maven-publish"
|
||||||
def proc = "git log --max-count=1 --pretty=format:%s".execute()
|
|
||||||
proc.in.eachLine { line ->
|
archivesBaseName = rootProject.archives_base_name
|
||||||
def processedLine = line.toString()
|
version = rootProject.mod_version
|
||||||
if (!processedLine.contains("New translations") && !processedLine.contains("Merge") && !processedLine.contains("branch")) {
|
group = rootProject.maven_group
|
||||||
changes << "\n- ${processedLine.capitalize()}"
|
|
||||||
|
tasks.withType(JavaCompile) {
|
||||||
|
options.encoding = "UTF-8"
|
||||||
|
options.release = 21
|
||||||
|
}
|
||||||
|
ext {
|
||||||
|
releaseChangelog = {
|
||||||
|
def changes = new StringBuilder()
|
||||||
|
changes << "## Blur+ v$project.version for $project.minecraft_version\n[View the changelog](https://www.github.com/Motschen/Blur/commits/)"
|
||||||
|
def proc = "git log --max-count=1 --pretty=format:%s".execute()
|
||||||
|
proc.in.eachLine { line ->
|
||||||
|
def processedLine = line.toString()
|
||||||
|
if (!processedLine.contains("New translations") && !processedLine.contains("Merge") && !processedLine.contains("branch")) {
|
||||||
|
changes << "\n- ${processedLine.capitalize()}"
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
proc.waitFor()
|
||||||
|
return changes.toString()
|
||||||
}
|
}
|
||||||
proc.waitFor()
|
|
||||||
return changes.toString()
|
|
||||||
}
|
}
|
||||||
}
|
processResources {
|
||||||
|
// Minify json resources
|
||||||
unifiedPublishing {
|
doLast {
|
||||||
project {
|
fileTree(dir: outputs.files.asPath, include: "**/*.json").each {
|
||||||
displayName = "Blur+ $project.version - Fabric $project.minecraft_version"
|
File file -> file.text = JsonOutput.toJson(new JsonSlurper().parse(file))
|
||||||
releaseType = "$project.release_type"
|
|
||||||
changelog = releaseChangelog()
|
|
||||||
gameVersions = []
|
|
||||||
gameLoaders = ["fabric","quilt"]
|
|
||||||
mainPublication remapJar
|
|
||||||
relations {
|
|
||||||
includes {
|
|
||||||
curseforge = "midnightlib"
|
|
||||||
modrinth = "midnightlib"
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
var CURSEFORGE_TOKEN = project.findProperty("CURSEFORGE_TOKEN") ?: System.getenv("CURSEFORGE_TOKEN")
|
|
||||||
if (CURSEFORGE_TOKEN != null) {
|
|
||||||
curseforge {
|
|
||||||
token = CURSEFORGE_TOKEN
|
|
||||||
id = rootProject.curseforge_id
|
|
||||||
gameVersions.addAll "Java 21", project.minecraft_version
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
var MODRINTH_TOKEN = project.findProperty("MODRINTH_TOKEN") ?: System.getenv("MODRINTH_TOKEN")
|
|
||||||
if (MODRINTH_TOKEN != null) {
|
|
||||||
modrinth {
|
|
||||||
token = MODRINTH_TOKEN
|
|
||||||
id = rootProject.modrinth_id
|
|
||||||
version = "$project.version"
|
|
||||||
gameVersions.addAll project.minecraft_version
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
java {
|
||||||
|
withSourcesJar()
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|||||||
25
common/build.gradle
Normal file
25
common/build.gradle
Normal file
@@ -0,0 +1,25 @@
|
|||||||
|
architectury {
|
||||||
|
common(rootProject.enabled_platforms.split(","))
|
||||||
|
}
|
||||||
|
|
||||||
|
dependencies {
|
||||||
|
// We depend on fabric loader here to use the fabric @Environment annotations and get the mixin dependencies
|
||||||
|
// Do NOT use other classes from fabric loader
|
||||||
|
modImplementation "net.fabricmc:fabric-loader:${rootProject.fabric_loader_version}"
|
||||||
|
modCompileOnly "maven.modrinth:midnightlib:${rootProject.midnightlib_version}-fabric"
|
||||||
|
modCompileOnly "maven.modrinth:emi:${rootProject.emi_version}+fabric"
|
||||||
|
}
|
||||||
|
|
||||||
|
publishing {
|
||||||
|
publications {
|
||||||
|
mavenCommon(MavenPublication) {
|
||||||
|
artifactId = rootProject.archives_base_name
|
||||||
|
from components.java
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// See https://docs.gradle.org/current/userguide/publishing_maven.html for information on how to set up publishing.
|
||||||
|
repositories {
|
||||||
|
// Add repositories to publish to here.
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -3,36 +3,20 @@ package eu.midnightdust.blur;
|
|||||||
import eu.midnightdust.blur.config.BlurConfig;
|
import eu.midnightdust.blur.config.BlurConfig;
|
||||||
import eu.midnightdust.blur.util.RainbowColor;
|
import eu.midnightdust.blur.util.RainbowColor;
|
||||||
import eu.midnightdust.lib.util.MidnightColorUtil;
|
import eu.midnightdust.lib.util.MidnightColorUtil;
|
||||||
import net.fabricmc.api.ClientModInitializer;
|
|
||||||
import net.fabricmc.fabric.api.client.event.lifecycle.v1.ClientTickEvents;
|
|
||||||
import net.minecraft.client.gui.DrawContext;
|
import net.minecraft.client.gui.DrawContext;
|
||||||
import org.joml.Math;
|
import org.joml.Math;
|
||||||
|
import org.joml.Matrix4f;
|
||||||
|
|
||||||
import java.awt.*;
|
import java.awt.Color;
|
||||||
import java.lang.Double;
|
import java.lang.Double;
|
||||||
|
|
||||||
|
import static eu.midnightdust.blur.BlurInfo.*;
|
||||||
import static eu.midnightdust.blur.util.RainbowColor.hue;
|
import static eu.midnightdust.blur.util.RainbowColor.hue;
|
||||||
import static eu.midnightdust.blur.util.RainbowColor.hue2;
|
import static eu.midnightdust.blur.util.RainbowColor.hue2;
|
||||||
|
|
||||||
public class Blur implements ClientModInitializer {
|
public class Blur {
|
||||||
|
public static void init() {
|
||||||
public static long start;
|
|
||||||
public static float progress;
|
|
||||||
|
|
||||||
public static boolean prevScreenHasBlur;
|
|
||||||
public static boolean screenHasBlur;
|
|
||||||
|
|
||||||
public static boolean prevScreenHasBackground;
|
|
||||||
public static boolean screenHasBackground;
|
|
||||||
|
|
||||||
public static boolean doTest = true;
|
|
||||||
public static boolean screenChanged = true;
|
|
||||||
public static long lastScreenChange = System.currentTimeMillis();
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void onInitializeClient() {
|
|
||||||
BlurConfig.init("blur", BlurConfig.class);
|
BlurConfig.init("blur", BlurConfig.class);
|
||||||
ClientTickEvents.END_CLIENT_TICK.register(RainbowColor::tick);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public static boolean doFade = false;
|
public static boolean doFade = false;
|
||||||
@@ -66,7 +50,7 @@ public class Blur implements ClientModInitializer {
|
|||||||
x = BlurConfig.animationCurve.apply(x, fadeIn);
|
x = BlurConfig.animationCurve.apply(x, fadeIn);
|
||||||
x = Math.clamp(0, 1, x);
|
x = Math.clamp(0, 1, x);
|
||||||
|
|
||||||
Blur.progress = Double.valueOf(x).floatValue();
|
progress = Double.valueOf(x).floatValue();
|
||||||
}
|
}
|
||||||
|
|
||||||
public static int getBackgroundColor(boolean second) {
|
public static int getBackgroundColor(boolean second) {
|
||||||
@@ -91,10 +75,11 @@ public class Blur implements ClientModInitializer {
|
|||||||
float diagonal = Math.sqrt((float) width*width + height*height);
|
float diagonal = Math.sqrt((float) width*width + height*height);
|
||||||
int smallestDimension = Math.min(width, height);
|
int smallestDimension = Math.min(width, height);
|
||||||
|
|
||||||
context.getMatrices().peek().getPositionMatrix().rotationZ(Math.toRadians(getRotation()));
|
Matrix4f posMatrix = context.getMatrices().peek().getPositionMatrix();
|
||||||
context.getMatrices().peek().getPositionMatrix().setTranslation(width / 2f, height / 2f, 0); // Make the gradient's center the pivot point
|
posMatrix.rotationZ(Math.toRadians(getRotation()));
|
||||||
context.getMatrices().peek().getPositionMatrix().scale(diagonal / smallestDimension); // Scales the gradient to the maximum diagonal value needed
|
posMatrix.setTranslation(width / 2f, height / 2f, 0); // 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
|
context.fillGradient(-width / 2, -height / 2, width / 2, height / 2, Blur.getBackgroundColor(false), Blur.getBackgroundColor(true)); // Actually draw the gradient
|
||||||
context.getMatrices().peek().getPositionMatrix().rotationZ(0);
|
posMatrix.rotationZ(0);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
28
common/src/main/java/eu/midnightdust/blur/BlurInfo.java
Normal file
28
common/src/main/java/eu/midnightdust/blur/BlurInfo.java
Normal file
@@ -0,0 +1,28 @@
|
|||||||
|
package eu.midnightdust.blur;
|
||||||
|
|
||||||
|
public class BlurInfo {
|
||||||
|
public static long start;
|
||||||
|
public static float progress;
|
||||||
|
|
||||||
|
public static boolean prevScreenHasBlur;
|
||||||
|
public static boolean screenHasBlur;
|
||||||
|
|
||||||
|
public static boolean prevScreenHasBackground;
|
||||||
|
public static boolean screenHasBackground;
|
||||||
|
|
||||||
|
public static boolean doTest = true;
|
||||||
|
public static boolean screenChanged = true;
|
||||||
|
public static long lastScreenChange = System.currentTimeMillis();
|
||||||
|
|
||||||
|
public static void reset() {
|
||||||
|
// Here, we reset all tests, to check if the new screen has blur and/or a background
|
||||||
|
prevScreenHasBlur = screenHasBlur;
|
||||||
|
prevScreenHasBackground = screenHasBackground;
|
||||||
|
screenHasBlur = false;
|
||||||
|
screenHasBackground = false;
|
||||||
|
doTest = true;
|
||||||
|
screenChanged = true;
|
||||||
|
start = -1;
|
||||||
|
lastScreenChange = System.currentTimeMillis();
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -11,9 +11,10 @@ import static java.lang.Math.*;
|
|||||||
public class BlurConfig extends MidnightConfig {
|
public class BlurConfig extends MidnightConfig {
|
||||||
public static final String ANIMATIONS = "animations";
|
public static final String ANIMATIONS = "animations";
|
||||||
public static final String STYLE = "style";
|
public static final String STYLE = "style";
|
||||||
|
public static final String SCREENS = "screens";
|
||||||
@Entry @Hidden public static int configVersion = 2;
|
@Entry @Hidden public static int configVersion = 2;
|
||||||
|
|
||||||
@Entry(category = STYLE)
|
@Entry(category = SCREENS)
|
||||||
public static boolean blurContainers = true;
|
public static boolean blurContainers = true;
|
||||||
@Entry(category = ANIMATIONS, min = 0, max = 2000, isSlider = true)
|
@Entry(category = ANIMATIONS, min = 0, max = 2000, isSlider = true)
|
||||||
public static int fadeTimeMillis = 300;
|
public static int fadeTimeMillis = 300;
|
||||||
@@ -35,12 +36,16 @@ public class BlurConfig extends MidnightConfig {
|
|||||||
public static int gradientRotation = 0;
|
public static int gradientRotation = 0;
|
||||||
@Entry(category = STYLE)
|
@Entry(category = STYLE)
|
||||||
public static boolean rainbowMode = false;
|
public static boolean rainbowMode = false;
|
||||||
@Entry(category = STYLE)
|
@Entry(category = SCREENS) // Screens where Blur+ should not apply transition effects (mostly dynamically blurred screens)
|
||||||
public static List<String> excludedScreens = Lists.newArrayList("net.irisshaders.iris.gui.screen.ShaderPackScreen");
|
public static List<String> excludedScreens = Lists.newArrayList("net.irisshaders.iris.gui.screen.ShaderPackScreen");
|
||||||
|
@Entry(category = SCREENS) // Screens where the vanilla blur effect should be force enabled
|
||||||
|
public static List<String> forceEnabledScreens = Lists.newArrayList();
|
||||||
|
@Entry(category = SCREENS) // Screens where the vanilla blur effect should be force disabled
|
||||||
|
public static List<String> forceDisabledScreens = Lists.newArrayList();
|
||||||
|
|
||||||
public enum Easing {
|
public enum Easing {
|
||||||
// Based on https://gist.github.com/dev-hydrogen/21a66f83f0386123e0c0acf107254843
|
// Based on https://gist.github.com/dev-hydrogen/21a66f83f0386123e0c0acf107254843
|
||||||
// Thanks you very much!
|
// Thank you very much!
|
||||||
|
|
||||||
FLAT(x -> x, x -> x),
|
FLAT(x -> x, x -> x),
|
||||||
SINE(x -> 1 - cos(x * PI) / 2, x -> sin(x * PI) / 2),
|
SINE(x -> 1 - cos(x * PI) / 2, x -> sin(x * PI) / 2),
|
||||||
@@ -0,0 +1,57 @@
|
|||||||
|
/*
|
||||||
|
* Copyright © 2021 LambdAurora <aurora42lambda@gmail.com>
|
||||||
|
*
|
||||||
|
* This file is part of midnightcontrols.
|
||||||
|
*
|
||||||
|
* Licensed under the MIT license. For more information,
|
||||||
|
* see the LICENSE file.
|
||||||
|
*/
|
||||||
|
|
||||||
|
package eu.midnightdust.blur.mixin;
|
||||||
|
|
||||||
|
import eu.midnightdust.lib.util.PlatformFunctions;
|
||||||
|
import org.objectweb.asm.tree.ClassNode;
|
||||||
|
import org.spongepowered.asm.mixin.extensibility.IMixinConfigPlugin;
|
||||||
|
import org.spongepowered.asm.mixin.extensibility.IMixinInfo;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
import java.util.Set;
|
||||||
|
|
||||||
|
public class BlurMixinPlugin implements IMixinConfigPlugin {
|
||||||
|
private String mixinPackage;
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onLoad(String mixinPackage) {
|
||||||
|
this.mixinPackage = mixinPackage + ".";
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String getRefMapperConfig() {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean shouldApplyMixin(String targetClassName, String mixinClassName) {
|
||||||
|
final String mixinName = mixinClassName.substring(this.mixinPackage.length());
|
||||||
|
final String packageName = mixinName.substring(0, mixinName.lastIndexOf('.'));
|
||||||
|
|
||||||
|
if (packageName.startsWith("emi") && !PlatformFunctions.isModLoaded("emi"))
|
||||||
|
return false;
|
||||||
|
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void acceptTargets(Set<String> myTargets, Set<String> otherTargets) {}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public List<String> getMixins() {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void preApply(String targetClassName, ClassNode targetClass, String mixinClassName, IMixinInfo mixinInfo) {}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void postApply(String targetClassName, ClassNode targetClass, String mixinClassName, IMixinInfo mixinInfo) {}
|
||||||
|
}
|
||||||
@@ -1,6 +1,7 @@
|
|||||||
package eu.midnightdust.blur.mixin;
|
package eu.midnightdust.blur.mixin;
|
||||||
|
|
||||||
import eu.midnightdust.blur.Blur;
|
import eu.midnightdust.blur.Blur;
|
||||||
|
import eu.midnightdust.blur.BlurInfo;
|
||||||
import net.minecraft.client.render.GameRenderer;
|
import net.minecraft.client.render.GameRenderer;
|
||||||
import org.spongepowered.asm.mixin.Mixin;
|
import org.spongepowered.asm.mixin.Mixin;
|
||||||
import org.spongepowered.asm.mixin.injection.At;
|
import org.spongepowered.asm.mixin.injection.At;
|
||||||
@@ -10,8 +11,8 @@ import org.spongepowered.asm.mixin.injection.ModifyVariable;
|
|||||||
public class MixinGameRenderer {
|
public class MixinGameRenderer {
|
||||||
@ModifyVariable(method = "renderBlur", at = @At("STORE"), ordinal = 1)
|
@ModifyVariable(method = "renderBlur", at = @At("STORE"), ordinal = 1)
|
||||||
private float blur$modifyRadius(float radius) { // Modify the radius based on the animation progress
|
private float blur$modifyRadius(float radius) { // Modify the radius based on the animation progress
|
||||||
if (!Blur.screenChanged && Blur.start >= 0) // Only update the progress after all tests have been completed
|
if (!BlurInfo.screenChanged && BlurInfo.start >= 0) // Only update the progress after all tests have been completed
|
||||||
Blur.updateProgress(Blur.screenHasBlur);
|
Blur.updateProgress(BlurInfo.screenHasBlur);
|
||||||
return radius * Blur.progress;
|
return radius * BlurInfo.progress;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -1,6 +1,7 @@
|
|||||||
package eu.midnightdust.blur.mixin;
|
package eu.midnightdust.blur.mixin;
|
||||||
|
|
||||||
import eu.midnightdust.blur.Blur;
|
import eu.midnightdust.blur.Blur;
|
||||||
|
import eu.midnightdust.blur.BlurInfo;
|
||||||
import net.minecraft.client.MinecraftClient;
|
import net.minecraft.client.MinecraftClient;
|
||||||
import net.minecraft.client.gui.DrawContext;
|
import net.minecraft.client.gui.DrawContext;
|
||||||
import net.minecraft.client.gui.hud.InGameHud;
|
import net.minecraft.client.gui.hud.InGameHud;
|
||||||
@@ -18,13 +19,13 @@ public class MixinInGameHud {
|
|||||||
|
|
||||||
@Inject(at = @At("TAIL"), method = "render")
|
@Inject(at = @At("TAIL"), method = "render")
|
||||||
public void blur$renderFadeOut(DrawContext context, RenderTickCounter tickCounter, CallbackInfo ci) { // Adds a fade-out effect when a player is in a world and closes all screens
|
public void blur$renderFadeOut(DrawContext context, RenderTickCounter tickCounter, CallbackInfo ci) { // Adds a fade-out effect when a player is in a world and closes all screens
|
||||||
if (client.currentScreen == null && client.world != null && Blur.start >= 0 && Blur.prevScreenHasBlur) {
|
if (client.currentScreen == null && client.world != null && BlurInfo.start >= 0 && BlurInfo.prevScreenHasBlur) {
|
||||||
Blur.doTest = false;
|
BlurInfo.doTest = false;
|
||||||
Blur.screenChanged = false;
|
BlurInfo.screenChanged = false;
|
||||||
this.client.gameRenderer.renderBlur(tickCounter.getTickDelta(true));
|
this.client.gameRenderer.renderBlur(tickCounter.getTickDelta(true));
|
||||||
this.client.getFramebuffer().beginWrite(false);
|
this.client.getFramebuffer().beginWrite(false);
|
||||||
|
|
||||||
if (Blur.prevScreenHasBackground) Blur.renderRotatedGradient(context, client.getWindow().getScaledWidth(), client.getWindow().getScaledHeight());
|
if (BlurInfo.prevScreenHasBackground) Blur.renderRotatedGradient(context, client.getWindow().getScaledWidth(), client.getWindow().getScaledHeight());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -1,6 +1,7 @@
|
|||||||
package eu.midnightdust.blur.mixin;
|
package eu.midnightdust.blur.mixin;
|
||||||
|
|
||||||
import eu.midnightdust.blur.Blur;
|
import eu.midnightdust.blur.Blur;
|
||||||
|
import eu.midnightdust.blur.BlurInfo;
|
||||||
import org.objectweb.asm.Opcodes;
|
import org.objectweb.asm.Opcodes;
|
||||||
import org.spongepowered.asm.mixin.Mixin;
|
import org.spongepowered.asm.mixin.Mixin;
|
||||||
import org.spongepowered.asm.mixin.injection.At;
|
import org.spongepowered.asm.mixin.injection.At;
|
||||||
@@ -18,17 +19,10 @@ public class MixinMinecraftClient {
|
|||||||
target = "Lnet/minecraft/client/MinecraftClient;currentScreen:Lnet/minecraft/client/gui/screen/Screen;",
|
target = "Lnet/minecraft/client/MinecraftClient;currentScreen:Lnet/minecraft/client/gui/screen/Screen;",
|
||||||
opcode = Opcodes.PUTFIELD))
|
opcode = Opcodes.PUTFIELD))
|
||||||
private void blur$onScreenOpen(Screen newScreen, CallbackInfo info) {
|
private void blur$onScreenOpen(Screen newScreen, CallbackInfo info) {
|
||||||
if (Blur.lastScreenChange < System.currentTimeMillis() - 100) { // For some reason, in certain scenarios the screen is set to a new one multiple times in a tick. We want to avoid that.
|
if (BlurInfo.lastScreenChange < System.currentTimeMillis() - 100) { // For some reason, in certain scenarios the screen is set to a new one multiple times in a tick. We want to avoid that.
|
||||||
|
|
||||||
// Here, we reset all tests, to check if the new screen has blur and/or a background
|
// Here, we reset all tests, to check if the new screen has blur and/or a background
|
||||||
Blur.prevScreenHasBlur = Blur.screenHasBlur;
|
BlurInfo.reset();
|
||||||
Blur.prevScreenHasBackground = Blur.screenHasBackground;
|
|
||||||
Blur.screenHasBlur = false;
|
|
||||||
Blur.screenHasBackground = false;
|
|
||||||
Blur.doTest = true;
|
|
||||||
Blur.screenChanged = true;
|
|
||||||
Blur.start = -1;
|
|
||||||
Blur.lastScreenChange = System.currentTimeMillis();
|
|
||||||
|
|
||||||
// Manually activate the onScreenChange method when all screens are closed (in-game)
|
// Manually activate the onScreenChange method when all screens are closed (in-game)
|
||||||
if (newScreen == null) Blur.onScreenChange();
|
if (newScreen == null) Blur.onScreenChange();
|
||||||
@@ -1,5 +1,6 @@
|
|||||||
package eu.midnightdust.blur.mixin;
|
package eu.midnightdust.blur.mixin;
|
||||||
|
|
||||||
|
import eu.midnightdust.blur.BlurInfo;
|
||||||
import eu.midnightdust.blur.config.BlurConfig;
|
import eu.midnightdust.blur.config.BlurConfig;
|
||||||
import net.minecraft.client.MinecraftClient;
|
import net.minecraft.client.MinecraftClient;
|
||||||
import net.minecraft.client.gui.DrawContext;
|
import net.minecraft.client.gui.DrawContext;
|
||||||
@@ -17,40 +18,38 @@ import org.spongepowered.asm.mixin.injection.callback.CallbackInfo;
|
|||||||
|
|
||||||
@Mixin(Screen.class)
|
@Mixin(Screen.class)
|
||||||
public abstract class MixinScreen {
|
public abstract class MixinScreen {
|
||||||
|
|
||||||
@Shadow protected MinecraftClient client;
|
|
||||||
|
|
||||||
@Shadow @Final protected Text title;
|
@Shadow @Final protected Text title;
|
||||||
|
@Shadow protected MinecraftClient client;
|
||||||
@Shadow public abstract void renderInGameBackground(DrawContext context);
|
@Shadow public abstract void renderInGameBackground(DrawContext context);
|
||||||
|
|
||||||
@Shadow public int width;
|
@Shadow public int width;
|
||||||
|
|
||||||
@Shadow public int height;
|
@Shadow public int height;
|
||||||
|
|
||||||
@Inject(at = @At("HEAD"), method = "render")
|
@Inject(at = @At("HEAD"), method = "render")
|
||||||
public void blur$processScreenChange(DrawContext context, int mouseX, int mouseY, float delta, CallbackInfo ci) {
|
public void blur$processScreenChange(DrawContext context, int mouseX, int mouseY, float delta, CallbackInfo ci) {
|
||||||
if (!Blur.doTest && Blur.screenChanged) { // After the tests for blur and background color have been completed
|
if (!BlurInfo.doTest && BlurInfo.screenChanged) { // After the tests for blur and background color have been completed
|
||||||
Blur.onScreenChange();
|
Blur.onScreenChange();
|
||||||
Blur.screenChanged = false;
|
BlurInfo.screenChanged = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (Blur.start >= 0 && !Blur.screenHasBlur && Blur.prevScreenHasBlur) { // Fade out in non-blurred screens
|
if (BlurInfo.start >= 0 && !BlurInfo.screenHasBlur && BlurInfo.prevScreenHasBlur) { // Fade out in non-blurred screens
|
||||||
this.client.gameRenderer.renderBlur(delta);
|
this.client.gameRenderer.renderBlur(delta);
|
||||||
this.client.getFramebuffer().beginWrite(false);
|
this.client.getFramebuffer().beginWrite(false);
|
||||||
|
|
||||||
if (Blur.prevScreenHasBackground) Blur.renderRotatedGradient(context, width, height);
|
if (BlurInfo.prevScreenHasBackground) Blur.renderRotatedGradient(context, width, height);
|
||||||
}
|
}
|
||||||
Blur.doTest = false; // Set the test state to completed, as tests will happen in the same tick.
|
BlurInfo.doTest = false; // Set the test state to completed, as tests will happen in the same tick.
|
||||||
}
|
}
|
||||||
@Inject(at = @At("HEAD"), method = "renderInGameBackground")
|
@Inject(at = @At("HEAD"), method = "renderInGameBackground")
|
||||||
public void blur$getBackgroundEnabled(DrawContext context, CallbackInfo ci) {
|
public void blur$getBackgroundEnabled(DrawContext context, CallbackInfo ci) {
|
||||||
Blur.screenHasBackground = true; // Test if the screen has a background
|
BlurInfo.screenHasBackground = true; // Test if the screen has a background
|
||||||
}
|
}
|
||||||
@Inject(at = @At("HEAD"), method = "applyBlur")
|
@Inject(at = @At("HEAD"), method = "applyBlur", cancellable = true)
|
||||||
public void blur$getBlurEnabled(float delta, CallbackInfo ci) {
|
public void blur$getBlurEnabled(float delta, CallbackInfo ci) {
|
||||||
|
if (BlurConfig.forceDisabledScreens.contains(this.getClass().toString())) {
|
||||||
|
ci.cancel(); return;
|
||||||
|
}
|
||||||
if (!BlurConfig.excludedScreens.contains(this.getClass().toString()))
|
if (!BlurConfig.excludedScreens.contains(this.getClass().toString()))
|
||||||
Blur.screenHasBlur = true; // Test if the screen has blur
|
BlurInfo.screenHasBlur = true; // Test if the screen has blur
|
||||||
}
|
}
|
||||||
|
|
||||||
@Inject(at = @At("HEAD"), method = "renderDarkening(Lnet/minecraft/client/gui/DrawContext;IIII)V", cancellable = true)
|
@Inject(at = @At("HEAD"), method = "renderDarkening(Lnet/minecraft/client/gui/DrawContext;IIII)V", cancellable = true)
|
||||||
@@ -62,8 +61,11 @@ public abstract class MixinScreen {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Inject(at = @At("HEAD"), method = "renderInGameBackground", cancellable = true)
|
@Inject(at = @At("HEAD"), method = "renderInGameBackground", cancellable = true)
|
||||||
public void blur$rotatedGradient(DrawContext context, CallbackInfo ci) { // Replaces the default gradient with our rotated one
|
public void blur$rotatedGradient(DrawContext context, CallbackInfo ci) {
|
||||||
Blur.renderRotatedGradient(context, width, height);
|
if (BlurConfig.forceEnabledScreens.contains(this.getClass().toString()))
|
||||||
|
(((ScreenAccessor)this)).forceApplyBlur(client.getRenderTickCounter().getTickDelta(true)); // Applies the blur effect in force-enabled screens
|
||||||
|
|
||||||
|
Blur.renderRotatedGradient(context, width, height); // Replaces the default gradient with our rotated one
|
||||||
ci.cancel();
|
ci.cancel();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -0,0 +1,11 @@
|
|||||||
|
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(float delta);
|
||||||
|
}
|
||||||
@@ -0,0 +1,25 @@
|
|||||||
|
package eu.midnightdust.blur.mixin.emi;
|
||||||
|
|
||||||
|
import dev.emi.emi.screen.RecipeScreen;
|
||||||
|
import eu.midnightdust.blur.config.BlurConfig;
|
||||||
|
import net.minecraft.client.gui.DrawContext;
|
||||||
|
import net.minecraft.client.gui.screen.Screen;
|
||||||
|
import net.minecraft.text.Text;
|
||||||
|
import org.spongepowered.asm.mixin.Mixin;
|
||||||
|
import org.spongepowered.asm.mixin.injection.At;
|
||||||
|
import org.spongepowered.asm.mixin.injection.Inject;
|
||||||
|
import org.spongepowered.asm.mixin.injection.callback.CallbackInfo;
|
||||||
|
|
||||||
|
@Mixin(RecipeScreen.class)
|
||||||
|
public class MixinRecipeScreen extends Screen {
|
||||||
|
|
||||||
|
protected MixinRecipeScreen(Text title) {
|
||||||
|
super(title);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Inject(at = @At("HEAD"), method = "render")
|
||||||
|
public void blur$addBlurEffect(DrawContext raw, int mouseX, int mouseY, float delta, CallbackInfo ci) {
|
||||||
|
if (BlurConfig.blurContainers) this.applyBlur(delta);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
@@ -1,14 +1,13 @@
|
|||||||
package eu.midnightdust.blur.util;
|
package eu.midnightdust.blur.util;
|
||||||
|
|
||||||
import eu.midnightdust.blur.config.BlurConfig;
|
import eu.midnightdust.blur.config.BlurConfig;
|
||||||
import net.minecraft.client.MinecraftClient;
|
|
||||||
|
|
||||||
public class RainbowColor {
|
public class RainbowColor {
|
||||||
public static int rotation;
|
public static int rotation;
|
||||||
public static float hue;
|
public static float hue;
|
||||||
public static float hue2 = 0.35f;
|
public static float hue2 = 0.35f;
|
||||||
|
|
||||||
public static void tick(MinecraftClient ignoredClient) {
|
public static void tick() {
|
||||||
if (BlurConfig.rainbowMode) {
|
if (BlurConfig.rainbowMode) {
|
||||||
if (hue >= 1) hue = 0f;
|
if (hue >= 1) hue = 0f;
|
||||||
hue += 0.01f;
|
hue += 0.01f;
|
||||||
|
Before Width: | Height: | Size: 7.8 KiB After Width: | Height: | Size: 7.8 KiB |
@@ -2,6 +2,7 @@
|
|||||||
"blur.midnightconfig.title": "Blur+ Config",
|
"blur.midnightconfig.title": "Blur+ Config",
|
||||||
"blur.midnightconfig.category.animations": "Animations",
|
"blur.midnightconfig.category.animations": "Animations",
|
||||||
"blur.midnightconfig.category.style": "Style",
|
"blur.midnightconfig.category.style": "Style",
|
||||||
|
"blur.midnightconfig.category.screens": "Screens",
|
||||||
"blur.midnightconfig.blurContainers": "Apply Blur to Containers",
|
"blur.midnightconfig.blurContainers": "Apply Blur to Containers",
|
||||||
"blur.midnightconfig.fadeTimeMillis": "Fade Time (in milliseconds)",
|
"blur.midnightconfig.fadeTimeMillis": "Fade Time (in milliseconds)",
|
||||||
"blur.midnightconfig.fadeOutTimeMillis": "Fade Out Time (in milliseconds)",
|
"blur.midnightconfig.fadeOutTimeMillis": "Fade Out Time (in milliseconds)",
|
||||||
@@ -24,5 +25,7 @@
|
|||||||
"blur.midnightconfig.gradientStartAlpha": "Gradient Start Alpha",
|
"blur.midnightconfig.gradientStartAlpha": "Gradient Start Alpha",
|
||||||
"blur.midnightconfig.gradientEndAlpha": "Gradient End Alpha",
|
"blur.midnightconfig.gradientEndAlpha": "Gradient End Alpha",
|
||||||
"blur.midnightconfig.gradientRotation": "Gradient Rotation",
|
"blur.midnightconfig.gradientRotation": "Gradient Rotation",
|
||||||
"blur.midnightconfig.excludedScreens": "Excluded Screens"
|
"blur.midnightconfig.excludedScreens": "Excluded Screens",
|
||||||
|
"blur.midnightconfig.forceEnabledScreens": "Screens where blur should be force-enabled",
|
||||||
|
"blur.midnightconfig.forceDisabledScreens": "Screens where blur should be force-disabled"
|
||||||
}
|
}
|
||||||
@@ -2,9 +2,10 @@
|
|||||||
"required": true,
|
"required": true,
|
||||||
"minVersion": "0.8",
|
"minVersion": "0.8",
|
||||||
"package": "eu.midnightdust.blur.mixin",
|
"package": "eu.midnightdust.blur.mixin",
|
||||||
"compatibilityLevel": "JAVA_17",
|
"compatibilityLevel": "JAVA_21",
|
||||||
"client": [
|
"client": [
|
||||||
"MixinScreen",
|
"MixinScreen",
|
||||||
|
"ScreenAccessor",
|
||||||
"MixinHandledScreen",
|
"MixinHandledScreen",
|
||||||
"MixinMinecraftClient",
|
"MixinMinecraftClient",
|
||||||
"MixinGameRenderer",
|
"MixinGameRenderer",
|
||||||
12
common/src/main/resources/blur_compat.mixins.json
Normal file
12
common/src/main/resources/blur_compat.mixins.json
Normal file
@@ -0,0 +1,12 @@
|
|||||||
|
{
|
||||||
|
"required": true,
|
||||||
|
"package": "eu.midnightdust.blur.mixin",
|
||||||
|
"plugin": "eu.midnightdust.blur.mixin.BlurMixinPlugin",
|
||||||
|
"compatibilityLevel": "JAVA_21",
|
||||||
|
"client": [
|
||||||
|
"emi.MixinRecipeScreen"
|
||||||
|
],
|
||||||
|
"injectors": {
|
||||||
|
"defaultRequire": 1
|
||||||
|
}
|
||||||
|
}
|
||||||
100
fabric/build.gradle
Normal file
100
fabric/build.gradle
Normal file
@@ -0,0 +1,100 @@
|
|||||||
|
plugins {
|
||||||
|
id 'com.github.johnrengelman.shadow'
|
||||||
|
id "me.shedaniel.unified-publishing"
|
||||||
|
}
|
||||||
|
|
||||||
|
architectury {
|
||||||
|
platformSetupLoomIde()
|
||||||
|
fabric()
|
||||||
|
}
|
||||||
|
|
||||||
|
configurations {
|
||||||
|
common
|
||||||
|
shadowCommon // Don't use shadow from the shadow plugin since it *excludes* files.
|
||||||
|
compileClasspath.extendsFrom common
|
||||||
|
runtimeClasspath.extendsFrom common
|
||||||
|
developmentFabric.extendsFrom common
|
||||||
|
archivesBaseName = rootProject.archives_base_name + "-fabric"
|
||||||
|
version = rootProject.mod_version + "+" + rootProject.minecraft_version
|
||||||
|
}
|
||||||
|
|
||||||
|
dependencies {
|
||||||
|
modImplementation "net.fabricmc:fabric-loader:${rootProject.fabric_loader_version}"
|
||||||
|
modApi "net.fabricmc.fabric-api:fabric-api:${rootProject.fabric_api_version}"
|
||||||
|
modImplementation include ("maven.modrinth:midnightlib:${rootProject.midnightlib_version}-fabric")
|
||||||
|
|
||||||
|
common(project(path: ":common", configuration: "namedElements")) { transitive false }
|
||||||
|
shadowCommon(project(path: ":common", configuration: "transformProductionFabric")) { transitive false }
|
||||||
|
}
|
||||||
|
|
||||||
|
processResources {
|
||||||
|
inputs.property "version", rootProject.version
|
||||||
|
|
||||||
|
filesMatching("fabric.mod.json") {
|
||||||
|
expand "version": rootProject.version
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
shadowJar {
|
||||||
|
exclude "architectury.common.json"
|
||||||
|
|
||||||
|
configurations = [project.configurations.shadowCommon]
|
||||||
|
archiveClassifier = "dev-shadow"
|
||||||
|
}
|
||||||
|
|
||||||
|
remapJar {
|
||||||
|
input.set shadowJar.archiveFile
|
||||||
|
dependsOn shadowJar
|
||||||
|
}
|
||||||
|
|
||||||
|
sourcesJar {
|
||||||
|
def commonSources = project(":common").sourcesJar
|
||||||
|
dependsOn commonSources
|
||||||
|
from commonSources.archiveFile.map { zipTree(it) }
|
||||||
|
}
|
||||||
|
|
||||||
|
components.java {
|
||||||
|
withVariantsFromConfiguration(project.configurations.shadowRuntimeElements) {
|
||||||
|
skip()
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
unifiedPublishing {
|
||||||
|
project {
|
||||||
|
displayName = "Blur+ $rootProject.version - Fabric $project.minecraft_version"
|
||||||
|
releaseType = "$project.release_type"
|
||||||
|
changelog = releaseChangelog()
|
||||||
|
gameVersions = []
|
||||||
|
gameLoaders = ["fabric","quilt"]
|
||||||
|
mainPublication remapJar
|
||||||
|
relations {
|
||||||
|
depends {
|
||||||
|
curseforge = "fabric-api"
|
||||||
|
modrinth = "fabric-api"
|
||||||
|
}
|
||||||
|
includes {
|
||||||
|
curseforge = "midnightlib"
|
||||||
|
modrinth = "midnightlib"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
var CURSEFORGE_TOKEN = project.findProperty("CURSEFORGE_TOKEN") ?: System.getenv("CURSEFORGE_TOKEN")
|
||||||
|
if (CURSEFORGE_TOKEN != null) {
|
||||||
|
curseforge {
|
||||||
|
token = CURSEFORGE_TOKEN
|
||||||
|
id = rootProject.curseforge_id
|
||||||
|
gameVersions.addAll "Java 21", project.minecraft_version, project.supported_versions
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
var MODRINTH_TOKEN = project.findProperty("MODRINTH_TOKEN") ?: System.getenv("MODRINTH_TOKEN")
|
||||||
|
if (MODRINTH_TOKEN != null) {
|
||||||
|
modrinth {
|
||||||
|
token = MODRINTH_TOKEN
|
||||||
|
id = rootProject.modrinth_id
|
||||||
|
version = "$rootProject.version-$project.name"
|
||||||
|
gameVersions.addAll project.minecraft_version, project.supported_versions
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,14 @@
|
|||||||
|
package eu.midnightdust.blur.fabric;
|
||||||
|
|
||||||
|
import eu.midnightdust.blur.Blur;
|
||||||
|
import eu.midnightdust.blur.util.RainbowColor;
|
||||||
|
import net.fabricmc.api.ClientModInitializer;
|
||||||
|
import net.fabricmc.fabric.api.client.event.lifecycle.v1.ClientTickEvents;
|
||||||
|
|
||||||
|
public class BlurFabric implements ClientModInitializer {
|
||||||
|
@Override
|
||||||
|
public void onInitializeClient() {
|
||||||
|
Blur.init();
|
||||||
|
ClientTickEvents.END_CLIENT_TICK.register(client -> RainbowColor.tick());
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -8,7 +8,7 @@
|
|||||||
"icon": "assets/blur/icon.png",
|
"icon": "assets/blur/icon.png",
|
||||||
"entrypoints": {
|
"entrypoints": {
|
||||||
"client": [
|
"client": [
|
||||||
"eu.midnightdust.blur.Blur"
|
"eu.midnightdust.blur.fabric.BlurFabric"
|
||||||
]
|
]
|
||||||
},
|
},
|
||||||
"contact": {
|
"contact": {
|
||||||
@@ -25,7 +25,8 @@
|
|||||||
],
|
],
|
||||||
"description": "Various enhancements for the blur effect behind Minecraft GUIs",
|
"description": "Various enhancements for the blur effect behind Minecraft GUIs",
|
||||||
"mixins": [
|
"mixins": [
|
||||||
"mixins.blur.json"
|
"blur.mixins.json",
|
||||||
|
"blur_compat.mixins.json"
|
||||||
],
|
],
|
||||||
"depends": {
|
"depends": {
|
||||||
"minecraft": ">=1.20.5"
|
"minecraft": ">=1.20.5"
|
||||||
@@ -1,22 +1,29 @@
|
|||||||
# Done to increase the memory available to gradle.
|
# Done to increase the memory available to gradle.
|
||||||
org.gradle.jvmargs=-Xmx1G
|
org.gradle.jvmargs=-Xmx2G
|
||||||
org.gradle.parallel=true
|
org.gradle.parallel=true
|
||||||
|
|
||||||
# Fabric Properties
|
minecraft_version=1.21
|
||||||
# check these on https://fabricmc.net/develop
|
supported_versions=1.21.1
|
||||||
minecraft_version=1.21
|
yarn_mappings=1.21+build.2
|
||||||
yarn_mappings=1.21+build.2
|
enabled_platforms=fabric,neoforge
|
||||||
loader_version=0.15.11
|
|
||||||
|
|
||||||
# Mod Properties
|
|
||||||
mod_version=4.1.0
|
|
||||||
maven_group=eu.midnightdust.blur
|
|
||||||
archives_base_name=blur
|
|
||||||
release_type=release
|
|
||||||
curseforge_id=393563
|
|
||||||
modrinth_id=NK39zBp2
|
|
||||||
|
|
||||||
# Dependencies
|
# Mod Properties
|
||||||
# currently not on the main fabric site, check on the maven: https://maven.fabricmc.net/net/fabricmc/fabric-api/fabric-api
|
mod_version=5.0.0
|
||||||
fabric_version=0.100.1+1.21
|
maven_group=eu.midnightdust.blur
|
||||||
midnightlib_version=1.5.7-fabric
|
archives_base_name=blur
|
||||||
|
release_type=release
|
||||||
|
curseforge_id=393563
|
||||||
|
modrinth_id=NK39zBp2
|
||||||
|
|
||||||
|
# Modloaders
|
||||||
|
fabric_loader_version=0.15.11
|
||||||
|
fabric_api_version=0.100.1+1.21
|
||||||
|
|
||||||
|
neoforge_version=21.0.143
|
||||||
|
yarn_mappings_patch_neoforge_version = 1.21+build.4
|
||||||
|
|
||||||
|
# Libraries
|
||||||
|
midnightlib_version = 1.6.3
|
||||||
|
modmenu_version = 11.0.2
|
||||||
|
|
||||||
|
emi_version=1.1.12+1.21
|
||||||
|
|||||||
2
gradle/wrapper/gradle-wrapper.properties
vendored
2
gradle/wrapper/gradle-wrapper.properties
vendored
@@ -1,6 +1,6 @@
|
|||||||
distributionBase=GRADLE_USER_HOME
|
distributionBase=GRADLE_USER_HOME
|
||||||
distributionPath=wrapper/dists
|
distributionPath=wrapper/dists
|
||||||
distributionUrl=https\://services.gradle.org/distributions/gradle-8.7-bin.zip
|
distributionUrl=https\://services.gradle.org/distributions/gradle-8.9-bin.zip
|
||||||
networkTimeout=10000
|
networkTimeout=10000
|
||||||
validateDistributionUrl=true
|
validateDistributionUrl=true
|
||||||
zipStoreBase=GRADLE_USER_HOME
|
zipStoreBase=GRADLE_USER_HOME
|
||||||
|
|||||||
Binary file not shown.
113
neoforge/build.gradle
Normal file
113
neoforge/build.gradle
Normal file
@@ -0,0 +1,113 @@
|
|||||||
|
plugins {
|
||||||
|
id 'com.github.johnrengelman.shadow'
|
||||||
|
id "me.shedaniel.unified-publishing"
|
||||||
|
}
|
||||||
|
|
||||||
|
repositories {
|
||||||
|
maven {
|
||||||
|
name = 'NeoForged'
|
||||||
|
url = 'https://maven.neoforged.net/releases'
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
architectury {
|
||||||
|
platformSetupLoomIde()
|
||||||
|
neoForge()
|
||||||
|
}
|
||||||
|
|
||||||
|
loom {
|
||||||
|
accessWidenerPath = project(":common").loom.accessWidenerPath
|
||||||
|
}
|
||||||
|
|
||||||
|
configurations {
|
||||||
|
common {
|
||||||
|
canBeResolved = true
|
||||||
|
canBeConsumed = false
|
||||||
|
}
|
||||||
|
compileClasspath.extendsFrom common
|
||||||
|
runtimeClasspath.extendsFrom common
|
||||||
|
developmentNeoForge.extendsFrom common
|
||||||
|
|
||||||
|
// Files in this configuration will be bundled into your mod using the Shadow plugin.
|
||||||
|
// Don't use the `shadow` configuration from the plugin itself as it's meant for excluding files.
|
||||||
|
shadowBundle {
|
||||||
|
canBeResolved = true
|
||||||
|
canBeConsumed = false
|
||||||
|
}
|
||||||
|
archivesBaseName = rootProject.archives_base_name + "-neoforge"
|
||||||
|
version = rootProject.mod_version + "+" + rootProject.minecraft_version
|
||||||
|
}
|
||||||
|
|
||||||
|
dependencies {
|
||||||
|
neoForge "net.neoforged:neoforge:$rootProject.neoforge_version"
|
||||||
|
modImplementation ("maven.modrinth:midnightlib:${rootProject.midnightlib_version}-neoforge")
|
||||||
|
|
||||||
|
common(project(path: ':common', configuration: 'namedElements')) { transitive false }
|
||||||
|
shadowBundle project(path: ':common', configuration: 'transformProductionNeoForge')
|
||||||
|
}
|
||||||
|
|
||||||
|
processResources {
|
||||||
|
inputs.property 'version', rootProject.version
|
||||||
|
|
||||||
|
filesMatching('META-INF/neoforge.mods.toml') {
|
||||||
|
expand version: rootProject.version
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
shadowJar {
|
||||||
|
configurations = [project.configurations.shadowBundle]
|
||||||
|
archiveClassifier = 'dev-shadow'
|
||||||
|
}
|
||||||
|
|
||||||
|
remapJar {
|
||||||
|
input.set shadowJar.archiveFile
|
||||||
|
}
|
||||||
|
|
||||||
|
sourcesJar {
|
||||||
|
def commonSources = project(":common").sourcesJar
|
||||||
|
dependsOn commonSources
|
||||||
|
from commonSources.archiveFile.map { zipTree(it) }
|
||||||
|
}
|
||||||
|
|
||||||
|
components.java {
|
||||||
|
withVariantsFromConfiguration(project.configurations.shadowRuntimeElements) {
|
||||||
|
skip()
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
unifiedPublishing {
|
||||||
|
project {
|
||||||
|
displayName = "Blur+ $rootProject.version - NeoForge $project.minecraft_version"
|
||||||
|
releaseType = "$project.release_type"
|
||||||
|
changelog = releaseChangelog()
|
||||||
|
gameVersions = []
|
||||||
|
gameLoaders = ["neoforge"]
|
||||||
|
mainPublication remapJar
|
||||||
|
relations {
|
||||||
|
depends {
|
||||||
|
curseforge = "midnightlib"
|
||||||
|
modrinth = "midnightlib"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
var CURSEFORGE_TOKEN = project.findProperty("CURSEFORGE_TOKEN") ?: System.getenv("CURSEFORGE_TOKEN")
|
||||||
|
if (CURSEFORGE_TOKEN != null) {
|
||||||
|
curseforge {
|
||||||
|
token = CURSEFORGE_TOKEN
|
||||||
|
id = rootProject.curseforge_id
|
||||||
|
gameVersions.addAll "Java 21", project.minecraft_version, project.supported_versions
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
var MODRINTH_TOKEN = project.findProperty("MODRINTH_TOKEN") ?: System.getenv("MODRINTH_TOKEN")
|
||||||
|
if (MODRINTH_TOKEN != null) {
|
||||||
|
modrinth {
|
||||||
|
token = MODRINTH_TOKEN
|
||||||
|
id = rootProject.modrinth_id
|
||||||
|
version = "$rootProject.version-$project.name"
|
||||||
|
gameVersions.addAll project.minecraft_version, project.supported_versions
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
1
neoforge/gradle.properties
Normal file
1
neoforge/gradle.properties
Normal file
@@ -0,0 +1 @@
|
|||||||
|
loom.platform=neoforge
|
||||||
@@ -0,0 +1,24 @@
|
|||||||
|
package eu.midnightdust.blur.neoforge;
|
||||||
|
|
||||||
|
import eu.midnightdust.blur.Blur;
|
||||||
|
import eu.midnightdust.blur.util.RainbowColor;
|
||||||
|
import net.neoforged.api.distmarker.Dist;
|
||||||
|
import net.neoforged.bus.api.SubscribeEvent;
|
||||||
|
import net.neoforged.fml.common.EventBusSubscriber;
|
||||||
|
import net.neoforged.fml.common.Mod;
|
||||||
|
import net.neoforged.neoforge.client.event.ClientTickEvent;
|
||||||
|
|
||||||
|
@Mod(value = "blur", dist = Dist.CLIENT)
|
||||||
|
public class BlurNeoForge {
|
||||||
|
public BlurNeoForge() {
|
||||||
|
Blur.init();
|
||||||
|
}
|
||||||
|
|
||||||
|
@EventBusSubscriber(modid = "blur", bus = EventBusSubscriber.Bus.GAME, value = Dist.CLIENT)
|
||||||
|
public static class ClientGameEvents {
|
||||||
|
@SubscribeEvent
|
||||||
|
public static void endClientTick(ClientTickEvent.Post event) {
|
||||||
|
RainbowColor.tick();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
33
neoforge/src/main/resources/META-INF/neoforge.mods.toml
Normal file
33
neoforge/src/main/resources/META-INF/neoforge.mods.toml
Normal file
@@ -0,0 +1,33 @@
|
|||||||
|
modLoader = "javafml"
|
||||||
|
loaderVersion = "[2,)"
|
||||||
|
#issueTrackerURL = ""
|
||||||
|
license = "MIT License"
|
||||||
|
|
||||||
|
[[mods]]
|
||||||
|
modId = "blur"
|
||||||
|
version = "${version}"
|
||||||
|
displayName = "Blur+"
|
||||||
|
logoFile = "blur.png"
|
||||||
|
authors = "Motschen, tterrag1098, Pyrofab, backryun, byquanton"
|
||||||
|
description = '''
|
||||||
|
Various enhancements for the blur effect behind Minecraft GUIs
|
||||||
|
'''
|
||||||
|
|
||||||
|
[[mixins]]
|
||||||
|
config = "blur.mixins.json"
|
||||||
|
[[mixins]]
|
||||||
|
config = "blur_compat.mixins.json"
|
||||||
|
|
||||||
|
[[dependencies.blur]]
|
||||||
|
modId = "neoforge"
|
||||||
|
mandatory = true
|
||||||
|
versionRange = "[21.0,)"
|
||||||
|
ordering = "NONE"
|
||||||
|
side = "CLIENT"
|
||||||
|
|
||||||
|
[[dependencies.blur]]
|
||||||
|
modId = "minecraft"
|
||||||
|
mandatory = true
|
||||||
|
versionRange = "[1.21,)"
|
||||||
|
ordering = "NONE"
|
||||||
|
side = "CLIENT"
|
||||||
@@ -1,13 +1,15 @@
|
|||||||
pluginManagement {
|
pluginManagement {
|
||||||
repositories {
|
repositories {
|
||||||
maven {
|
maven { url "https://maven.fabricmc.net/" }
|
||||||
name = 'Fabric'
|
|
||||||
url = 'https://maven.fabricmc.net/'
|
|
||||||
}
|
|
||||||
maven { url "https://maven.architectury.dev/" }
|
maven { url "https://maven.architectury.dev/" }
|
||||||
mavenCentral()
|
maven { url "https://maven.neoforged.net/releases" }
|
||||||
gradlePluginPortal()
|
gradlePluginPortal()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
rootProject.name = "blur"
|
include("common")
|
||||||
|
include("fabric")
|
||||||
|
include("neoforge")
|
||||||
|
//include("quilt")
|
||||||
|
|
||||||
|
rootProject.name = "blur"
|
||||||
|
|||||||
Reference in New Issue
Block a user