From a26e4c6bdb9f7bfd8e5e3e58be6cd6d74e593fa6 Mon Sep 17 00:00:00 2001 From: Takkkom <76614532+Takkkom@users.noreply.github.com> Date: Thu, 4 Jul 2024 09:34:57 +0900 Subject: [PATCH] Update embeddium hack (#80) * Remove Embeddium Hack * Since there is no API for cloud rendering, we will temporarily hack the embeddium. * remove version lock * add version lock * Update hack * Clean --------- Co-authored-by: dima_dencep --- gradle.properties | 4 +- .../ExtraRenderSectionDistanceFilter.java | 23 ++++ .../client/SodiumExtraClientMod.java | 23 ++-- .../client/gui/EmbeddiumExtendedOptions.java | 10 +- .../gui/SodiumExtraGameOptionPages.java | 87 ++++++++++++-- .../options/storage/SodiumExtraOptions.java | 108 ++++++++++++++++++ .../mixin/SodiumExtraMixinConfigPlugin.java | 28 +++-- .../sodium/embeddium/OptionGroupMixin.java | 29 ----- .../sodium/embeddium/OptionImplMixin.java | 31 ----- .../sodium/fog/MixinOcclusionCuller.java | 35 ------ .../resources/META-INF/neoforge.mods.toml | 2 +- src/main/resources/sodium-extra.mixins.json | 7 +- 12 files changed, 252 insertions(+), 135 deletions(-) create mode 100644 src/main/java/me/flashyreese/mods/sodiumextra/client/ExtraRenderSectionDistanceFilter.java create mode 100644 src/main/java/me/flashyreese/mods/sodiumextra/client/gui/options/storage/SodiumExtraOptions.java delete mode 100644 src/main/java/me/flashyreese/mods/sodiumextra/mixin/sodium/embeddium/OptionGroupMixin.java delete mode 100644 src/main/java/me/flashyreese/mods/sodiumextra/mixin/sodium/embeddium/OptionImplMixin.java delete mode 100644 src/main/java/me/flashyreese/mods/sodiumextra/mixin/sodium/fog/MixinOcclusionCuller.java diff --git a/gradle.properties b/gradle.properties index 1efdbbef..4627fe29 100644 --- a/gradle.properties +++ b/gradle.properties @@ -14,11 +14,11 @@ loom.platform = neoforge loader_version=21.0.38-beta # Mod Properties - mod_version=0.5.7 + mod_version=0.5.7a maven_group=com.github.dima_dencep.mods archives_base_name=rubidium-extra # Dependencies nanoliveconfig_version=2.2.0 oculus_version=1.20.1-1.6.9 - embeddium_version=1.0.2-git-7f6f509+mc1.21 + embeddium_version=1.0.3-git-b2dc012+mc1.21 diff --git a/src/main/java/me/flashyreese/mods/sodiumextra/client/ExtraRenderSectionDistanceFilter.java b/src/main/java/me/flashyreese/mods/sodiumextra/client/ExtraRenderSectionDistanceFilter.java new file mode 100644 index 00000000..2c6347dd --- /dev/null +++ b/src/main/java/me/flashyreese/mods/sodiumextra/client/ExtraRenderSectionDistanceFilter.java @@ -0,0 +1,23 @@ +package me.flashyreese.mods.sodiumextra.client; + +import net.minecraft.client.MinecraftClient; +import org.embeddedt.embeddium.api.render.chunk.RenderSectionDistanceFilter; + +public class ExtraRenderSectionDistanceFilter implements RenderSectionDistanceFilter { + public static ExtraRenderSectionDistanceFilter INSTANCE = new ExtraRenderSectionDistanceFilter(); + + private ExtraRenderSectionDistanceFilter() { + + } + + @Override + public boolean isWithinDistance(float xDistance, float yDistance, float zDistance, float maxDistance) { + int fogDistance = SodiumExtraClientMod.options().renderSettings.multiDimensionFogControl ? + SodiumExtraClientMod.options().renderSettings.dimensionFogDistanceMap.getOrDefault(MinecraftClient.getInstance().world.getDimension().effects(), 0) : + SodiumExtraClientMod.options().renderSettings.fogDistance; + if (fogDistance == 33) + return ((xDistance * xDistance) + (zDistance * zDistance)) < (maxDistance * maxDistance); + else + return RenderSectionDistanceFilter.DEFAULT.isWithinDistance(xDistance, yDistance, zDistance, maxDistance); + } +} diff --git a/src/main/java/me/flashyreese/mods/sodiumextra/client/SodiumExtraClientMod.java b/src/main/java/me/flashyreese/mods/sodiumextra/client/SodiumExtraClientMod.java index 5c5568f9..b892cc33 100644 --- a/src/main/java/me/flashyreese/mods/sodiumextra/client/SodiumExtraClientMod.java +++ b/src/main/java/me/flashyreese/mods/sodiumextra/client/SodiumExtraClientMod.java @@ -1,9 +1,10 @@ package me.flashyreese.mods.sodiumextra.client; +import static me.flashyreese.mods.sodiumextra.mixin.SodiumExtraMixinConfigPlugin.EMBEDDIUM_HACKED; + import me.flashyreese.mods.sodiumextra.client.gui.EmbeddiumExtendedOptions; import me.flashyreese.mods.sodiumextra.client.gui.SodiumExtraGameOptionPages; import me.flashyreese.mods.sodiumextra.client.gui.SodiumExtraGameOptions; -import me.flashyreese.mods.sodiumextra.client.gui.SodiumExtraHud; import net.caffeinemc.caffeineconfig.CaffeineConfig; import net.neoforged.api.distmarker.Dist; import net.neoforged.fml.common.Mod; @@ -13,8 +14,8 @@ import org.embeddedt.embeddium.api.OptionGUIConstructionEvent; import org.embeddedt.embeddium.api.OptionGroupConstructionEvent; import org.embeddedt.embeddium.api.OptionPageConstructionEvent; -import org.embeddedt.embeddium.api.options.OptionIdentifier; import org.embeddedt.embeddium.api.options.structure.StandardOptions; +import org.embeddedt.embeddium.api.render.chunk.RenderSectionDistanceFilterEvent; @Mod(value = SodiumExtraClientMod.MOD_ID, dist = Dist.CLIENT) public class SodiumExtraClientMod { @@ -59,12 +60,12 @@ public static CaffeineConfig mixinConfig() { .addMixinOption("sky", true) .addMixinOption("sky_colors", true) .addMixinOption("sodium", true) - .addMixinOption("sodium.accessibility", true) - .addMixinOption("sodium.fog", true) - .addMixinOption("sodium.cloud", true) - .addMixinOption("sodium.resolution", true) - .addMixinOption("sodium.scrollable_page", true) - .addMixinOption("sodium.vsync", true) + //.addMixinOption("sodium.accessibility", true) in embeddium + // .addMixinOption("sodium.fog", true) via api + .addMixinOption("sodium.cloud", EMBEDDIUM_HACKED) + //.addMixinOption("sodium.resolution", true) via api + //.addMixinOption("sodium.scrollable_page", true) in embeddium + //.addMixinOption("sodium.vsync", true) via api .addMixinOption("stars", true) .addMixinOption("steady_debug_hud", true) .addMixinOption("sun_moon", true) @@ -111,9 +112,9 @@ public SodiumExtraClientMod() { return EmbeddiumExtendedOptions.ADAPTIVE_VSYNC; }); }); - } - public static OptionIdentifier optionIdentifier(String path) { - return OptionIdentifier.create(MOD_ID, path); + RenderSectionDistanceFilterEvent.BUS.addListener(event -> { + event.setFilter(ExtraRenderSectionDistanceFilter.INSTANCE); + }); } } diff --git a/src/main/java/me/flashyreese/mods/sodiumextra/client/gui/EmbeddiumExtendedOptions.java b/src/main/java/me/flashyreese/mods/sodiumextra/client/gui/EmbeddiumExtendedOptions.java index 8056176a..c86c430d 100644 --- a/src/main/java/me/flashyreese/mods/sodiumextra/client/gui/EmbeddiumExtendedOptions.java +++ b/src/main/java/me/flashyreese/mods/sodiumextra/client/gui/EmbeddiumExtendedOptions.java @@ -1,14 +1,13 @@ package me.flashyreese.mods.sodiumextra.client.gui; -import me.flashyreese.mods.sodiumextra.client.SodiumExtraClientMod; import me.flashyreese.mods.sodiumextra.client.gui.options.control.SliderControlExtended; +import me.flashyreese.mods.sodiumextra.client.gui.options.storage.SodiumExtraOptions; import me.flashyreese.mods.sodiumextra.common.util.ControlValueFormatterExtended; import net.minecraft.client.MinecraftClient; import net.minecraft.client.option.GameOptions; import net.minecraft.client.util.VideoMode; import net.minecraft.client.util.Window; import net.minecraft.text.Text; -import net.minecraft.util.Identifier; import org.embeddedt.embeddium.api.options.control.ControlValueFormatter; import org.embeddedt.embeddium.api.options.control.CyclingControl; import org.embeddedt.embeddium.api.options.control.SliderControl; @@ -26,7 +25,7 @@ public class EmbeddiumExtendedOptions { public static final Option ADAPTIVE_VSYNC = OptionImpl.createBuilder(SodiumExtraGameOptions.VerticalSyncOption.class, SodiumExtraGameOptionPages.sodiumExtraOpts) .setName(Text.translatable("options.vsync")) - .setId(Identifier.of(SodiumExtraClientMod.MOD_ID, "vsync")) + .setId(SodiumExtraOptions.Option.ADAPTIVE_VSYNC) .setTooltip(Text.literal(Text.translatable("sodium.options.v_sync.tooltip").getString() + "\n- " + Text.translatable("sodium-extra.option.use_adaptive_sync.name").getString() + ": " + Text.translatable("sodium-extra.option.use_adaptive_sync.tooltip").getString())) .setControl((opt) -> new CyclingControl<>(opt, SodiumExtraGameOptions.VerticalSyncOption.class, SodiumExtraGameOptions.VerticalSyncOption.getAvailableOptions())) @@ -59,8 +58,10 @@ public class EmbeddiumExtendedOptions { .build(); public static final OptionGroup EFFECTS_GROUP = OptionGroup.createBuilder() + .setId(SodiumExtraOptions.Group.EFFECTS) .add(OptionImpl.createBuilder(int.class, vanillaOpts) .setName(Text.translatable("options.screenEffectScale")) + .setId(SodiumExtraOptions.Option.SCREEN_EFFECT_SCALE) .setTooltip(Text.translatable("options.screenEffectScale.tooltip")) .setControl(option -> new SliderControl(option, 0, 100, 1, ControlValueFormatter.percentage())) .setBinding((opts, value) -> opts.getDistortionEffectScale().setValue((double) value / 100.0F), (opts) -> Math.toIntExact(Math.round(opts.getDistortionEffectScale().getValue() * 100.0F))) @@ -69,6 +70,7 @@ public class EmbeddiumExtendedOptions { ) .add(OptionImpl.createBuilder(int.class, vanillaOpts) .setName(Text.translatable("options.fovEffectScale")) + .setId(SodiumExtraOptions.Option.FOV_EFFECT_SCALE) .setTooltip(Text.translatable("options.fovEffectScale.tooltip")) .setControl(option -> new SliderControl(option, 0, 100, 1, ControlValueFormatter.percentage())) .setBinding((opts, value) -> opts.getFovEffectScale().setValue(Math.sqrt(value / 100.0F)), (opts) -> (int) Math.round(Math.pow(opts.getFovEffectScale().getValue(), 2.0D) * 100.0F)) @@ -78,8 +80,10 @@ public class EmbeddiumExtendedOptions { .build(); public static final OptionGroup RESOLUTION_GROUP = OptionGroup.createBuilder() + .setId(SodiumExtraOptions.Group.RESOLUTIONS) .add(OptionImpl.createBuilder(int.class, vanillaOpts) .setName(Text.translatable("options.fullscreen.resolution")) + .setId(SodiumExtraOptions.Option.RESOLUTION) .setTooltip(Text.translatable("sodium-extra.option.resolution.tooltip")) .setControl(option -> new SliderControlExtended(option, 0, window().getMonitor() != null ? window().getMonitor().getVideoModeCount() : 0, 1, ControlValueFormatterExtended.resolution(), false)) .setBinding((options, value) -> { diff --git a/src/main/java/me/flashyreese/mods/sodiumextra/client/gui/SodiumExtraGameOptionPages.java b/src/main/java/me/flashyreese/mods/sodiumextra/client/gui/SodiumExtraGameOptionPages.java index 2fd416a9..c1641048 100644 --- a/src/main/java/me/flashyreese/mods/sodiumextra/client/gui/SodiumExtraGameOptionPages.java +++ b/src/main/java/me/flashyreese/mods/sodiumextra/client/gui/SodiumExtraGameOptionPages.java @@ -3,6 +3,7 @@ import com.google.common.collect.ImmutableList; import me.flashyreese.mods.sodiumextra.client.SodiumExtraClientMod; import me.flashyreese.mods.sodiumextra.client.gui.options.control.SliderControlExtended; +import me.flashyreese.mods.sodiumextra.client.gui.options.storage.SodiumExtraOptions; import me.flashyreese.mods.sodiumextra.client.gui.options.storage.SodiumExtraOptionsStorage; import me.flashyreese.mods.sodiumextra.common.util.ControlValueFormatterExtended; import org.embeddedt.embeddium.api.options.structure.OptionFlag; @@ -37,7 +38,9 @@ private static Text parseVanillaString(String key) { public static OptionPage animation() { List groups = new ArrayList<>(); groups.add(OptionGroup.createBuilder() + .setId(SodiumExtraOptions.Group.ANIMATIONS_ALL) .add(OptionImpl.createBuilder(boolean.class, sodiumExtraOpts) + .setId(SodiumExtraOptions.Option.ANIMATIONS_ALL) .setEnabled(SodiumExtraClientMod.mixinConfig().getOptions().get("mixin.animation").isEnabled()) .setName(parseVanillaString("gui.socialInteractions.tab_all")) .setTooltip(Text.translatable("sodium-extra.option.animations_all.tooltip")) @@ -49,7 +52,9 @@ public static OptionPage animation() { .build()); groups.add(OptionGroup.createBuilder() + .setId(SodiumExtraOptions.Group.BLOCK_ANIMATIONS) .add(OptionImpl.createBuilder(boolean.class, sodiumExtraOpts) + .setId(SodiumExtraOptions.Option.ANIMATIONS_WATER) .setEnabled(SodiumExtraClientMod.mixinConfig().getOptions().get("mixin.animation").isEnabled()) .setName(parseVanillaString("block.minecraft.water")) .setTooltip(Text.translatable("sodium-extra.option.animate_water.tooltip")) @@ -60,6 +65,7 @@ public static OptionPage animation() { ) .add(OptionImpl.createBuilder(boolean.class, sodiumExtraOpts) .setEnabled(SodiumExtraClientMod.mixinConfig().getOptions().get("mixin.animation").isEnabled()) + .setId(SodiumExtraOptions.Option.ANIMATIONS_LAVA) .setName(parseVanillaString("block.minecraft.lava")) .setTooltip(Text.translatable("sodium-extra.option.animate_lava.tooltip")) .setControl(TickBoxControl::new) @@ -69,6 +75,7 @@ public static OptionPage animation() { ) .add(OptionImpl.createBuilder(boolean.class, sodiumExtraOpts) .setEnabled(SodiumExtraClientMod.mixinConfig().getOptions().get("mixin.animation").isEnabled()) + .setId(SodiumExtraOptions.Option.ANIMATIONS_FIRE) .setName(parseVanillaString("block.minecraft.fire")) .setTooltip(Text.translatable("sodium-extra.option.animate_fire.tooltip")) .setControl(TickBoxControl::new) @@ -78,6 +85,7 @@ public static OptionPage animation() { ) .add(OptionImpl.createBuilder(boolean.class, sodiumExtraOpts) .setEnabled(SodiumExtraClientMod.mixinConfig().getOptions().get("mixin.animation").isEnabled()) + .setId(SodiumExtraOptions.Option.ANIMATIONS_NETHER_PORTAL) .setName(parseVanillaString("block.minecraft.nether_portal")) .setTooltip(Text.translatable("sodium-extra.option.animate_portal.tooltip")) .setControl(TickBoxControl::new) @@ -87,6 +95,7 @@ public static OptionPage animation() { ) .add(OptionImpl.createBuilder(boolean.class, sodiumExtraOpts) .setEnabled(SodiumExtraClientMod.mixinConfig().getOptions().get("mixin.animation").isEnabled()) + .setId(SodiumExtraOptions.Option.ANIMATIONS_BLOCK) .setName(Text.translatable("sodium-extra.option.block_animations")) .setTooltip(Text.translatable("sodium-extra.option.block_animations.tooltip")) .setControl(TickBoxControl::new) @@ -96,6 +105,7 @@ public static OptionPage animation() { ) .add(OptionImpl.createBuilder(boolean.class, sodiumExtraOpts) .setEnabled(SodiumExtraClientMod.mixinConfig().getOptions().get("mixin.animation").isEnabled()) + .setId(SodiumExtraOptions.Option.ANIMATIONS_SCULK_SENSOR) .setName(parseVanillaString("block.minecraft.sculk_sensor")) .setTooltip(Text.translatable("sodium-extra.option.animate_sculk_sensor.tooltip")) .setControl(TickBoxControl::new) @@ -104,13 +114,15 @@ public static OptionPage animation() { .build() ) .build()); - return new OptionPage(SodiumExtraClientMod.optionIdentifier("animations"), Text.translatable("sodium-extra.option.animations"), ImmutableList.copyOf(groups)); + return new OptionPage(SodiumExtraOptions.Pages.ANIMATIONS, Text.translatable("sodium-extra.option.animations"), ImmutableList.copyOf(groups)); } public static OptionPage particle() { List groups = new ArrayList<>(); groups.add(OptionGroup.createBuilder() + .setId(SodiumExtraOptions.Group.PARTICLES_ALL) .add(OptionImpl.createBuilder(boolean.class, sodiumExtraOpts) + .setId(SodiumExtraOptions.Option.PARTICLES_ALL) .setEnabled(SodiumExtraClientMod.mixinConfig().getOptions().get("mixin.particle").isEnabled()) .setName(parseVanillaString("gui.socialInteractions.tab_all")) .setTooltip(Text.translatable("sodium-extra.option.particles_all.tooltip")) @@ -121,7 +133,9 @@ public static OptionPage particle() { .build()); groups.add(OptionGroup.createBuilder() + .setId(SodiumExtraOptions.Group.PARTICLES_BLOCK) .add(OptionImpl.createBuilder(boolean.class, sodiumExtraOpts) + .setId(SodiumExtraOptions.Option.PARTICLES_SPLASH) .setEnabled(SodiumExtraClientMod.mixinConfig().getOptions().get("mixin.particle").isEnabled()) .setName(parseVanillaString("subtitles.entity.generic.splash")) .setTooltip(Text.translatable("sodium-extra.option.rain_splash.tooltip")) @@ -130,6 +144,7 @@ public static OptionPage particle() { .build() ) .add(OptionImpl.createBuilder(boolean.class, sodiumExtraOpts) + .setId(SodiumExtraOptions.Option.PARTICLES_BREAK) .setEnabled(SodiumExtraClientMod.mixinConfig().getOptions().get("mixin.particle").isEnabled()) .setName(parseVanillaString("subtitles.block.generic.break")) .setTooltip(Text.translatable("sodium-extra.option.block_break.tooltip")) @@ -138,6 +153,7 @@ public static OptionPage particle() { .build() ) .add(OptionImpl.createBuilder(boolean.class, sodiumExtraOpts) + .setId(SodiumExtraOptions.Option.PARTICLES_HIT) .setEnabled(SodiumExtraClientMod.mixinConfig().getOptions().get("mixin.particle").isEnabled()) .setName(parseVanillaString("subtitles.block.generic.hit")) .setTooltip(Text.translatable("sodium-extra.option.block_breaking.tooltip")) @@ -151,6 +167,7 @@ public static OptionPage particle() { .collect(Collectors.groupingBy(Identifier::getNamespace)); otherParticles.forEach((namespace, identifiers) -> groups.add(identifiers.stream() .map(identifier -> OptionImpl.createBuilder(boolean.class, sodiumExtraOpts) + .setId(Identifier.of(identifier.getNamespace(), "particles_type")) .setEnabled(SodiumExtraClientMod.mixinConfig().getOptions().get("mixin.particle").isEnabled()) .setName(translatableName(identifier, "particles")) .setTooltip(translatableTooltip(identifier, "particles")) @@ -164,16 +181,20 @@ public static OptionPage particle() { OptionGroup.Builder::add, (b1, b2) -> { } - ).build() + ) + .setId(SodiumExtraOptions.Option.PARTICLES_TYPES) + .build() )); - return new OptionPage(SodiumExtraClientMod.optionIdentifier("particles"), parseVanillaString("options.particles"), ImmutableList.copyOf(groups)); + return new OptionPage(SodiumExtraOptions.Pages.PARTICLES, parseVanillaString("options.particles"), ImmutableList.copyOf(groups)); } public static OptionPage detail() { List groups = new ArrayList<>(); groups.add(OptionGroup.createBuilder() + .setId(SodiumExtraOptions.Group.DETAILS_DEFAULT) .add(OptionImpl.createBuilder(boolean.class, sodiumExtraOpts) + .setId(SodiumExtraOptions.Option.DETAILS_SKY) .setEnabled(SodiumExtraClientMod.mixinConfig().getOptions().get("mixin.sky").isEnabled()) .setName(Text.translatable("sodium-extra.option.sky")) .setTooltip(Text.translatable("sodium-extra.option.sky.tooltip")) @@ -182,6 +203,7 @@ public static OptionPage detail() { .build() ) .add(OptionImpl.createBuilder(boolean.class, sodiumExtraOpts) + .setId(SodiumExtraOptions.Option.DETAILS_STARS) .setEnabled(SodiumExtraClientMod.mixinConfig().getOptions().get("mixin.stars").isEnabled()) .setName(Text.translatable("sodium-extra.option.stars")) .setTooltip(Text.translatable("sodium-extra.option.stars.tooltip")) @@ -190,6 +212,7 @@ public static OptionPage detail() { .build() ) .add(OptionImpl.createBuilder(boolean.class, sodiumExtraOpts) + .setId(SodiumExtraOptions.Option.DETAILS_SUN_MOON) .setEnabled(SodiumExtraClientMod.mixinConfig().getOptions().get("mixin.sun_moon").isEnabled()) .setName(Text.translatable("sodium-extra.option.sun_moon")) .setTooltip(Text.translatable("sodium-extra.option.sun_moon.tooltip")) @@ -199,6 +222,7 @@ public static OptionPage detail() { .build() ) .add(OptionImpl.createBuilder(boolean.class, sodiumExtraOpts) + .setId(SodiumExtraOptions.Option.DETAILS_WEATHER) .setEnabled(SodiumExtraClientMod.mixinConfig().getOptions().get("mixin.particle").isEnabled()) .setName(parseVanillaString("soundCategory.weather")) .setTooltip(Text.translatable("sodium-extra.option.rain_snow.tooltip")) @@ -207,6 +231,7 @@ public static OptionPage detail() { .build() ) .add(OptionImpl.createBuilder(boolean.class, sodiumExtraOpts) + .setId(SodiumExtraOptions.Option.DETAILS_BIOME_COLORS) .setEnabled(SodiumExtraClientMod.mixinConfig().getOptions().get("mixin.biome_colors").isEnabled()) .setName(Text.translatable("sodium-extra.option.biome_colors")) .setTooltip(Text.translatable("sodium-extra.option.biome_colors.tooltip")) @@ -216,6 +241,7 @@ public static OptionPage detail() { .build() ) .add(OptionImpl.createBuilder(boolean.class, sodiumExtraOpts) + .setId(SodiumExtraOptions.Option.DETAILS_SKY_COLORS) .setEnabled(SodiumExtraClientMod.mixinConfig().getOptions().get("mixin.sky_colors").isEnabled()) .setName(Text.translatable("sodium-extra.option.sky_colors")) .setTooltip(Text.translatable("sodium-extra.option.sky_colors.tooltip")) @@ -225,14 +251,16 @@ public static OptionPage detail() { .build() ) .build()); - return new OptionPage(SodiumExtraClientMod.optionIdentifier("details"), Text.translatable("sodium-extra.option.details"), ImmutableList.copyOf(groups)); + return new OptionPage(SodiumExtraOptions.Pages.DETAILS, Text.translatable("sodium-extra.option.details"), ImmutableList.copyOf(groups)); } public static OptionPage render() { List groups = new ArrayList<>(); groups.add(OptionGroup.createBuilder() + .setId(SodiumExtraOptions.Group.RENDER_FOG) .add(OptionImpl.createBuilder(SodiumExtraGameOptions.RenderSettings.FogType.class, sodiumExtraOpts) + .setId(SodiumExtraOptions.Option.RENDER_FOG_TYPE) .setEnabled(SodiumExtraClientMod.mixinConfig().getOptions().get("mixin.fog").isEnabled()) .setName(Text.translatable("sodium-extra.option.fog_type")) .setTooltip(Text.translatable("sodium-extra.option.fog_type.tooltip")) @@ -241,6 +269,7 @@ public static OptionPage render() { .build() ) .add(OptionImpl.createBuilder(boolean.class, sodiumExtraOpts) + .setId(SodiumExtraOptions.Option.RENDER_MULTI_DIMENSION_FOG) .setEnabled(SodiumExtraClientMod.mixinConfig().getOptions().get("mixin.fog").isEnabled()) .setName(Text.translatable("sodium-extra.option.multi_dimension_fog")) .setTooltip(Text.translatable("sodium-extra.option.multi_dimension_fog.tooltip")) @@ -249,6 +278,7 @@ public static OptionPage render() { .build() ) .add(OptionImpl.createBuilder(int.class, sodiumExtraOpts) + .setId(SodiumExtraOptions.Option.RENDER_FOG_FALLOUT) .setEnabled(SodiumExtraClientMod.mixinConfig().getOptions().get("mixin.fog_falloff").isEnabled()) .setName(Text.translatable("sodium-extra.option.fog_start")) .setTooltip(Text.translatable("sodium-extra.option.fog_start.tooltip")) @@ -265,6 +295,7 @@ public static OptionPage render() { .forEach(dim -> SodiumExtraClientMod.options().renderSettings.dimensionFogDistanceMap.put(dim.getValue(), 0)); groups.add(SodiumExtraClientMod.options().renderSettings.dimensionFogDistanceMap.keySet().stream() .map(identifier -> OptionImpl.createBuilder(int.class, sodiumExtraOpts) + .setId(Identifier.of(identifier.getNamespace(), "render_dimension_fog")) .setEnabled(SodiumExtraClientMod.mixinConfig().getOptions().get("mixin.fog").isEnabled()) .setName(Text.translatable("sodium-extra.option.fog", translatableName(identifier, "dimensions").getString())) .setTooltip(Text.translatable("sodium-extra.option.fog.tooltip")) @@ -277,11 +308,15 @@ public static OptionPage render() { OptionGroup.Builder::add, (b1, b2) -> { } - ).build() + ) + .setId(SodiumExtraOptions.Option.RENDER_FOG_DIMENSION_TYPES) + .build() ); } else { groups.add(OptionGroup.createBuilder() + .setId(SodiumExtraOptions.Group.RENDER_SINGLE_FOG) .add(OptionImpl.createBuilder(int.class, sodiumExtraOpts) + .setId(SodiumExtraOptions.Option.RENDER_SINGLE_FOG) .setEnabled(SodiumExtraClientMod.mixinConfig().getOptions().get("mixin.fog").isEnabled()) .setName(Text.translatable("sodium-extra.option.single_fog")) .setTooltip(Text.translatable("sodium-extra.option.single_fog.tooltip")) @@ -293,7 +328,9 @@ public static OptionPage render() { } groups.add(OptionGroup.createBuilder() + .setId(SodiumExtraOptions.Group.RENDER_LIGHT) .add(OptionImpl.createBuilder(boolean.class, sodiumExtraOpts) + .setId(SodiumExtraOptions.Option.RENDER_LIGHT_UPDATES) .setEnabled(SodiumExtraClientMod.mixinConfig().getOptions().get("mixin.light_updates").isEnabled()) .setName(Text.translatable("sodium-extra.option.light_updates")) .setTooltip(Text.translatable("sodium-extra.option.light_updates.tooltip")) @@ -303,7 +340,9 @@ public static OptionPage render() { ) .build()); groups.add(OptionGroup.createBuilder() + .setId(SodiumExtraOptions.Group.RENDER_ENTITY) .add(OptionImpl.createBuilder(boolean.class, sodiumExtraOpts) + .setId(SodiumExtraOptions.Option.RENDER_ITEM_FRAME) .setEnabled(SodiumExtraClientMod.mixinConfig().getOptions().get("mixin.render.entity").isEnabled()) .setName(parseVanillaString("entity.minecraft.item_frame")) .setTooltip(Text.translatable("sodium-extra.option.item_frames.tooltip")) @@ -312,6 +351,7 @@ public static OptionPage render() { .build() ) .add(OptionImpl.createBuilder(boolean.class, sodiumExtraOpts) + .setId(SodiumExtraOptions.Option.RENDER_ARMOR_STAND) .setEnabled(SodiumExtraClientMod.mixinConfig().getOptions().get("mixin.render.entity").isEnabled()) .setName(parseVanillaString("entity.minecraft.armor_stand")) .setTooltip(Text.translatable("sodium-extra.option.armor_stands.tooltip")) @@ -320,6 +360,7 @@ public static OptionPage render() { .build() ) .add(OptionImpl.createBuilder(boolean.class, sodiumExtraOpts) + .setId(SodiumExtraOptions.Option.RENDER_PAINTING) .setEnabled(SodiumExtraClientMod.mixinConfig().getOptions().get("mixin.render.entity").isEnabled()) .setName(parseVanillaString("entity.minecraft.painting")) .setTooltip(Text.translatable("sodium-extra.option.paintings.tooltip")) @@ -330,7 +371,9 @@ public static OptionPage render() { ) .build()); groups.add(OptionGroup.createBuilder() + .setId(SodiumExtraOptions.Group.RENDER_BLOCK_ENTITY) .add(OptionImpl.createBuilder(boolean.class, sodiumExtraOpts) + .setId(SodiumExtraOptions.Option.RENDER_RENDER_BEACON_BEAM) .setEnabled(SodiumExtraClientMod.mixinConfig().getOptions().get("mixin.render.block.entity").isEnabled()) .setName(Text.translatable("sodium-extra.option.beacon_beam")) .setTooltip(Text.translatable("sodium-extra.option.beacon_beam.tooltip")) @@ -339,6 +382,7 @@ public static OptionPage render() { .build() ) .add(OptionImpl.createBuilder(boolean.class, sodiumExtraOpts) + .setId(SodiumExtraOptions.Option.RENDER_LIMIT_BEACON_BEAM_HEIGHT) .setEnabled(SodiumExtraClientMod.mixinConfig().getOptions().get("mixin.render.block.entity").isEnabled()) .setName(Text.translatable("sodium-extra.option.limit_beacon_beam_height")) .setTooltip(Text.translatable("sodium-extra.option.limit_beacon_beam_height.tooltip")) @@ -347,6 +391,7 @@ public static OptionPage render() { .build() ) .add(OptionImpl.createBuilder(boolean.class, sodiumExtraOpts) + .setId(SodiumExtraOptions.Option.RENDER_ENCHANTING_TABLE_BOOK) .setEnabled(SodiumExtraClientMod.mixinConfig().getOptions().get("mixin.render.block.entity").isEnabled()) .setName(Text.translatable("sodium-extra.option.enchanting_table_book")) .setTooltip(Text.translatable("sodium-extra.option.enchanting_table_book.tooltip")) @@ -355,6 +400,7 @@ public static OptionPage render() { .build() ) .add(OptionImpl.createBuilder(boolean.class, sodiumExtraOpts) + .setId(SodiumExtraOptions.Option.RENDER_PISTON) .setEnabled(SodiumExtraClientMod.mixinConfig().getOptions().get("mixin.render.block.entity").isEnabled()) .setName(parseVanillaString("block.minecraft.piston")) .setTooltip(Text.translatable("sodium-extra.option.piston.tooltip")) @@ -364,7 +410,9 @@ public static OptionPage render() { ) .build()); groups.add(OptionGroup.createBuilder() + .setId(SodiumExtraOptions.Group.RENDER_TAG_ENTITY) .add(OptionImpl.createBuilder(boolean.class, sodiumExtraOpts) + .setId(SodiumExtraOptions.Option.RENDER_ITEM_FRAME_NAME_TAG) .setEnabled(SodiumExtraClientMod.mixinConfig().getOptions().get("mixin.render.entity").isEnabled()) .setName(Text.translatable("sodium-extra.option.item_frame_name_tag")) .setTooltip(Text.translatable("sodium-extra.option.item_frame_name_tag.tooltip")) @@ -373,6 +421,7 @@ public static OptionPage render() { .build() ) .add(OptionImpl.createBuilder(boolean.class, sodiumExtraOpts) + .setId(SodiumExtraOptions.Option.RENDER_PLAYER_NAME_TAG) .setEnabled(SodiumExtraClientMod.mixinConfig().getOptions().get("mixin.render.entity").isEnabled()) .setName(Text.translatable("sodium-extra.option.player_name_tag")) .setTooltip(Text.translatable("sodium-extra.option.player_name_tag.tooltip")) @@ -381,13 +430,15 @@ public static OptionPage render() { .build() ) .build()); - return new OptionPage(SodiumExtraClientMod.optionIdentifier("render"), Text.translatable("sodium-extra.option.render"), ImmutableList.copyOf(groups)); + return new OptionPage(SodiumExtraOptions.Pages.RENDER, Text.translatable("sodium-extra.option.render"), ImmutableList.copyOf(groups)); } public static OptionPage extra() { List groups = new ArrayList<>(); groups.add(OptionGroup.createBuilder() + .setId(SodiumExtraOptions.Group.EXTRA_MAC_OS) .add(OptionImpl.createBuilder(boolean.class, sodiumExtraOpts) + .setId(SodiumExtraOptions.Option.EXTRA_REDUCE_RESOLUTION_ON_MAC) .setEnabled(SodiumExtraClientMod.mixinConfig().getOptions().get("mixin.reduce_resolution_on_mac").isEnabled() && MinecraftClient.IS_SYSTEM_MAC) .setName(Text.translatable("sodium-extra.option.reduce_resolution_on_mac")) .setTooltip(Text.translatable("sodium-extra.option.reduce_resolution_on_mac.tooltip")) @@ -398,7 +449,9 @@ public static OptionPage extra() { .build() ).build()); groups.add(OptionGroup.createBuilder() + .setId(SodiumExtraOptions.Group.EXTRA_OVERLAY) .add(OptionImpl.createBuilder(SodiumExtraGameOptions.OverlayCorner.class, sodiumExtraOpts) + .setId(SodiumExtraOptions.Option.EXTRA_OVERLAY_CORNER) .setName(Text.translatable("sodium-extra.option.overlay_corner")) .setTooltip(Text.translatable("sodium-extra.option.overlay_corner.tooltip")) .setControl(option -> new CyclingControl<>(option, SodiumExtraGameOptions.OverlayCorner.class)) @@ -406,6 +459,7 @@ public static OptionPage extra() { .build() ) .add(OptionImpl.createBuilder(SodiumExtraGameOptions.TextContrast.class, sodiumExtraOpts) + .setId(SodiumExtraOptions.Option.EXTRA_TEXT_CONTRAST) .setName(Text.translatable("sodium-extra.option.text_contrast")) .setTooltip(Text.translatable("sodium-extra.option.text_contrast.tooltip")) .setControl(option -> new CyclingControl<>(option, SodiumExtraGameOptions.TextContrast.class)) @@ -413,6 +467,7 @@ public static OptionPage extra() { .build() ) .add(OptionImpl.createBuilder(boolean.class, sodiumExtraOpts) + .setId(SodiumExtraOptions.Option.EXTRA_SHOW_FPS) .setName(Text.translatable("sodium-extra.option.show_fps")) .setTooltip(Text.translatable("sodium-extra.option.show_fps.tooltip")) .setControl(TickBoxControl::new) @@ -420,6 +475,7 @@ public static OptionPage extra() { .build() ) .add(OptionImpl.createBuilder(boolean.class, sodiumExtraOpts) + .setId(SodiumExtraOptions.Option.EXTRA_SHOW_FPS_EXTENDED) .setName(Text.translatable("sodium-extra.option.show_fps_extended")) .setTooltip(Text.translatable("sodium-extra.option.show_fps_extended.tooltip")) .setControl(TickBoxControl::new) @@ -427,6 +483,7 @@ public static OptionPage extra() { .build() ) .add(OptionImpl.createBuilder(boolean.class, sodiumExtraOpts) + .setId(SodiumExtraOptions.Option.EXTRA_SHOW_COORDINATES) .setName(Text.translatable("sodium-extra.option.show_coordinates")) .setTooltip(Text.translatable("sodium-extra.option.show_coordinates.tooltip")) .setControl(TickBoxControl::new) @@ -434,6 +491,7 @@ public static OptionPage extra() { .build() ) .add(OptionImpl.createBuilder(int.class, sodiumExtraOpts) + .setId(SodiumExtraOptions.Option.EXTRA_CLOUD_HEIGHT) .setEnabled(SodiumExtraClientMod.mixinConfig().getOptions().get("mixin.cloud").isEnabled()) .setName(Text.translatable("sodium-extra.option.cloud_height")) .setTooltip(Text.translatable("sodium-extra.option.cloud_height.tooltip")) @@ -442,6 +500,7 @@ public static OptionPage extra() { .build() ) .add(OptionImpl.createBuilder(int.class, sodiumExtraOpts) + .setId(SodiumExtraOptions.Option.EXTRA_CLOUD_DISTANCE) .setEnabled(SodiumExtraClientMod.mixinConfig().getOptions().get("mixin.sodium.cloud").isEnabled()) .setName(Text.translatable("sodium-extra.option.cloud_distance")) .setTooltip(Text.translatable("sodium-extra.option.cloud_distance.tooltip")) @@ -451,7 +510,9 @@ public static OptionPage extra() { ) .build()); groups.add(OptionGroup.createBuilder() + .setId(SodiumExtraOptions.Group.EXTRA_ADVANCED_ITEM_TOOLTIPS) .add(OptionImpl.createBuilder(boolean.class, vanillaOpts) + .setId(SodiumExtraOptions.Option.EXTRA_ADVANCED_ITEM_TOOLTIPS) .setName(Text.translatable("sodium-extra.option.advanced_item_tooltips")) .setTooltip(Text.translatable("sodium-extra.option.advanced_item_tooltips.tooltip")) .setControl(TickBoxControl::new) @@ -460,7 +521,9 @@ public static OptionPage extra() { ) .build()); groups.add(OptionGroup.createBuilder() + .setId(SodiumExtraOptions.Group.EXTRA_TOASTS) .add(OptionImpl.createBuilder(boolean.class, sodiumExtraOpts) + .setId(SodiumExtraOptions.Option.EXTRA_TOASTS) .setEnabled(SodiumExtraClientMod.mixinConfig().getOptions().get("mixin.toasts").isEnabled()) .setName(Text.translatable("sodium-extra.option.toasts")) .setTooltip(Text.translatable("sodium-extra.option.toasts.tooltip")) @@ -468,6 +531,7 @@ public static OptionPage extra() { .setBinding((options, value) -> options.extraSettings.toasts = value, options -> options.extraSettings.toasts) .build()) .add(OptionImpl.createBuilder(boolean.class, sodiumExtraOpts) + .setId(SodiumExtraOptions.Option.EXTRA_ADVANCEMENT_TOAST) .setEnabled(SodiumExtraClientMod.mixinConfig().getOptions().get("mixin.toasts").isEnabled()) .setName(Text.translatable("sodium-extra.option.advancement_toast")) .setTooltip(Text.translatable("sodium-extra.option.advancement_toast.tooltip")) @@ -476,6 +540,7 @@ public static OptionPage extra() { .build() ) .add(OptionImpl.createBuilder(boolean.class, sodiumExtraOpts) + .setId(SodiumExtraOptions.Option.EXTRA_RECIPE_TOAST) .setEnabled(SodiumExtraClientMod.mixinConfig().getOptions().get("mixin.toasts").isEnabled()) .setName(Text.translatable("sodium-extra.option.recipe_toast")) .setTooltip(Text.translatable("sodium-extra.option.recipe_toast.tooltip")) @@ -484,6 +549,7 @@ public static OptionPage extra() { .build() ) .add(OptionImpl.createBuilder(boolean.class, sodiumExtraOpts) + .setId(SodiumExtraOptions.Option.EXTRA_SYSTEM_TOAST) .setEnabled(SodiumExtraClientMod.mixinConfig().getOptions().get("mixin.toasts").isEnabled()) .setName(Text.translatable("sodium-extra.option.system_toast")) .setTooltip(Text.translatable("sodium-extra.option.system_toast.tooltip")) @@ -492,6 +558,7 @@ public static OptionPage extra() { .build() ) .add(OptionImpl.createBuilder(boolean.class, sodiumExtraOpts) + .setId(SodiumExtraOptions.Option.EXTRA_TUTORIAL_TOAST) .setEnabled(SodiumExtraClientMod.mixinConfig().getOptions().get("mixin.toasts").isEnabled()) .setName(Text.translatable("sodium-extra.option.tutorial_toast")) .setTooltip(Text.translatable("sodium-extra.option.tutorial_toast.tooltip")) @@ -501,7 +568,9 @@ public static OptionPage extra() { ) .build()); groups.add(OptionGroup.createBuilder() + .setId(SodiumExtraOptions.Group.EXTRA_SHADERS) .add(OptionImpl.createBuilder(boolean.class, sodiumExtraOpts) + .setId(SodiumExtraOptions.Option.EXTRA_INSTANT_SNEAK) .setEnabled(SodiumExtraClientMod.mixinConfig().getOptions().get("mixin.instant_sneak").isEnabled()) .setName(Text.translatable("sodium-extra.option.instant_sneak")) .setTooltip(Text.translatable("sodium-extra.option.instant_sneak.tooltip")) @@ -510,6 +579,7 @@ public static OptionPage extra() { .build() ) .add(OptionImpl.createBuilder(boolean.class, sodiumExtraOpts) + .setId(SodiumExtraOptions.Option.EXTRA_PREVENT_SHADERS) .setEnabled(SodiumExtraClientMod.mixinConfig().getOptions().get("mixin.prevent_shaders").isEnabled()) .setName(Text.translatable("sodium-extra.option.prevent_shaders")) .setTooltip(Text.translatable("sodium-extra.option.prevent_shaders.tooltip")) @@ -520,7 +590,9 @@ public static OptionPage extra() { ) .build()); groups.add(OptionGroup.createBuilder() + .setId(SodiumExtraOptions.Group.EXTRA_DEBUG) .add(OptionImpl.createBuilder(boolean.class, sodiumExtraOpts) + .setId(SodiumExtraOptions.Option.EXTRA_STEADY_DEBUG_HUD) .setEnabled(SodiumExtraClientMod.mixinConfig().getOptions().get("mixin.steady_debug_hud").isEnabled()) .setName(Text.translatable("sodium-extra.option.steady_debug_hud")) .setTooltip(Text.translatable("sodium-extra.option.steady_debug_hud.tooltip")) @@ -529,6 +601,7 @@ public static OptionPage extra() { .build() ) .add(OptionImpl.createBuilder(int.class, sodiumExtraOpts) + .setId(SodiumExtraOptions.Option.EXTRA_STEADY_DEBUG_HUD_REFRESH_INTERVAL) .setEnabled(SodiumExtraClientMod.mixinConfig().getOptions().get("mixin.steady_debug_hud").isEnabled()) .setName(Text.translatable("sodium-extra.option.steady_debug_hud_refresh_interval")) .setTooltip(Text.translatable("sodium-extra.option.steady_debug_hud_refresh_interval.tooltip")) @@ -538,7 +611,7 @@ public static OptionPage extra() { ) .build()); - return new OptionPage(SodiumExtraClientMod.optionIdentifier("extras"), Text.translatable("sodium-extra.option.extras"), ImmutableList.copyOf(groups)); + return new OptionPage(SodiumExtraOptions.Pages.EXTRAS, Text.translatable("sodium-extra.option.extras"), ImmutableList.copyOf(groups)); } private static Text translatableName(Identifier identifier, String category) { diff --git a/src/main/java/me/flashyreese/mods/sodiumextra/client/gui/options/storage/SodiumExtraOptions.java b/src/main/java/me/flashyreese/mods/sodiumextra/client/gui/options/storage/SodiumExtraOptions.java new file mode 100644 index 00000000..8ffdc8be --- /dev/null +++ b/src/main/java/me/flashyreese/mods/sodiumextra/client/gui/options/storage/SodiumExtraOptions.java @@ -0,0 +1,108 @@ +package me.flashyreese.mods.sodiumextra.client.gui.options.storage; + +import me.flashyreese.mods.sodiumextra.client.SodiumExtraClientMod; +import net.minecraft.util.Identifier; +import org.embeddedt.embeddium.api.options.OptionIdentifier; + +public class SodiumExtraOptions { + public static class Group { + public static final Identifier EFFECTS = Identifier.of(SodiumExtraClientMod.MOD_ID, "group_effects"); + public static final Identifier RESOLUTIONS = Identifier.of(SodiumExtraClientMod.MOD_ID, "group_resolutions"); + public static final Identifier ANIMATIONS_ALL = Identifier.of(SodiumExtraClientMod.MOD_ID, "group_animations_all"); + public static final Identifier BLOCK_ANIMATIONS = Identifier.of(SodiumExtraClientMod.MOD_ID, "group_block_animations"); + + public static final Identifier PARTICLES_ALL = Identifier.of(SodiumExtraClientMod.MOD_ID, "group_particles_all"); + public static final Identifier PARTICLES_BLOCK = Identifier.of(SodiumExtraClientMod.MOD_ID, "group_particles_block"); + + public static final Identifier DETAILS_DEFAULT = Identifier.of(SodiumExtraClientMod.MOD_ID, "group_details_default"); + + public static final Identifier RENDER_FOG = Identifier.of(SodiumExtraClientMod.MOD_ID, "group_render_fog"); + public static final Identifier RENDER_SINGLE_FOG = Identifier.of(SodiumExtraClientMod.MOD_ID, "group_render_single_fog"); + public static final Identifier RENDER_LIGHT = Identifier.of(SodiumExtraClientMod.MOD_ID, "group_render_light"); + public static final Identifier RENDER_ENTITY = Identifier.of(SodiumExtraClientMod.MOD_ID, "group_render_entity"); + public static final Identifier RENDER_BLOCK_ENTITY = Identifier.of(SodiumExtraClientMod.MOD_ID, "group_render_block_entity"); + public static final Identifier RENDER_TAG_ENTITY = Identifier.of(SodiumExtraClientMod.MOD_ID, "group_render_other_entity"); + public static final Identifier EXTRA_MAC_OS = Identifier.of(SodiumExtraClientMod.MOD_ID, "group_extra_mac_os"); + public static final Identifier EXTRA_OVERLAY = Identifier.of(SodiumExtraClientMod.MOD_ID, "group_extra_overlay"); + public static final Identifier EXTRA_ADVANCED_ITEM_TOOLTIPS = Identifier.of(SodiumExtraClientMod.MOD_ID, "group_extra_advanced_item_tooltips"); + public static final Identifier EXTRA_TOASTS = Identifier.of(SodiumExtraClientMod.MOD_ID, "group_extra_toasts"); + public static final Identifier EXTRA_SHADERS = Identifier.of(SodiumExtraClientMod.MOD_ID, "group_extra_toasts"); + public static final Identifier EXTRA_DEBUG = Identifier.of(SodiumExtraClientMod.MOD_ID, "group_extra_toasts"); + } + + public static class Pages { + public static final OptionIdentifier ANIMATIONS = optionIdentifier("animations"); + public static final OptionIdentifier PARTICLES = optionIdentifier("particles"); + public static final OptionIdentifier DETAILS = optionIdentifier("details"); + public static final OptionIdentifier RENDER = optionIdentifier("render"); + public static final OptionIdentifier EXTRAS = optionIdentifier("extras"); + + private static OptionIdentifier optionIdentifier(String path) { + return OptionIdentifier.create(SodiumExtraClientMod.MOD_ID, path); + } + } + + public static class Option { + public static final Identifier RESOLUTION = Identifier.of("minecraft", "resolution"); + + public static final Identifier ADAPTIVE_VSYNC = Identifier.of(SodiumExtraClientMod.MOD_ID, "vsync"); + public static final Identifier SCREEN_EFFECT_SCALE = Identifier.of(SodiumExtraClientMod.MOD_ID, "screen_effect_scale"); + public static final Identifier FOV_EFFECT_SCALE = Identifier.of(SodiumExtraClientMod.MOD_ID, "fov_effect_scale"); + + public static final Identifier ANIMATIONS_ALL = Identifier.of(SodiumExtraClientMod.MOD_ID, "animations_all"); + public static final Identifier ANIMATIONS_WATER = Identifier.of(SodiumExtraClientMod.MOD_ID, "animations_water"); + public static final Identifier ANIMATIONS_LAVA = Identifier.of(SodiumExtraClientMod.MOD_ID, "animations_lava"); + public static final Identifier ANIMATIONS_FIRE = Identifier.of(SodiumExtraClientMod.MOD_ID, "animations_fire"); + public static final Identifier ANIMATIONS_NETHER_PORTAL = Identifier.of(SodiumExtraClientMod.MOD_ID, "animations_nether_portal"); + public static final Identifier ANIMATIONS_BLOCK = Identifier.of(SodiumExtraClientMod.MOD_ID, "animations_block"); + public static final Identifier ANIMATIONS_SCULK_SENSOR = Identifier.of(SodiumExtraClientMod.MOD_ID, "animations_sculk_sensor"); + + public static final Identifier PARTICLES_ALL = Identifier.of(SodiumExtraClientMod.MOD_ID, "particles_all"); + public static final Identifier PARTICLES_SPLASH = Identifier.of(SodiumExtraClientMod.MOD_ID, "particles_splash"); + public static final Identifier PARTICLES_BREAK = Identifier.of(SodiumExtraClientMod.MOD_ID, "particles_break"); + public static final Identifier PARTICLES_HIT = Identifier.of(SodiumExtraClientMod.MOD_ID, "particles_hit"); + public static final Identifier PARTICLES_TYPES = Identifier.of(SodiumExtraClientMod.MOD_ID, "particles_types"); + + public static final Identifier DETAILS_SKY = Identifier.of(SodiumExtraClientMod.MOD_ID, "details_sky"); + public static final Identifier DETAILS_STARS = Identifier.of(SodiumExtraClientMod.MOD_ID, "details_stars"); + public static final Identifier DETAILS_SUN_MOON = Identifier.of(SodiumExtraClientMod.MOD_ID, "details_sun_moon"); + public static final Identifier DETAILS_WEATHER = Identifier.of(SodiumExtraClientMod.MOD_ID, "details_weather"); + public static final Identifier DETAILS_BIOME_COLORS = Identifier.of(SodiumExtraClientMod.MOD_ID, "details_biome_colors"); + public static final Identifier DETAILS_SKY_COLORS = Identifier.of(SodiumExtraClientMod.MOD_ID, "details_sky_colors"); + + public static final Identifier RENDER_FOG_TYPE = Identifier.of(SodiumExtraClientMod.MOD_ID, "render_fog_type"); + public static final Identifier RENDER_FOG_DIMENSION_TYPES = Identifier.of(SodiumExtraClientMod.MOD_ID, "render_fog_dimension_type"); + public static final Identifier RENDER_MULTI_DIMENSION_FOG = Identifier.of(SodiumExtraClientMod.MOD_ID, "render_multi_dimension_fog"); + public static final Identifier RENDER_FOG_FALLOUT = Identifier.of(SodiumExtraClientMod.MOD_ID, "render_fog_falloff"); + public static final Identifier RENDER_SINGLE_FOG = Identifier.of(SodiumExtraClientMod.MOD_ID, "render_single_fog"); + public static final Identifier RENDER_LIGHT_UPDATES = Identifier.of(SodiumExtraClientMod.MOD_ID, "render_light_updates"); + public static final Identifier RENDER_ITEM_FRAME = Identifier.of(SodiumExtraClientMod.MOD_ID, "render_item_frame"); + public static final Identifier RENDER_ARMOR_STAND = Identifier.of(SodiumExtraClientMod.MOD_ID, "render_armor_stand"); + public static final Identifier RENDER_PAINTING = Identifier.of(SodiumExtraClientMod.MOD_ID, "render_painting"); + public static final Identifier RENDER_RENDER_BEACON_BEAM = Identifier.of(SodiumExtraClientMod.MOD_ID, "render_beacon_beam"); + public static final Identifier RENDER_LIMIT_BEACON_BEAM_HEIGHT = Identifier.of(SodiumExtraClientMod.MOD_ID, "render_limit_beacon_beam_height"); + public static final Identifier RENDER_ENCHANTING_TABLE_BOOK = Identifier.of(SodiumExtraClientMod.MOD_ID, "render_enchanting_table_book"); + public static final Identifier RENDER_PISTON = Identifier.of(SodiumExtraClientMod.MOD_ID, "render_piston"); + public static final Identifier RENDER_ITEM_FRAME_NAME_TAG = Identifier.of(SodiumExtraClientMod.MOD_ID, "render_item_frame_name_tag"); + public static final Identifier RENDER_PLAYER_NAME_TAG = Identifier.of(SodiumExtraClientMod.MOD_ID, "render_player_name_tag"); + + public static final Identifier EXTRA_REDUCE_RESOLUTION_ON_MAC = Identifier.of(SodiumExtraClientMod.MOD_ID, "extra_reduce_resolution_on_mac"); + public static final Identifier EXTRA_OVERLAY_CORNER = Identifier.of(SodiumExtraClientMod.MOD_ID, "extra_overlay_corner"); + public static final Identifier EXTRA_TEXT_CONTRAST = Identifier.of(SodiumExtraClientMod.MOD_ID, "extra_text_contrast"); + public static final Identifier EXTRA_SHOW_FPS = Identifier.of(SodiumExtraClientMod.MOD_ID, "extra_show_fps"); + public static final Identifier EXTRA_SHOW_FPS_EXTENDED = Identifier.of(SodiumExtraClientMod.MOD_ID, "extra_show_fps_extended"); + public static final Identifier EXTRA_SHOW_COORDINATES = Identifier.of(SodiumExtraClientMod.MOD_ID, "extra_show_coordinates"); + public static final Identifier EXTRA_CLOUD_HEIGHT = Identifier.of(SodiumExtraClientMod.MOD_ID, "extra_cloud_height"); + public static final Identifier EXTRA_CLOUD_DISTANCE = Identifier.of(SodiumExtraClientMod.MOD_ID, "extra_cloud_distance"); + public static final Identifier EXTRA_ADVANCED_ITEM_TOOLTIPS = Identifier.of(SodiumExtraClientMod.MOD_ID, "extra_advanced_item_tooltips"); + public static final Identifier EXTRA_TOASTS = Identifier.of(SodiumExtraClientMod.MOD_ID, "extra_toasts"); + public static final Identifier EXTRA_ADVANCEMENT_TOAST = Identifier.of(SodiumExtraClientMod.MOD_ID, "extra_advancement_toast"); + public static final Identifier EXTRA_RECIPE_TOAST = Identifier.of(SodiumExtraClientMod.MOD_ID, "extra_recipe_toast"); + public static final Identifier EXTRA_SYSTEM_TOAST = Identifier.of(SodiumExtraClientMod.MOD_ID, "extra_system_toast"); + public static final Identifier EXTRA_TUTORIAL_TOAST = Identifier.of(SodiumExtraClientMod.MOD_ID, "extra_tutorial_toast"); + public static final Identifier EXTRA_INSTANT_SNEAK = Identifier.of(SodiumExtraClientMod.MOD_ID, "extra_instant_sneak"); + public static final Identifier EXTRA_PREVENT_SHADERS = Identifier.of(SodiumExtraClientMod.MOD_ID, "extra_prevent_shaders"); + public static final Identifier EXTRA_STEADY_DEBUG_HUD = Identifier.of(SodiumExtraClientMod.MOD_ID, "extra_steady_debug_hud"); + public static final Identifier EXTRA_STEADY_DEBUG_HUD_REFRESH_INTERVAL = Identifier.of(SodiumExtraClientMod.MOD_ID, "extra_steady_debug_hud_refresh_interval"); + } +} diff --git a/src/main/java/me/flashyreese/mods/sodiumextra/mixin/SodiumExtraMixinConfigPlugin.java b/src/main/java/me/flashyreese/mods/sodiumextra/mixin/SodiumExtraMixinConfigPlugin.java index dee9ee27..0f7a44d5 100644 --- a/src/main/java/me/flashyreese/mods/sodiumextra/mixin/SodiumExtraMixinConfigPlugin.java +++ b/src/main/java/me/flashyreese/mods/sodiumextra/mixin/SodiumExtraMixinConfigPlugin.java @@ -4,23 +4,31 @@ import me.flashyreese.mods.sodiumextra.client.SodiumExtraClientMod; import net.caffeinemc.caffeineconfig.AbstractCaffeineConfigMixinPlugin; import net.caffeinemc.caffeineconfig.CaffeineConfig; -import org.embeddedt.embeddium.impl.taint.mixin.MixinTaintDetector; import org.spongepowered.asm.mixin.transformer.ext.IExtension; -import java.lang.reflect.Field; - public class SodiumExtraMixinConfigPlugin extends AbstractCaffeineConfigMixinPlugin { private static final String MIXIN_PACKAGE_ROOT = "me.flashyreese.mods.sodiumextra.mixin."; + public static boolean EMBEDDIUM_HACKED = false; - public SodiumExtraMixinConfigPlugin() { + static { System.setProperty("embeddium.mixinTaintEnforceLevel", "WARN"); - try { - Field instanceField = MixinTaintDetector.class.getDeclaredField("INSTANCE"); - instanceField.setAccessible(true); - MixinInternals.unregisterExtension((IExtension) instanceField.get(null)); - } catch (Throwable th) { - System.out.println("Embeddium is shit"); + + for (IExtension extension : MixinInternals.getExtensions().getActiveExtensions()) { + String extensionClass = extension.getClass().getName(); + + SodiumExtraClientMod.LOGGER.info("Try {}...", extensionClass); + + if (extensionClass.contains(".embeddium.")) { + MixinInternals.unregisterExtension(extension); + EMBEDDIUM_HACKED = true; + SodiumExtraClientMod.LOGGER.info("Embeddium hacked!"); + break; + } + } + + if (!EMBEDDIUM_HACKED) { + SodiumExtraClientMod.LOGGER.error("Embeddium NOT hacked!"); } } diff --git a/src/main/java/me/flashyreese/mods/sodiumextra/mixin/sodium/embeddium/OptionGroupMixin.java b/src/main/java/me/flashyreese/mods/sodiumextra/mixin/sodium/embeddium/OptionGroupMixin.java deleted file mode 100644 index 56439d4a..00000000 --- a/src/main/java/me/flashyreese/mods/sodiumextra/mixin/sodium/embeddium/OptionGroupMixin.java +++ /dev/null @@ -1,29 +0,0 @@ -package me.flashyreese.mods.sodiumextra.mixin.sodium.embeddium; - -import org.embeddedt.embeddium.api.options.OptionIdentifier; -import org.embeddedt.embeddium.api.options.structure.OptionGroup; -import org.spongepowered.asm.mixin.Mixin; -import org.spongepowered.asm.mixin.Shadow; -import org.spongepowered.asm.mixin.injection.At; -import org.spongepowered.asm.mixin.injection.Inject; -import org.spongepowered.asm.mixin.injection.callback.CallbackInfoReturnable; - -@Mixin(value = OptionGroup.Builder.class, remap = false) -public abstract class OptionGroupMixin { - @Shadow - private OptionIdentifier id; - @Shadow - public abstract OptionGroup.Builder setId(OptionIdentifier id); - - @Inject( - method = "build", - at = @At( - value = "HEAD" - ) - ) - public void embeddiumextra$fixShit(CallbackInfoReturnable cir) { - if (this.id == null) { - setId(OptionIdentifier.EMPTY); - } - } -} diff --git a/src/main/java/me/flashyreese/mods/sodiumextra/mixin/sodium/embeddium/OptionImplMixin.java b/src/main/java/me/flashyreese/mods/sodiumextra/mixin/sodium/embeddium/OptionImplMixin.java deleted file mode 100644 index e83dea9f..00000000 --- a/src/main/java/me/flashyreese/mods/sodiumextra/mixin/sodium/embeddium/OptionImplMixin.java +++ /dev/null @@ -1,31 +0,0 @@ -package me.flashyreese.mods.sodiumextra.mixin.sodium.embeddium; - -import org.embeddedt.embeddium.api.options.OptionIdentifier; -import org.embeddedt.embeddium.api.options.structure.OptionGroup; -import org.embeddedt.embeddium.api.options.structure.OptionImpl; -import org.spongepowered.asm.mixin.Mixin; -import org.spongepowered.asm.mixin.Shadow; -import org.spongepowered.asm.mixin.injection.At; -import org.spongepowered.asm.mixin.injection.Inject; -import org.spongepowered.asm.mixin.injection.callback.CallbackInfoReturnable; - -@Mixin(value = OptionImpl.Builder.class, remap = false) -public abstract class OptionImplMixin { - @Shadow - private OptionIdentifier id; - - @Shadow - public abstract OptionImpl.Builder setId(OptionIdentifier id); - - @Inject( - method = "build", - at = @At( - value = "HEAD" - ) - ) - public void embeddiumextra$fixShit(CallbackInfoReturnable cir) { - if (this.id == null) { - setId((OptionIdentifier) OptionIdentifier.EMPTY); - } - } -} diff --git a/src/main/java/me/flashyreese/mods/sodiumextra/mixin/sodium/fog/MixinOcclusionCuller.java b/src/main/java/me/flashyreese/mods/sodiumextra/mixin/sodium/fog/MixinOcclusionCuller.java deleted file mode 100644 index 09d80b80..00000000 --- a/src/main/java/me/flashyreese/mods/sodiumextra/mixin/sodium/fog/MixinOcclusionCuller.java +++ /dev/null @@ -1,35 +0,0 @@ -package me.flashyreese.mods.sodiumextra.mixin.sodium.fog; - -import me.flashyreese.mods.sodiumextra.client.SodiumExtraClientMod; -import org.embeddedt.embeddium.impl.render.chunk.RenderSection; -import org.embeddedt.embeddium.impl.render.chunk.occlusion.OcclusionCuller; -import org.embeddedt.embeddium.impl.render.viewport.CameraTransform; -import net.minecraft.client.MinecraftClient; -import org.spongepowered.asm.mixin.Mixin; -import org.spongepowered.asm.mixin.Shadow; -import org.spongepowered.asm.mixin.injection.At; -import org.spongepowered.asm.mixin.injection.Inject; -import org.spongepowered.asm.mixin.injection.callback.CallbackInfoReturnable; - -@Mixin(value = OcclusionCuller.class, remap = false) -public abstract class MixinOcclusionCuller { - @Shadow - private static int nearestToZero(int min, int max) { - return 0; - } - - @Inject(method = "isWithinRenderDistance", at = @At(value = "HEAD"), cancellable = true) - private static void isWithinRenderDistance(CameraTransform camera, RenderSection section, float maxDistance, CallbackInfoReturnable cir) { - int fogDistance = SodiumExtraClientMod.options().renderSettings.multiDimensionFogControl ? - SodiumExtraClientMod.options().renderSettings.dimensionFogDistanceMap.getOrDefault(MinecraftClient.getInstance().world.getDimension().effects(), 0) : - SodiumExtraClientMod.options().renderSettings.fogDistance; - if (fogDistance == 33) { - int ox = section.getOriginX() - camera.intX; - int oz = section.getOriginZ() - camera.intZ; - float dx = nearestToZero(ox, ox + 16) - camera.fracX; - float dz = nearestToZero(oz, oz + 16) - camera.fracZ; - boolean result = ((dx * dx) + (dz * dz)) < (maxDistance * maxDistance); - cir.setReturnValue(result); - } - } -} diff --git a/src/main/resources/META-INF/neoforge.mods.toml b/src/main/resources/META-INF/neoforge.mods.toml index c88e89d2..2e0bd85e 100644 --- a/src/main/resources/META-INF/neoforge.mods.toml +++ b/src/main/resources/META-INF/neoforge.mods.toml @@ -29,7 +29,7 @@ side = "BOTH" [[dependencies.embeddium_extra]] modId = "embeddium" type = "required" -versionRange = "*" +versionRange = "[1.0.3+mc1.21,)" ordering = "NONE" side = "CLIENT" diff --git a/src/main/resources/sodium-extra.mixins.json b/src/main/resources/sodium-extra.mixins.json index 86261a94..86a4599c 100644 --- a/src/main/resources/sodium-extra.mixins.json +++ b/src/main/resources/sodium-extra.mixins.json @@ -36,7 +36,6 @@ "sky.MixinWorldRenderer", "sky_colors.MixinBiome", "sodium.cloud.MixinCloudRenderer", - "sodium.fog.MixinOcclusionCuller", "stars.MixinWorldRenderer", "steady_debug_hud.MixinDebugHud", "sun_moon.MixinWorldRenderer", @@ -48,9 +47,5 @@ ], "injectors": { "defaultRequire": 1 - }, - "mixins": [ - "sodium.embeddium.OptionGroupMixin", - "sodium.embeddium.OptionImplMixin" - ] + } }