diff --git a/build.gradle b/build.gradle index bb47e7d..cceb425 100644 --- a/build.gradle +++ b/build.gradle @@ -6,7 +6,7 @@ plugins { repositories { maven { url = 'https://maven.terraformersmc.com/releases/' } maven { url = 'https://maven.shedaniel.me/' } - maven { url = 'https://jitpack.io' } + maven { url = 'https://api.modrinth.com/maven' } } sourceCompatibility = JavaVersion.VERSION_16 @@ -36,8 +36,8 @@ dependencies { modImplementation("com.terraformersmc:modmenu:${project.mod_menu_version}") { transitive = false } -// modCompileOnly "com.github.jellysquid3:sodium-fabric:${project.sodium_version}" -// modRuntime "com.github.jellysquid3:sodium-fabric:${project.sodium_version}" + modCompileOnly "maven.modrinth:sodium:${project.sodium_version}" + modRuntime "maven.modrinth:sodium:${project.sodium_version}" } processResources { diff --git a/src/main/java/io/github/kvverti/colormatic/iface/SodiumColorProviderCompat.java b/src/main/java/io/github/kvverti/colormatic/iface/SodiumColorProviderCompat.java index 78cb5f6..558f073 100644 --- a/src/main/java/io/github/kvverti/colormatic/iface/SodiumColorProviderCompat.java +++ b/src/main/java/io/github/kvverti/colormatic/iface/SodiumColorProviderCompat.java @@ -1,13 +1,44 @@ +/* + * Colormatic + * Copyright (C) 2021 Thalia Nero + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * As an additional permission, when conveying the Corresponding Source of an + * object code form of this work, you may exclude the Corresponding Source for + * "Minecraft" by Mojang Studios, AB. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public License + * along with this program. If not, see . + */ package io.github.kvverti.colormatic.iface; +import me.jellysquid.mods.sodium.client.model.quad.ModelQuadColorProvider; +import me.jellysquid.mods.sodium.client.world.biome.BlockColorsExtended; + import net.minecraft.block.BlockState; -import net.minecraft.client.color.block.BlockColorProvider; /** * Compatibility interface for mixing into Sodium. This interface effectively "forward declares" the methods - * declared in {@code BlockColorsExtended} in order to prevent a non-fatal exception from being thrown within + * declared in {@link BlockColorsExtended} in order to prevent a non-fatal exception from being thrown within * mixin when Sodium is not installed. */ public interface SodiumColorProviderCompat { - BlockColorProvider getColorProvider(BlockState state); + ModelQuadColorProvider getColorProvider(BlockState state); +} + +@SuppressWarnings("unused") +final class EnsureCorrectSignatures implements SodiumColorProviderCompat, BlockColorsExtended { + @Override + public ModelQuadColorProvider getColorProvider(BlockState state) { + throw new AssertionError("this class should not be instantiated"); + } } diff --git a/src/main/java/io/github/kvverti/colormatic/mixinsodium/color/SodiumBlockColorsMixin.java b/src/main/java/io/github/kvverti/colormatic/mixinsodium/color/SodiumBlockColorsMixin.java index e426c91..04c5c79 100644 --- a/src/main/java/io/github/kvverti/colormatic/mixinsodium/color/SodiumBlockColorsMixin.java +++ b/src/main/java/io/github/kvverti/colormatic/mixinsodium/color/SodiumBlockColorsMixin.java @@ -1,12 +1,16 @@ /* * Colormatic - * Copyright (C) 2020 Thalia Nero + * Copyright (C) 2021 Thalia Nero * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU Lesser General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * + * As an additional permission, when conveying the Corresponding Source of an + * object code form of this work, you may exclude the Corresponding Source for + * "Minecraft" by Mojang Studios, AB. + * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the @@ -19,6 +23,7 @@ import io.github.kvverti.colormatic.colormap.BiomeColormaps; import io.github.kvverti.colormatic.iface.SodiumColorProviderCompat; +import me.jellysquid.mods.sodium.client.model.quad.ModelQuadColorProvider; import org.spongepowered.asm.mixin.Implements; import org.spongepowered.asm.mixin.Interface; import org.spongepowered.asm.mixin.Intrinsic; @@ -26,7 +31,6 @@ import org.spongepowered.asm.mixin.Unique; import net.minecraft.block.BlockState; -import net.minecraft.client.color.block.BlockColorProvider; import net.minecraft.client.color.block.BlockColors; @Mixin(value = BlockColors.class, priority = 2000) @@ -34,14 +38,14 @@ public abstract class SodiumBlockColorsMixin implements SodiumColorProviderCompat { @Unique - private static final BlockColorProvider COLORMATIC_PROVIDER = + private static final ModelQuadColorProvider COLORMATIC_PROVIDER = (state, world, pos, tintIndex) -> BiomeColormaps.getBiomeColor(state, world, pos); /** * Displace Sodium's implementation to first check Colormatic's custom block colors. */ @Intrinsic(displace = true) - public BlockColorProvider i$getColorProvider(BlockState state) { + public ModelQuadColorProvider i$getColorProvider(BlockState state) { if(BiomeColormaps.isCustomColored(state)) { return COLORMATIC_PROVIDER; } diff --git a/src/main/resources/fabric.mod.json b/src/main/resources/fabric.mod.json index 5effd51..f72363d 100644 --- a/src/main/resources/fabric.mod.json +++ b/src/main/resources/fabric.mod.json @@ -41,7 +41,9 @@ "suggests": { "flamingo": "*" }, - "conflicts": { - "sodium": "0.3.x" + "custom": { + "sodium:options": { + "mixin.features.fast_biome_colors": false + } } }