From 9060c8f32bdd8ada71e21212c675cb1d2dd8c859 Mon Sep 17 00:00:00 2001 From: mastermc05 Date: Fri, 18 Nov 2022 13:30:13 +0200 Subject: [PATCH] Forge 1.19.2 --- .../dynmap/forge_1_19_2/ForgeMapChunkCache.java | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/forge-1.19.2/src/main/java/org/dynmap/forge_1_19_2/ForgeMapChunkCache.java b/forge-1.19.2/src/main/java/org/dynmap/forge_1_19_2/ForgeMapChunkCache.java index a46d23dd..0f9d7f2d 100644 --- a/forge-1.19.2/src/main/java/org/dynmap/forge_1_19_2/ForgeMapChunkCache.java +++ b/forge-1.19.2/src/main/java/org/dynmap/forge_1_19_2/ForgeMapChunkCache.java @@ -3,8 +3,11 @@ package org.dynmap.forge_1_19_2; import java.util.List; import java.util.NoSuchElementException; +import net.minecraft.world.level.biome.Biome; +import net.minecraft.world.level.biome.BiomeSpecialEffects; import org.dynmap.DynmapChunk; import org.dynmap.Log; +import org.dynmap.common.BiomeMap; import org.dynmap.common.chunk.GenericChunk; import org.dynmap.common.chunk.GenericChunkCache; import org.dynmap.common.chunk.GenericMapChunkCache; @@ -87,4 +90,17 @@ public class ForgeMapChunkCache extends GenericMapChunkCache { return null; } } + @Override + public int getFoliageColor(BiomeMap bm, int[] colormap, int x, int z) { + return bm.getBiomeObject().map(Biome::getSpecialEffects) + .flatMap(BiomeSpecialEffects::getFoliageColorOverride) + .orElse(colormap[bm.biomeLookup()]); + } + + @Override + public int getGrassColor(BiomeMap bm, int[] colormap, int x, int z) { + BiomeSpecialEffects effects = bm.getBiomeObject().map(Biome::getSpecialEffects).orElse(null); + if (effects == null) return colormap[bm.biomeLookup()]; + return effects.getGrassColorModifier().modifyColor(x, z, effects.getGrassColorOverride().orElse(colormap[bm.biomeLookup()])); + } }