Improve riverbank color in Valleys mapgen
parent
03b0d4f63c
commit
8858dda70f
|
@ -3,20 +3,33 @@ package amidst.fragment.colorprovider;
|
|||
import amidst.documentation.ThreadSafe;
|
||||
import amidst.fragment.Fragment;
|
||||
import amidst.mojangapi.world.Dimension;
|
||||
import amidst.mojangapi.world.WorldType;
|
||||
import amidst.mojangapi.world.coordinates.Resolution;
|
||||
import amidst.minetest.world.oracle.MinetestBiomeDataOracle;
|
||||
|
||||
@ThreadSafe
|
||||
public class MinetestRiverColorProvider implements ColorProvider {
|
||||
private static final int RIVER_COLOR = 0xC8062170; // 0xAARRGGBB
|
||||
private static final int RIVERS_EDGE_COLOR = 0x70949d96; // 0xAARRGGBB
|
||||
private static final int NOT_RIVER_COLOR = 0x00000000; // 0xAARRGGBB
|
||||
private static final int RIVER_COLOR = 0xC8062170; // 0xAARRGGBB
|
||||
private static final int RIVERS_EDGE_COLOR = 0x70949d96; // 0xAARRGGBB
|
||||
private static final int RIVERS_EDGE_COLOR_THIN = 0x78062170; // 0xAARRGGBB
|
||||
private static final int NOT_RIVER_COLOR = 0x00000000; // 0xAARRGGBB
|
||||
|
||||
private static final int OCEAN_RIVER_MASK = MinetestBiomeDataOracle.BITPLANE_RIVER | MinetestBiomeDataOracle.BITPLANE_OCEAN;
|
||||
private static int FRAGSIZE_MINUS1;
|
||||
|
||||
private int riversEdgeColor;
|
||||
|
||||
public MinetestRiverColorProvider(Resolution resolution) {
|
||||
public MinetestRiverColorProvider(WorldType world_type, Resolution resolution) {
|
||||
FRAGSIZE_MINUS1 = resolution.getStepsPerFragment() - 1;
|
||||
|
||||
if (world_type == WorldType.VALLEYS) {
|
||||
// Valleys mapgen rivers tend to be one or two pixels wide in Amidst,
|
||||
// so they don't have "riversides", so rather than using an edge color to
|
||||
// suggest a riverbank, use the color to suggest a creek.
|
||||
riversEdgeColor = RIVERS_EDGE_COLOR_THIN;
|
||||
} else {
|
||||
riversEdgeColor = RIVERS_EDGE_COLOR;
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -28,7 +41,7 @@ public class MinetestRiverColorProvider implements ColorProvider {
|
|||
(x < FRAGSIZE_MINUS1 && (fragment.getBiomeDataAt(x + 1, y) & OCEAN_RIVER_MASK) == 0) ||
|
||||
(y > 0 && (fragment.getBiomeDataAt(x, y - 1) & OCEAN_RIVER_MASK) == 0) ||
|
||||
(y < FRAGSIZE_MINUS1 && (fragment.getBiomeDataAt(x, y + 1) & OCEAN_RIVER_MASK) == 0)) {
|
||||
return RIVERS_EDGE_COLOR;
|
||||
return riversEdgeColor;
|
||||
} else {
|
||||
return RIVER_COLOR;
|
||||
}
|
||||
|
|
|
@ -147,7 +147,7 @@ public class LayerBuilder {
|
|||
new BiomeDataLoader( declarations.get(LayerIds.BIOME_DATA), world.getBiomeDataOracle()),
|
||||
new EndIslandsLoader( declarations.get(LayerIds.END_ISLANDS), world.getEndIslandOracle()),
|
||||
new ImageLoader( declarations.get(LayerIds.BACKGROUND), Resolution.QUARTER, new BackgroundColorProvider(new BiomeColorProvider(biomeSelection, settings.biomeProfileSelection), new TheEndColorProvider())),
|
||||
new ImageLoader( declarations.get(LayerIds.MINETEST_RIVER), Resolution.QUARTER, new MinetestRiverColorProvider(Resolution.QUARTER)),
|
||||
new ImageLoader( declarations.get(LayerIds.MINETEST_RIVER), Resolution.QUARTER, new MinetestRiverColorProvider(world.getWorldType(), Resolution.QUARTER)),
|
||||
new ImageLoader( declarations.get(LayerIds.MINETEST_OCEAN), Resolution.QUARTER, new MinetestOceanColorProvider()),
|
||||
new ImageLoader( declarations.get(LayerIds.MINETEST_MOUNTAIN), Resolution.QUARTER, new MinetestMountainColorProvider(Resolution.QUARTER)),
|
||||
new ImageLoader( declarations.get(LayerIds.SLIME), Resolution.CHUNK, new SlimeColorProvider(world.getSlimeChunkOracle())),
|
||||
|
|
Loading…
Reference in New Issue