sodium-fabric icon indicating copy to clipboard operation
sodium-fabric copied to clipboard

FluidRenderHandler implementation is ignored for water blocks

Open MehVahdJukaar opened this issue 1 year ago • 8 comments

Bug Description

WaterColorProvider class does not refer to water fluid FluidRenderHandler registered via Fabric fluid API as it should. This makes it so registering any of those render handlers for water does not override vanilla colors making it hard to modify it.

Reproduction Steps

tested in dev environment. Vanilla FluidRenderHandler is never called for water while it is called for lava

Log File

no log needed.

Crash Report

no crash occurred

MehVahdJukaar avatar Jan 31 '24 07:01 MehVahdJukaar

The problem is that Sodium registers its own custom color provider for water so that it can make use of smooth blending (something which Fabric API does not support.)

But it's hard to detect whether a mod is overriding the default fluid handler... Fabric API returns a registry entry regardless of it being the default or provided by another mod. So we don't know when it's the default implementation.

jellysquid3 avatar Jan 31 '24 08:01 jellysquid3

I guess we need to ask Fabric to either expose FluidRenderHandlerRegistryImpl#getOverride or to provide some way for us to obtain the default implementation for comparison purposes.

jellysquid3 avatar Jan 31 '24 08:01 jellysquid3

I don't want to depend on internal details of Fabric API (as those are not stable), so I've opened a pull request here to expose the necessary function to public code.

jellysquid3 avatar Jan 31 '24 08:01 jellysquid3

I see. related to that would it be possible to register other color BlenderColorProviders directly to sodium to benefit from better blending?

MehVahdJukaar avatar Jan 31 '24 09:01 MehVahdJukaar

Sodium does not expose a public interface for doing that. The registrations are handled internally. We need to work out those details. If you really wanted to, look at an example like GrassColorProvider<T> (which pulls the color directly out of the grass color map for each vertex) and register it in ColorProviderRegistry.installOverrides() via mixin.

Though, again, I don't recommend doing that until we have a stable way to interact with it.

jellysquid3 avatar Jan 31 '24 09:01 jellysquid3

alright, I'll wait for a proper api then

MehVahdJukaar avatar Jan 31 '24 09:01 MehVahdJukaar

Blocked on upstream changes; pulling it out of the milestone.

jellysquid3 avatar Feb 01 '24 09:02 jellysquid3

The related PR was merged in Fabric API, and has been published with version 0.96.0.

jellysquid3 avatar Feb 10 '24 12:02 jellysquid3

any update on this? This change makes custom colormap for water not possible and customize water color is quite a big thing people want to do

MehVahdJukaar avatar Jul 28 '24 19:07 MehVahdJukaar

This should be already fixed in Sodium 0.6 Alpha 2.

IMS212 avatar Jul 28 '24 19:07 IMS212

I don't see the commit which fixes this linked to this issue. @IMS212 Can you x-ref & update the labels if this is solved in Sodium 0.6?

jellysquid3 avatar Jul 28 '24 19:07 jellysquid3

Ah, I misunderstood what was said. This will be fixed in Alpha 3; is there a test pack I can use to confirm this?

IMS212 avatar Jul 28 '24 19:07 IMS212