mirror of
https://github.com/PuzzleMC/Puzzle.git
synced 2025-12-15 19:35:10 +01:00
Fix 1.18 support
This commit is contained in:
@@ -23,9 +23,9 @@ org.gradle.jvmargs=-Xmx4G
|
||||
iris_version = 1.18.x-v1.2.4
|
||||
continuity_version = 1.0.3+1.18
|
||||
animatica_version = 0.2+1.18
|
||||
colormatic_version = 3.1.1
|
||||
colormatic_version = 3.1.1
|
||||
borderless_mining_version = 1.1.2+1.18.2
|
||||
dynamic_fps_version = 2.1.0
|
||||
dynamic_fps_version = v2.1.0
|
||||
toml4j_version = 0.7.2
|
||||
cit_resewn_version = 1.0.1+1.18.2
|
||||
cem_version = 0.7.1
|
||||
|
||||
@@ -6,6 +6,7 @@ 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.LiteralText;
|
||||
import net.minecraft.text.Style;
|
||||
import net.minecraft.text.Text;
|
||||
import net.minecraft.text.TranslatableText;
|
||||
@@ -15,11 +16,11 @@ 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) -> {
|
||||
PuzzleApi.addToGraphicsOptions(new PuzzleWidget(new TranslatableText("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(new LiteralText("➥ ").append(new TranslatableText("iris.puzzle.option.open").setStyle(Style.EMPTY.withColor(MidnightColorUtil.radialRainbow(0.5f, 1).getRGB())))), (button) -> {
|
||||
PuzzleApi.addToGraphicsOptions(new PuzzleWidget(new TranslatableText("options.iris.shaderPackSelection.title"), (button) -> button.setMessage(new LiteralText("➥ ").append(new TranslatableText("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));
|
||||
}));
|
||||
|
||||
@@ -16,6 +16,7 @@ import me.pepperbell.continuity.client.config.Option;
|
||||
import net.dorianpb.cem.internal.config.CemConfig;
|
||||
import net.dorianpb.cem.internal.config.CemConfigFairy;
|
||||
import net.dorianpb.cem.internal.config.CemOptions;
|
||||
import net.minecraft.text.LiteralText;
|
||||
import net.minecraft.text.TranslatableText;
|
||||
import net.puzzlemc.core.config.PuzzleConfig;
|
||||
import net.puzzlemc.gui.mixin.CemConfigAccessor;
|
||||
@@ -27,9 +28,10 @@ import net.minecraft.text.Text;
|
||||
import net.minecraft.util.Formatting;
|
||||
import net.puzzlemc.splashscreen.PuzzleSplashScreen;
|
||||
import shcm.shsupercm.fabric.citresewn.config.CITResewnConfig;
|
||||
import traben.entity_texture_features.ETFApi;
|
||||
import traben.entity_texture_features.client.ETFClient;
|
||||
import traben.entity_texture_features.config.ETFConfig;
|
||||
import io.github.kvverti.colormatic.ColormaticConfig;
|
||||
import traben.entity_texture_features.config.ETFConfigScreen;
|
||||
|
||||
public class PuzzleClient implements ClientModInitializer {
|
||||
|
||||
@@ -74,7 +76,7 @@ public class PuzzleClient implements ClientModInitializer {
|
||||
}
|
||||
if (FabricLoader.getInstance().isModLoaded("cullleaves") && !PuzzleConfig.disabledIntegrations.contains("cullleaves")) {
|
||||
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) -> {
|
||||
PuzzleApi.addToPerformanceOptions(new PuzzleWidget(new TranslatableText("cullleaves.puzzle.option.enabled"), (button) -> button.setMessage(CullLeavesConfig.enabled ? YES : NO), (button) -> {
|
||||
CullLeavesConfig.enabled = !CullLeavesConfig.enabled;
|
||||
CullLeavesConfig.write("cullleaves");
|
||||
MinecraftClient.getInstance().worldRenderer.reload();
|
||||
@@ -83,27 +85,27 @@ public class PuzzleClient implements ClientModInitializer {
|
||||
if (FabricLoader.getInstance().isModLoaded("colormatic") && !PuzzleConfig.disabledIntegrations.contains("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) -> {
|
||||
PuzzleApi.addToResourceOptions(new PuzzleWidget(new TranslatableText("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) -> {
|
||||
PuzzleApi.addToResourceOptions(new PuzzleWidget(new TranslatableText("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) -> {
|
||||
PuzzleApi.addToResourceOptions(new PuzzleWidget(new TranslatableText("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) -> {
|
||||
PuzzleApi.addToResourceOptions(new PuzzleWidget(new TranslatableText("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"),
|
||||
PuzzleApi.addToResourceOptions(new PuzzleWidget(0, 100, new TranslatableText("colormatic.config.option.relativeBlockLightIntensity"),
|
||||
() -> (int) (100*(1.0 - colormaticConfig.relativeBlockLightIntensityExponent / -16.0)),
|
||||
(button) -> button.setMessage(Text.translatable("colormatic.config.option.relativeBlockLightIntensity")
|
||||
(button) -> button.setMessage(new TranslatableText("colormatic.config.option.relativeBlockLightIntensity")
|
||||
.append(": ")
|
||||
.append(Text.literal(String.valueOf((int)(100 * Math.exp(ColormaticConfig.scaled(colormaticConfig.relativeBlockLightIntensityExponent))))).append("%"))),
|
||||
.append(new LiteralText(String.valueOf((int)(100 * Math.exp(ColormaticConfig.scaled(colormaticConfig.relativeBlockLightIntensityExponent))))).append("%"))),
|
||||
(slider) -> {
|
||||
try {
|
||||
colormaticConfig.relativeBlockLightIntensityExponent = ((1.00 - ((slider.getInt())/100f)) * -16.0);
|
||||
@@ -115,11 +117,11 @@ public class PuzzleClient implements ClientModInitializer {
|
||||
if (FabricLoader.getInstance().isModLoaded("dynamicfps") && !PuzzleConfig.disabledIntegrations.contains("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) -> {
|
||||
PuzzleApi.addToPerformanceOptions(new PuzzleWidget(new TranslatableText("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,
|
||||
PuzzleApi.addToPerformanceOptions(new PuzzleWidget(0, 60,new TranslatableText("config.dynamicfps.unfocused_fps"), () -> fpsConfig.unfocusedFPS,
|
||||
(button) -> button.setMessage(Text.of(fpsConfig.unfocusedFPS + " FPS")),
|
||||
(slider) -> {
|
||||
try {
|
||||
@@ -128,15 +130,15 @@ public class PuzzleClient implements ClientModInitializer {
|
||||
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) -> {
|
||||
PuzzleApi.addToPerformanceOptions(new PuzzleWidget(new TranslatableText("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) -> {
|
||||
PuzzleApi.addToPerformanceOptions(new PuzzleWidget(new TranslatableText("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(),
|
||||
PuzzleApi.addToPerformanceOptions(new PuzzleWidget(0, 100,new TranslatableText("config.dynamicfps.unfocused_volume"), () -> ((Number)(fpsConfig.unfocusedVolumeMultiplier * 100)).intValue(),
|
||||
(button) -> button.setMessage(Text.of(((Number)(fpsConfig.unfocusedVolumeMultiplier * 100)).intValue() + "%")),
|
||||
(slider) -> {
|
||||
try {
|
||||
@@ -145,7 +147,7 @@ public class PuzzleClient implements ClientModInitializer {
|
||||
catch (NumberFormatException ignored) {}
|
||||
finally {fpsConfig.save();}
|
||||
}));
|
||||
PuzzleApi.addToPerformanceOptions(new PuzzleWidget(0, 100,Text.translatable("config.dynamicfps.hidden_volume"), () -> ((Number)(fpsConfig.hiddenVolumeMultiplier * 100)).intValue(),
|
||||
PuzzleApi.addToPerformanceOptions(new PuzzleWidget(0, 100,new TranslatableText("config.dynamicfps.hidden_volume"), () -> ((Number)(fpsConfig.hiddenVolumeMultiplier * 100)).intValue(),
|
||||
(button) -> button.setMessage(Text.of(((Number)(fpsConfig.hiddenVolumeMultiplier * 100)).intValue() + "%")),
|
||||
(slider) -> {
|
||||
try {
|
||||
@@ -158,12 +160,12 @@ public class PuzzleClient implements ClientModInitializer {
|
||||
if (FabricLoader.getInstance().isModLoaded("borderlessmining") && !PuzzleConfig.disabledIntegrations.contains("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) -> {
|
||||
PuzzleApi.addToMiscOptions(new PuzzleWidget(new TranslatableText("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) -> {
|
||||
PuzzleApi.addToMiscOptions(new PuzzleWidget(new TranslatableText("config.borderlessmining.general.enabledmac"), (button) -> button.setMessage(bmConfig.enableMacOS ? YES : NO), (button) -> {
|
||||
bmConfig.enableMacOS = !bmConfig.enableMacOS;
|
||||
bmConfig.setEnabledPending(bmConfig.isEnabled());
|
||||
bmConfig.save();
|
||||
@@ -261,24 +263,28 @@ public class PuzzleClient implements ClientModInitializer {
|
||||
ETFConfigScreen etfConfigScreen = new ETFConfigScreen();
|
||||
PuzzleApi.addToResourceOptions(new PuzzleWidget(new TranslatableText("config.etf.enable_custom_textures.title"), (button) -> button.setMessage(etfConfig.enableCustomTextures ? YES : NO), (button) -> {
|
||||
etfConfig.enableCustomTextures = !etfConfig.enableCustomTextures;
|
||||
ETFApi.saveETFConfigChangesAndResetETF();
|
||||
etfConfigScreen.saveConfig();
|
||||
etfConfigScreen.resetVisuals();
|
||||
}));
|
||||
PuzzleApi.addToResourceOptions(new PuzzleWidget(new TranslatableText("config.etf.enable_emissive_textures.title"), (button) -> button.setMessage(etfConfig.enableEmissiveTextures ? YES : NO), (button) -> {
|
||||
etfConfig.enableEmissiveTextures = !etfConfig.enableEmissiveTextures;
|
||||
ETFApi.saveETFConfigChangesAndResetETF();
|
||||
etfConfigScreen.saveConfig();
|
||||
etfConfigScreen.resetVisuals();
|
||||
}));
|
||||
PuzzleApi.addToResourceOptions(new PuzzleWidget(Text.translatable("config.entity_texture_features.full_bright_emissives.title"), (button) -> button.setMessage(
|
||||
etfConfig.fullBrightEmissives ? Text.translatable("entity_texture_features.puzzle.emissive_type.brighter") : Text.translatable("entity_texture_features.puzzle.emissive_type.default")), (button) -> {
|
||||
PuzzleApi.addToResourceOptions(new PuzzleWidget(Text.of("Emissive Texture Rendering Mode"), (button) -> button.setMessage(etfConfig.fullBrightEmissives ? Text.of("Brighter") : Text.of("Default")), (button) -> {
|
||||
etfConfig.fullBrightEmissives = !etfConfig.fullBrightEmissives ;
|
||||
ETFApi.saveETFConfigChangesAndResetETF();
|
||||
etfConfigScreen.saveConfig();
|
||||
etfConfigScreen.resetVisuals();
|
||||
}));
|
||||
PuzzleApi.addToResourceOptions(new PuzzleWidget(new TranslatableText("config.etf.blinking_mob_settings.title"), (button) -> button.setMessage(etfConfig.enableBlinking ? YES : NO), (button) -> {
|
||||
etfConfig.enableBlinking = !etfConfig.enableBlinking;
|
||||
ETFApi.saveETFConfigChangesAndResetETF();
|
||||
etfConfigScreen.saveConfig();
|
||||
etfConfigScreen.resetVisuals();
|
||||
}));
|
||||
PuzzleApi.addToResourceOptions(new PuzzleWidget(Text.translatable("config.entity_texture_features.player_skin_features.title"), (button) -> button.setMessage(etfConfig.skinFeaturesEnabled ? YES : NO), (button) -> {
|
||||
PuzzleApi.addToResourceOptions(new PuzzleWidget(Text.of("Enable Player Skin Features"), (button) -> button.setMessage(etfConfig.skinFeaturesEnabled ? YES : NO), (button) -> {
|
||||
etfConfig.skinFeaturesEnabled = !etfConfig.skinFeaturesEnabled;
|
||||
ETFApi.saveETFConfigChangesAndResetETF();
|
||||
etfConfigScreen.saveConfig();
|
||||
etfConfigScreen.resetVisuals();
|
||||
}));
|
||||
}
|
||||
lateInitDone = true;
|
||||
|
||||
@@ -12,7 +12,7 @@ import net.minecraft.client.resource.language.I18n;
|
||||
import net.minecraft.client.util.math.MatrixStack;
|
||||
import net.minecraft.text.LiteralText;
|
||||
import net.minecraft.text.Text;
|
||||
import net.minecraft.text.TranslatableTextContent;
|
||||
import net.minecraft.text.TranslatableText;
|
||||
import net.puzzlemc.gui.screen.page.AbstractPuzzleOptionsPage;
|
||||
import org.apache.logging.log4j.LogManager;
|
||||
|
||||
@@ -87,7 +87,7 @@ public class PuzzleOptionListWidget extends ElementListWidget<PuzzleOptionListWi
|
||||
else drawTextWithShadow(matrices,textRenderer, text,x+15,y+5,0xFFFFFF);
|
||||
|
||||
if (!(client.currentScreen instanceof AbstractPuzzleOptionsPage 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) {
|
||||
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 instanceof TranslatableText 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";
|
||||
@@ -100,7 +100,7 @@ public class PuzzleOptionListWidget extends ElementListWidget<PuzzleOptionListWi
|
||||
if (key != null) {
|
||||
List<Text> list = new ArrayList<>();
|
||||
for (String str : I18n.translate(key).split("\n"))
|
||||
list.add(Text.literal(str));
|
||||
list.add(new LiteralText(str));
|
||||
page.tooltip = list;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user