Better colored floor/wall support
This commit is contained in:
@@ -24,12 +24,14 @@ public class ColoredFloor extends Floor{
|
||||
public ColoredFloor(String name){
|
||||
super(name);
|
||||
saveData = true;
|
||||
showColorEdit = true;
|
||||
saveConfig = true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void init(){
|
||||
super.init();
|
||||
defaultColorRgba = defaultColor.rgba();
|
||||
lastConfig = defaultColorRgba = defaultColor.rgba();
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -132,7 +134,9 @@ public class ColoredFloor extends Floor{
|
||||
@Override
|
||||
public void floorChanged(Tile tile){
|
||||
//reset to white
|
||||
tile.extraData = defaultColorRgba;
|
||||
if(tile.extraData == 0){
|
||||
tile.extraData = defaultColorRgba;
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -19,17 +19,19 @@ public class ColoredWall extends StaticWall{
|
||||
public ColoredWall(String name){
|
||||
super(name);
|
||||
saveData = true;
|
||||
showColorEdit = true;
|
||||
saveConfig = true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void init(){
|
||||
super.init();
|
||||
defaultColorRgba = defaultColor.rgba();
|
||||
lastConfig = defaultColorRgba = defaultColor.rgba();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void drawBase(Tile tile){
|
||||
//make sure to mask out the alpha channel - it's generally undesirable, and leads to invisible blocks when the data is not initialized
|
||||
//make sure to mask out the alpha channel - it's generally undesirable, and leads to invisible blocks when thtoe data is not initialized
|
||||
Draw.color(tile.extraData | 0xff);
|
||||
super.drawBase(tile);
|
||||
Draw.color();
|
||||
@@ -37,8 +39,10 @@ public class ColoredWall extends StaticWall{
|
||||
|
||||
@Override
|
||||
public void blockChanged(Tile tile){
|
||||
//reset to white
|
||||
tile.extraData = defaultColorRgba;
|
||||
//reset to white on first placement
|
||||
if(tile.extraData == 0){
|
||||
tile.extraData = defaultColorRgba;
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -59,12 +63,12 @@ public class ColoredWall extends StaticWall{
|
||||
|
||||
@Override
|
||||
public boolean checkAutotileSame(Tile tile, @Nullable Tile other){
|
||||
return other != null && other.block() == this && ((tile.extraData & flagIgnoreDifferentColor) != 0 || tile.extraData == other.extraData);
|
||||
return other != null && other.block() == this && ((tile.extraData == flagIgnoreDifferentColor) || tile.extraData == other.extraData);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isDarkened(Tile tile){
|
||||
return (tile.extraData & flagApplyDarkness) != 0;
|
||||
return (tile.extraData == flagApplyDarkness);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -378,19 +378,6 @@ public class Floor extends Block{
|
||||
}
|
||||
}
|
||||
|
||||
//'new' style of edges with shadows instead of colors, not used currently
|
||||
protected void drawEdgesFlat(Tile tile, boolean sameLayer){
|
||||
for(int i = 0; i < 4; i++){
|
||||
Tile other = tile.nearby(i);
|
||||
if(other != null && doEdge(tile, other, other.floor())){
|
||||
Color color = other.floor().mapColor;
|
||||
Draw.color(color.r, color.g, color.b, 1f);
|
||||
Draw.rect(edgeRegion, tile.worldx(), tile.worldy(), i*90);
|
||||
}
|
||||
}
|
||||
Draw.color();
|
||||
}
|
||||
|
||||
public int realBlendId(Tile tile){
|
||||
if(tile.floor().isLiquid && !tile.overlay().isAir() && !(tile.overlay() instanceof OreBlock)){
|
||||
return -((tile.overlay().blendId) | (tile.floor().blendId << 15));
|
||||
|
||||
Reference in New Issue
Block a user