From d434b33cfb362f546b4ad1f933670669ff54d80c Mon Sep 17 00:00:00 2001 From: mastermc05 Date: Fri, 18 Nov 2022 13:32:07 +0200 Subject: [PATCH] Forge 1.18 --- .../dynmap/forge_1_18/ForgeMapChunkCache.java | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/forge-1.18/src/main/java/org/dynmap/forge_1_18/ForgeMapChunkCache.java b/forge-1.18/src/main/java/org/dynmap/forge_1_18/ForgeMapChunkCache.java index fbcf362d..476613c8 100644 --- a/forge-1.18/src/main/java/org/dynmap/forge_1_18/ForgeMapChunkCache.java +++ b/forge-1.18/src/main/java/org/dynmap/forge_1_18/ForgeMapChunkCache.java @@ -2,8 +2,11 @@ package org.dynmap.forge_1_18; import java.util.List; +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; @@ -86,4 +89,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()])); + } }