Skip to content

Commit 33b04ee

Browse files
committed
Sky light change is now instant
1 parent 9c20cb8 commit 33b04ee

File tree

3 files changed

+3
-6
lines changed

3 files changed

+3
-6
lines changed

src/main/java/ml/sakii/factoryisland/Game.java

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -621,10 +621,7 @@ public void run() {
621621
debugInfo.add("FirstBlockUnder: " + Engine.world.getBlockUnderEntity(false, true, SelectedEntity)+",VV:"+SelectedEntity.VerticalVector.z);
622622
}
623623
debugInfo.add("Entities ("+Engine.world.getAllEntities().size()+"): "+Engine.world.getAllEntities());
624-
long lastLightUpdateTick = Engine.Tick / (Globals.TICKS_PER_DAY/Globals.LIGHT_UPDATES_PER_DAY) * (Globals.TICKS_PER_DAY/Globals.LIGHT_UPDATES_PER_DAY);
625-
debugInfo.add("TimePercent:"+Engine.getTimePercent()+
626-
", level:"+Polygon3D.testLightLevel(Engine.getTimePercent())+
627-
", cached:"+Polygon3D.testLightLevel(GameEngine.getTimePercent(lastLightUpdateTick)));
624+
debugInfo.add("Sky light: "+Polygon3D.testLightLevel(Engine.getTimePercent())+", timePercent:"+Engine.getTimePercent());
628625
// DEBUG SZÖVEG
629626
g.setColor(Color.BLACK);
630627
g.setFont(new Font(g.getFont().getName(), g.getFont().getStyle(), fontSize));

src/main/java/ml/sakii/factoryisland/GameEngine.java

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -267,9 +267,10 @@ public void performTick() {
267267

268268
}
269269

270-
if(Tick % (Globals.TICKS_PER_DAY/Globals.LIGHT_UPDATES_PER_DAY) == 0) {
270+
if(Polygon3D.testLightLevel(getTimePercent(Tick)) != Polygon3D.testLightLevel(getTimePercent(Tick-1))){
271271
game.updateSkyLight();
272272
}
273+
273274
Tick++;
274275
}
275276

src/main/java/ml/sakii/factoryisland/Globals.java

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,6 @@ public class Globals {
3333
</ul>""";
3434

3535
public static final long TICKS_PER_DAY = 72000;
36-
public static final long LIGHT_UPDATES_PER_DAY=360;
3736

3837

3938
}

0 commit comments

Comments
 (0)