Update to 1.21 & Add exclusion list

- Iris' shader selection screen is excluded by default
- Also added unifiedPublishing for easier update publishing
This commit is contained in:
Martin Prokoph
2024-06-17 11:09:58 +02:00
parent 0799437138
commit 5f0d65e84c
8 changed files with 79 additions and 13 deletions

View File

@@ -1,10 +1,11 @@
plugins {
id 'fabric-loom' version '1.6-SNAPSHOT'
id 'maven-publish'
id "me.shedaniel.unified-publishing" version "0.1.+"
}
sourceCompatibility = JavaVersion.VERSION_17
targetCompatibility = JavaVersion.VERSION_17
sourceCompatibility = JavaVersion.VERSION_21
targetCompatibility = JavaVersion.VERSION_21
archivesBaseName = project.archives_base_name
version = project.mod_version
@@ -75,4 +76,56 @@ publishing {
from components.java
}
}
}
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()
}
}
unifiedPublishing {
project {
displayName = "Blur+ $project.version - Fabric $project.minecraft_version"
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
}
}
}
}

View File

@@ -4,16 +4,19 @@ org.gradle.parallel=true
# Fabric Properties
# check these on https://fabricmc.net/develop
minecraft_version=1.20.5
yarn_mappings=1.20.5+build.1
loader_version=0.15.10
minecraft_version=1.21
yarn_mappings=1.21+build.2
loader_version=0.15.11
# Mod Properties
mod_version=4.0.0
mod_version=4.1.0
maven_group=eu.midnightdust.blur
archives_base_name=blur
release_type=release
curseforge_id=393563
modrinth_id=NK39zBp2
# 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.97.7+1.20.5
midnightlib_version=1.5.4-fabric
fabric_version=0.100.1+1.21
midnightlib_version=1.5.7-fabric

View File

@@ -4,6 +4,7 @@ pluginManagement {
name = 'Fabric'
url = 'https://maven.fabricmc.net/'
}
maven { url "https://maven.architectury.dev/" }
mavenCentral()
gradlePluginPortal()
}

View File

@@ -1,6 +1,9 @@
package eu.midnightdust.blur.config;
import com.google.common.collect.Lists;
import eu.midnightdust.lib.config.MidnightConfig;
import java.util.List;
import java.util.function.Function;
import static java.lang.Math.*;
@@ -32,6 +35,8 @@ public class BlurConfig extends MidnightConfig {
public static int gradientRotation = 0;
@Entry(category = STYLE)
public static boolean rainbowMode = false;
@Entry(category = STYLE)
public static List<String> excludedScreens = Lists.newArrayList("net.irisshaders.iris.gui.screen.ShaderPackScreen");
public enum Easing {
// Based on https://gist.github.com/dev-hydrogen/21a66f83f0386123e0c0acf107254843

View File

@@ -4,6 +4,7 @@ import eu.midnightdust.blur.Blur;
import net.minecraft.client.MinecraftClient;
import net.minecraft.client.gui.DrawContext;
import net.minecraft.client.gui.hud.InGameHud;
import net.minecraft.client.render.RenderTickCounter;
import org.spongepowered.asm.mixin.Final;
import org.spongepowered.asm.mixin.Mixin;
import org.spongepowered.asm.mixin.Shadow;
@@ -16,11 +17,11 @@ public class MixinInGameHud {
@Final @Shadow private MinecraftClient client;
@Inject(at = @At("TAIL"), method = "render")
public void blur$renderFadeOut(DrawContext context, float delta, 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) {
Blur.doTest = false;
Blur.screenChanged = false;
this.client.gameRenderer.renderBlur(delta);
this.client.gameRenderer.renderBlur(tickCounter.getTickDelta(true));
this.client.getFramebuffer().beginWrite(false);
if (Blur.prevScreenHasBackground) Blur.renderRotatedGradient(context, client.getWindow().getScaledWidth(), client.getWindow().getScaledHeight());

View File

@@ -49,7 +49,8 @@ public abstract class MixinScreen {
}
@Inject(at = @At("HEAD"), method = "applyBlur")
public void blur$getBlurEnabled(float delta, CallbackInfo ci) {
Blur.screenHasBlur = true; // Test if the screen has blur
if (!BlurConfig.excludedScreens.contains(this.getClass().toString()))
Blur.screenHasBlur = true; // Test if the screen has blur
}
@Inject(at = @At("HEAD"), method = "renderDarkening(Lnet/minecraft/client/gui/DrawContext;IIII)V", cancellable = true)

View File

@@ -23,5 +23,6 @@
"blur.midnightconfig.gradientEnd": "Farbverlauf-Endfarbe",
"blur.midnightconfig.gradientStartAlpha": "Farbverlauf-Anfangstransparenz",
"blur.midnightconfig.gradientEndAlpha": "Farbverlauf-Endstransparenz",
"blur.midnightconfig.gradientRotation": "Farbverlauf-Rotation"
"blur.midnightconfig.gradientRotation": "Farbverlauf-Rotation",
"blur.midnightconfig.excludedScreens": "Ausgeschlossene Bildschirme"
}

View File

@@ -23,5 +23,6 @@
"blur.midnightconfig.gradientEnd": "Gradient End Color",
"blur.midnightconfig.gradientStartAlpha": "Gradient Start Alpha",
"blur.midnightconfig.gradientEndAlpha": "Gradient End Alpha",
"blur.midnightconfig.gradientRotation": "Gradient Rotation"
"blur.midnightconfig.gradientRotation": "Gradient Rotation",
"blur.midnightconfig.excludedScreens": "Excluded Screens"
}