Skip to content

Commit

Permalink
Use enum to return the biome info, use camera entity to get the biome…
Browse files Browse the repository at this point in the history
…, have null check for level.
  • Loading branch information
IMS212 committed Sep 28, 2021
1 parent 68a8f9a commit cd8f2a6
Showing 1 changed file with 7 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -56,11 +56,14 @@ private static SmoothedFloat rainStrengthS(FrameUpdateNotifier updateNotifier) {
}

private static float getRawPrecipitation() {
Biome.Precipitation precipitation = Minecraft.getInstance().level.getBiome(Minecraft.getInstance().player.blockPosition()).getPrecipitation();
switch (precipitation.getName()) {
case "rain":
if (Minecraft.getInstance().level == null) {
return 0;
}
Biome.Precipitation precipitation = Minecraft.getInstance().level.getBiome(Minecraft.getInstance().getCameraEntity().blockPosition()).getPrecipitation();
switch (precipitation) {
case RAIN:
return 1;
case "snow":
case SNOW:
return 2;
default:
return 0;
Expand Down

0 comments on commit cd8f2a6

Please sign in to comment.