Skip to content

Commit

Permalink
Add a default lighting override hack
Browse files Browse the repository at this point in the history
This keeps cabs bright inside if the interior is missing without making
all locomotives missing a INTERIOR glow all the time
  • Loading branch information
cam72cam committed Dec 8, 2023
1 parent bea12a3 commit 9c8eddb
Showing 1 changed file with 5 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -85,10 +85,14 @@ public StockModel(DEFINITION def) throws Exception {
if (!stock.internalLightsEnabled()) {
return base;
}
Boolean interiorHack = null;
if (!hasInterior) {
interiorHack = MinecraftClient.getPlayer().getRiding() != stock;
}
float blockLight = stock.getWorld().getBlockLightLevel(stock.getBlockPosition());
float skyLight = stock.getWorld().getSkyLightLevel(stock.getBlockPosition());
boolean brighter = blockLight < interiorLight;
return base.merge(new ModelState.LightState(brighter ? interiorLight : null, brighter ? skyLight : null, true, null));
return base.merge(new ModelState.LightState(brighter ? interiorLight : null, brighter ? skyLight : null, true, interiorHack));
};

animations = new ArrayList<>();
Expand Down

0 comments on commit 9c8eddb

Please sign in to comment.