mirror of
https://github.com/Jozufozu/Flywheel.git
synced 2024-12-27 07:26:48 +01:00
#tick and #beginFrame on creation
- Fixes weird delay in object appearance when reloading chunks
This commit is contained in:
parent
008c6c1e3f
commit
e575b1c580
3 changed files with 11 additions and 5 deletions
|
@ -13,9 +13,9 @@ import com.jozufozu.flywheel.backend.instancing.tile.TileEntityInstance;
|
||||||
*/
|
*/
|
||||||
public interface IDynamicInstance extends IInstance {
|
public interface IDynamicInstance extends IInstance {
|
||||||
/**
|
/**
|
||||||
* Called every frame.
|
* Called every frame, and after initialization.
|
||||||
* <br>
|
* <br>
|
||||||
* <em>DISPATCHED IN PARALLEL</em>, don't attempt to mutate anything outside of this instance.
|
* <em>DISPATCHED IN PARALLEL</em>, don't attempt to mutate anything outside this instance.
|
||||||
* <br>
|
* <br>
|
||||||
* {@link Instancer}/{@link InstanceData} creation/acquisition is safe here.
|
* {@link Instancer}/{@link InstanceData} creation/acquisition is safe here.
|
||||||
*/
|
*/
|
||||||
|
|
|
@ -21,7 +21,7 @@ import com.jozufozu.flywheel.backend.instancing.tile.TileEntityInstance;
|
||||||
public interface ITickableInstance extends IInstance {
|
public interface ITickableInstance extends IInstance {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Called every tick.
|
* Called every tick, and after initialization.
|
||||||
* <br>
|
* <br>
|
||||||
* <em>DISPATCHED IN PARALLEL</em>, don't attempt to mutate anything outside of this instance.
|
* <em>DISPATCHED IN PARALLEL</em>, don't attempt to mutate anything outside of this instance.
|
||||||
* <br>
|
* <br>
|
||||||
|
|
|
@ -294,9 +294,15 @@ public abstract class InstanceManager<T> implements InstancingEngine.OriginShift
|
||||||
.addListener(renderer);
|
.addListener(renderer);
|
||||||
instances.put(obj, 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;
|
return renderer;
|
||||||
|
|
Loading…
Reference in a new issue