mirror of
https://github.com/webbukkit/dynmap.git
synced 2024-11-27 12:45:59 +01:00
Forge 1.16.5
This commit is contained in:
parent
4fdb04725d
commit
adc9e273ca
@ -4,6 +4,8 @@ import java.util.List;
|
||||
|
||||
import net.minecraft.nbt.CompoundNBT;
|
||||
import net.minecraft.util.math.ChunkPos;
|
||||
import net.minecraft.world.biome.Biome;
|
||||
import net.minecraft.world.biome.BiomeAmbience;
|
||||
import net.minecraft.world.chunk.AbstractChunkProvider;
|
||||
import net.minecraft.world.chunk.ChunkStatus;
|
||||
import net.minecraft.world.chunk.IChunk;
|
||||
@ -13,6 +15,7 @@ import net.minecraft.world.server.ServerWorld;
|
||||
|
||||
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;
|
||||
@ -77,4 +80,25 @@ 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::getAmbience)
|
||||
.flatMap(BiomeAmbience::getFoliageColor)
|
||||
.orElse(colormap[bm.biomeLookup()]);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getGrassColor(BiomeMap bm, int[] colormap, int x, int z) {
|
||||
BiomeAmbience effects = bm.<Biome>getBiomeObject().map(Biome::getAmbience).orElse(null);
|
||||
if (effects == null) return colormap[bm.biomeLookup()];
|
||||
BiomeAmbience.GrassColorModifier modifier = effects.getGrassColorModifier();
|
||||
if (modifier == BiomeAmbience.GrassColorModifier.DARK_FOREST) {
|
||||
return ((effects.getGrassColor().orElse(colormap[bm.biomeLookup()]) & 0xfefefe) + 0x28340a) >> 1;
|
||||
} else if (modifier == BiomeAmbience.GrassColorModifier.SWAMP) {
|
||||
double d0 = Biome.INFO_NOISE.noiseAt(x * 0.0225D, z * 0.0225D, false);
|
||||
return d0 < -0.1D ? 0x4c763c : 0x6a7039;
|
||||
} else {
|
||||
return effects.getGrassColor().orElse(colormap[bm.biomeLookup()]);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user