Forge 1.18

This commit is contained in:
mastermc05 2022-11-18 13:32:07 +02:00
parent 1f352e0b11
commit d434b33cfb

View File

@ -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.<Biome>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.<Biome>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()]));
}
}