mirror of
https://github.com/PuzzleMC/Puzzle.git
synced 2025-12-15 19:35:10 +01:00
Port to 1.20.6
- Port to 1.20.6 - Move compatibility code into individual classes
This commit is contained in:
62
build.gradle
62
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 {
|
||||||
@@ -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,20 +3,23 @@ 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.4
|
minecraft_version=1.20.6
|
||||||
yarn_mappings=1.20.4+build.1
|
yarn_mappings=1.20.6+build.1
|
||||||
loader_version=0.15.1
|
loader_version=0.15.10
|
||||||
|
|
||||||
# Mod Properties
|
# Mod Properties
|
||||||
mod_version = 1.6.1+1.20.4
|
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.91.2+1.20.4
|
fabric_version=0.97.8+1.20.6
|
||||||
mod_menu_version = 7.0.1
|
mod_menu_version = 7.0.1
|
||||||
midnightlib_version = 1.5.2-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.2+1.20.1
|
ldl_version = 2.3.2+1.20.1
|
||||||
@@ -31,8 +34,8 @@ org.gradle.jvmargs=-Xmx4G
|
|||||||
cit_resewn_version = 1.1.3+1.20
|
cit_resewn_version = 1.1.3+1.20
|
||||||
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=1.2
|
emf_version=2.0.2
|
||||||
etf_version=5.0
|
etf_version=6.0.1
|
||||||
exordium_version=1.2.1-1.20.2
|
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
|
||||||
|
|||||||
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.4-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
|
||||||
|
|||||||
@@ -1,26 +0,0 @@
|
|||||||
package net.puzzlemc.gui;
|
|
||||||
|
|
||||||
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.Text;
|
|
||||||
import net.minecraft.util.Formatting;
|
|
||||||
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").formatted(Formatting.GOLD))), (button) -> {
|
|
||||||
MinecraftClient client = MinecraftClient.getInstance();
|
|
||||||
client.setScreen((Screen) IrisApi.getInstance().openMainIrisScreenObj(client.currentScreen));
|
|
||||||
}));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -1,31 +1,16 @@
|
|||||||
package net.puzzlemc.gui;
|
package net.puzzlemc.gui;
|
||||||
|
|
||||||
import dev.lambdaurora.lambdabettergrass.LBGConfig;
|
|
||||||
import dev.lambdaurora.lambdabettergrass.LambdaBetterGrass;
|
|
||||||
import dev.lambdaurora.lambdynlights.DynamicLightsConfig;
|
|
||||||
import dev.lambdaurora.lambdynlights.LambDynLights;
|
|
||||||
import eu.midnightdust.core.MidnightLib;
|
import eu.midnightdust.core.MidnightLib;
|
||||||
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 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.minecraft.screen.ScreenTexts;
|
|
||||||
import net.minecraft.util.Identifier;
|
import net.minecraft.util.Identifier;
|
||||||
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_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 {
|
||||||
|
|
||||||
@@ -69,195 +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("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.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())));
|
if (isActive("entity_model_features")) EMFCompat.init();
|
||||||
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())));
|
|
||||||
}
|
|
||||||
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.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.force_models"), (button) -> button.setMessage(emfConfig.attemptRevertingEntityModelsAlteredByAnotherMod ? YES : NO), (button) -> {
|
|
||||||
emfConfig.attemptRevertingEntityModelsAlteredByAnotherMod = !emfConfig.attemptRevertingEntityModelsAlteredByAnotherMod;
|
|
||||||
EMFConfig.EMF_saveConfig();
|
|
||||||
}));
|
|
||||||
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) -> {
|
|
||||||
emfConfig.attemptPhysicsModPatch_2 = emfConfig.attemptPhysicsModPatch_2.next();
|
|
||||||
EMFConfig.EMF_saveConfig();
|
|
||||||
}));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
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())));
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -50,14 +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 - 64, 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();
|
||||||
if (client != null && client.world != null) this.list.setRenderBackground(false);
|
|
||||||
|
|
||||||
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,12 +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) {
|
|
||||||
if (client != null && client.world != null) super.renderInGameBackground(context);
|
|
||||||
this.list.render(context, mouseX, mouseY, delta);
|
|
||||||
super.render(context, mouseX, mouseY, delta);
|
|
||||||
}
|
|
||||||
@Override public void renderBackground(DrawContext c, int x, int y, float d) {}
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,11 +1,13 @@
|
|||||||
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 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.screen.Screen;
|
||||||
import net.minecraft.client.gui.widget.ClickableWidget;
|
import net.minecraft.client.gui.widget.ClickableWidget;
|
||||||
import net.minecraft.client.resource.language.I18n;
|
import net.minecraft.client.resource.language.I18n;
|
||||||
import net.minecraft.text.Text;
|
import net.minecraft.text.Text;
|
||||||
@@ -25,26 +27,38 @@ public class PuzzleOptionListWidget extends MidnightConfig.MidnightConfigListWid
|
|||||||
this.centerListVertically = false;
|
this.centerListVertically = false;
|
||||||
textRenderer = minecraftClient.textRenderer;
|
textRenderer = minecraftClient.textRenderer;
|
||||||
}
|
}
|
||||||
|
// TODO: Make renderHeaderSeperator in MidnightLib public and remove the following code
|
||||||
|
protected void drawHeaderAndFooterSeparators(DrawContext context) {
|
||||||
|
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(List.of(), Text.literal("> ").append(button.descriptionText).formatted(Formatting.BOLD), new MidnightConfig.EntryInfo());
|
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(List.of(new PuzzleButtonWidget(this.width / 2 + 25, 0, 150, 20, button.buttonTextAction, button.onPress)), button.descriptionText, new MidnightConfig.EntryInfo());
|
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(List.of(new PuzzleSliderWidget(button.min, button.max, this.width / 2 + 25, 0, 150, 20, button.defaultSliderValue.getAsInt(), button.buttonTextAction, button.changeSliderValue)), button.descriptionText, new MidnightConfig.EntryInfo());
|
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(List.of(new PuzzleTextFieldWidget(textRenderer, this.width / 2 + 25, 0, 150, 20, button.setTextValue, button.changeTextValue)), button.descriptionText, new MidnightConfig.EntryInfo());
|
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) {
|
||||||
|
var entry = new MidnightConfig.ButtonEntry(buttons, text, new MidnightConfig.EntryInfo());
|
||||||
|
entry.centered = buttons.isEmpty();
|
||||||
|
this.addEntry(entry);
|
||||||
|
}
|
||||||
public void renderWidget(DrawContext context, int mouseX, int mouseY, float delta) {
|
public void renderWidget(DrawContext context, int mouseX, int mouseY, float delta) {
|
||||||
super.renderWidget(context, mouseX, mouseY, delta);
|
super.renderWidget(context, mouseX, mouseY, delta);
|
||||||
MidnightConfig.ButtonEntry e = this.getHoveredEntry();
|
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) {
|
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.get(0);
|
ClickableWidget button = e.buttons.getFirst();
|
||||||
String key = null;
|
String key = null;
|
||||||
if (I18n.hasTranslation(content.getKey() + ".tooltip")) key = content.getKey() + ".tooltip";
|
if (I18n.hasTranslation(content.getKey() + ".tooltip")) key = content.getKey() + ".tooltip";
|
||||||
else if (I18n.hasTranslation(content.getKey() + ".desc")) key = content.getKey() + ".desc";
|
else if (I18n.hasTranslation(content.getKey() + ".desc")) key = content.getKey() + ".desc";
|
||||||
|
|||||||
@@ -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()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user