Fabric API

Fabric API

108M Downloads

Water/Foliage Color Modification Not Working

AViewFromTheTop opened this issue ยท 9 comments

commented

Has stopped working for quite a while. Only seems to impact modded biomes.

commented

Have you got a minimal way to reproduce this? How are you adding the modded biome?

commented

Screenshot_20240316_211644
If a screenshot's easier, here it is.
It only works on biomes we've added, nothing else.

commented

Have you got a minimal way to reproduce this? How are you adding the modded biome?

I'm registering them through datagen.
We do have a custom FrozenBiome class, but it's the same as how vanilla builds its biomes- just streamlined into separate classes.
Screenshot_20240316_211406

2024-03-16_21 15 42

BiomeModifications.create(WilderSharedConstants.id("modify_hot_water")).add( ModificationPhase.REPLACEMENTS, BiomeSelectors.all(), (selectionContext, modificationContext) -> { BiomeModificationContext.EffectsContext context = modificationContext.getEffects(); context.setWaterColor(0); context.setWaterFogColor(0); });

commented

Seems to only impact 1.20.5 versions.

commented

I'm having almost the same issue in 1.20.5 release, I call this in my modinitializer but it doesn't change the grass color

        BiomeModifications.create(new Identifier(Bitty.MOD_ID, "birch_overhaul"))
                .add(ModificationPhase.REPLACEMENTS, biomeSelectionContext -> BittyConfig.birchOverhaul && biomeSelectionContext.hasTag(ConventionalBiomeTags.IS_BIRCH_FOREST), context -> {
                    context.getEffects().setGrassColor(10475854);
                });
commented

Was able to reproduce this issue for unmodded biomes with this code:

  BiomeModifications.create(MOD.id("testing"))
    .add(ModificationPhase.REPLACEMENTS,
      ctx -> ctx.hasTag(ConventionalBiomeTags.IS_OCEAN),
      ctx -> ctx.getEffects().setSkyColor(Color.BLACK.getRGB()));

Edit: for reference, you can check the registries and confirm that the value is applied to the biome. However, my assumption is that the original value is getting cached somewhere by the renderer, meaning these changes either occur too late or something needs to be updated. I've been searching for what that could be, but am not able to find it so far.

commented

I've done some research into this issue and it appears to be caused by the fact that BiomeModificationsImpl#finalizeWorldGen is only applied to the server side, so any changes are lost to the client. Changes can only be recovered by the client when received from a remote server, which would contain the expected changes.

commented

This will be fixed as part of a future refactor for dynamic registry modification, see #4085 (comment)

commented

In the meantime, the easiest workaround is to update the registration info for whichever biomes you've modified. This will force the server synchronize that biome with the client. Should work for both singleplayer and multiplayer. Requires an accessor to get the registration map from the registry. I assume this is harmless, but am still testing.