-
-
Notifications
You must be signed in to change notification settings - Fork 52
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Add debug flag to disable frame/tick plan execution - Should help debugging cases where a visual constructor produces a visual in an invalid state like the weeping shulker bug
- Loading branch information
Showing
7 changed files
with
101 additions
and
13 deletions.
There are no files selected for viewing
5 changes: 5 additions & 0 deletions
5
common/src/backend/java/dev/engine_room/flywheel/backend/BackendDebugFlags.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
package dev.engine_room.flywheel.backend; | ||
|
||
public class BackendDebugFlags { | ||
public static boolean LIGHT_STORAGE_VIEW = false; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
44 changes: 44 additions & 0 deletions
44
common/src/lib/java/dev/engine_room/flywheel/lib/task/ConditionalPlan.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,44 @@ | ||
package dev.engine_room.flywheel.lib.task; | ||
|
||
import dev.engine_room.flywheel.api.task.Plan; | ||
import dev.engine_room.flywheel.api.task.TaskExecutor; | ||
import dev.engine_room.flywheel.lib.task.functional.BooleanSupplierWithContext; | ||
|
||
/** | ||
* Executes one plan or another, depending on a dynamically evaluated condition. | ||
* | ||
* @param condition The condition to branch on. | ||
* @param onTrue The plan to execute if the condition is true. | ||
* @param <C> The type of the context object. | ||
*/ | ||
public record ConditionalPlan<C>(BooleanSupplierWithContext<C> condition, | ||
Plan<C> onTrue) implements SimplyComposedPlan<C> { | ||
public static <C> Builder<C> on(BooleanSupplierWithContext<C> condition) { | ||
return new Builder<>(condition); | ||
} | ||
|
||
public static <C> Builder<C> on(BooleanSupplierWithContext.Ignored<C> condition) { | ||
return new Builder<>(condition); | ||
} | ||
|
||
@Override | ||
public void execute(TaskExecutor taskExecutor, C context, Runnable onCompletion) { | ||
if (condition.getAsBoolean(context)) { | ||
onTrue.execute(taskExecutor, context, onCompletion); | ||
} else { | ||
onCompletion.run(); | ||
} | ||
} | ||
|
||
public static final class Builder<C> { | ||
private final BooleanSupplierWithContext<C> condition; | ||
|
||
public Builder(BooleanSupplierWithContext<C> condition) { | ||
this.condition = condition; | ||
} | ||
|
||
public ConditionalPlan<C> then(Plan<C> onTrue) { | ||
return new ConditionalPlan<>(condition, onTrue); | ||
} | ||
} | ||
} |
8 changes: 8 additions & 0 deletions
8
common/src/main/java/dev/engine_room/flywheel/impl/ImplDebugFlags.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
package dev.engine_room.flywheel.impl; | ||
|
||
public class ImplDebugFlags { | ||
/** | ||
* Debug flag to globally turn beginFrame/tick off. | ||
*/ | ||
public static boolean PAUSE_UPDATES = false; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters