diff options
Diffstat (limited to 'src/main/java/at/hannibal2')
4 files changed, 86 insertions, 0 deletions
diff --git a/src/main/java/at/hannibal2/skyhanni/config/features/fishing/FishingConfig.java b/src/main/java/at/hannibal2/skyhanni/config/features/fishing/FishingConfig.java index 759da0f0e..3cae9f2f5 100644 --- a/src/main/java/at/hannibal2/skyhanni/config/features/fishing/FishingConfig.java +++ b/src/main/java/at/hannibal2/skyhanni/config/features/fishing/FishingConfig.java @@ -67,6 +67,11 @@ public class FishingConfig { public SeaCreatureTrackerConfig seaCreatureTracker = new SeaCreatureTrackerConfig(); @Expose + @ConfigOption(name = "Lava Replacement", desc = "") + @Accordion + public LavaReplacementConfig lavaReplacement = new LavaReplacementConfig(); + + @Expose @ConfigOption( name = "Shark Fish Counter", desc = "Counts how many Sharks have been caught." diff --git a/src/main/java/at/hannibal2/skyhanni/config/features/fishing/LavaReplacementConfig.java b/src/main/java/at/hannibal2/skyhanni/config/features/fishing/LavaReplacementConfig.java new file mode 100644 index 000000000..e1cd4fd33 --- /dev/null +++ b/src/main/java/at/hannibal2/skyhanni/config/features/fishing/LavaReplacementConfig.java @@ -0,0 +1,23 @@ +package at.hannibal2.skyhanni.config.features.fishing; + +import at.hannibal2.skyhanni.config.FeatureToggle; +import com.google.gson.annotations.Expose; +import io.github.notenoughupdates.moulconfig.annotations.ConfigEditorBoolean; +import io.github.notenoughupdates.moulconfig.annotations.ConfigEditorButton; +import io.github.notenoughupdates.moulconfig.annotations.ConfigOption; +import io.github.notenoughupdates.moulconfig.observer.Property; +import net.minecraft.client.Minecraft; + +public class LavaReplacementConfig { + + @Expose + @ConfigOption(name = "Enabled", desc = "Replace the lava texture with the water texture.") + @ConfigEditorBoolean + @FeatureToggle + public Property<Boolean> enabled = Property.of(false); + + @Expose + @ConfigOption(name = "Only In Crimson Isle", desc = "Enable the water texture only in Crimson Isle.") + @ConfigEditorBoolean + public Property<Boolean> onlyInCrimsonIsle = Property.of(true); +} diff --git a/src/main/java/at/hannibal2/skyhanni/features/fishing/LavaReplacement.kt b/src/main/java/at/hannibal2/skyhanni/features/fishing/LavaReplacement.kt new file mode 100644 index 000000000..663f2d87a --- /dev/null +++ b/src/main/java/at/hannibal2/skyhanni/features/fishing/LavaReplacement.kt @@ -0,0 +1,31 @@ +package at.hannibal2.skyhanni.features.fishing + +import at.hannibal2.skyhanni.SkyHanniMod +import at.hannibal2.skyhanni.data.IslandType +import at.hannibal2.skyhanni.events.ConfigLoadEvent +import at.hannibal2.skyhanni.skyhannimodule.SkyHanniModule +import at.hannibal2.skyhanni.utils.ConditionalUtils +import at.hannibal2.skyhanni.utils.LorenzUtils +import at.hannibal2.skyhanni.utils.LorenzUtils.isInIsland +import net.minecraft.client.Minecraft +import net.minecraftforge.fml.common.eventhandler.SubscribeEvent + +@SkyHanniModule +object LavaReplacement { + + private val config get() = SkyHanniMod.feature.fishing.lavaReplacement + + @SubscribeEvent + fun onConfigLoad(event: ConfigLoadEvent) { + ConditionalUtils.onToggle(config.enabled, config.onlyInCrimsonIsle) { + Minecraft.getMinecraft().renderGlobal.loadRenderers() + } + } + + @JvmStatic + fun replaceLava(): Boolean { + if (!LorenzUtils.inSkyBlock || !config.enabled.get()) return false + if (config.onlyInCrimsonIsle.get() && !IslandType.CRIMSON_ISLE.isInIsland()) return false + return true + } +} diff --git a/src/main/java/at/hannibal2/skyhanni/mixins/transformers/MixinBlockLiquid.java b/src/main/java/at/hannibal2/skyhanni/mixins/transformers/MixinBlockLiquid.java new file mode 100644 index 000000000..0e9b7779f --- /dev/null +++ b/src/main/java/at/hannibal2/skyhanni/mixins/transformers/MixinBlockLiquid.java @@ -0,0 +1,27 @@ +package at.hannibal2.skyhanni.mixins.transformers; + +import at.hannibal2.skyhanni.features.fishing.LavaReplacement; +import net.minecraft.client.renderer.BlockFluidRenderer; +import net.minecraft.client.renderer.texture.TextureAtlasSprite; +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.ModifyVariable; + +@Mixin(value = BlockFluidRenderer.class) +public abstract class MixinBlockLiquid { + + @Shadow + private TextureAtlasSprite[] atlasSpritesWater; + + @ModifyVariable( + method = "renderFluid", + at = @At(value = "INVOKE", target = "Lnet/minecraft/block/BlockLiquid;colorMultiplier(Lnet/minecraft/world/IBlockAccess;Lnet/minecraft/util/BlockPos;)I") + ) + TextureAtlasSprite[] replaceRenderedFluid(TextureAtlasSprite[] value) { + if (LavaReplacement.replaceLava()) { + return this.atlasSpritesWater; + } + return value; + } +} |