Better colored floor/wall support

This commit is contained in:
Anuken
2025-07-17 16:09:45 -04:00
parent 4c8f956fef
commit 24cfb000de
19 changed files with 134 additions and 84 deletions
+25 -1
View File
@@ -139,6 +139,23 @@ public class MapIO{
}
return tile;
}
@Override
public void onReadTileData(){
//colored floor/wall tile data will affect the map preview
if(!tile.block().synthetic() && tile.block() != Blocks.air){
int color = tile.block().minimapColor(tile);
if(color != 0){
walls.set(tile.x, walls.height - 1 - tile.y, color);
}
}else if(tile.overlay() == Blocks.air && tile.block() == Blocks.air){
int color = tile.floor().minimapColor(tile);
if(color != 0){
floors.set(tile.x, floors.height - 1 - tile.y, color);
}
}
}
}));
floors.draw(walls, true);
@@ -154,7 +171,14 @@ public class MapIO{
for(int x = 0; x < pixmap.width; x++){
for(int y = 0; y < pixmap.height; y++){
Tile tile = tiles.getn(x, y);
pixmap.set(x, pixmap.height - 1 - y, colorFor(tile.block(), tile.floor(), tile.overlay(), tile.team()));
int color = 0;
if(!tile.block().synthetic() && tile.block() != Blocks.air){
color = tile.block().minimapColor(tile);
}else if(tile.overlay() == Blocks.air && tile.block() == Blocks.air){
color = tile.floor().minimapColor(tile);
}
if(color == 0) color = colorFor(tile.block(), tile.floor(), tile.overlay(), tile.team());
pixmap.set(x, pixmap.height - 1 - y, color);
}
}
return pixmap;
+1
View File
@@ -347,6 +347,7 @@ public abstract class SaveVersion extends SaveFileReader{
tile.floorData = floorData;
tile.overlayData = overlayData;
tile.extraData = extraData;
context.onReadTileData();
}
if(hadEntity){