aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorHiZe <super@hize.be>2024-10-11 18:33:04 +0200
committerGitHub <noreply@github.com>2024-10-11 18:33:04 +0200
commit0671e35163d55ab0f940aa6806a0d7bfb2876429 (patch)
tree7adc361416df400359c72591159e528df3d0a857
parent0d34625ac157a477f04226fa76026601ecb79a49 (diff)
downloadskyhanni-0671e35163d55ab0f940aa6806a0d7bfb2876429.tar.gz
skyhanni-0671e35163d55ab0f940aa6806a0d7bfb2876429.tar.bz2
skyhanni-0671e35163d55ab0f940aa6806a0d7bfb2876429.zip
Feature: Change lava color (#1885)
Co-authored-by: nea <nea@nea.moe> Co-authored-by: Cal <cwolfson58@gmail.com> Co-authored-by: hannibal2 <24389977+hannibal00212@users.noreply.github.com> Co-authored-by: CalMWolfs <94038482+CalMWolfs@users.noreply.github.com>
-rw-r--r--src/main/java/at/hannibal2/skyhanni/config/features/fishing/FishingConfig.java5
-rw-r--r--src/main/java/at/hannibal2/skyhanni/config/features/fishing/LavaReplacementConfig.java23
-rw-r--r--src/main/java/at/hannibal2/skyhanni/features/fishing/LavaReplacement.kt31
-rw-r--r--src/main/java/at/hannibal2/skyhanni/mixins/transformers/MixinBlockLiquid.java27
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;
+ }
+}