Ignore fully translucent blocks in the terrain-height calculation

This makes sure that, e.g. barrier-blocks are not visible on the lowres map. Fixes #83
This commit is contained in:
Blue (Lukas Rieger) 2020-09-07 12:28:14 +02:00
parent fea7d9a1cd
commit 5d82c40884

View File

@ -81,8 +81,6 @@ public HiresModel render(WorldTile tile, AABB region) {
for (int y = min.getY(); y <= max.getY(); y++){ for (int y = min.getY(); y <= max.getY(); y++){
Block block = world.getBlock(x, y, z); Block block = world.getBlock(x, y, z);
if (block.getBlockState().equals(BlockState.AIR)) continue; if (block.getBlockState().equals(BlockState.AIR)) continue;
maxHeight = y;
BlockStateModel blockModel; BlockStateModel blockModel;
try { try {
@ -98,8 +96,13 @@ public HiresModel render(WorldTile tile, AABB region) {
} }
blockModel.translate(new Vector3f(x, y, z).sub(modelMin.toFloat())); blockModel.translate(new Vector3f(x, y, z).sub(modelMin.toFloat()));
color = MathUtils.overlayColors(blockModel.getMapColor(), color); //update color and height (only if not 100% translucent)
Vector4f blockColor = blockModel.getMapColor();
if (blockColor.getW() > 0) {
maxHeight = y;
color = MathUtils.overlayColors(blockModel.getMapColor(), color);
}
//TODO: quick hack to random offset grass //TODO: quick hack to random offset grass
if (block.getBlockState().getFullId().equals(grassId)){ if (block.getBlockState().getFullId().equals(grassId)){