mirror of
https://github.com/PuzzleMC/Puzzle.git
synced 2025-12-16 11:55:09 +01:00
Compare commits
3 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
b3b49cb8b8 | ||
|
|
39261272bf | ||
|
|
bc01662cda |
64
build.gradle
64
build.gradle
@@ -1,7 +1,7 @@
|
|||||||
// Based on https://github.com/OnyxStudios/Cardinal-Components-API/blob/1.17/build.gradle
|
// Based on https://github.com/OnyxStudios/Cardinal-Components-API/blob/1.17/build.gradle
|
||||||
plugins {
|
plugins {
|
||||||
id "fabric-loom" version "1.2-SNAPSHOT" apply false
|
id "fabric-loom" version "1.6-SNAPSHOT" apply false
|
||||||
id "com.matthewprenger.cursegradle" version "1.4.0"
|
id "me.shedaniel.unified-publishing" version "0.1.+"
|
||||||
id "maven-publish"
|
id "maven-publish"
|
||||||
id "java-library"
|
id "java-library"
|
||||||
}
|
}
|
||||||
@@ -21,7 +21,7 @@ subprojects {
|
|||||||
|
|
||||||
allprojects {
|
allprojects {
|
||||||
apply plugin: "fabric-loom"
|
apply plugin: "fabric-loom"
|
||||||
sourceCompatibility = targetCompatibility = JavaVersion.VERSION_17
|
sourceCompatibility = targetCompatibility = JavaVersion.VERSION_21
|
||||||
version = System.getenv("TRAVIS_TAG") ?: rootProject.mod_version
|
version = System.getenv("TRAVIS_TAG") ?: rootProject.mod_version
|
||||||
|
|
||||||
configurations {
|
configurations {
|
||||||
@@ -53,7 +53,7 @@ allprojects {
|
|||||||
// see http://yodaconditions.net/blog/fix-for-java-file-encoding-problems-with-gradle.html
|
// see http://yodaconditions.net/blog/fix-for-java-file-encoding-problems-with-gradle.html
|
||||||
tasks.withType(JavaCompile).configureEach {
|
tasks.withType(JavaCompile).configureEach {
|
||||||
it.options.encoding = "UTF-8"
|
it.options.encoding = "UTF-8"
|
||||||
it.options.release = 17
|
it.options.release = 21
|
||||||
}
|
}
|
||||||
|
|
||||||
java {
|
java {
|
||||||
@@ -134,7 +134,7 @@ dependencies {
|
|||||||
modImplementation ("maven.modrinth:entitytexturefeatures:${project.etf_version}")
|
modImplementation ("maven.modrinth:entitytexturefeatures:${project.etf_version}")
|
||||||
modImplementation ("maven.modrinth:entity-model-features:${project.emf_version}")
|
modImplementation ("maven.modrinth:entity-model-features:${project.emf_version}")
|
||||||
modImplementation ("maven.modrinth:completeconfig:${project.complete_config_version}")
|
modImplementation ("maven.modrinth:completeconfig:${project.complete_config_version}")
|
||||||
modImplementation ("maven.modrinth:exordium:${project.exordium_version}")
|
//modImplementation ("maven.modrinth:exordium:${project.exordium_version}")
|
||||||
|
|
||||||
modImplementation("org.aperlambda:lambdajcommon:1.8.1") {
|
modImplementation("org.aperlambda:lambdajcommon:1.8.1") {
|
||||||
exclude group: 'com.google.code.gson'
|
exclude group: 'com.google.code.gson'
|
||||||
@@ -167,3 +167,57 @@ publishing {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
ext {
|
||||||
|
releaseChangelog = {
|
||||||
|
def changes = new StringBuilder()
|
||||||
|
changes << "## Puzzle v$project.version for $project.minecraft_version\n[View the changelog](https://www.github.com/TeamMidnightDust/Puzzle/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 = "Puzzle $project.version - $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 = project.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 = project.modrinth_id
|
||||||
|
version = "$project.version-$project.name"
|
||||||
|
gameVersions.addAll project.minecraft_version
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|||||||
@@ -3,38 +3,40 @@ org.gradle.jvmargs=-Xmx4G
|
|||||||
|
|
||||||
# Fabric Properties
|
# Fabric Properties
|
||||||
# check these on https://fabricmc.net/use
|
# check these on https://fabricmc.net/use
|
||||||
minecraft_version=1.20
|
minecraft_version=1.20.6
|
||||||
yarn_mappings=1.20+build.1
|
yarn_mappings=1.20.6+build.1
|
||||||
loader_version=0.14.21
|
loader_version=0.15.10
|
||||||
|
|
||||||
# Mod Properties
|
# Mod Properties
|
||||||
mod_version = 1.5.2+1.20
|
mod_version = 1.6.2+1.20.6
|
||||||
maven_group = net.puzzlemc
|
maven_group = net.puzzlemc
|
||||||
archives_base_name = puzzle
|
archives_base_name = puzzle
|
||||||
|
release_type=release
|
||||||
|
curseforge_id=563977
|
||||||
|
modrinth_id=3IuO68q1
|
||||||
|
|
||||||
# Dependencies
|
# Dependencies
|
||||||
# currently not on the main fabric site, check on the maven: https://maven.fabricmc.net/net/fabricmc/fabric-api/fabric-api
|
# currently not on the main fabric site, check on the maven: https://maven.fabricmc.net/net/fabricmc/fabric-api/fabric-api
|
||||||
fabric_version=0.83.0+1.20
|
fabric_version=0.97.8+1.20.6
|
||||||
mod_menu_version = 7.0.1
|
mod_menu_version = 7.0.1
|
||||||
midnightlib_version = 1.4.1-fabric
|
midnightlib_version = 1.5.5-fabric
|
||||||
|
|
||||||
cull_leaves_version = 3.0.2-fabric
|
cull_leaves_version = 3.0.2-fabric
|
||||||
ldl_version = 2.3.0+1.19.4
|
ldl_version = 2.3.2+1.20.1
|
||||||
lbg_version = 1.5.1+1.20
|
lbg_version = 1.5.2+1.20.1
|
||||||
iris_version = 1.6.4+1.20
|
iris_version = 1.6.9+1.20.2
|
||||||
continuity_version = 3.0.0-beta.2+1.19.3
|
continuity_version = 3.0.0-beta.3+1.20.1
|
||||||
animatica_version = 0.5+1.19
|
animatica_version = 0.6+1.20
|
||||||
colormatic_version = 3.1.2
|
colormatic_version = 3.1.2
|
||||||
borderless_mining_version = 1.1.7+1.19.4
|
borderless_mining_version = 1.1.8+1.20.1
|
||||||
dynamic_fps_version = v2.2.0
|
dynamic_fps_version = 3.2.0
|
||||||
toml4j_version = 0.7.2
|
toml4j_version = 0.7.2
|
||||||
cit_resewn_version = 1.1.3+1.20
|
cit_resewn_version = 1.1.3+1.20
|
||||||
cem_version = 0.7.1-1.19.3
|
|
||||||
complete_config_version = 2.3.0
|
complete_config_version = 2.3.0
|
||||||
spruceui_version=5.0.0+1.20
|
spruceui_version=5.0.0+1.20
|
||||||
emf_version=0.2.10
|
emf_version=2.0.2
|
||||||
etf_version=4.4.4
|
etf_version=6.0.1
|
||||||
exordium_version=1.1.1-1.19.4
|
exordium_version=1.2.1-1.20.2
|
||||||
# Required for LBG
|
# Required for LBG
|
||||||
quilt_loader_version=0.19.0-beta.18
|
quilt_loader_version=0.19.0-beta.18
|
||||||
quilt_fabric_api_version=7.0.1+0.83.0-1.20
|
quilt_fabric_api_version=7.0.1+0.83.0-1.20
|
||||||
|
|||||||
2
gradle/wrapper/gradle-wrapper.properties
vendored
2
gradle/wrapper/gradle-wrapper.properties
vendored
@@ -1,5 +1,5 @@
|
|||||||
distributionBase=GRADLE_USER_HOME
|
distributionBase=GRADLE_USER_HOME
|
||||||
distributionPath=wrapper/dists
|
distributionPath=wrapper/dists
|
||||||
distributionUrl=https\://services.gradle.org/distributions/gradle-8.1-bin.zip
|
distributionUrl=https\://services.gradle.org/distributions/gradle-8.7-bin.zip
|
||||||
zipStoreBase=GRADLE_USER_HOME
|
zipStoreBase=GRADLE_USER_HOME
|
||||||
zipStorePath=wrapper/dists
|
zipStorePath=wrapper/dists
|
||||||
|
|||||||
@@ -43,10 +43,10 @@ dependencies {
|
|||||||
modCompileOnlyApi ("maven.modrinth:lambdabettergrass:${project.lbg_version}")
|
modCompileOnlyApi ("maven.modrinth:lambdabettergrass:${project.lbg_version}")
|
||||||
modCompileOnly "org.quiltmc:quilt-loader:${rootProject.quilt_loader_version}"
|
modCompileOnly "org.quiltmc:quilt-loader:${rootProject.quilt_loader_version}"
|
||||||
modCompileOnlyApi "org.quiltmc.quilted-fabric-api:quilted-fabric-api:${rootProject.quilt_fabric_api_version}"
|
modCompileOnlyApi "org.quiltmc.quilted-fabric-api:quilted-fabric-api:${rootProject.quilt_fabric_api_version}"
|
||||||
modImplementation ("maven.modrinth:iris:${project.iris_version}")
|
modCompileOnlyApi ("maven.modrinth:iris:${project.iris_version}")
|
||||||
modCompileOnly ("maven.modrinth:cit-resewn:${project.cit_resewn_version}")
|
modCompileOnly ("maven.modrinth:cit-resewn:${project.cit_resewn_version}")
|
||||||
modCompileOnlyApi ("maven.modrinth:continuity:${project.continuity_version}")
|
modCompileOnlyApi ("maven.modrinth:continuity:${project.continuity_version}")
|
||||||
modImplementation ("maven.modrinth:animatica:${project.animatica_version}")
|
modCompileOnlyApi ("maven.modrinth:animatica:${project.animatica_version}")
|
||||||
modCompileOnlyApi ("maven.modrinth:colormatic:${project.colormatic_version}")
|
modCompileOnlyApi ("maven.modrinth:colormatic:${project.colormatic_version}")
|
||||||
modImplementation ("maven.modrinth:borderless-mining:${project.borderless_mining_version}")
|
modImplementation ("maven.modrinth:borderless-mining:${project.borderless_mining_version}")
|
||||||
modImplementation ("maven.modrinth:dynamic-fps:${project.dynamic_fps_version}")
|
modImplementation ("maven.modrinth:dynamic-fps:${project.dynamic_fps_version}")
|
||||||
@@ -54,7 +54,7 @@ dependencies {
|
|||||||
modImplementation ("maven.modrinth:entitytexturefeatures:${project.etf_version}")
|
modImplementation ("maven.modrinth:entitytexturefeatures:${project.etf_version}")
|
||||||
modImplementation ("maven.modrinth:entity-model-features:${project.emf_version}")
|
modImplementation ("maven.modrinth:entity-model-features:${project.emf_version}")
|
||||||
modImplementation ("maven.modrinth:completeconfig:${project.complete_config_version}")
|
modImplementation ("maven.modrinth:completeconfig:${project.complete_config_version}")
|
||||||
modImplementation ("maven.modrinth:exordium:${project.exordium_version}")
|
//modImplementation ("maven.modrinth:exordium:${project.exordium_version}")
|
||||||
|
|
||||||
modImplementation("org.aperlambda:lambdajcommon:1.8.1") {
|
modImplementation("org.aperlambda:lambdajcommon:1.8.1") {
|
||||||
exclude group: 'com.google.code.gson'
|
exclude group: 'com.google.code.gson'
|
||||||
|
|||||||
@@ -1,27 +0,0 @@
|
|||||||
package net.puzzlemc.gui;
|
|
||||||
|
|
||||||
import eu.midnightdust.lib.util.MidnightColorUtil;
|
|
||||||
import net.fabricmc.loader.api.FabricLoader;
|
|
||||||
import net.irisshaders.iris.api.v0.IrisApi;
|
|
||||||
import net.irisshaders.iris.api.v0.IrisApiConfig;
|
|
||||||
import net.minecraft.client.MinecraftClient;
|
|
||||||
import net.minecraft.client.gui.screen.Screen;
|
|
||||||
import net.minecraft.text.Style;
|
|
||||||
import net.minecraft.text.Text;
|
|
||||||
import net.puzzlemc.gui.screen.widget.PuzzleWidget;
|
|
||||||
|
|
||||||
public class IrisCompat {
|
|
||||||
public static void init() {
|
|
||||||
if (FabricLoader.getInstance().isModLoaded("iris")) {
|
|
||||||
PuzzleApi.addToGraphicsOptions(new PuzzleWidget(Text.of("Iris")));
|
|
||||||
PuzzleApi.addToGraphicsOptions(new PuzzleWidget(Text.translatable("iris.puzzle.option.enableShaders"), (button) -> button.setMessage(IrisApi.getInstance().getConfig().areShadersEnabled() ? PuzzleClient.YES : PuzzleClient.NO), (button) -> {
|
|
||||||
IrisApiConfig irisConfig = IrisApi.getInstance().getConfig();
|
|
||||||
irisConfig.setShadersEnabledAndApply(!irisConfig.areShadersEnabled());
|
|
||||||
}));
|
|
||||||
PuzzleApi.addToGraphicsOptions(new PuzzleWidget(Text.translatable("options.iris.shaderPackSelection.title"), (button) -> button.setMessage(Text.literal("➥ ").append(Text.translatable("iris.puzzle.option.open").setStyle(Style.EMPTY.withColor(MidnightColorUtil.radialRainbow(0.5f, 1).getRGB())))), (button) -> {
|
|
||||||
MinecraftClient client = MinecraftClient.getInstance();
|
|
||||||
client.setScreen((Screen) IrisApi.getInstance().openMainIrisScreenObj(client.currentScreen));
|
|
||||||
}));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -1,42 +1,27 @@
|
|||||||
package net.puzzlemc.gui;
|
package net.puzzlemc.gui;
|
||||||
|
|
||||||
import dev.lambdaurora.lambdabettergrass.LBGConfig;
|
import eu.midnightdust.core.MidnightLib;
|
||||||
import dev.lambdaurora.lambdabettergrass.LambdaBetterGrass;
|
|
||||||
import dev.lambdaurora.lambdynlights.DynamicLightsConfig;
|
|
||||||
import dev.lambdaurora.lambdynlights.LambDynLights;
|
|
||||||
import dynamicfps.DynamicFPSConfig;
|
|
||||||
import dynamicfps.DynamicFPSMod;
|
|
||||||
import eu.midnightdust.core.MidnightLibClient;
|
|
||||||
import eu.midnightdust.cullleaves.config.CullLeavesConfig;
|
|
||||||
import eu.midnightdust.lib.util.PlatformFunctions;
|
import eu.midnightdust.lib.util.PlatformFunctions;
|
||||||
import io.github.kvverti.colormatic.Colormatic;
|
import net.minecraft.util.Identifier;
|
||||||
import io.github.kvverti.colormatic.ColormaticConfigController;
|
|
||||||
import link.infra.borderlessmining.config.ConfigHandler;
|
|
||||||
import me.pepperbell.continuity.client.config.ContinuityConfig;
|
|
||||||
import me.pepperbell.continuity.client.config.Option;
|
|
||||||
import net.puzzlemc.core.config.PuzzleConfig;
|
import net.puzzlemc.core.config.PuzzleConfig;
|
||||||
|
import net.puzzlemc.gui.compat.*;
|
||||||
import net.puzzlemc.gui.screen.widget.PuzzleWidget;
|
import net.puzzlemc.gui.screen.widget.PuzzleWidget;
|
||||||
import net.fabricmc.api.ClientModInitializer;
|
import net.fabricmc.api.ClientModInitializer;
|
||||||
import net.minecraft.client.MinecraftClient;
|
import net.minecraft.client.MinecraftClient;
|
||||||
import net.minecraft.text.Text;
|
import net.minecraft.text.Text;
|
||||||
import net.minecraft.util.Formatting;
|
import net.minecraft.util.Formatting;
|
||||||
import net.puzzlemc.splashscreen.PuzzleSplashScreen;
|
import net.puzzlemc.splashscreen.PuzzleSplashScreen;
|
||||||
import shcm.shsupercm.fabric.citresewn.config.CITResewnConfig;
|
|
||||||
import traben.entity_model_features.config.EMFConfig;
|
|
||||||
import traben.entity_model_features.utils.EMFManager;
|
|
||||||
import traben.entity_texture_features.ETFApi;
|
|
||||||
import traben.entity_texture_features.config.ETFConfig;
|
|
||||||
import io.github.kvverti.colormatic.ColormaticConfig;
|
|
||||||
|
|
||||||
public class PuzzleClient implements ClientModInitializer {
|
public class PuzzleClient implements ClientModInitializer {
|
||||||
|
|
||||||
public final static String id = "puzzle";
|
public final static String id = "puzzle";
|
||||||
public static final Text YES = Text.translatable("gui.yes").formatted(Formatting.GREEN);
|
public static final Text YES = Text.translatable("gui.yes").formatted(Formatting.GREEN);
|
||||||
public static final Text NO = Text.translatable("gui.no").formatted(Formatting.RED);
|
public static final Text NO = Text.translatable("gui.no").formatted(Formatting.RED);
|
||||||
|
public static final Identifier PUZZLE_BUTTON = new Identifier(id, "icon/button");
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onInitializeClient() {
|
public void onInitializeClient() {
|
||||||
MidnightLibClient.hiddenMods.add("puzzle");
|
MidnightLib.hiddenMods.add("puzzle");
|
||||||
MinecraftClient client = MinecraftClient.getInstance();
|
MinecraftClient client = MinecraftClient.getInstance();
|
||||||
PuzzleApi.addToMiscOptions(new PuzzleWidget(Text.of("Puzzle")));
|
PuzzleApi.addToMiscOptions(new PuzzleWidget(Text.of("Puzzle")));
|
||||||
PuzzleApi.addToMiscOptions(new PuzzleWidget(Text.translatable("puzzle.option.check_for_updates"), (button) -> button.setMessage(PuzzleConfig.checkUpdates ? YES : NO), (button) -> {
|
PuzzleApi.addToMiscOptions(new PuzzleWidget(Text.translatable("puzzle.option.check_for_updates"), (button) -> button.setMessage(PuzzleConfig.checkUpdates ? YES : NO), (button) -> {
|
||||||
@@ -69,235 +54,21 @@ public class PuzzleClient implements ClientModInitializer {
|
|||||||
PuzzleConfig.write(id);
|
PuzzleConfig.write(id);
|
||||||
}));
|
}));
|
||||||
}
|
}
|
||||||
if (isActive("cullleaves")) {
|
if (isActive("cullleaves")) CullLeavesCompat.init();
|
||||||
PuzzleApi.addToPerformanceOptions(new PuzzleWidget(Text.of("CullLeaves")));
|
if (isActive("colormatic")) ColormaticCompat.init();
|
||||||
PuzzleApi.addToPerformanceOptions(new PuzzleWidget(Text.translatable("cullleaves.puzzle.option.enabled"), (button) -> button.setMessage(CullLeavesConfig.enabled ? YES : NO), (button) -> {
|
if (isActive("borderlessmining")) BorderlessMiningCompat.init();
|
||||||
CullLeavesConfig.enabled = !CullLeavesConfig.enabled;
|
if (isActive("iris")) IrisCompat.init();
|
||||||
CullLeavesConfig.write("cullleaves");
|
|
||||||
MinecraftClient.getInstance().worldRenderer.reload();
|
|
||||||
}));
|
|
||||||
}
|
|
||||||
if (isActive("colormatic")) {
|
|
||||||
PuzzleApi.addToResourceOptions(new PuzzleWidget(Text.of("Colormatic")));
|
|
||||||
ColormaticConfig colormaticConfig = Colormatic.config();
|
|
||||||
PuzzleApi.addToResourceOptions(new PuzzleWidget(Text.translatable("colormatic.config.option.clearSky"), (button) -> button.setMessage(colormaticConfig.clearSky ? YES : NO), (button) -> {
|
|
||||||
colormaticConfig.clearSky = !colormaticConfig.clearSky;
|
|
||||||
ColormaticConfigController.persist(colormaticConfig);
|
|
||||||
}));
|
|
||||||
PuzzleApi.addToResourceOptions(new PuzzleWidget(Text.translatable("colormatic.config.option.clearVoid"), (button) -> button.setMessage(colormaticConfig.clearVoid ? YES : NO), (button) -> {
|
|
||||||
colormaticConfig.clearVoid = !colormaticConfig.clearVoid;
|
|
||||||
ColormaticConfigController.persist(colormaticConfig);
|
|
||||||
}));
|
|
||||||
PuzzleApi.addToResourceOptions(new PuzzleWidget(Text.translatable("colormatic.config.option.blendSkyLight"), (button) -> button.setMessage(colormaticConfig.blendSkyLight ? YES : NO), (button) -> {
|
|
||||||
colormaticConfig.blendSkyLight = !colormaticConfig.blendSkyLight;
|
|
||||||
ColormaticConfigController.persist(colormaticConfig);
|
|
||||||
}));
|
|
||||||
PuzzleApi.addToResourceOptions(new PuzzleWidget(Text.translatable("colormatic.config.option.flickerBlockLight"), (button) -> button.setMessage(colormaticConfig.flickerBlockLight ? YES : NO), (button) -> {
|
|
||||||
colormaticConfig.flickerBlockLight = !colormaticConfig.flickerBlockLight;
|
|
||||||
ColormaticConfigController.persist(colormaticConfig);
|
|
||||||
}));
|
|
||||||
PuzzleApi.addToResourceOptions(new PuzzleWidget(0, 100, Text.translatable("colormatic.config.option.relativeBlockLightIntensity"),
|
|
||||||
() -> (int) (100*(1.0 - colormaticConfig.relativeBlockLightIntensityExponent / -16.0)),
|
|
||||||
(button) -> button.setMessage(Text.translatable("colormatic.config.option.relativeBlockLightIntensity")
|
|
||||||
.append(": ")
|
|
||||||
.append(Text.literal(String.valueOf((int)(100 * Math.exp(ColormaticConfig.scaled(colormaticConfig.relativeBlockLightIntensityExponent))))).append("%"))),
|
|
||||||
(slider) -> {
|
|
||||||
try {
|
|
||||||
colormaticConfig.relativeBlockLightIntensityExponent = ((1.00 - ((slider.getInt())/100f)) * -16.0);
|
|
||||||
ColormaticConfigController.persist(colormaticConfig);
|
|
||||||
}
|
|
||||||
catch (NumberFormatException ignored) {}
|
|
||||||
}));
|
|
||||||
}
|
|
||||||
if (isActive("dynamicfps")) {
|
|
||||||
PuzzleApi.addToPerformanceOptions(new PuzzleWidget(Text.of("Dynamic FPS")));
|
|
||||||
DynamicFPSConfig fpsConfig = DynamicFPSMod.config;
|
|
||||||
PuzzleApi.addToPerformanceOptions(new PuzzleWidget(Text.translatable("config.dynamicfps.reduce_when_unfocused"), (button) -> button.setMessage(fpsConfig.reduceFPSWhenUnfocused ? YES : NO), (button) -> {
|
|
||||||
fpsConfig.reduceFPSWhenUnfocused = !fpsConfig.reduceFPSWhenUnfocused;
|
|
||||||
fpsConfig.save();
|
|
||||||
}));
|
|
||||||
PuzzleApi.addToPerformanceOptions(new PuzzleWidget(0, 60,Text.translatable("config.dynamicfps.unfocused_fps"), () -> fpsConfig.unfocusedFPS,
|
|
||||||
(button) -> button.setMessage(Text.of(fpsConfig.unfocusedFPS + " FPS")),
|
|
||||||
(slider) -> {
|
|
||||||
try {
|
|
||||||
fpsConfig.unfocusedFPS = slider.getInt();
|
|
||||||
}
|
|
||||||
catch (NumberFormatException ignored) {}
|
|
||||||
finally {fpsConfig.save();}
|
|
||||||
}));
|
|
||||||
PuzzleApi.addToPerformanceOptions(new PuzzleWidget(Text.translatable("config.dynamicfps.restore_when_hovered"), (button) -> button.setMessage(fpsConfig.restoreFPSWhenHovered ? YES : NO), (button) -> {
|
|
||||||
fpsConfig.restoreFPSWhenHovered = !fpsConfig.restoreFPSWhenHovered;
|
|
||||||
fpsConfig.save();
|
|
||||||
}));
|
|
||||||
PuzzleApi.addToPerformanceOptions(new PuzzleWidget(Text.translatable("config.dynamicfps.run_gc_on_unfocus"), (button) -> button.setMessage(fpsConfig.runGCOnUnfocus ? YES : NO), (button) -> {
|
|
||||||
fpsConfig.runGCOnUnfocus = !fpsConfig.runGCOnUnfocus;
|
|
||||||
fpsConfig.save();
|
|
||||||
}));
|
|
||||||
PuzzleApi.addToPerformanceOptions(new PuzzleWidget(0, 100,Text.translatable("config.dynamicfps.unfocused_volume"), () -> ((Number)(fpsConfig.unfocusedVolumeMultiplier * 100)).intValue(),
|
|
||||||
(button) -> button.setMessage(Text.of(((Number)(fpsConfig.unfocusedVolumeMultiplier * 100)).intValue() + "%")),
|
|
||||||
(slider) -> {
|
|
||||||
try {
|
|
||||||
fpsConfig.unfocusedVolumeMultiplier = ((Number)slider.getInt()).floatValue() / 100;
|
|
||||||
}
|
|
||||||
catch (NumberFormatException ignored) {}
|
|
||||||
finally {fpsConfig.save();}
|
|
||||||
}));
|
|
||||||
PuzzleApi.addToPerformanceOptions(new PuzzleWidget(0, 100,Text.translatable("config.dynamicfps.hidden_volume"), () -> ((Number)(fpsConfig.hiddenVolumeMultiplier * 100)).intValue(),
|
|
||||||
(button) -> button.setMessage(Text.of(((Number)(fpsConfig.hiddenVolumeMultiplier * 100)).intValue() + "%")),
|
|
||||||
(slider) -> {
|
|
||||||
try {
|
|
||||||
fpsConfig.hiddenVolumeMultiplier = ((Number)slider.getInt()).floatValue() / 100;
|
|
||||||
}
|
|
||||||
catch (NumberFormatException ignored) {}
|
|
||||||
finally {fpsConfig.save();}
|
|
||||||
}));
|
|
||||||
}
|
|
||||||
if (isActive("borderlessmining")) {
|
|
||||||
PuzzleApi.addToMiscOptions(new PuzzleWidget(Text.of("Borderless Mining")));
|
|
||||||
ConfigHandler bmConfig = ConfigHandler.getInstance();
|
|
||||||
PuzzleApi.addToMiscOptions(new PuzzleWidget(Text.translatable("config.borderlessmining.general.enabled"), (button) -> button.setMessage(bmConfig.isEnabledOrPending() ? YES : NO), (button) -> {
|
|
||||||
bmConfig.setEnabledPending(!bmConfig.isEnabledOrPending());
|
|
||||||
bmConfig.save();
|
|
||||||
}));
|
|
||||||
if (MinecraftClient.IS_SYSTEM_MAC) {
|
|
||||||
PuzzleApi.addToMiscOptions(new PuzzleWidget(Text.translatable("config.borderlessmining.general.enabledmac"), (button) -> button.setMessage(bmConfig.enableMacOS ? YES : NO), (button) -> {
|
|
||||||
bmConfig.enableMacOS = !bmConfig.enableMacOS;
|
|
||||||
bmConfig.setEnabledPending(bmConfig.isEnabled());
|
|
||||||
bmConfig.save();
|
|
||||||
}));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if (isActive("iris")) {
|
|
||||||
IrisCompat.init();
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
public static boolean lateInitDone = false;
|
public static boolean lateInitDone = false;
|
||||||
public static void lateInit() { // Some mods are initialized after Puzzle, so we can't access them in our ClientModInitializer
|
public static void lateInit() { // Some mods are initialized after Puzzle, so we can't access them in our ClientModInitializer
|
||||||
if (isActive("lambdynlights")) {
|
if (isActive("lambdynlights")) LDLCompat.init();
|
||||||
DynamicLightsConfig ldlConfig = LambDynLights.get().config;
|
if (isActive("citresewn")) CITRCompat.init();
|
||||||
|
if (isActive("lambdabettergrass")) LBGCompat.init();
|
||||||
PuzzleApi.addToGraphicsOptions(new PuzzleWidget(Text.of("LambDynamicLights")));
|
if (isActive("continuity")) ContinuityCompat.init();
|
||||||
PuzzleApi.addToGraphicsOptions(new PuzzleWidget(Text.translatable("lambdynlights.option.mode"), (button) -> button.setMessage(ldlConfig.getDynamicLightsMode().getTranslatedText()), (button) -> ldlConfig.setDynamicLightsMode(ldlConfig.getDynamicLightsMode().next())));
|
if (isActive("entity_texture_features")) ETFCompat.init();
|
||||||
PuzzleApi.addToGraphicsOptions(new PuzzleWidget(Text.translatable("").append("DynLights: ").append(Text.translatable("lambdynlights.option.light_sources.entities")), (button) -> button.setMessage(ldlConfig.getEntitiesLightSource().get() ? YES : NO), (button) -> ldlConfig.getEntitiesLightSource().set(!ldlConfig.getEntitiesLightSource().get())));
|
if (isActive("entity_model_features")) EMFCompat.init();
|
||||||
PuzzleApi.addToGraphicsOptions(new PuzzleWidget(Text.translatable("").append("DynLights: ").append(Text.translatable("lambdynlights.option.light_sources.block_entities")), (button) -> button.setMessage(ldlConfig.getBlockEntitiesLightSource().get() ? YES : NO), (button) -> ldlConfig.getBlockEntitiesLightSource().set(!ldlConfig.getBlockEntitiesLightSource().get())));
|
|
||||||
PuzzleApi.addToGraphicsOptions(new PuzzleWidget(Text.translatable("").append("DynLights: ").append(Text.translatable("entity.minecraft.creeper")), (button) -> button.setMessage(ldlConfig.getCreeperLightingMode().getTranslatedText()), (button) -> ldlConfig.setCreeperLightingMode(ldlConfig.getCreeperLightingMode().next())));
|
|
||||||
PuzzleApi.addToGraphicsOptions(new PuzzleWidget(Text.translatable("").append("DynLights: ").append(Text.translatable("block.minecraft.tnt")), (button) -> button.setMessage(ldlConfig.getTntLightingMode().getTranslatedText()), (button) -> ldlConfig.setTntLightingMode(ldlConfig.getTntLightingMode().next())));
|
|
||||||
PuzzleApi.addToGraphicsOptions(new PuzzleWidget(Text.translatable("").append("DynLights: ").append(Text.translatable("lambdynlights.option.light_sources.water_sensitive_check")), (button) -> button.setMessage(ldlConfig.getWaterSensitiveCheck().get() ? YES : NO), (button) -> ldlConfig.getWaterSensitiveCheck().set(!ldlConfig.getWaterSensitiveCheck().get())));
|
|
||||||
}
|
|
||||||
if (isActive("citresewn") && CITResewnConfig.INSTANCE != null) {
|
|
||||||
PuzzleApi.addToResourceOptions(new PuzzleWidget(Text.of("CIT Resewn")));
|
|
||||||
CITResewnConfig citConfig = CITResewnConfig.INSTANCE;
|
|
||||||
PuzzleApi.addToResourceOptions(new PuzzleWidget(Text.translatable("config.citresewn.enabled.title"), (button) -> button.setMessage(citConfig.enabled ? YES : NO), (button) -> {
|
|
||||||
citConfig.enabled = !citConfig.enabled;
|
|
||||||
citConfig.write();
|
|
||||||
MinecraftClient.getInstance().reloadResources();
|
|
||||||
}));
|
|
||||||
PuzzleApi.addToResourceOptions(new PuzzleWidget(Text.translatable("config.citresewn.mute_errors.title"), (button) -> button.setMessage(citConfig.mute_errors ? YES : NO), (button) -> {
|
|
||||||
citConfig.mute_errors = !citConfig.mute_errors;
|
|
||||||
citConfig.write();
|
|
||||||
}));
|
|
||||||
PuzzleApi.addToResourceOptions(new PuzzleWidget(Text.translatable("config.citresewn.mute_warns.title"), (button) -> button.setMessage(citConfig.mute_warns ? YES : NO), (button) -> {
|
|
||||||
citConfig.mute_warns = !citConfig.mute_warns;
|
|
||||||
citConfig.write();
|
|
||||||
}));
|
|
||||||
PuzzleApi.addToResourceOptions(new PuzzleWidget(Text.translatable("config.citresewn.broken_paths.title"), (button) -> button.setMessage(citConfig.broken_paths ? YES : NO), (button) -> {
|
|
||||||
citConfig.broken_paths = !citConfig.broken_paths;
|
|
||||||
citConfig.write();
|
|
||||||
}));
|
|
||||||
PuzzleApi.addToResourceOptions(new PuzzleWidget(0, 100,Text.translatable("config.citresewn.cache_ms.title"), () -> citConfig.cache_ms,
|
|
||||||
(button) -> button.setMessage(message(citConfig)),
|
|
||||||
(slider) -> {
|
|
||||||
try {
|
|
||||||
citConfig.cache_ms = slider.getInt();
|
|
||||||
}
|
|
||||||
catch (NumberFormatException ignored) {}
|
|
||||||
citConfig.write();
|
|
||||||
}));
|
|
||||||
}
|
|
||||||
if (isActive("lambdabettergrass")) {
|
|
||||||
LBGConfig lbgConfig = LambdaBetterGrass.get().config;
|
|
||||||
PuzzleApi.addToGraphicsOptions(new PuzzleWidget(Text.of("LambdaBetterGrass")));
|
|
||||||
PuzzleApi.addToGraphicsOptions(new PuzzleWidget(Text.translatable("lambdabettergrass.option.mode"), (button) -> button.setMessage(lbgConfig.getMode().getTranslatedText()), (button) -> lbgConfig.setMode(lbgConfig.getMode().next())));
|
|
||||||
PuzzleApi.addToGraphicsOptions(new PuzzleWidget(Text.translatable("lambdabettergrass.option.better_snow"), (button) -> button.setMessage(lbgConfig.hasBetterLayer() ? YES : NO), (button) -> lbgConfig.setBetterLayer(!lbgConfig.hasBetterLayer())));
|
|
||||||
}
|
|
||||||
if (isActive("continuity")) {
|
|
||||||
PuzzleApi.addToResourceOptions(new PuzzleWidget(Text.of("Continuity")));
|
|
||||||
ContinuityConfig contConfig = ContinuityConfig.INSTANCE;
|
|
||||||
contConfig.getOptionMapView().forEach((s, option) -> {
|
|
||||||
if (s.equals("use_manual_culling")) return;
|
|
||||||
try {
|
|
||||||
Option.BooleanOption booleanOption = ((Option.BooleanOption)option);
|
|
||||||
PuzzleApi.addToResourceOptions(new PuzzleWidget(Text.translatable("options.continuity."+s), (button) -> button.setMessage(booleanOption.get() ? YES : NO), (button) -> {
|
|
||||||
booleanOption.set(!booleanOption.get());
|
|
||||||
contConfig.onChange();
|
|
||||||
contConfig.save();
|
|
||||||
}));
|
|
||||||
} catch (Exception ignored) {}
|
|
||||||
});
|
|
||||||
}
|
|
||||||
if (isActive("entity_texture_features")) {
|
|
||||||
PuzzleApi.addToResourceOptions(new PuzzleWidget(Text.translatable("config.entity_texture_features.title")));
|
|
||||||
ETFConfig etfConfig = ETFApi.getETFConfigObject();
|
|
||||||
PuzzleApi.addToResourceOptions(new PuzzleWidget(Text.translatable("config.entity_texture_features.enable_custom_textures.title"), (button) -> button.setMessage(etfConfig.enableCustomTextures ? YES : NO), (button) -> {
|
|
||||||
etfConfig.enableCustomTextures = !etfConfig.enableCustomTextures;
|
|
||||||
ETFApi.saveETFConfigChangesAndResetETF();
|
|
||||||
}));
|
|
||||||
PuzzleApi.addToResourceOptions(new PuzzleWidget(Text.translatable("config.entity_texture_features.enable_emissive_textures.title"), (button) -> button.setMessage(etfConfig.enableEmissiveTextures ? YES : NO), (button) -> {
|
|
||||||
etfConfig.enableEmissiveTextures = !etfConfig.enableEmissiveTextures;
|
|
||||||
ETFApi.saveETFConfigChangesAndResetETF();
|
|
||||||
}));
|
|
||||||
PuzzleApi.addToResourceOptions(new PuzzleWidget(Text.translatable("config.entity_texture_features.emissive_mode.title"), (button) -> button.setMessage(
|
|
||||||
Text.literal(etfConfig.emissiveRenderMode.toString())), (button) -> {
|
|
||||||
etfConfig.emissiveRenderMode = etfConfig.emissiveRenderMode.next();
|
|
||||||
ETFApi.saveETFConfigChangesAndResetETF();
|
|
||||||
}));
|
|
||||||
PuzzleApi.addToResourceOptions(new PuzzleWidget(Text.translatable("config.entity_texture_features.blinking_mob_settings.title"), (button) -> button.setMessage(etfConfig.enableBlinking ? YES : NO), (button) -> {
|
|
||||||
etfConfig.enableBlinking = !etfConfig.enableBlinking;
|
|
||||||
ETFApi.saveETFConfigChangesAndResetETF();
|
|
||||||
}));
|
|
||||||
PuzzleApi.addToResourceOptions(new PuzzleWidget(Text.translatable("config.entity_texture_features.player_skin_features.title"), (button) -> button.setMessage(etfConfig.skinFeaturesEnabled ? YES : NO), (button) -> {
|
|
||||||
etfConfig.skinFeaturesEnabled = !etfConfig.skinFeaturesEnabled;
|
|
||||||
ETFApi.saveETFConfigChangesAndResetETF();
|
|
||||||
}));
|
|
||||||
}
|
|
||||||
if (isActive("entity_model_features")) {
|
|
||||||
PuzzleApi.addToResourceOptions(new PuzzleWidget(Text.translatable("entity_model_features.title")));
|
|
||||||
EMFConfig emfConfig = EMFConfig.getConfig();
|
|
||||||
PuzzleApi.addToResourceOptions(new PuzzleWidget(Text.translatable("entity_model_features.config.substitute_vanilla"), (button) -> button.setMessage(emfConfig.attemptToCopyVanillaModelIntoMissingModelPart ? YES : NO), (button) -> {
|
|
||||||
emfConfig.attemptToCopyVanillaModelIntoMissingModelPart = !emfConfig.attemptToCopyVanillaModelIntoMissingModelPart;
|
|
||||||
EMFConfig.EMF_saveConfig();
|
|
||||||
if (EMFConfig.getConfig().reloadMode == EMFConfig.ModelDataRefreshMode.MANUAL) {
|
|
||||||
EMFManager.resetInstance();
|
|
||||||
}
|
|
||||||
}));
|
|
||||||
}
|
|
||||||
lateInitDone = true;
|
lateInitDone = true;
|
||||||
}
|
}
|
||||||
public static Text message(CITResewnConfig config) {
|
|
||||||
int ticks = config.cache_ms;
|
|
||||||
if (ticks <= 1) {
|
|
||||||
return (Text.translatable("config.citresewn.cache_ms.ticks." + ticks)).formatted(Formatting.AQUA);
|
|
||||||
} else {
|
|
||||||
Formatting color = Formatting.DARK_RED;
|
|
||||||
if (ticks <= 40) {
|
|
||||||
color = Formatting.RED;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (ticks <= 20) {
|
|
||||||
color = Formatting.GOLD;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (ticks <= 10) {
|
|
||||||
color = Formatting.DARK_GREEN;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (ticks <= 5) {
|
|
||||||
color = Formatting.GREEN;
|
|
||||||
}
|
|
||||||
|
|
||||||
return (Text.translatable("config.citresewn.cache_ms.ticks.any", ticks)).formatted(color);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
public static boolean isActive(String modid) {
|
public static boolean isActive(String modid) {
|
||||||
return PlatformFunctions.isModLoaded(modid) && !PuzzleConfig.disabledIntegrations.contains(modid);
|
return PlatformFunctions.isModLoaded(modid) && !PuzzleConfig.disabledIntegrations.contains(modid);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -0,0 +1,28 @@
|
|||||||
|
package net.puzzlemc.gui.compat;
|
||||||
|
|
||||||
|
import link.infra.borderlessmining.config.ConfigHandler;
|
||||||
|
import net.minecraft.client.MinecraftClient;
|
||||||
|
import net.minecraft.text.Text;
|
||||||
|
import net.puzzlemc.gui.PuzzleApi;
|
||||||
|
import net.puzzlemc.gui.screen.widget.PuzzleWidget;
|
||||||
|
|
||||||
|
import static net.puzzlemc.gui.PuzzleClient.NO;
|
||||||
|
import static net.puzzlemc.gui.PuzzleClient.YES;
|
||||||
|
|
||||||
|
public class BorderlessMiningCompat {
|
||||||
|
public static void init() {
|
||||||
|
PuzzleApi.addToMiscOptions(new PuzzleWidget(Text.of("Borderless Mining")));
|
||||||
|
ConfigHandler bmConfig = ConfigHandler.getInstance();
|
||||||
|
PuzzleApi.addToMiscOptions(new PuzzleWidget(Text.translatable("config.borderlessmining.general.enabled"), (button) -> button.setMessage(bmConfig.isEnabledOrPending() ? YES : NO), (button) -> {
|
||||||
|
bmConfig.setEnabledPending(!bmConfig.isEnabledOrPending());
|
||||||
|
bmConfig.save();
|
||||||
|
}));
|
||||||
|
if (MinecraftClient.IS_SYSTEM_MAC) {
|
||||||
|
PuzzleApi.addToMiscOptions(new PuzzleWidget(Text.translatable("config.borderlessmining.general.enabledmac"), (button) -> button.setMessage(bmConfig.enableMacOS ? YES : NO), (button) -> {
|
||||||
|
bmConfig.enableMacOS = !bmConfig.enableMacOS;
|
||||||
|
bmConfig.setEnabledPending(bmConfig.isEnabled());
|
||||||
|
bmConfig.save();
|
||||||
|
}));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,60 @@
|
|||||||
|
package net.puzzlemc.gui.compat;
|
||||||
|
|
||||||
|
import net.minecraft.client.MinecraftClient;
|
||||||
|
import net.minecraft.text.Text;
|
||||||
|
import net.minecraft.util.Formatting;
|
||||||
|
import net.puzzlemc.gui.PuzzleApi;
|
||||||
|
import net.puzzlemc.gui.screen.widget.PuzzleWidget;
|
||||||
|
import shcm.shsupercm.fabric.citresewn.config.CITResewnConfig;
|
||||||
|
|
||||||
|
import static net.minecraft.screen.ScreenTexts.NO;
|
||||||
|
import static net.minecraft.screen.ScreenTexts.YES;
|
||||||
|
|
||||||
|
public class CITRCompat {
|
||||||
|
public static void init() {
|
||||||
|
if (CITResewnConfig.INSTANCE != null) {
|
||||||
|
PuzzleApi.addToResourceOptions(new PuzzleWidget(Text.of("CIT Resewn")));
|
||||||
|
CITResewnConfig citConfig = CITResewnConfig.INSTANCE;
|
||||||
|
PuzzleApi.addToResourceOptions(new PuzzleWidget(Text.translatable("config.citresewn.enabled.title"), (button) -> button.setMessage(citConfig.enabled ? YES : NO), (button) -> {
|
||||||
|
citConfig.enabled = !citConfig.enabled;
|
||||||
|
citConfig.write();
|
||||||
|
MinecraftClient.getInstance().reloadResources();
|
||||||
|
}));
|
||||||
|
PuzzleApi.addToResourceOptions(new PuzzleWidget(Text.translatable("config.citresewn.mute_errors.title"), (button) -> button.setMessage(citConfig.mute_errors ? YES : NO), (button) -> {
|
||||||
|
citConfig.mute_errors = !citConfig.mute_errors;
|
||||||
|
citConfig.write();
|
||||||
|
}));
|
||||||
|
PuzzleApi.addToResourceOptions(new PuzzleWidget(Text.translatable("config.citresewn.mute_warns.title"), (button) -> button.setMessage(citConfig.mute_warns ? YES : NO), (button) -> {
|
||||||
|
citConfig.mute_warns = !citConfig.mute_warns;
|
||||||
|
citConfig.write();
|
||||||
|
}));
|
||||||
|
PuzzleApi.addToResourceOptions(new PuzzleWidget(Text.translatable("config.citresewn.broken_paths.title"), (button) -> button.setMessage(citConfig.broken_paths ? YES : NO), (button) -> {
|
||||||
|
citConfig.broken_paths = !citConfig.broken_paths;
|
||||||
|
citConfig.write();
|
||||||
|
}));
|
||||||
|
PuzzleApi.addToResourceOptions(new PuzzleWidget(0, 100, Text.translatable("config.citresewn.cache_ms.title"), () -> citConfig.cache_ms,
|
||||||
|
(button) -> button.setMessage(message(citConfig)),
|
||||||
|
(slider) -> {
|
||||||
|
try {
|
||||||
|
citConfig.cache_ms = slider.getInt();
|
||||||
|
} catch (NumberFormatException ignored) {
|
||||||
|
}
|
||||||
|
citConfig.write();
|
||||||
|
}));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
public static Text message(CITResewnConfig config) {
|
||||||
|
int ticks = config.cache_ms;
|
||||||
|
if (ticks <= 1) {
|
||||||
|
return (Text.translatable("config.citresewn.cache_ms.ticks." + ticks)).formatted(Formatting.AQUA);
|
||||||
|
} else {
|
||||||
|
Formatting color = Formatting.DARK_RED;
|
||||||
|
if (ticks <= 40) color = Formatting.RED;
|
||||||
|
if (ticks <= 20) color = Formatting.GOLD;
|
||||||
|
if (ticks <= 10) color = Formatting.DARK_GREEN;
|
||||||
|
if (ticks <= 5) color = Formatting.GREEN;
|
||||||
|
|
||||||
|
return (Text.translatable("config.citresewn.cache_ms.ticks.any", ticks)).formatted(color);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,46 @@
|
|||||||
|
package net.puzzlemc.gui.compat;
|
||||||
|
|
||||||
|
import io.github.kvverti.colormatic.Colormatic;
|
||||||
|
import io.github.kvverti.colormatic.ColormaticConfig;
|
||||||
|
import io.github.kvverti.colormatic.ColormaticConfigController;
|
||||||
|
import net.minecraft.text.Text;
|
||||||
|
import net.puzzlemc.gui.PuzzleApi;
|
||||||
|
import net.puzzlemc.gui.screen.widget.PuzzleWidget;
|
||||||
|
|
||||||
|
import static net.puzzlemc.gui.PuzzleClient.NO;
|
||||||
|
import static net.puzzlemc.gui.PuzzleClient.YES;
|
||||||
|
|
||||||
|
public class ColormaticCompat {
|
||||||
|
public static void init() {
|
||||||
|
PuzzleApi.addToResourceOptions(new PuzzleWidget(Text.of("Colormatic")));
|
||||||
|
ColormaticConfig colormaticConfig = Colormatic.config();
|
||||||
|
PuzzleApi.addToResourceOptions(new PuzzleWidget(Text.translatable("colormatic.config.option.clearSky"), (button) -> button.setMessage(colormaticConfig.clearSky ? YES : NO), (button) -> {
|
||||||
|
colormaticConfig.clearSky = !colormaticConfig.clearSky;
|
||||||
|
ColormaticConfigController.persist(colormaticConfig);
|
||||||
|
}));
|
||||||
|
PuzzleApi.addToResourceOptions(new PuzzleWidget(Text.translatable("colormatic.config.option.clearVoid"), (button) -> button.setMessage(colormaticConfig.clearVoid ? YES : NO), (button) -> {
|
||||||
|
colormaticConfig.clearVoid = !colormaticConfig.clearVoid;
|
||||||
|
ColormaticConfigController.persist(colormaticConfig);
|
||||||
|
}));
|
||||||
|
PuzzleApi.addToResourceOptions(new PuzzleWidget(Text.translatable("colormatic.config.option.blendSkyLight"), (button) -> button.setMessage(colormaticConfig.blendSkyLight ? YES : NO), (button) -> {
|
||||||
|
colormaticConfig.blendSkyLight = !colormaticConfig.blendSkyLight;
|
||||||
|
ColormaticConfigController.persist(colormaticConfig);
|
||||||
|
}));
|
||||||
|
PuzzleApi.addToResourceOptions(new PuzzleWidget(Text.translatable("colormatic.config.option.flickerBlockLight"), (button) -> button.setMessage(colormaticConfig.flickerBlockLight ? YES : NO), (button) -> {
|
||||||
|
colormaticConfig.flickerBlockLight = !colormaticConfig.flickerBlockLight;
|
||||||
|
ColormaticConfigController.persist(colormaticConfig);
|
||||||
|
}));
|
||||||
|
PuzzleApi.addToResourceOptions(new PuzzleWidget(0, 100, Text.translatable("colormatic.config.option.relativeBlockLightIntensity"),
|
||||||
|
() -> (int) (100*(1.0 - colormaticConfig.relativeBlockLightIntensityExponent / -16.0)),
|
||||||
|
(button) -> button.setMessage(Text.translatable("colormatic.config.option.relativeBlockLightIntensity")
|
||||||
|
.append(": ")
|
||||||
|
.append(Text.literal(String.valueOf((int)(100 * Math.exp(ColormaticConfig.scaled(colormaticConfig.relativeBlockLightIntensityExponent))))).append("%"))),
|
||||||
|
(slider) -> {
|
||||||
|
try {
|
||||||
|
colormaticConfig.relativeBlockLightIntensityExponent = ((1.00 - ((slider.getInt())/100f)) * -16.0);
|
||||||
|
ColormaticConfigController.persist(colormaticConfig);
|
||||||
|
}
|
||||||
|
catch (NumberFormatException ignored) {}
|
||||||
|
}));
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,27 @@
|
|||||||
|
package net.puzzlemc.gui.compat;
|
||||||
|
|
||||||
|
import me.pepperbell.continuity.client.config.ContinuityConfig;
|
||||||
|
import me.pepperbell.continuity.client.config.Option;
|
||||||
|
import net.minecraft.text.Text;
|
||||||
|
import net.puzzlemc.gui.PuzzleApi;
|
||||||
|
import net.puzzlemc.gui.screen.widget.PuzzleWidget;
|
||||||
|
|
||||||
|
import static net.puzzlemc.gui.PuzzleClient.NO;
|
||||||
|
import static net.puzzlemc.gui.PuzzleClient.YES;
|
||||||
|
|
||||||
|
public class ContinuityCompat {
|
||||||
|
public static void init() {
|
||||||
|
PuzzleApi.addToResourceOptions(new PuzzleWidget(Text.of("Continuity")));
|
||||||
|
ContinuityConfig contConfig = ContinuityConfig.INSTANCE;
|
||||||
|
contConfig.getOptionMapView().forEach((s, option) -> {
|
||||||
|
if (s.equals("use_manual_culling")) return;
|
||||||
|
try {
|
||||||
|
Option.BooleanOption booleanOption = ((Option.BooleanOption)option);
|
||||||
|
PuzzleApi.addToResourceOptions(new PuzzleWidget(Text.translatable("options.continuity."+s), (button) -> button.setMessage(booleanOption.get() ? YES : NO), (button) -> {
|
||||||
|
booleanOption.set(!booleanOption.get());
|
||||||
|
contConfig.save();
|
||||||
|
}));
|
||||||
|
} catch (Exception ignored) {}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,21 @@
|
|||||||
|
package net.puzzlemc.gui.compat;
|
||||||
|
|
||||||
|
import eu.midnightdust.cullleaves.config.CullLeavesConfig;
|
||||||
|
import net.minecraft.client.MinecraftClient;
|
||||||
|
import net.minecraft.text.Text;
|
||||||
|
import net.puzzlemc.gui.PuzzleApi;
|
||||||
|
import net.puzzlemc.gui.screen.widget.PuzzleWidget;
|
||||||
|
|
||||||
|
import static net.puzzlemc.gui.PuzzleClient.NO;
|
||||||
|
import static net.puzzlemc.gui.PuzzleClient.YES;
|
||||||
|
|
||||||
|
public class CullLeavesCompat {
|
||||||
|
public static void init() {
|
||||||
|
PuzzleApi.addToPerformanceOptions(new PuzzleWidget(Text.of("CullLeaves")));
|
||||||
|
PuzzleApi.addToPerformanceOptions(new PuzzleWidget(Text.translatable("cullleaves.puzzle.option.enabled"), (button) -> button.setMessage(CullLeavesConfig.enabled ? YES : NO), (button) -> {
|
||||||
|
CullLeavesConfig.enabled = !CullLeavesConfig.enabled;
|
||||||
|
CullLeavesConfig.write("cullleaves");
|
||||||
|
MinecraftClient.getInstance().worldRenderer.reload();
|
||||||
|
}));
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,39 @@
|
|||||||
|
package net.puzzlemc.gui.compat;
|
||||||
|
|
||||||
|
import eu.midnightdust.lib.util.PlatformFunctions;
|
||||||
|
import net.minecraft.screen.ScreenTexts;
|
||||||
|
import net.minecraft.text.Text;
|
||||||
|
import net.puzzlemc.gui.PuzzleApi;
|
||||||
|
import net.puzzlemc.gui.screen.widget.PuzzleWidget;
|
||||||
|
import traben.entity_model_features.EMF;
|
||||||
|
import traben.entity_model_features.config.EMFConfig;
|
||||||
|
|
||||||
|
import java.util.EnumSet;
|
||||||
|
import java.util.NavigableSet;
|
||||||
|
import java.util.Objects;
|
||||||
|
import java.util.TreeSet;
|
||||||
|
|
||||||
|
import static net.puzzlemc.gui.PuzzleClient.NO;
|
||||||
|
import static net.puzzlemc.gui.PuzzleClient.YES;
|
||||||
|
|
||||||
|
public class EMFCompat {
|
||||||
|
public static void init() {
|
||||||
|
PuzzleApi.addToResourceOptions(new PuzzleWidget(Text.translatable("entity_model_features.title")));
|
||||||
|
EMFConfig emfConfig = EMF.config().getConfig();
|
||||||
|
PuzzleApi.addToResourceOptions(new PuzzleWidget(Text.translatable("entity_model_features.config.force_models"), (button) -> button.setMessage(emfConfig.attemptRevertingEntityModelsAlteredByAnotherMod ? YES : NO), (button) -> {
|
||||||
|
emfConfig.attemptRevertingEntityModelsAlteredByAnotherMod = !emfConfig.attemptRevertingEntityModelsAlteredByAnotherMod;
|
||||||
|
EMF.config().saveToFile();
|
||||||
|
}));
|
||||||
|
if (PlatformFunctions.isModLoaded("physicsmod")) {
|
||||||
|
PuzzleApi.addToResourceOptions(new PuzzleWidget(Text.translatable("entity_model_features.config.physics"), (button) -> button.setMessage(emfConfig.attemptPhysicsModPatch_2 != EMFConfig.PhysicsModCompatChoice.OFF ?
|
||||||
|
Text.translatable("entity_model_features.config." + (emfConfig.attemptPhysicsModPatch_2 == EMFConfig.PhysicsModCompatChoice.VANILLA ? "physics.1" : "physics.2")) : ScreenTexts.OFF), (button) -> {
|
||||||
|
final NavigableSet<EMFConfig.PhysicsModCompatChoice> set =
|
||||||
|
new TreeSet<>(EnumSet.allOf(EMFConfig.PhysicsModCompatChoice.class));
|
||||||
|
|
||||||
|
emfConfig.attemptPhysicsModPatch_2 = Objects.requireNonNullElseGet(
|
||||||
|
set.higher(emfConfig.attemptPhysicsModPatch_2), set::first);
|
||||||
|
EMF.config().saveToFile();
|
||||||
|
}));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,47 @@
|
|||||||
|
package net.puzzlemc.gui.compat;
|
||||||
|
|
||||||
|
import net.minecraft.text.Text;
|
||||||
|
import net.puzzlemc.gui.PuzzleApi;
|
||||||
|
import net.puzzlemc.gui.screen.widget.PuzzleWidget;
|
||||||
|
import traben.entity_texture_features.ETFApi;
|
||||||
|
import traben.entity_texture_features.config.ETFConfig;
|
||||||
|
|
||||||
|
import java.util.EnumSet;
|
||||||
|
import java.util.NavigableSet;
|
||||||
|
import java.util.Objects;
|
||||||
|
import java.util.TreeSet;
|
||||||
|
|
||||||
|
import static net.puzzlemc.gui.PuzzleClient.NO;
|
||||||
|
import static net.puzzlemc.gui.PuzzleClient.YES;
|
||||||
|
|
||||||
|
public class ETFCompat {
|
||||||
|
public static void init() {
|
||||||
|
PuzzleApi.addToResourceOptions(new PuzzleWidget(Text.translatable("config.entity_texture_features.title")));
|
||||||
|
ETFConfig etfConfig = ETFApi.getETFConfigObject();
|
||||||
|
PuzzleApi.addToResourceOptions(new PuzzleWidget(Text.translatable("config.entity_texture_features.enable_custom_textures.title"), (button) -> button.setMessage(etfConfig.enableCustomTextures ? YES : NO), (button) -> {
|
||||||
|
etfConfig.enableCustomTextures = !etfConfig.enableCustomTextures;
|
||||||
|
ETFApi.saveETFConfigChangesAndResetETF();
|
||||||
|
}));
|
||||||
|
PuzzleApi.addToResourceOptions(new PuzzleWidget(Text.translatable("config.entity_texture_features.enable_emissive_textures.title"), (button) -> button.setMessage(etfConfig.enableEmissiveTextures ? YES : NO), (button) -> {
|
||||||
|
etfConfig.enableEmissiveTextures = !etfConfig.enableEmissiveTextures;
|
||||||
|
ETFApi.saveETFConfigChangesAndResetETF();
|
||||||
|
}));
|
||||||
|
PuzzleApi.addToResourceOptions(new PuzzleWidget(Text.translatable("config.entity_texture_features.emissive_mode.title"), (button) -> button.setMessage(
|
||||||
|
Text.literal(etfConfig.emissiveRenderMode.toString())), (button) -> {
|
||||||
|
final NavigableSet<ETFConfig.EmissiveRenderModes> set =
|
||||||
|
new TreeSet<>(EnumSet.allOf(ETFConfig.EmissiveRenderModes.class));
|
||||||
|
|
||||||
|
etfConfig.emissiveRenderMode = Objects.requireNonNullElseGet(
|
||||||
|
set.higher(etfConfig.emissiveRenderMode), set::first);
|
||||||
|
ETFApi.saveETFConfigChangesAndResetETF();
|
||||||
|
}));
|
||||||
|
PuzzleApi.addToResourceOptions(new PuzzleWidget(Text.translatable("config.entity_texture_features.blinking_mob_settings.title"), (button) -> button.setMessage(etfConfig.enableBlinking ? YES : NO), (button) -> {
|
||||||
|
etfConfig.enableBlinking = !etfConfig.enableBlinking;
|
||||||
|
ETFApi.saveETFConfigChangesAndResetETF();
|
||||||
|
}));
|
||||||
|
PuzzleApi.addToResourceOptions(new PuzzleWidget(Text.translatable("config.entity_texture_features.player_skin_features.title"), (button) -> button.setMessage(etfConfig.skinFeaturesEnabled ? YES : NO), (button) -> {
|
||||||
|
etfConfig.skinFeaturesEnabled = !etfConfig.skinFeaturesEnabled;
|
||||||
|
ETFApi.saveETFConfigChangesAndResetETF();
|
||||||
|
}));
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,25 @@
|
|||||||
|
package net.puzzlemc.gui.compat;
|
||||||
|
|
||||||
|
import net.irisshaders.iris.api.v0.IrisApi;
|
||||||
|
import net.irisshaders.iris.api.v0.IrisApiConfig;
|
||||||
|
import net.minecraft.client.MinecraftClient;
|
||||||
|
import net.minecraft.client.gui.screen.Screen;
|
||||||
|
import net.minecraft.text.Text;
|
||||||
|
import net.minecraft.util.Formatting;
|
||||||
|
import net.puzzlemc.gui.PuzzleApi;
|
||||||
|
import net.puzzlemc.gui.PuzzleClient;
|
||||||
|
import net.puzzlemc.gui.screen.widget.PuzzleWidget;
|
||||||
|
|
||||||
|
public class IrisCompat {
|
||||||
|
public static void init() {
|
||||||
|
PuzzleApi.addToGraphicsOptions(new PuzzleWidget(Text.of("Iris")));
|
||||||
|
PuzzleApi.addToGraphicsOptions(new PuzzleWidget(Text.translatable("iris.puzzle.option.enableShaders"), (button) -> button.setMessage(IrisApi.getInstance().getConfig().areShadersEnabled() ? PuzzleClient.YES : PuzzleClient.NO), (button) -> {
|
||||||
|
IrisApiConfig irisConfig = IrisApi.getInstance().getConfig();
|
||||||
|
irisConfig.setShadersEnabledAndApply(!irisConfig.areShadersEnabled());
|
||||||
|
}));
|
||||||
|
PuzzleApi.addToGraphicsOptions(new PuzzleWidget(Text.translatable("options.iris.shaderPackSelection.title"), (button) -> button.setMessage(Text.literal("➥ ").append(Text.translatable("iris.puzzle.option.open").formatted(Formatting.GOLD))), (button) -> {
|
||||||
|
MinecraftClient client = MinecraftClient.getInstance();
|
||||||
|
client.setScreen((Screen) IrisApi.getInstance().openMainIrisScreenObj(client.currentScreen));
|
||||||
|
}));
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,19 @@
|
|||||||
|
package net.puzzlemc.gui.compat;
|
||||||
|
|
||||||
|
import dev.lambdaurora.lambdabettergrass.LBGConfig;
|
||||||
|
import dev.lambdaurora.lambdabettergrass.LambdaBetterGrass;
|
||||||
|
import net.minecraft.text.Text;
|
||||||
|
import net.puzzlemc.gui.PuzzleApi;
|
||||||
|
import net.puzzlemc.gui.screen.widget.PuzzleWidget;
|
||||||
|
|
||||||
|
import static net.puzzlemc.gui.PuzzleClient.NO;
|
||||||
|
import static net.puzzlemc.gui.PuzzleClient.YES;
|
||||||
|
|
||||||
|
public class LBGCompat {
|
||||||
|
public static void init() {
|
||||||
|
LBGConfig lbgConfig = LambdaBetterGrass.get().config;
|
||||||
|
PuzzleApi.addToGraphicsOptions(new PuzzleWidget(Text.of("LambdaBetterGrass")));
|
||||||
|
PuzzleApi.addToGraphicsOptions(new PuzzleWidget(Text.translatable("lambdabettergrass.option.mode"), (button) -> button.setMessage(lbgConfig.getMode().getTranslatedText()), (button) -> lbgConfig.setMode(lbgConfig.getMode().next())));
|
||||||
|
PuzzleApi.addToGraphicsOptions(new PuzzleWidget(Text.translatable("lambdabettergrass.option.better_snow"), (button) -> button.setMessage(lbgConfig.hasBetterLayer() ? YES : NO), (button) -> lbgConfig.setBetterLayer(!lbgConfig.hasBetterLayer())));
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,24 @@
|
|||||||
|
package net.puzzlemc.gui.compat;
|
||||||
|
|
||||||
|
import dev.lambdaurora.lambdynlights.DynamicLightsConfig;
|
||||||
|
import dev.lambdaurora.lambdynlights.LambDynLights;
|
||||||
|
import net.minecraft.text.Text;
|
||||||
|
import net.puzzlemc.gui.PuzzleApi;
|
||||||
|
import net.puzzlemc.gui.screen.widget.PuzzleWidget;
|
||||||
|
|
||||||
|
import static net.puzzlemc.gui.PuzzleClient.NO;
|
||||||
|
import static net.puzzlemc.gui.PuzzleClient.YES;
|
||||||
|
|
||||||
|
public class LDLCompat {
|
||||||
|
public static void init() {
|
||||||
|
DynamicLightsConfig ldlConfig = LambDynLights.get().config;
|
||||||
|
|
||||||
|
PuzzleApi.addToGraphicsOptions(new PuzzleWidget(Text.of("LambDynamicLights")));
|
||||||
|
PuzzleApi.addToGraphicsOptions(new PuzzleWidget(Text.translatable("lambdynlights.option.mode"), (button) -> button.setMessage(ldlConfig.getDynamicLightsMode().getTranslatedText()), (button) -> ldlConfig.setDynamicLightsMode(ldlConfig.getDynamicLightsMode().next())));
|
||||||
|
PuzzleApi.addToGraphicsOptions(new PuzzleWidget(Text.empty().append("DynLights: ").append(Text.translatable("lambdynlights.option.light_sources.entities")), (button) -> button.setMessage(ldlConfig.getEntitiesLightSource().get() ? YES : NO), (button) -> ldlConfig.getEntitiesLightSource().set(!ldlConfig.getEntitiesLightSource().get())));
|
||||||
|
PuzzleApi.addToGraphicsOptions(new PuzzleWidget(Text.empty().append("DynLights: ").append(Text.translatable("lambdynlights.option.light_sources.block_entities")), (button) -> button.setMessage(ldlConfig.getBlockEntitiesLightSource().get() ? YES : NO), (button) -> ldlConfig.getBlockEntitiesLightSource().set(!ldlConfig.getBlockEntitiesLightSource().get())));
|
||||||
|
PuzzleApi.addToGraphicsOptions(new PuzzleWidget(Text.empty().append("DynLights: ").append(Text.translatable("entity.minecraft.creeper")), (button) -> button.setMessage(ldlConfig.getCreeperLightingMode().getTranslatedText()), (button) -> ldlConfig.setCreeperLightingMode(ldlConfig.getCreeperLightingMode().next())));
|
||||||
|
PuzzleApi.addToGraphicsOptions(new PuzzleWidget(Text.empty().append("DynLights: ").append(Text.translatable("block.minecraft.tnt")), (button) -> button.setMessage(ldlConfig.getTntLightingMode().getTranslatedText()), (button) -> ldlConfig.setTntLightingMode(ldlConfig.getTntLightingMode().next())));
|
||||||
|
PuzzleApi.addToGraphicsOptions(new PuzzleWidget(Text.empty().append("DynLights: ").append(Text.translatable("lambdynlights.option.light_sources.water_sensitive_check")), (button) -> button.setMessage(ldlConfig.getWaterSensitiveCheck().get() ? YES : NO), (button) -> ldlConfig.getWaterSensitiveCheck().set(!ldlConfig.getWaterSensitiveCheck().get())));
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -1,9 +1,8 @@
|
|||||||
package net.puzzlemc.gui.mixin;
|
package net.puzzlemc.gui.mixin;
|
||||||
|
|
||||||
import eu.midnightdust.core.config.MidnightLibConfig;
|
import eu.midnightdust.core.config.MidnightLibConfig;
|
||||||
import eu.midnightdust.lib.util.screen.TexturedOverlayButtonWidget;
|
|
||||||
import net.fabricmc.loader.api.FabricLoader;
|
import net.fabricmc.loader.api.FabricLoader;
|
||||||
import net.minecraft.util.Identifier;
|
import net.minecraft.client.gui.widget.TextIconButtonWidget;
|
||||||
import net.puzzlemc.core.config.PuzzleConfig;
|
import net.puzzlemc.core.config.PuzzleConfig;
|
||||||
import net.puzzlemc.gui.PuzzleClient;
|
import net.puzzlemc.gui.PuzzleClient;
|
||||||
import net.puzzlemc.gui.screen.PuzzleOptionsScreen;
|
import net.puzzlemc.gui.screen.PuzzleOptionsScreen;
|
||||||
@@ -19,8 +18,6 @@ import java.util.Objects;
|
|||||||
|
|
||||||
@Mixin(OptionsScreen.class)
|
@Mixin(OptionsScreen.class)
|
||||||
public abstract class MixinOptionsScreen extends Screen {
|
public abstract class MixinOptionsScreen extends Screen {
|
||||||
private static final Identifier PUZZLE_ICON_TEXTURE = new Identifier(PuzzleClient.id, "textures/gui/puzzle_button.png");
|
|
||||||
|
|
||||||
protected MixinOptionsScreen(Text title) {
|
protected MixinOptionsScreen(Text title) {
|
||||||
super(title);
|
super(title);
|
||||||
}
|
}
|
||||||
@@ -31,7 +28,9 @@ public abstract class MixinOptionsScreen extends Screen {
|
|||||||
int i = 0;
|
int i = 0;
|
||||||
if (FabricLoader.getInstance().isModLoaded("lod")) i = i + 358;
|
if (FabricLoader.getInstance().isModLoaded("lod")) i = i + 358;
|
||||||
if (MidnightLibConfig.config_screen_list.equals(MidnightLibConfig.ConfigButton.FALSE)) i = i - 25;
|
if (MidnightLibConfig.config_screen_list.equals(MidnightLibConfig.ConfigButton.FALSE)) i = i - 25;
|
||||||
this.addDrawableChild(new TexturedOverlayButtonWidget(this.width / 2 - 178 + i, this.height / 6 - 12, 20, 20, 0, 0, 20, PUZZLE_ICON_TEXTURE, 32, 64, (buttonWidget) -> (Objects.requireNonNull(this.client)).setScreen(new PuzzleOptionsScreen(this)), Text.translatable("midnightlib.overview.title")));
|
TextIconButtonWidget iconButton = TextIconButtonWidget.builder(Text.translatable("puzzle.screen.title"), (buttonWidget) -> (Objects.requireNonNull(this.client)).setScreen(new PuzzleOptionsScreen(this)), true).dimension(20, 20).texture(PuzzleClient.PUZZLE_BUTTON, 20, 20).build();
|
||||||
|
iconButton.setPosition(this.width / 2 - 178 + i, this.height / 6 - 12);
|
||||||
|
this.addDrawableChild(iconButton);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -10,8 +10,7 @@ import net.minecraft.screen.ScreenTexts;
|
|||||||
import net.minecraft.text.Text;
|
import net.minecraft.text.Text;
|
||||||
import net.puzzlemc.gui.PuzzleApi;
|
import net.puzzlemc.gui.PuzzleApi;
|
||||||
import net.puzzlemc.gui.PuzzleClient;
|
import net.puzzlemc.gui.PuzzleClient;
|
||||||
import net.puzzlemc.gui.screen.widget.PuzzleOptionListWidget;
|
import net.puzzlemc.gui.screen.widget.*;
|
||||||
import net.puzzlemc.gui.screen.widget.PuzzleWidget;
|
|
||||||
import net.minecraft.client.gui.screen.Screen;
|
import net.minecraft.client.gui.screen.Screen;
|
||||||
import net.minecraft.client.gui.widget.ButtonWidget;
|
import net.minecraft.client.gui.widget.ButtonWidget;
|
||||||
|
|
||||||
@@ -51,13 +50,14 @@ public class PuzzleOptionsScreen extends Screen {
|
|||||||
tabNavigation.init();
|
tabNavigation.init();
|
||||||
prevTab = tabManager.getCurrentTab();
|
prevTab = tabManager.getCurrentTab();
|
||||||
this.addDrawableChild(tabNavigation);
|
this.addDrawableChild(tabNavigation);
|
||||||
this.list = new PuzzleOptionListWidget(this.client, this.width, this.height, 32, this.height - 32, 25);
|
this.list = new PuzzleOptionListWidget(this.client, this.width, this.height - 57, 24, 25);
|
||||||
fillList();
|
fillList();
|
||||||
this.addSelectableChild(this.list);
|
this.addDrawableChild(list);
|
||||||
|
|
||||||
super.init();
|
super.init();
|
||||||
|
|
||||||
this.addDrawableChild(ButtonWidget.builder(ScreenTexts.DONE, (button) -> Objects.requireNonNull(client).setScreen(parent)).dimensions(this.width / 2 - 100, this.height - 28, 200, 20).build());
|
|
||||||
|
this.addDrawableChild(ButtonWidget.builder(ScreenTexts.DONE, (button) -> Objects.requireNonNull(client).setScreen(parent)).dimensions(this.width / 2 - 100, this.height - 26, 200, 20).build());
|
||||||
}
|
}
|
||||||
private void fillList() {
|
private void fillList() {
|
||||||
List<PuzzleWidget> options = List.of();
|
List<PuzzleWidget> options = List.of();
|
||||||
@@ -83,20 +83,4 @@ public class PuzzleOptionsScreen extends Screen {
|
|||||||
list.setScrollAmount(0);
|
list.setScrollAmount(0);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
public void render(DrawContext context, int mouseX, int mouseY, float delta) {
|
|
||||||
this.renderBackground(context);
|
|
||||||
if (client != null && client.world != null) this.list.setRenderBackground(false);
|
|
||||||
this.list.render(context, mouseX, mouseY, delta);
|
|
||||||
|
|
||||||
super.render(context, mouseX, mouseY, delta);
|
|
||||||
if (tooltip != null) {
|
|
||||||
if (this.list.getFocused() != null && (this.list.getHoveredEntry() == null || this.list.getHoveredEntry().button == null || !this.list.getHoveredEntry().button.isMouseOver(mouseX, mouseY))) {
|
|
||||||
context.drawTooltip(textRenderer, tooltip, this.list.getFocused().getX(), this.list.getFocused().getY() + (this.list.getFocused().getHeight() * 2));
|
|
||||||
}
|
|
||||||
else context.drawTooltip(textRenderer, tooltip, mouseX, mouseY);
|
|
||||||
}
|
|
||||||
tooltip = null;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -2,7 +2,6 @@ package net.puzzlemc.gui.screen.widget;
|
|||||||
|
|
||||||
import net.minecraft.client.gui.DrawContext;
|
import net.minecraft.client.gui.DrawContext;
|
||||||
import net.minecraft.client.gui.widget.ButtonWidget;
|
import net.minecraft.client.gui.widget.ButtonWidget;
|
||||||
import net.minecraft.client.util.math.MatrixStack;
|
|
||||||
import net.minecraft.text.Text;
|
import net.minecraft.text.Text;
|
||||||
|
|
||||||
import java.util.function.Supplier;
|
import java.util.function.Supplier;
|
||||||
@@ -15,8 +14,10 @@ public class PuzzleButtonWidget extends ButtonWidget {
|
|||||||
this.title = title;
|
this.title = title;
|
||||||
}
|
}
|
||||||
@Override
|
@Override
|
||||||
public void renderButton(DrawContext context, int mouseX, int mouseY, float delta) {
|
public void renderWidget(DrawContext context, int mouseX, int mouseY, float delta) {
|
||||||
title.setTitle(this);
|
try {
|
||||||
super.renderButton(context, mouseX, mouseY, delta);
|
title.setTitle(this);
|
||||||
|
} catch (Exception e) {e.fillInStackTrace(); this.visible = false;}
|
||||||
|
super.renderWidget(context, mouseX, mouseY, delta);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,133 +1,88 @@
|
|||||||
package net.puzzlemc.gui.screen.widget;
|
package net.puzzlemc.gui.screen.widget;
|
||||||
|
|
||||||
|
import com.mojang.blaze3d.systems.RenderSystem;
|
||||||
|
import eu.midnightdust.lib.config.MidnightConfig;
|
||||||
import net.fabricmc.api.EnvType;
|
import net.fabricmc.api.EnvType;
|
||||||
import net.fabricmc.api.Environment;
|
import net.fabricmc.api.Environment;
|
||||||
import net.minecraft.client.MinecraftClient;
|
import net.minecraft.client.MinecraftClient;
|
||||||
import net.minecraft.client.font.TextRenderer;
|
import net.minecraft.client.font.TextRenderer;
|
||||||
import net.minecraft.client.gui.DrawContext;
|
import net.minecraft.client.gui.DrawContext;
|
||||||
import net.minecraft.client.gui.Element;
|
import net.minecraft.client.gui.screen.Screen;
|
||||||
import net.minecraft.client.gui.Selectable;
|
|
||||||
import net.minecraft.client.gui.widget.ClickableWidget;
|
import net.minecraft.client.gui.widget.ClickableWidget;
|
||||||
import net.minecraft.client.gui.widget.ElementListWidget;
|
|
||||||
import net.minecraft.client.resource.language.I18n;
|
import net.minecraft.client.resource.language.I18n;
|
||||||
import net.minecraft.client.util.math.MatrixStack;
|
|
||||||
import net.minecraft.text.Text;
|
import net.minecraft.text.Text;
|
||||||
import net.minecraft.text.TranslatableTextContent;
|
import net.minecraft.text.TranslatableTextContent;
|
||||||
|
import net.minecraft.util.Formatting;
|
||||||
import net.puzzlemc.gui.screen.PuzzleOptionsScreen;
|
import net.puzzlemc.gui.screen.PuzzleOptionsScreen;
|
||||||
import org.apache.logging.log4j.LogManager;
|
import org.apache.logging.log4j.LogManager;
|
||||||
|
|
||||||
import java.util.*;
|
import java.util.*;
|
||||||
|
|
||||||
@Environment(EnvType.CLIENT)
|
@Environment(EnvType.CLIENT)
|
||||||
public class PuzzleOptionListWidget extends ElementListWidget<PuzzleOptionListWidget.ButtonEntry> {
|
public class PuzzleOptionListWidget extends MidnightConfig.MidnightConfigListWidget {
|
||||||
TextRenderer textRenderer;
|
TextRenderer textRenderer;
|
||||||
|
|
||||||
public PuzzleOptionListWidget(MinecraftClient minecraftClient, int i, int j, int k, int l, int m) {
|
public PuzzleOptionListWidget(MinecraftClient minecraftClient, int i, int j, int k, int l) {
|
||||||
super(minecraftClient, i, j, k, l, m);
|
super(minecraftClient, i, j, k, l);
|
||||||
this.centerListVertically = false;
|
this.centerListVertically = false;
|
||||||
textRenderer = minecraftClient.textRenderer;
|
textRenderer = minecraftClient.textRenderer;
|
||||||
}
|
}
|
||||||
|
// TODO: Make renderHeaderSeperator in MidnightLib public and remove the following code
|
||||||
public void addButton(ClickableWidget button, Text text) {
|
protected void drawHeaderAndFooterSeparators(DrawContext context) {
|
||||||
this.addEntry(ButtonEntry.create(button, text));
|
RenderSystem.enableBlend();
|
||||||
|
context.drawTexture(this.client.world == null ? Screen.FOOTER_SEPARATOR_TEXTURE : Screen.INWORLD_FOOTER_SEPARATOR_TEXTURE, this.getX(), this.getBottom(), 0.0F, 0.0F, this.getWidth(), 2, 32, 2);
|
||||||
|
RenderSystem.disableBlend();
|
||||||
}
|
}
|
||||||
|
|
||||||
public void addAll(List<PuzzleWidget> buttons) {
|
public void addAll(List<PuzzleWidget> buttons) {
|
||||||
|
int buttonX = this.width - 160;
|
||||||
for (PuzzleWidget button : buttons) {
|
for (PuzzleWidget button : buttons) {
|
||||||
if (button.buttonType == ButtonType.TEXT) {
|
if (button.buttonType == ButtonType.TEXT) {
|
||||||
this.addButton(null, button.descriptionText);
|
this.addButton(List.of(), Text.literal(" ").append(button.descriptionText).formatted(Formatting.BOLD));
|
||||||
} else if (button.buttonType == ButtonType.BUTTON) {
|
} else if (button.buttonType == ButtonType.BUTTON) {
|
||||||
this.addButton(new PuzzleButtonWidget(this.width / 2 + 25, 0, 150, 20, button.buttonTextAction, button.onPress), button.descriptionText);
|
this.addButton(List.of(new PuzzleButtonWidget(buttonX, 0, 150, 20, button.buttonTextAction, button.onPress)), button.descriptionText);
|
||||||
} else if (button.buttonType == ButtonType.SLIDER) {
|
} else if (button.buttonType == ButtonType.SLIDER) {
|
||||||
this.addButton(new PuzzleSliderWidget(button.min, button.max, this.width / 2 + 25, 0, 150, 20, button.defaultSliderValue.getAsInt(), button.buttonTextAction, button.changeSliderValue), button.descriptionText);
|
this.addButton(List.of(new PuzzleSliderWidget(button.min, button.max, buttonX, 0, 150, 20, button.defaultSliderValue.getAsInt(), button.buttonTextAction, button.changeSliderValue)), button.descriptionText);
|
||||||
} else if (button.buttonType == ButtonType.TEXT_FIELD) {
|
} else if (button.buttonType == ButtonType.TEXT_FIELD) {
|
||||||
this.addButton(new PuzzleTextFieldWidget(textRenderer, this.width / 2 + 25, 0, 150, 20, button.setTextValue, button.changeTextValue), button.descriptionText);
|
this.addButton(List.of(new PuzzleTextFieldWidget(textRenderer, buttonX, 0, 150, 20, button.setTextValue, button.changeTextValue)), button.descriptionText);
|
||||||
} else
|
} else
|
||||||
LogManager.getLogger("Puzzle").warn("Button " + button + " is missing the buttonType variable. This shouldn't happen!");
|
LogManager.getLogger("Puzzle").warn("Button " + button + " is missing the buttonType variable. This shouldn't happen!");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
public void addButton(List<ClickableWidget> buttons, Text text) {
|
||||||
public void clear() {
|
var entry = new MidnightConfig.ButtonEntry(buttons, text, new MidnightConfig.EntryInfo());
|
||||||
super.clearEntries();
|
entry.centered = buttons.isEmpty();
|
||||||
}
|
this.addEntry(entry);
|
||||||
public int getRowWidth() {
|
|
||||||
return 400;
|
|
||||||
}
|
}
|
||||||
|
public void renderWidget(DrawContext context, int mouseX, int mouseY, float delta) {
|
||||||
|
super.renderWidget(context, mouseX, mouseY, delta);
|
||||||
|
MidnightConfig.ButtonEntry e = this.getHoveredEntry();
|
||||||
|
if (client.currentScreen instanceof PuzzleOptionsScreen page && e != null && !e.buttons.isEmpty() && MidnightConfig.ButtonEntry.buttonsWithText.get(e.buttons.get(0)).getContent() instanceof TranslatableTextContent content) {
|
||||||
|
ClickableWidget button = e.buttons.getFirst();
|
||||||
|
String key = null;
|
||||||
|
if (I18n.hasTranslation(content.getKey() + ".tooltip")) key = content.getKey() + ".tooltip";
|
||||||
|
else if (I18n.hasTranslation(content.getKey() + ".desc")) key = content.getKey() + ".desc";
|
||||||
|
if (key == null && content.getKey().endsWith(".title")) {
|
||||||
|
String strippedContent = content.getKey().substring(0, content.getKey().length()-6);
|
||||||
|
if (I18n.hasTranslation(strippedContent + ".tooltip")) key = strippedContent + ".tooltip";
|
||||||
|
else if (I18n.hasTranslation(strippedContent + ".desc")) key = strippedContent + ".desc";
|
||||||
|
}
|
||||||
|
|
||||||
protected int getScrollbarPositionX() {
|
if (key != null) {
|
||||||
return super.getScrollbarPositionX() + 60;
|
List<Text> list = new ArrayList<>();
|
||||||
|
for (String str : I18n.translate(key).split("\n"))
|
||||||
|
list.add(Text.literal(str));
|
||||||
|
page.tooltip = list;
|
||||||
|
if (!button.isMouseOver(mouseX, mouseY)) {
|
||||||
|
context.drawTooltip(textRenderer, list, button.getX(), button.getY() + (button.getHeight() * 2));
|
||||||
|
}
|
||||||
|
else context.drawTooltip(textRenderer, list, mouseX, mouseY);
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public ButtonEntry getHoveredEntry() {
|
public MidnightConfig.ButtonEntry getHoveredEntry() {
|
||||||
return super.getHoveredEntry();
|
return super.getHoveredEntry();
|
||||||
}
|
}
|
||||||
|
|
||||||
public static class ButtonEntry extends ElementListWidget.Entry<ButtonEntry> {
|
|
||||||
private static final TextRenderer textRenderer = MinecraftClient.getInstance().textRenderer;
|
|
||||||
private List<ClickableWidget> buttons = new ArrayList<>();
|
|
||||||
public final ClickableWidget button;
|
|
||||||
public final Text text;
|
|
||||||
private MinecraftClient client = MinecraftClient.getInstance();
|
|
||||||
|
|
||||||
private ButtonEntry(ClickableWidget button, Text text) {
|
|
||||||
if (button != null)
|
|
||||||
this.buttons.add(button);
|
|
||||||
this.button = button;
|
|
||||||
this.text = text;
|
|
||||||
}
|
|
||||||
|
|
||||||
public static ButtonEntry create(ClickableWidget button, Text text) {
|
|
||||||
return new ButtonEntry(button, text);
|
|
||||||
}
|
|
||||||
|
|
||||||
public void render(DrawContext context, int index, int y, int x, int entryWidth, int entryHeight, int mouseX, int mouseY, boolean hovered, float tickDelta) {
|
|
||||||
if (button != null) {
|
|
||||||
button.setY(y);
|
|
||||||
button.render(context, mouseX, mouseY, tickDelta);
|
|
||||||
}
|
|
||||||
if (button == null) context.drawCenteredTextWithShadow(textRenderer, Text.literal("------ ").append(text).append(" ------"),x + 200,y+5,0xFFFFFF);
|
|
||||||
else context.drawTextWithShadow(textRenderer, text,x+15,y+5,0xFFFFFF);
|
|
||||||
|
|
||||||
if (!(client.currentScreen instanceof PuzzleOptionsScreen page)) return;
|
|
||||||
if (button != null && (button.isMouseOver(mouseX, mouseY) || ((page.list.getHoveredEntry() == null || page.list.getHoveredEntry().button == null || !page.list.getHoveredEntry().button.isMouseOver(mouseX, mouseY)) && button.isFocused())) && text.getContent() instanceof TranslatableTextContent content) {
|
|
||||||
String key = null;
|
|
||||||
if (I18n.hasTranslation(content.getKey() + ".tooltip")) key = content.getKey() + ".tooltip";
|
|
||||||
else if (I18n.hasTranslation(content.getKey() + ".desc")) key = content.getKey() + ".desc";
|
|
||||||
if (key == null && content.getKey().endsWith(".title")) {
|
|
||||||
String strippedContent = content.getKey().substring(0, content.getKey().length()-6);
|
|
||||||
if (I18n.hasTranslation(strippedContent + ".tooltip")) key = strippedContent + ".tooltip";
|
|
||||||
else if (I18n.hasTranslation(strippedContent + ".desc")) key = strippedContent + ".desc";
|
|
||||||
}
|
|
||||||
|
|
||||||
if (key != null) {
|
|
||||||
List<Text> list = new ArrayList<>();
|
|
||||||
for (String str : I18n.translate(key).split("\n"))
|
|
||||||
list.add(Text.literal(str));
|
|
||||||
page.tooltip = list;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
public int getY() {
|
|
||||||
return button.getY();
|
|
||||||
}
|
|
||||||
public int getX() {
|
|
||||||
return button.getX();
|
|
||||||
}
|
|
||||||
public int getHeight() {
|
|
||||||
return button.getHeight();
|
|
||||||
}
|
|
||||||
public int getWidth() {
|
|
||||||
return button.getWidth();
|
|
||||||
}
|
|
||||||
|
|
||||||
public List<? extends Element> children() {
|
|
||||||
return buttons;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public List<? extends Selectable> selectableChildren() {
|
|
||||||
return buttons;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -17,7 +17,9 @@ public class PuzzleSliderWidget extends SliderWidget {
|
|||||||
|
|
||||||
this.setTextAction = setTextAction;
|
this.setTextAction = setTextAction;
|
||||||
this.changeAction = changeAction;
|
this.changeAction = changeAction;
|
||||||
this.updateMessage();
|
try {
|
||||||
|
this.updateMessage();
|
||||||
|
} catch (Exception e) {e.printStackTrace(); this.visible = false;}
|
||||||
}
|
}
|
||||||
public int getInt() {
|
public int getInt() {
|
||||||
int difference = max - min;
|
int difference = max - min;
|
||||||
|
|||||||
@@ -12,7 +12,9 @@ public class PuzzleTextFieldWidget extends TextFieldWidget {
|
|||||||
super(textRenderer, x, y, width, height, Text.of(""));
|
super(textRenderer, x, y, width, height, Text.of(""));
|
||||||
this.setValueAction = setValue;
|
this.setValueAction = setValue;
|
||||||
this.change = change;
|
this.change = change;
|
||||||
setValueAction.setTextValue(this);
|
try {
|
||||||
|
setValueAction.setTextValue(this);
|
||||||
|
} catch (Exception e) {e.printStackTrace(); this.setVisible(false);}
|
||||||
}
|
}
|
||||||
@Override
|
@Override
|
||||||
public void write(String text) {
|
public void write(String text) {
|
||||||
|
|||||||
Binary file not shown.
|
Before Width: | Height: | Size: 4.2 KiB |
Binary file not shown.
|
After Width: | Height: | Size: 152 B |
@@ -8,7 +8,6 @@ import net.minecraft.client.gui.screen.SplashOverlay;
|
|||||||
import net.minecraft.client.render.GameRenderer;
|
import net.minecraft.client.render.GameRenderer;
|
||||||
import net.minecraft.client.texture.NativeImage;
|
import net.minecraft.client.texture.NativeImage;
|
||||||
import net.minecraft.client.texture.NativeImageBackedTexture;
|
import net.minecraft.client.texture.NativeImageBackedTexture;
|
||||||
import net.minecraft.client.util.math.MatrixStack;
|
|
||||||
import net.minecraft.util.Identifier;
|
import net.minecraft.util.Identifier;
|
||||||
import net.minecraft.util.Util;
|
import net.minecraft.util.Util;
|
||||||
import net.minecraft.util.math.MathHelper;
|
import net.minecraft.util.math.MathHelper;
|
||||||
|
|||||||
@@ -4,6 +4,7 @@ pluginManagement {
|
|||||||
name = 'Fabric'
|
name = 'Fabric'
|
||||||
url = 'https://maven.fabricmc.net/'
|
url = 'https://maven.fabricmc.net/'
|
||||||
}
|
}
|
||||||
|
maven { url "https://maven.architectury.dev/" }
|
||||||
gradlePluginPortal()
|
gradlePluginPortal()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -21,6 +21,7 @@
|
|||||||
"environment": "client",
|
"environment": "client",
|
||||||
|
|
||||||
"depends": {
|
"depends": {
|
||||||
"fabric": "*"
|
"fabric": "*",
|
||||||
|
"minecraft": ">=1.20.2"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user