Fix another issue with ghost instances.

Hopefully fix belt lighting issues.
This commit is contained in:
JozsefA 2021-02-04 00:03:37 -08:00
parent 8c0e983f36
commit 456ed364a4
2 changed files with 12 additions and 4 deletions

View file

@ -125,6 +125,9 @@ public class BeltTileEntity extends KineticTileEntity {
BeltMovementHandler.transportEntity(this, entity, info);
});
toRemove.forEach(passengers::remove);
if (blockLight == -1)
updateLight();
}
@Override
@ -216,7 +219,7 @@ public class BeltTileEntity extends KineticTileEntity {
if (!clientPacket)
return;
updateLight();
if (casingBefore == casing)
return;
requestModelDataUpdate();
@ -484,7 +487,12 @@ public class BeltTileEntity extends KineticTileEntity {
}
private void updateLight() {
skyLight = (byte) world.getLightLevel(LightType.SKY, pos);
blockLight = (byte) world.getLightLevel(LightType.BLOCK, pos);
if (world != null) {
skyLight = (byte) world.getLightLevel(LightType.SKY, pos);
blockLight = (byte) world.getLightLevel(LightType.BLOCK, pos);
} else {
skyLight = -1;
blockLight = -1;
}
}
}

View file

@ -92,8 +92,8 @@ public abstract class InstancedModel<D extends InstanceData> extends BufferedMod
keys.get(i).index--;
}
markIndexChanged(index - 1);
maxIndexChanged = keys.size() - 1;
markIndexChanged(Math.min(maxIndexChanged, index));
key.invalidate();
}