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); BeltMovementHandler.transportEntity(this, entity, info);
}); });
toRemove.forEach(passengers::remove); toRemove.forEach(passengers::remove);
if (blockLight == -1)
updateLight();
} }
@Override @Override
@ -216,7 +219,7 @@ public class BeltTileEntity extends KineticTileEntity {
if (!clientPacket) if (!clientPacket)
return; return;
updateLight();
if (casingBefore == casing) if (casingBefore == casing)
return; return;
requestModelDataUpdate(); requestModelDataUpdate();
@ -484,7 +487,12 @@ public class BeltTileEntity extends KineticTileEntity {
} }
private void updateLight() { private void updateLight() {
skyLight = (byte) world.getLightLevel(LightType.SKY, pos); if (world != null) {
blockLight = (byte) world.getLightLevel(LightType.BLOCK, pos); 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--; keys.get(i).index--;
} }
markIndexChanged(index - 1);
maxIndexChanged = keys.size() - 1; maxIndexChanged = keys.size() - 1;
markIndexChanged(Math.min(maxIndexChanged, index));
key.invalidate(); key.invalidate();
} }