Class AbstractInstance
java.lang.Object
com.jozufozu.flywheel.backend.instancing.AbstractInstance
- All Implemented Interfaces:
Instance,LightListener
- Direct Known Subclasses:
BlockEntityInstance,EntityInstance
A general interface providing information about any type of thing that could use Flywheel's instanced rendering.
Right now, that's only
BlockEntityInstanceManager, but there could be an entity equivalent in the future.-
Field Summary
FieldsModifier and TypeFieldDescriptionprotected final MaterialManagerprotected booleanfinal net.minecraft.world.level.Level -
Constructor Summary
ConstructorsConstructorDescriptionAbstractInstance(MaterialManager materialManager, net.minecraft.world.level.Level world) -
Method Summary
Modifier and TypeMethodDescriptionvoidinit()Initialize models here.booleanCheck the status of the light listener.voidonLightUpdate(net.minecraft.world.level.LightLayer type, ImmutableBox changed) Called when a light updates in a chunk the implementor cares about.protected voidprotected <L extends FlatLit<?>>
voidprotected voidprotected <L extends FlatLit<?>>
voidprotected abstract voidremove()Free any acquired resources.final voidbooleanWhen an instance is reset, the instance is deleted and re-created.voidupdate()Update instance data here.voidCalled after construction and when a light update occurs in the world.Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface com.jozufozu.flywheel.api.instance.Instance
getWorldPositionMethods inherited from interface com.jozufozu.flywheel.light.LightListener
getVolume, onLightPacket
-
Field Details
-
materialManager
-
world
public final net.minecraft.world.level.Level world -
removed
protected boolean removed
-
-
Constructor Details
-
AbstractInstance
-
-
Method Details
-
init
public void init()Initialize models here. -
removeAndMark
public final void removeAndMark() -
remove
protected abstract void remove()Free any acquired resources. -
update
public void update()Update instance data here. Good for when data doesn't change very often and when animations are GPU based. Don't query lighting data here, that's handled separately inupdateLight().
If your animations are complex or more CPU driven, seeDynamicInstanceorTickableInstance. -
updateLight
public void updateLight()Called after construction and when a light update occurs in the world.
If your model needs it, update light here. -
shouldReset
public boolean shouldReset()When an instance is reset, the instance is deleted and re-created.Just before
update()would be called,shouldReset()is checked. If this function returnstrue, then this instance will beremoved, and another instance will be constructed to replace it. This allows for more sane resource acquisition compared to trying to update everything within the lifetime of an instance.- Returns:
trueif this instance should be discarded and refreshed.
-
isListenerInvalid
public boolean isListenerInvalid()Description copied from interface:LightListenerCheck the status of the light listener.- Specified by:
isListenerInvalidin interfaceLightListener- Returns:
trueif the listener is invalid/removed/deleted, and should no longer receive updates.
-
onLightUpdate
Description copied from interface:LightListenerCalled when a light updates in a chunk the implementor cares about.- Specified by:
onLightUpdatein interfaceLightListener
-
relight
-
relight
-
relight
-
relight
-