Ellpeck / NaturesAura

A Minecraft mod about using Aura for unique mechanics
https://modrinth.com/mod/natures-aura
MIT License
47 stars 35 forks source link

Add null check in `BlockSpring#getBlockColor` #321

Closed SuperMartijn642 closed 11 months ago

SuperMartijn642 commented 1 year ago

This pull request fixes #320 by adding a null check for both the world and position arguments in the BlockSpring#getBlockColor lambda. If either argument is null, the method will simply return 0 as is the case for BlockSpring#getItemColor.

    @Override
    @OnlyIn(Dist.CLIENT)
    public BlockColor getBlockColor() {
-       return (state, level, pos, i) -> BiomeColors.getAverageWaterColor(level, pos);
+       return (state, level, pos, i) -> level == null || pos == null ? -1 : BiomeColors.getAverageWaterColor(level, pos);
    }