Fixed colored wall data reset
This commit is contained in:
@@ -322,11 +322,14 @@ public abstract class SaveVersion extends SaveFileReader{
|
|||||||
//new data format (bit 3): 7 bytes (3x block-specific bytes + 1x 4-byte extra data int)
|
//new data format (bit 3): 7 bytes (3x block-specific bytes + 1x 4-byte extra data int)
|
||||||
boolean hadDataOld = (packedCheck & 2) != 0, hadDataNew = (packedCheck & 4) != 0;
|
boolean hadDataOld = (packedCheck & 2) != 0, hadDataNew = (packedCheck & 4) != 0;
|
||||||
|
|
||||||
|
byte data = 0, floorData = 0, overlayData = 0;
|
||||||
|
int extraData = 0;
|
||||||
|
|
||||||
if(hadDataNew){
|
if(hadDataNew){
|
||||||
tile.data = stream.readByte();
|
data = stream.readByte();
|
||||||
tile.floorData = stream.readByte();
|
floorData = stream.readByte();
|
||||||
tile.overlayData = stream.readByte();
|
overlayData = stream.readByte();
|
||||||
tile.extraData = stream.readInt();
|
extraData = stream.readInt();
|
||||||
}
|
}
|
||||||
|
|
||||||
if(hadEntity){
|
if(hadEntity){
|
||||||
@@ -338,6 +341,14 @@ public abstract class SaveVersion extends SaveFileReader{
|
|||||||
tile.setBlock(block);
|
tile.setBlock(block);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//must be assigned after setBlock, because that can reset data
|
||||||
|
if(hadDataNew){
|
||||||
|
tile.data = data;
|
||||||
|
tile.floorData = floorData;
|
||||||
|
tile.overlayData = overlayData;
|
||||||
|
tile.extraData = extraData;
|
||||||
|
}
|
||||||
|
|
||||||
if(hadEntity){
|
if(hadEntity){
|
||||||
if(isCenter){ //only read entity for center blocks
|
if(isCenter){ //only read entity for center blocks
|
||||||
if(block.hasBuilding()){
|
if(block.hasBuilding()){
|
||||||
@@ -357,8 +368,8 @@ public abstract class SaveVersion extends SaveFileReader{
|
|||||||
context.onReadBuilding();
|
context.onReadBuilding();
|
||||||
}
|
}
|
||||||
}else if(hadDataOld || hadDataNew){ //never read consecutive blocks if there's any kind of data
|
}else if(hadDataOld || hadDataNew){ //never read consecutive blocks if there's any kind of data
|
||||||
tile.setBlock(block);
|
|
||||||
if(hadDataOld){
|
if(hadDataOld){
|
||||||
|
tile.setBlock(block);
|
||||||
//the old data format was only read in the case where there is no building, and only contained a single byte
|
//the old data format was only read in the case where there is no building, and only contained a single byte
|
||||||
tile.data = stream.readByte();
|
tile.data = stream.readByte();
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user