diff --git a/src/main/java/com/jozufozu/flywheel/backend/instancing/IDynamicInstance.java b/src/main/java/com/jozufozu/flywheel/backend/instancing/IDynamicInstance.java index e801d16f8..5f598022a 100644 --- a/src/main/java/com/jozufozu/flywheel/backend/instancing/IDynamicInstance.java +++ b/src/main/java/com/jozufozu/flywheel/backend/instancing/IDynamicInstance.java @@ -13,9 +13,9 @@ import com.jozufozu.flywheel.backend.instancing.tile.TileEntityInstance; */ public interface IDynamicInstance extends IInstance { /** - * Called every frame. + * Called every frame, and after initialization. *
- * DISPATCHED IN PARALLEL, don't attempt to mutate anything outside of this instance. + * DISPATCHED IN PARALLEL, don't attempt to mutate anything outside this instance. *
* {@link Instancer}/{@link InstanceData} creation/acquisition is safe here. */ diff --git a/src/main/java/com/jozufozu/flywheel/backend/instancing/ITickableInstance.java b/src/main/java/com/jozufozu/flywheel/backend/instancing/ITickableInstance.java index 71e5e1d8d..0e97b5327 100644 --- a/src/main/java/com/jozufozu/flywheel/backend/instancing/ITickableInstance.java +++ b/src/main/java/com/jozufozu/flywheel/backend/instancing/ITickableInstance.java @@ -21,7 +21,7 @@ import com.jozufozu.flywheel.backend.instancing.tile.TileEntityInstance; public interface ITickableInstance extends IInstance { /** - * Called every tick. + * Called every tick, and after initialization. *
* DISPATCHED IN PARALLEL, don't attempt to mutate anything outside of this instance. *
diff --git a/src/main/java/com/jozufozu/flywheel/backend/instancing/InstanceManager.java b/src/main/java/com/jozufozu/flywheel/backend/instancing/InstanceManager.java index 2eee2f458..535357ff3 100644 --- a/src/main/java/com/jozufozu/flywheel/backend/instancing/InstanceManager.java +++ b/src/main/java/com/jozufozu/flywheel/backend/instancing/InstanceManager.java @@ -294,9 +294,15 @@ public abstract class InstanceManager implements InstancingEngine.OriginShift .addListener(renderer); instances.put(obj, renderer); - if (renderer instanceof IDynamicInstance) dynamicInstances.put(obj, (IDynamicInstance) renderer); + if (renderer instanceof ITickableInstance r) { + tickableInstances.put(obj, r); + r.tick(); + } - if (renderer instanceof ITickableInstance) tickableInstances.put(obj, ((ITickableInstance) renderer)); + if (renderer instanceof IDynamicInstance r) { + dynamicInstances.put(obj, r); + r.beginFrame(); + } } return renderer;