Merge pull request #3862 from mastermc05/colorful-biomes

Colorful biomes
This commit is contained in:
mikeprimm 2022-11-29 15:37:42 -06:00 committed by GitHub
commit 7d1a273e6d
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
34 changed files with 347 additions and 2 deletions

View file

@ -3,6 +3,7 @@ package org.dynmap.common;
import java.util.Arrays;
import java.util.HashMap;
import java.util.Map;
import java.util.Optional;
import org.dynmap.hdmap.HDBlockModels;
@ -44,6 +45,7 @@ public class BiomeMap {
private int watercolormult;
private int grassmult;
private int foliagemult;
private Optional<?> biomeObj = Optional.empty();
private final String id;
private final String resourcelocation;
private final int index;
@ -308,4 +310,10 @@ public class BiomeMap {
public String toString() {
return String.format("%s(%s)", id, resourcelocation);
}
public @SuppressWarnings("unchecked") <T> Optional<T> getBiomeObject() {
return (Optional<T>) biomeObj;
}
public void setBiomeObject(Object biomeObj) {
this.biomeObj = Optional.of(biomeObj);
}
}

View file

@ -181,7 +181,7 @@ public abstract class GenericMapChunkCache extends MapChunkCache {
for (int dz = -1; dz <= 1; dz++) {
BiomeMap bm = getBiomeRel(dx, dz);
if (bm == BiomeMap.NULL) continue;
int rmult = bm.getModifiedGrassMultiplier(colormap[bm.biomeLookup()]);
int rmult = getGrassColor(bm, colormap, getX() + dx, getZ() + dz);
raccum += (rmult >> 16) & 0xFF;
gaccum += (rmult >> 8) & 0xFF;
baccum += rmult & 0xFF;
@ -212,7 +212,7 @@ public abstract class GenericMapChunkCache extends MapChunkCache {
for (int dz = -1; dz <= 1; dz++) {
BiomeMap bm = getBiomeRel(dx, dz);
if (bm == BiomeMap.NULL) continue;
int rmult = bm.getModifiedFoliageMultiplier(colormap[bm.biomeLookup()]);
int rmult = getFoliageColor(bm, colormap, getX() + dx, getZ() + dz);
raccum += (rmult >> 16) & 0xFF;
gaccum += (rmult >> 8) & 0xFF;
baccum += rmult & 0xFF;
@ -546,6 +546,14 @@ public abstract class GenericMapChunkCache extends MapChunkCache {
}
}
public int getGrassColor(BiomeMap bm, int[] colormap, int x, int z) {
return bm.getModifiedGrassMultiplier(colormap[bm.biomeLookup()]);
}
public int getFoliageColor(BiomeMap bm, int[] colormap, int x, int z) {
return bm.getModifiedFoliageMultiplier(colormap[bm.biomeLookup()]);
}
private class OurEndMapIterator extends OurMapIterator {
OurEndMapIterator(int x0, int y0, int z0) {
super(x0, y0, z0);