Forge 1.19

This commit is contained in:
mastermc05 2022-11-18 13:31:11 +02:00
parent 9060c8f32b
commit ed9fb8614d

View File

@ -3,8 +3,11 @@ package org.dynmap.forge_1_19;
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.<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()]));
}
}