-
Notifications
You must be signed in to change notification settings - Fork 81
/
LeavesColorizer.java
35 lines (30 loc) · 1.26 KB
/
LeavesColorizer.java
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
package com.progwml6.natura.world.client;
import com.progwml6.natura.world.block.TreeType;
import net.minecraft.client.renderer.BiomeColors;
import net.minecraft.core.BlockPos;
import net.minecraft.world.level.BlockAndTintGetter;
public class LeavesColorizer {
public static int mapleColor = 0xcc5718;
public static int amaranthColor = 10079569;
public static int noColor = 16777215;
public static int leaves2Color = 7842607;
public static int leavesColor = 0xffffff;
public static int getColorStatic(TreeType type) {
return switch (type) {
case MAPLE -> LeavesColorizer.mapleColor;
case AMARANTH -> LeavesColorizer.amaranthColor;
case EUCALYPTUS, HOPSEED -> LeavesColorizer.leaves2Color;
case WILLOW, SAKURA -> LeavesColorizer.noColor;
default -> LeavesColorizer.leavesColor;
};
}
public static int getColorForPos(BlockAndTintGetter worldIn, BlockPos pos, TreeType type) {
return switch (type) {
case MAPLE -> LeavesColorizer.mapleColor;
case AMARANTH -> BiomeColors.getAverageFoliageColor(worldIn, pos) + 0x222222;
case EUCALYPTUS, HOPSEED -> BiomeColors.getAverageFoliageColor(worldIn, pos);
case WILLOW, SAKURA -> LeavesColorizer.noColor;
default -> LeavesColorizer.leavesColor;
};
}
}