Skip to content

Commit 8ab5c6f

Browse files
committed
Fix water tint when level or player are null.
1 parent af0cff5 commit 8ab5c6f

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

src/main/java/net/minecraftforge/lex/cfd/WaterItemTint.java

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,8 @@
44
*/
55
package net.minecraftforge.lex.cfd;
66

7+
import javax.annotation.Nullable;
8+
79
import com.mojang.serialization.MapCodec;
810

911
import net.minecraft.client.color.item.ItemTintSource;
@@ -17,7 +19,8 @@ public record WaterItemTint() implements ItemTintSource {
1719
public static final MapCodec<WaterItemTint> CODEC = MapCodec.unit(() -> INSTANCE);
1820

1921
@Override
20-
public int calculate(ItemStack stack, ClientLevel level, LivingEntity entity) {
22+
public int calculate(ItemStack stack, @Nullable ClientLevel level, @Nullable LivingEntity entity) {
23+
if (level == null || entity == null) return CobbleForDays.PLAINS;
2124
return BiomeColors.getAverageWaterColor(level, entity.blockPosition());
2225
}
2326

0 commit comments

Comments
 (0)