Water/Foliage Color Modification Not Working
AViewFromTheTop opened this issue ยท 9 comments
Has stopped working for quite a while. Only seems to impact modded biomes.
Have you got a minimal way to reproduce this? How are you adding the modded biome?
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.
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); });
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);
});
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.
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.
This will be fixed as part of a future refactor for dynamic registry modification, see #4085 (comment)
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.