Tuesday, February 2, 2016

Hippocamps and Seeing Underwater

Now that version 1.4.1 is out, riding a hippocamp lets you see underwater.  This works even in the dark, because the way I currently have it implemented, going underwater while riding a hippocamp triggers the Night Vision potion effect.

Special thanks go out to Adrian, who suggested I add the Night Vision potion effect to a hippocamp's rider.  It's a nice, easy solution to a problem that others had discovered while using the hipppcamp's otherwise awesome ability to let you explore underwater!

Even though giving the rider Night Vision is a nice way to solve a tricky problem, it still feels a little hacky to me.  The potion effect doesn't turn off right away, and it flashes the screen annoyingly when it does start to wear off (at least I think it's annoying).  Writing code to turn it off immediately when you come out of water is kind of complex, and may result in turning off legitimate uses of Night Vision potions, so I haven't done it yet.

The main problem is that the Minecraft code is written in such a way as there's no easy, central place to change the code so that it provides the Night Vision effect, without also changing core Minecraft classes.  For now, I'm avoiding changing core classes, just because it increases the likelihood that The Ultimate Unicorn Mod will break something when used with other mods.  Things break often enough with other mods that don't play nice, so I want to make sure to play nice! :)

I'll keep thinking about it, and if I come up with a better way to let players see underwater, I'll jump at it.  For now, though, this is a pretty good solution.

If you have any ideas, feel free to let me know in the comments!