diff --git a/build.gradle.kts b/build.gradle.kts index 74978d11..d3a9da9b 100644 --- a/build.gradle.kts +++ b/build.gradle.kts @@ -3,16 +3,16 @@ plugins { id("fabric-loom") version ("1.7.2") apply (false) } -val MINECRAFT_VERSION by extra { "1.21" } -val NEOFORGE_VERSION by extra { "21.0.76-beta" } -val FABRIC_LOADER_VERSION by extra { "0.15.11" } -val FABRIC_API_VERSION by extra { "0.100.4+1.21" } +val MINECRAFT_VERSION by extra { "1.21.1" } +val NEOFORGE_VERSION by extra { "21.1.23" } +val FABRIC_LOADER_VERSION by extra { "0.16.2" } +val FABRIC_API_VERSION by extra { "0.102.1+1.21.1" } // This value can be set to null to disable Parchment. -val PARCHMENT_VERSION by extra { "2024.06.23" } +val PARCHMENT_VERSION by extra { null } // https://semver.org/ -val MOD_VERSION by extra { "0.5.7" } +val MOD_VERSION by extra { "0.6.0-beta.1" } allprojects { apply(plugin = "java") @@ -24,6 +24,11 @@ tasks.withType { } subprojects { + repositories { + maven("https://maven.parchmentmc.org/") + maven("https://api.modrinth.com/maven") + } + apply(plugin = "maven-publish") java.toolchain.languageVersion = JavaLanguageVersion.of(21) diff --git a/common/build.gradle.kts b/common/build.gradle.kts index 1faa2917..9984a6fb 100644 --- a/common/build.gradle.kts +++ b/common/build.gradle.kts @@ -6,10 +6,6 @@ plugins { id("fabric-loom") version "1.7.2" } -repositories { - maven("https://maven.parchmentmc.org/") -} - val MINECRAFT_VERSION: String by rootProject.extra val PARCHMENT_VERSION: String? by rootProject.extra val FABRIC_LOADER_VERSION: String by rootProject.extra @@ -45,7 +41,7 @@ dependencies { modCompileOnly("net.fabricmc.fabric-api:fabric-renderer-api-v1:3.2.9+1172e897d7") implementation(group = "com.lodborg", name = "interval-tree", version = "1.0.0") - modImplementation(files(rootDir.resolve("sodium-fabric.jar"))) + modImplementation(/*files(rootDir.resolve("sodium-fabric.jar"))*/ "maven.modrinth:sodium:mc1.21-0.6.0-beta.1-fabric") } tasks.withType().forEach { diff --git a/common/src/main/java/me/flashyreese/mods/sodiumextra/client/SodiumExtraClientMod.java b/common/src/main/java/me/flashyreese/mods/sodiumextra/client/SodiumExtraClientMod.java index 126802bb..5358c957 100644 --- a/common/src/main/java/me/flashyreese/mods/sodiumextra/client/SodiumExtraClientMod.java +++ b/common/src/main/java/me/flashyreese/mods/sodiumextra/client/SodiumExtraClientMod.java @@ -3,7 +3,7 @@ import me.flashyreese.mods.sodiumextra.client.gui.SodiumExtraGameOptions; import me.flashyreese.mods.sodiumextra.client.gui.SodiumExtraHud; import net.caffeinemc.caffeineconfig.CaffeineConfig; -import net.caffeinemc.mods.sodium.client.services.PlatformInfoAccess; +import net.caffeinemc.mods.sodium.client.services.PlatformRuntimeInformation; import net.minecraft.client.DeltaTracker; import net.minecraft.client.Minecraft; import net.minecraft.client.gui.GuiGraphics; @@ -76,7 +76,7 @@ public static CaffeineConfig mixinConfig() { //.withLogger(SodiumExtraClientMod.logger()) .withInfoUrl("https://github.com/FlashyReese/sodium-extra-fabric/wiki/Configuration-File") - .build(PlatformInfoAccess.getInstance().getConfigDirectory().resolve("sodium-extra.properties")); + .build(PlatformRuntimeInformation.getInstance().getConfigDirectory().resolve("sodium-extra.properties")); } return MIXIN_CONFIG; } @@ -86,7 +86,7 @@ public static ClientTickHandler getClientTickHandler() { } private static SodiumExtraGameOptions loadConfig() { - return SodiumExtraGameOptions.load(PlatformInfoAccess.getInstance().getConfigDirectory().resolve("sodium-extra-options.json").toFile()); + return SodiumExtraGameOptions.load(PlatformRuntimeInformation.getInstance().getConfigDirectory().resolve("sodium-extra-options.json").toFile()); } public static void onTick(Minecraft client) { diff --git a/common/src/main/java/me/flashyreese/mods/sodiumextra/client/gui/SodiumExtraGameOptionPages.java b/common/src/main/java/me/flashyreese/mods/sodiumextra/client/gui/SodiumExtraGameOptionPages.java index 2db2124c..5894bd47 100644 --- a/common/src/main/java/me/flashyreese/mods/sodiumextra/client/gui/SodiumExtraGameOptionPages.java +++ b/common/src/main/java/me/flashyreese/mods/sodiumextra/client/gui/SodiumExtraGameOptionPages.java @@ -34,7 +34,7 @@ public static OptionPage animation() { List groups = new ArrayList<>(); groups.add(OptionGroup.createBuilder() .add(OptionImpl.createBuilder(boolean.class, sodiumExtraOpts) - .setEnabled(SodiumExtraClientMod.mixinConfig().getOptions().get("mixin.animation").isEnabled()) + .setEnabled(() -> SodiumExtraClientMod.mixinConfig().getOptions().get("mixin.animation").isEnabled()) .setName(parseVanillaString("gui.socialInteractions.tab_all")) .setTooltip(Component.translatable("sodium-extra.option.animations_all.tooltip")) .setControl(TickBoxControl::new) @@ -46,7 +46,7 @@ public static OptionPage animation() { groups.add(OptionGroup.createBuilder() .add(OptionImpl.createBuilder(boolean.class, sodiumExtraOpts) - .setEnabled(SodiumExtraClientMod.mixinConfig().getOptions().get("mixin.animation").isEnabled()) + .setEnabled(() -> SodiumExtraClientMod.mixinConfig().getOptions().get("mixin.animation").isEnabled()) .setName(parseVanillaString("block.minecraft.water")) .setTooltip(Component.translatable("sodium-extra.option.animate_water.tooltip")) .setControl(TickBoxControl::new) @@ -55,7 +55,7 @@ public static OptionPage animation() { .build() ) .add(OptionImpl.createBuilder(boolean.class, sodiumExtraOpts) - .setEnabled(SodiumExtraClientMod.mixinConfig().getOptions().get("mixin.animation").isEnabled()) + .setEnabled(() -> SodiumExtraClientMod.mixinConfig().getOptions().get("mixin.animation").isEnabled()) .setName(parseVanillaString("block.minecraft.lava")) .setTooltip(Component.translatable("sodium-extra.option.animate_lava.tooltip")) .setControl(TickBoxControl::new) @@ -64,7 +64,7 @@ public static OptionPage animation() { .build() ) .add(OptionImpl.createBuilder(boolean.class, sodiumExtraOpts) - .setEnabled(SodiumExtraClientMod.mixinConfig().getOptions().get("mixin.animation").isEnabled()) + .setEnabled(() -> SodiumExtraClientMod.mixinConfig().getOptions().get("mixin.animation").isEnabled()) .setName(parseVanillaString("block.minecraft.fire")) .setTooltip(Component.translatable("sodium-extra.option.animate_fire.tooltip")) .setControl(TickBoxControl::new) @@ -73,7 +73,7 @@ public static OptionPage animation() { .build() ) .add(OptionImpl.createBuilder(boolean.class, sodiumExtraOpts) - .setEnabled(SodiumExtraClientMod.mixinConfig().getOptions().get("mixin.animation").isEnabled()) + .setEnabled(() -> SodiumExtraClientMod.mixinConfig().getOptions().get("mixin.animation").isEnabled()) .setName(parseVanillaString("block.minecraft.nether_portal")) .setTooltip(Component.translatable("sodium-extra.option.animate_portal.tooltip")) .setControl(TickBoxControl::new) @@ -82,7 +82,7 @@ public static OptionPage animation() { .build() ) .add(OptionImpl.createBuilder(boolean.class, sodiumExtraOpts) - .setEnabled(SodiumExtraClientMod.mixinConfig().getOptions().get("mixin.animation").isEnabled()) + .setEnabled(() -> SodiumExtraClientMod.mixinConfig().getOptions().get("mixin.animation").isEnabled()) .setName(Component.translatable("sodium-extra.option.block_animations")) .setTooltip(Component.translatable("sodium-extra.option.block_animations.tooltip")) .setControl(TickBoxControl::new) @@ -91,7 +91,7 @@ public static OptionPage animation() { .build() ) .add(OptionImpl.createBuilder(boolean.class, sodiumExtraOpts) - .setEnabled(SodiumExtraClientMod.mixinConfig().getOptions().get("mixin.animation").isEnabled()) + .setEnabled(() -> SodiumExtraClientMod.mixinConfig().getOptions().get("mixin.animation").isEnabled()) .setName(parseVanillaString("block.minecraft.sculk_sensor")) .setTooltip(Component.translatable("sodium-extra.option.animate_sculk_sensor.tooltip")) .setControl(TickBoxControl::new) @@ -107,7 +107,7 @@ public static OptionPage particle() { List groups = new ArrayList<>(); groups.add(OptionGroup.createBuilder() .add(OptionImpl.createBuilder(boolean.class, sodiumExtraOpts) - .setEnabled(SodiumExtraClientMod.mixinConfig().getOptions().get("mixin.particle").isEnabled()) + .setEnabled(() -> SodiumExtraClientMod.mixinConfig().getOptions().get("mixin.particle").isEnabled()) .setName(parseVanillaString("gui.socialInteractions.tab_all")) .setTooltip(Component.translatable("sodium-extra.option.particles_all.tooltip")) .setControl(TickBoxControl::new) @@ -118,7 +118,7 @@ public static OptionPage particle() { groups.add(OptionGroup.createBuilder() .add(OptionImpl.createBuilder(boolean.class, sodiumExtraOpts) - .setEnabled(SodiumExtraClientMod.mixinConfig().getOptions().get("mixin.particle").isEnabled()) + .setEnabled(() -> SodiumExtraClientMod.mixinConfig().getOptions().get("mixin.particle").isEnabled()) .setName(parseVanillaString("subtitles.entity.generic.splash")) .setTooltip(Component.translatable("sodium-extra.option.rain_splash.tooltip")) .setControl(TickBoxControl::new) @@ -126,7 +126,7 @@ public static OptionPage particle() { .build() ) .add(OptionImpl.createBuilder(boolean.class, sodiumExtraOpts) - .setEnabled(SodiumExtraClientMod.mixinConfig().getOptions().get("mixin.particle").isEnabled()) + .setEnabled(() -> SodiumExtraClientMod.mixinConfig().getOptions().get("mixin.particle").isEnabled()) .setName(parseVanillaString("subtitles.block.generic.break")) .setTooltip(Component.translatable("sodium-extra.option.block_break.tooltip")) .setControl(TickBoxControl::new) @@ -134,7 +134,7 @@ public static OptionPage particle() { .build() ) .add(OptionImpl.createBuilder(boolean.class, sodiumExtraOpts) - .setEnabled(SodiumExtraClientMod.mixinConfig().getOptions().get("mixin.particle").isEnabled()) + .setEnabled(() -> SodiumExtraClientMod.mixinConfig().getOptions().get("mixin.particle").isEnabled()) .setName(parseVanillaString("subtitles.block.generic.hit")) .setTooltip(Component.translatable("sodium-extra.option.block_breaking.tooltip")) .setControl(TickBoxControl::new) @@ -147,7 +147,7 @@ public static OptionPage particle() { .collect(Collectors.groupingBy(ResourceLocation::getNamespace)); otherParticles.forEach((namespace, identifiers) -> groups.add(identifiers.stream() .map(identifier -> OptionImpl.createBuilder(boolean.class, sodiumExtraOpts) - .setEnabled(SodiumExtraClientMod.mixinConfig().getOptions().get("mixin.particle").isEnabled()) + .setEnabled(() -> SodiumExtraClientMod.mixinConfig().getOptions().get("mixin.particle").isEnabled()) .setName(translatableName(identifier, "particles")) .setTooltip(translatableTooltip(identifier, "particles")) .setControl(TickBoxControl::new) @@ -170,7 +170,7 @@ public static OptionPage detail() { List groups = new ArrayList<>(); groups.add(OptionGroup.createBuilder() .add(OptionImpl.createBuilder(boolean.class, sodiumExtraOpts) - .setEnabled(SodiumExtraClientMod.mixinConfig().getOptions().get("mixin.sky").isEnabled()) + .setEnabled(() -> SodiumExtraClientMod.mixinConfig().getOptions().get("mixin.sky").isEnabled()) .setName(Component.translatable("sodium-extra.option.sky")) .setTooltip(Component.translatable("sodium-extra.option.sky.tooltip")) .setControl(TickBoxControl::new) @@ -178,7 +178,7 @@ public static OptionPage detail() { .build() ) .add(OptionImpl.createBuilder(boolean.class, sodiumExtraOpts) - .setEnabled(SodiumExtraClientMod.mixinConfig().getOptions().get("mixin.stars").isEnabled()) + .setEnabled(() -> SodiumExtraClientMod.mixinConfig().getOptions().get("mixin.stars").isEnabled()) .setName(Component.translatable("sodium-extra.option.stars")) .setTooltip(Component.translatable("sodium-extra.option.stars.tooltip")) .setControl(TickBoxControl::new) @@ -186,7 +186,7 @@ public static OptionPage detail() { .build() ) .add(OptionImpl.createBuilder(boolean.class, sodiumExtraOpts) - .setEnabled(SodiumExtraClientMod.mixinConfig().getOptions().get("mixin.sun_moon").isEnabled()) + .setEnabled(() -> SodiumExtraClientMod.mixinConfig().getOptions().get("mixin.sun_moon").isEnabled()) .setName(Component.translatable("sodium-extra.option.sun_moon")) .setTooltip(Component.translatable("sodium-extra.option.sun_moon.tooltip")) .setControl(TickBoxControl::new) @@ -195,7 +195,7 @@ public static OptionPage detail() { .build() ) .add(OptionImpl.createBuilder(boolean.class, sodiumExtraOpts) - .setEnabled(SodiumExtraClientMod.mixinConfig().getOptions().get("mixin.particle").isEnabled()) + .setEnabled(() -> SodiumExtraClientMod.mixinConfig().getOptions().get("mixin.particle").isEnabled()) .setName(parseVanillaString("soundCategory.weather")) .setTooltip(Component.translatable("sodium-extra.option.rain_snow.tooltip")) .setControl(TickBoxControl::new) @@ -203,7 +203,7 @@ public static OptionPage detail() { .build() ) .add(OptionImpl.createBuilder(boolean.class, sodiumExtraOpts) - .setEnabled(SodiumExtraClientMod.mixinConfig().getOptions().get("mixin.biome_colors").isEnabled()) + .setEnabled(() -> SodiumExtraClientMod.mixinConfig().getOptions().get("mixin.biome_colors").isEnabled()) .setName(Component.translatable("sodium-extra.option.biome_colors")) .setTooltip(Component.translatable("sodium-extra.option.biome_colors.tooltip")) .setControl(TickBoxControl::new) @@ -212,7 +212,7 @@ public static OptionPage detail() { .build() ) .add(OptionImpl.createBuilder(boolean.class, sodiumExtraOpts) - .setEnabled(SodiumExtraClientMod.mixinConfig().getOptions().get("mixin.sky_colors").isEnabled()) + .setEnabled(() -> SodiumExtraClientMod.mixinConfig().getOptions().get("mixin.sky_colors").isEnabled()) .setName(Component.translatable("sodium-extra.option.sky_colors")) .setTooltip(Component.translatable("sodium-extra.option.sky_colors.tooltip")) .setControl(TickBoxControl::new) @@ -229,7 +229,7 @@ public static OptionPage render() { groups.add(OptionGroup.createBuilder() .add(OptionImpl.createBuilder(boolean.class, sodiumExtraOpts) - .setEnabled(SodiumExtraClientMod.mixinConfig().getOptions().get("mixin.fog").isEnabled()) + .setEnabled(() -> SodiumExtraClientMod.mixinConfig().getOptions().get("mixin.fog").isEnabled()) .setName(Component.translatable("sodium-extra.option.multi_dimension_fog")) .setTooltip(Component.translatable("sodium-extra.option.multi_dimension_fog.tooltip")) .setControl(TickBoxControl::new) @@ -237,7 +237,7 @@ public static OptionPage render() { .build() ) .add(OptionImpl.createBuilder(int.class, sodiumExtraOpts) - .setEnabled(SodiumExtraClientMod.mixinConfig().getOptions().get("mixin.fog_falloff").isEnabled()) + .setEnabled(() -> SodiumExtraClientMod.mixinConfig().getOptions().get("mixin.fog_falloff").isEnabled()) .setName(Component.translatable("sodium-extra.option.fog_start")) .setTooltip(Component.translatable("sodium-extra.option.fog_start.tooltip")) .setControl(option -> new SliderControlExtended(option, 20, 100, 1, ControlValueFormatter.percentage(), false)) @@ -253,7 +253,7 @@ public static OptionPage render() { .forEach(dim -> SodiumExtraClientMod.options().renderSettings.dimensionFogDistanceMap.put(dim.location(), 0)); groups.add(SodiumExtraClientMod.options().renderSettings.dimensionFogDistanceMap.keySet().stream() .map(identifier -> OptionImpl.createBuilder(int.class, sodiumExtraOpts) - .setEnabled(SodiumExtraClientMod.mixinConfig().getOptions().get("mixin.fog").isEnabled()) + .setEnabled(() -> SodiumExtraClientMod.mixinConfig().getOptions().get("mixin.fog").isEnabled()) .setName(Component.translatable("sodium-extra.option.fog", translatableName(identifier, "dimensions").getString())) .setTooltip(Component.translatable("sodium-extra.option.fog.tooltip")) .setControl(option -> new SliderControlExtended(option, 0, 33, 1, ControlValueFormatterExtended.fogDistance(), false)) @@ -270,7 +270,7 @@ public static OptionPage render() { } else { groups.add(OptionGroup.createBuilder() .add(OptionImpl.createBuilder(int.class, sodiumExtraOpts) - .setEnabled(SodiumExtraClientMod.mixinConfig().getOptions().get("mixin.fog").isEnabled()) + .setEnabled(() -> SodiumExtraClientMod.mixinConfig().getOptions().get("mixin.fog").isEnabled()) .setName(Component.translatable("sodium-extra.option.single_fog")) .setTooltip(Component.translatable("sodium-extra.option.single_fog.tooltip")) .setControl(option -> new SliderControlExtended(option, 0, 33, 1, ControlValueFormatterExtended.fogDistance(), false)) @@ -282,7 +282,7 @@ public static OptionPage render() { groups.add(OptionGroup.createBuilder() .add(OptionImpl.createBuilder(boolean.class, sodiumExtraOpts) - .setEnabled(SodiumExtraClientMod.mixinConfig().getOptions().get("mixin.light_updates").isEnabled()) + .setEnabled(() -> SodiumExtraClientMod.mixinConfig().getOptions().get("mixin.light_updates").isEnabled()) .setName(Component.translatable("sodium-extra.option.light_updates")) .setTooltip(Component.translatable("sodium-extra.option.light_updates.tooltip")) .setControl(TickBoxControl::new) @@ -292,7 +292,7 @@ public static OptionPage render() { .build()); groups.add(OptionGroup.createBuilder() .add(OptionImpl.createBuilder(boolean.class, sodiumExtraOpts) - .setEnabled(SodiumExtraClientMod.mixinConfig().getOptions().get("mixin.render.entity").isEnabled()) + .setEnabled(() -> SodiumExtraClientMod.mixinConfig().getOptions().get("mixin.render.entity").isEnabled()) .setName(parseVanillaString("entity.minecraft.item_frame")) .setTooltip(Component.translatable("sodium-extra.option.item_frames.tooltip")) .setControl(TickBoxControl::new) @@ -300,7 +300,7 @@ public static OptionPage render() { .build() ) .add(OptionImpl.createBuilder(boolean.class, sodiumExtraOpts) - .setEnabled(SodiumExtraClientMod.mixinConfig().getOptions().get("mixin.render.entity").isEnabled()) + .setEnabled(() -> SodiumExtraClientMod.mixinConfig().getOptions().get("mixin.render.entity").isEnabled()) .setName(parseVanillaString("entity.minecraft.armor_stand")) .setTooltip(Component.translatable("sodium-extra.option.armor_stands.tooltip")) .setControl(TickBoxControl::new) @@ -308,7 +308,7 @@ public static OptionPage render() { .build() ) .add(OptionImpl.createBuilder(boolean.class, sodiumExtraOpts) - .setEnabled(SodiumExtraClientMod.mixinConfig().getOptions().get("mixin.render.entity").isEnabled()) + .setEnabled(() -> SodiumExtraClientMod.mixinConfig().getOptions().get("mixin.render.entity").isEnabled()) .setName(parseVanillaString("entity.minecraft.painting")) .setTooltip(Component.translatable("sodium-extra.option.paintings.tooltip")) .setControl(TickBoxControl::new) @@ -319,7 +319,7 @@ public static OptionPage render() { .build()); groups.add(OptionGroup.createBuilder() .add(OptionImpl.createBuilder(boolean.class, sodiumExtraOpts) - .setEnabled(SodiumExtraClientMod.mixinConfig().getOptions().get("mixin.render.block.entity").isEnabled()) + .setEnabled(() -> SodiumExtraClientMod.mixinConfig().getOptions().get("mixin.render.block.entity").isEnabled()) .setName(Component.translatable("sodium-extra.option.beacon_beam")) .setTooltip(Component.translatable("sodium-extra.option.beacon_beam.tooltip")) .setControl(TickBoxControl::new) @@ -327,7 +327,7 @@ public static OptionPage render() { .build() ) .add(OptionImpl.createBuilder(boolean.class, sodiumExtraOpts) - .setEnabled(SodiumExtraClientMod.mixinConfig().getOptions().get("mixin.render.block.entity").isEnabled()) + .setEnabled(() -> SodiumExtraClientMod.mixinConfig().getOptions().get("mixin.render.block.entity").isEnabled()) .setName(Component.translatable("sodium-extra.option.limit_beacon_beam_height")) .setTooltip(Component.translatable("sodium-extra.option.limit_beacon_beam_height.tooltip")) .setControl(TickBoxControl::new) @@ -335,7 +335,7 @@ public static OptionPage render() { .build() ) .add(OptionImpl.createBuilder(boolean.class, sodiumExtraOpts) - .setEnabled(SodiumExtraClientMod.mixinConfig().getOptions().get("mixin.render.block.entity").isEnabled()) + .setEnabled(() -> SodiumExtraClientMod.mixinConfig().getOptions().get("mixin.render.block.entity").isEnabled()) .setName(Component.translatable("sodium-extra.option.enchanting_table_book")) .setTooltip(Component.translatable("sodium-extra.option.enchanting_table_book.tooltip")) .setControl(TickBoxControl::new) @@ -343,7 +343,7 @@ public static OptionPage render() { .build() ) .add(OptionImpl.createBuilder(boolean.class, sodiumExtraOpts) - .setEnabled(SodiumExtraClientMod.mixinConfig().getOptions().get("mixin.render.block.entity").isEnabled()) + .setEnabled(() -> SodiumExtraClientMod.mixinConfig().getOptions().get("mixin.render.block.entity").isEnabled()) .setName(parseVanillaString("block.minecraft.piston")) .setTooltip(Component.translatable("sodium-extra.option.piston.tooltip")) .setControl(TickBoxControl::new) @@ -353,7 +353,7 @@ public static OptionPage render() { .build()); groups.add(OptionGroup.createBuilder() .add(OptionImpl.createBuilder(boolean.class, sodiumExtraOpts) - .setEnabled(SodiumExtraClientMod.mixinConfig().getOptions().get("mixin.render.entity").isEnabled()) + .setEnabled(() -> SodiumExtraClientMod.mixinConfig().getOptions().get("mixin.render.entity").isEnabled()) .setName(Component.translatable("sodium-extra.option.item_frame_name_tag")) .setTooltip(Component.translatable("sodium-extra.option.item_frame_name_tag.tooltip")) .setControl(TickBoxControl::new) @@ -361,7 +361,7 @@ public static OptionPage render() { .build() ) .add(OptionImpl.createBuilder(boolean.class, sodiumExtraOpts) - .setEnabled(SodiumExtraClientMod.mixinConfig().getOptions().get("mixin.render.entity").isEnabled()) + .setEnabled(() -> SodiumExtraClientMod.mixinConfig().getOptions().get("mixin.render.entity").isEnabled()) .setName(Component.translatable("sodium-extra.option.player_name_tag")) .setTooltip(Component.translatable("sodium-extra.option.player_name_tag.tooltip")) .setControl(TickBoxControl::new) @@ -376,10 +376,10 @@ public static OptionPage extra() { List groups = new ArrayList<>(); groups.add(OptionGroup.createBuilder() .add(OptionImpl.createBuilder(boolean.class, sodiumExtraOpts) - .setEnabled(SodiumExtraClientMod.mixinConfig().getOptions().get("mixin.reduce_resolution_on_mac").isEnabled() && Minecraft.ON_OSX) + .setEnabled(() -> SodiumExtraClientMod.mixinConfig().getOptions().get("mixin.reduce_resolution_on_mac").isEnabled() && Minecraft.ON_OSX) .setName(Component.translatable("sodium-extra.option.reduce_resolution_on_mac")) .setTooltip(Component.translatable("sodium-extra.option.reduce_resolution_on_mac.tooltip")) - .setEnabled(Minecraft.ON_OSX) + .setEnabled(() -> Minecraft.ON_OSX) .setImpact(OptionImpact.HIGH) .setControl(TickBoxControl::new) .setBinding((opts, value) -> opts.extraSettings.reduceResolutionOnMac = value, opts -> opts.extraSettings.reduceResolutionOnMac) @@ -422,7 +422,7 @@ public static OptionPage extra() { .build() ) .add(OptionImpl.createBuilder(int.class, sodiumExtraOpts) - .setEnabled(SodiumExtraClientMod.mixinConfig().getOptions().get("mixin.cloud").isEnabled()) + .setEnabled(() -> SodiumExtraClientMod.mixinConfig().getOptions().get("mixin.cloud").isEnabled()) .setName(Component.translatable("sodium-extra.option.cloud_height")) .setTooltip(Component.translatable("sodium-extra.option.cloud_height.tooltip")) .setControl(option -> new SliderControl(option, -64, 319, 1, ControlValueFormatter.number())) @@ -430,7 +430,7 @@ public static OptionPage extra() { .build() ) .add(OptionImpl.createBuilder(int.class, sodiumExtraOpts) - .setEnabled(SodiumExtraClientMod.mixinConfig().getOptions().get("mixin.sodium.cloud").isEnabled()) + .setEnabled(() -> SodiumExtraClientMod.mixinConfig().getOptions().get("mixin.sodium.cloud").isEnabled()) .setName(Component.translatable("sodium-extra.option.cloud_distance")) .setTooltip(Component.translatable("sodium-extra.option.cloud_distance.tooltip")) .setControl(option -> new SliderControl(option, 100, 300, 10, ControlValueFormatter.percentage())) @@ -449,14 +449,14 @@ public static OptionPage extra() { .build()); groups.add(OptionGroup.createBuilder() .add(OptionImpl.createBuilder(boolean.class, sodiumExtraOpts) - .setEnabled(SodiumExtraClientMod.mixinConfig().getOptions().get("mixin.toasts").isEnabled()) + .setEnabled(() -> SodiumExtraClientMod.mixinConfig().getOptions().get("mixin.toasts").isEnabled()) .setName(Component.translatable("sodium-extra.option.toasts")) .setTooltip(Component.translatable("sodium-extra.option.toasts.tooltip")) .setControl(TickBoxControl::new) .setBinding((options, value) -> options.extraSettings.toasts = value, options -> options.extraSettings.toasts) .build()) .add(OptionImpl.createBuilder(boolean.class, sodiumExtraOpts) - .setEnabled(SodiumExtraClientMod.mixinConfig().getOptions().get("mixin.toasts").isEnabled()) + .setEnabled(() -> SodiumExtraClientMod.mixinConfig().getOptions().get("mixin.toasts").isEnabled()) .setName(Component.translatable("sodium-extra.option.advancement_toast")) .setTooltip(Component.translatable("sodium-extra.option.advancement_toast.tooltip")) .setControl(TickBoxControl::new) @@ -464,7 +464,7 @@ public static OptionPage extra() { .build() ) .add(OptionImpl.createBuilder(boolean.class, sodiumExtraOpts) - .setEnabled(SodiumExtraClientMod.mixinConfig().getOptions().get("mixin.toasts").isEnabled()) + .setEnabled(() -> SodiumExtraClientMod.mixinConfig().getOptions().get("mixin.toasts").isEnabled()) .setName(Component.translatable("sodium-extra.option.recipe_toast")) .setTooltip(Component.translatable("sodium-extra.option.recipe_toast.tooltip")) .setControl(TickBoxControl::new) @@ -472,7 +472,7 @@ public static OptionPage extra() { .build() ) .add(OptionImpl.createBuilder(boolean.class, sodiumExtraOpts) - .setEnabled(SodiumExtraClientMod.mixinConfig().getOptions().get("mixin.toasts").isEnabled()) + .setEnabled(() -> SodiumExtraClientMod.mixinConfig().getOptions().get("mixin.toasts").isEnabled()) .setName(Component.translatable("sodium-extra.option.system_toast")) .setTooltip(Component.translatable("sodium-extra.option.system_toast.tooltip")) .setControl(TickBoxControl::new) @@ -480,7 +480,7 @@ public static OptionPage extra() { .build() ) .add(OptionImpl.createBuilder(boolean.class, sodiumExtraOpts) - .setEnabled(SodiumExtraClientMod.mixinConfig().getOptions().get("mixin.toasts").isEnabled()) + .setEnabled(() -> SodiumExtraClientMod.mixinConfig().getOptions().get("mixin.toasts").isEnabled()) .setName(Component.translatable("sodium-extra.option.tutorial_toast")) .setTooltip(Component.translatable("sodium-extra.option.tutorial_toast.tooltip")) .setControl(TickBoxControl::new) @@ -490,7 +490,7 @@ public static OptionPage extra() { .build()); groups.add(OptionGroup.createBuilder() .add(OptionImpl.createBuilder(boolean.class, sodiumExtraOpts) - .setEnabled(SodiumExtraClientMod.mixinConfig().getOptions().get("mixin.instant_sneak").isEnabled()) + .setEnabled(() -> SodiumExtraClientMod.mixinConfig().getOptions().get("mixin.instant_sneak").isEnabled()) .setName(Component.translatable("sodium-extra.option.instant_sneak")) .setTooltip(Component.translatable("sodium-extra.option.instant_sneak.tooltip")) .setControl(TickBoxControl::new) @@ -498,7 +498,7 @@ public static OptionPage extra() { .build() ) .add(OptionImpl.createBuilder(boolean.class, sodiumExtraOpts) - .setEnabled(SodiumExtraClientMod.mixinConfig().getOptions().get("mixin.prevent_shaders").isEnabled()) + .setEnabled(() -> SodiumExtraClientMod.mixinConfig().getOptions().get("mixin.prevent_shaders").isEnabled()) .setName(Component.translatable("sodium-extra.option.prevent_shaders")) .setTooltip(Component.translatable("sodium-extra.option.prevent_shaders.tooltip")) .setControl(TickBoxControl::new) @@ -509,7 +509,7 @@ public static OptionPage extra() { .build()); groups.add(OptionGroup.createBuilder() .add(OptionImpl.createBuilder(boolean.class, sodiumExtraOpts) - .setEnabled(SodiumExtraClientMod.mixinConfig().getOptions().get("mixin.steady_debug_hud").isEnabled()) + .setEnabled(() -> SodiumExtraClientMod.mixinConfig().getOptions().get("mixin.steady_debug_hud").isEnabled()) .setName(Component.translatable("sodium-extra.option.steady_debug_hud")) .setTooltip(Component.translatable("sodium-extra.option.steady_debug_hud.tooltip")) .setControl(TickBoxControl::new) @@ -517,7 +517,7 @@ public static OptionPage extra() { .build() ) .add(OptionImpl.createBuilder(int.class, sodiumExtraOpts) - .setEnabled(SodiumExtraClientMod.mixinConfig().getOptions().get("mixin.steady_debug_hud").isEnabled()) + .setEnabled(() -> SodiumExtraClientMod.mixinConfig().getOptions().get("mixin.steady_debug_hud").isEnabled()) .setName(Component.translatable("sodium-extra.option.steady_debug_hud_refresh_interval")) .setTooltip(Component.translatable("sodium-extra.option.steady_debug_hud_refresh_interval.tooltip")) .setControl(option -> new SliderControlExtended(option, 1, 20, 1, ControlValueFormatterExtended.ticks(), false)) diff --git a/common/src/main/java/me/flashyreese/mods/sodiumextra/common/util/ColorRGBA.java b/common/src/main/java/me/flashyreese/mods/sodiumextra/common/util/ColorRGBA.java deleted file mode 100644 index 8c8f65ad..00000000 --- a/common/src/main/java/me/flashyreese/mods/sodiumextra/common/util/ColorRGBA.java +++ /dev/null @@ -1,36 +0,0 @@ -package me.flashyreese.mods.sodiumextra.common.util; - -import net.caffeinemc.mods.sodium.api.util.ColorU8; - -public class ColorRGBA implements ColorU8 { - public ColorRGBA() { - } - - public static int pack(int r, int g, int b, int a) { - return (r & 0xFF) << 24 | (g & 0xFF) << 16 | (b & 0xFF) << 8 | (a & 0xFF); - } - - public static int unpackRed(int color) { - return color >> 24 & 0xFF; - } - - public static int unpackGreen(int color) { - return color >> 16 & 0xFF; - } - - public static int unpackBlue(int color) { - return color >> 8 & 0xFF; - } - - public static int unpackAlpha(int color) { - return color & 0xFF; - } - - public static int fromARGB(int color) { - return color << 8 | (color >> 24 & 0xFF); - } - - public static int fromOrToABGR(int color) { - return Integer.reverseBytes(color); - } -} diff --git a/common/src/main/java/me/flashyreese/mods/sodiumextra/mixin/optimizations/draw_helpers/MixinGuiGraphics.java b/common/src/main/java/me/flashyreese/mods/sodiumextra/mixin/optimizations/draw_helpers/MixinGuiGraphics.java index c9ef4879..66e7abf2 100644 --- a/common/src/main/java/me/flashyreese/mods/sodiumextra/mixin/optimizations/draw_helpers/MixinGuiGraphics.java +++ b/common/src/main/java/me/flashyreese/mods/sodiumextra/mixin/optimizations/draw_helpers/MixinGuiGraphics.java @@ -4,8 +4,8 @@ import com.mojang.blaze3d.vertex.*; import me.flashyreese.mods.sodiumextra.client.render.vertex.formats.TextureColorVertex; import me.flashyreese.mods.sodiumextra.client.render.vertex.formats.TextureVertex; -import me.flashyreese.mods.sodiumextra.common.util.ColorRGBA; import net.caffeinemc.mods.sodium.api.util.ColorABGR; +import net.caffeinemc.mods.sodium.api.util.ColorARGB; import net.caffeinemc.mods.sodium.api.vertex.buffer.VertexBufferWriter; import net.caffeinemc.mods.sodium.api.vertex.format.common.ColorVertex; import net.minecraft.client.gui.GuiGraphics; @@ -45,8 +45,8 @@ public abstract class MixinGuiGraphics { private void fillGradient(VertexConsumer vertexConsumer, int startX, int startY, int endX, int endY, int z, int colorStart, int colorEnd, CallbackInfo ci) { VertexBufferWriter writer = VertexBufferWriter.of(vertexConsumer); Matrix4f matrix4f = this.pose.last().pose(); - colorStart = ColorRGBA.fromOrToABGR(ColorRGBA.fromARGB(colorStart)); - colorEnd = ColorRGBA.fromOrToABGR(ColorRGBA.fromARGB(colorEnd)); + colorStart = ColorARGB.toABGR(colorStart); + colorEnd = ColorARGB.toABGR(colorEnd); try (MemoryStack stack = MemoryStack.stackPush()) { final long buffer = stack.nmalloc(4 * ColorVertex.STRIDE); long ptr = buffer; @@ -88,7 +88,7 @@ public void fill(RenderType type, int x1, int y1, int x2, int y2, int z, int col } VertexConsumer vertexConsumer = this.bufferSource.getBuffer(type); VertexBufferWriter writer = VertexBufferWriter.of(vertexConsumer); - color = ColorRGBA.fromOrToABGR(ColorRGBA.fromARGB(color)); + color = ColorARGB.toABGR(color); try (MemoryStack stack = MemoryStack.stackPush()) { final long buffer = stack.nmalloc(4 * ColorVertex.STRIDE); long ptr = buffer; diff --git a/fabric/build.gradle.kts b/fabric/build.gradle.kts index c1bde606..59bf85b9 100644 --- a/fabric/build.gradle.kts +++ b/fabric/build.gradle.kts @@ -40,7 +40,7 @@ dependencies { implementation("com.google.code.findbugs:jsr305:3.0.1") compileOnly(project(":common")) - modImplementation(files(rootDir.resolve("sodium-fabric.jar"))) + modImplementation(/*files(rootDir.resolve("sodium-fabric.jar"))*/ "maven.modrinth:sodium:mc1.21-0.6.0-beta.1-fabric") } diff --git a/fabric/src/main/resources/fabric.mod.json b/fabric/src/main/resources/fabric.mod.json index 296c4be5..10cf9d04 100644 --- a/fabric/src/main/resources/fabric.mod.json +++ b/fabric/src/main/resources/fabric.mod.json @@ -50,7 +50,7 @@ ], "depends": { "fabricloader": ">=0.15", - "sodium": ">=0.5.9", + "sodium": ">=0.6.0-beta.1", "minecraft": ">=1.21" }, "breaks": { diff --git a/neoforge/build.gradle.kts b/neoforge/build.gradle.kts index 1d409ba1..03d97691 100644 --- a/neoforge/build.gradle.kts +++ b/neoforge/build.gradle.kts @@ -83,7 +83,7 @@ tasks.named("compileTestJava").configure { dependencies { compileOnly(project(":common")) - implementation(files(rootDir.resolve("sodium-neo.jar"))) + implementation(/*files(rootDir.resolve("sodium-neo.jar"))*/ "maven.modrinth:sodium:mc1.21-0.6.0-beta.1-neoforge") } // NeoGradle compiles the game, but we don't want to add our common code to the game's code diff --git a/neoforge/src/main/resources/META-INF/neoforge.mods.toml b/neoforge/src/main/resources/META-INF/neoforge.mods.toml index 30437005..271d490a 100644 --- a/neoforge/src/main/resources/META-INF/neoforge.mods.toml +++ b/neoforge/src/main/resources/META-INF/neoforge.mods.toml @@ -23,5 +23,12 @@ versionRange = "[1.20.4,1.21.1)" ordering = "NONE" side = "CLIENT" +[[dependencies.sodium_extra]] +modId = "sodium" +type = "required" +versionRange = "[0.6.0-beta.1,0.6.0)" +ordering = "NONE" +side = "CLIENT" + [[mixins]] config = "sodium-extra.mixins.json" \ No newline at end of file