Class InstanceManager<T>
java.lang.Object
com.jozufozu.flywheel.backend.instancing.InstanceManager<T>
- All Implemented Interfaces:
InstancingEngine.OriginShiftListener
- Direct Known Subclasses:
BlockEntityInstanceManager,EntityInstanceManager
public abstract class InstanceManager<T>
extends Object
implements InstancingEngine.OriginShiftListener
-
Field Summary
FieldsModifier and TypeFieldDescriptionprotected final it.unimi.dsi.fastutil.objects.Object2ObjectOpenHashMap<T,DynamicInstance> protected DistanceUpdateLimiterprotected final Map<T,AbstractInstance> final MaterialManagerprotected DistanceUpdateLimiterprotected final it.unimi.dsi.fastutil.objects.Object2ObjectOpenHashMap<T,TickableInstance> -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidprotected voidaddInternal(T obj) voidbeginFrame(TaskEngine taskEngine, net.minecraft.client.Camera info) protected abstract booleancanCreateInstance(T obj) Is the given object currently capable of being instanced?protected abstract booleancanInstance(T obj) Is the given object capable of being instanced at all?protected AbstractInstancecreateInternal(T obj) protected abstract AbstractInstanceprotected DistanceUpdateLimitervoidprotected <I extends T>
AbstractInstancegetInstance(I obj) intGet the number of game objects that are currently being instanced.voidvoidprotected voidprotected voidvoidvoidqueueAddAll(Collection<? extends T> objects) voidqueueUpdate(T obj) voidprotected voidremoveInternal(T obj, AbstractInstance instance) voidtick(TaskEngine taskEngine, double cameraX, double cameraY, double cameraZ) Ticks the InstanceManager.protected voidtickInstance(int cX, int cY, int cZ, TickableInstance instance) voidUpdate the instance associated with an object.protected voidupdateInstance(DynamicInstance dyn, float lookX, float lookY, float lookZ, int cX, int cY, int cZ)
-
Field Details
-
materialManager
-
instances
-
tickableInstances
protected final it.unimi.dsi.fastutil.objects.Object2ObjectOpenHashMap<T,TickableInstance> tickableInstances -
dynamicInstances
protected final it.unimi.dsi.fastutil.objects.Object2ObjectOpenHashMap<T,DynamicInstance> dynamicInstances -
frame
-
tick
-
-
Constructor Details
-
InstanceManager
-
-
Method Details
-
createUpdateLimiter
-
getObjectCount
public int getObjectCount()Get the number of game objects that are currently being instanced.- Returns:
- The object count.
-
canInstance
Is the given object capable of being instanced at all?- Returns:
- false if on object cannot be instanced.
-
canCreateInstance
Is the given object currently capable of being instanced?This won't be the case for TEs or entities that are outside of loaded chunks.
- Returns:
- true if the object is currently capable of being instanced.
-
createRaw
-
tick
Ticks the InstanceManager.TickableInstances get ticked.
Queued updates are processed. -
tickInstance
-
beginFrame
-
updateInstance
protected void updateInstance(DynamicInstance dyn, float lookX, float lookY, float lookZ, int cX, int cY, int cZ) -
add
-
queueAdd
-
queueUpdate
-
update
Update the instance associated with an object.By default this is the only hook an IInstance has to change its internal state. This is the lowest frequency update hook IInstance gets. For more frequent updates, see
TickableInstanceandDynamicInstance.- Parameters:
obj- the object to update.
-
remove
-
invalidate
public void invalidate() -
getInstance
-
processQueuedAdditions
protected void processQueuedAdditions() -
processQueuedUpdates
protected void processQueuedUpdates() -
addInternal
-
removeInternal
-
createInternal
-
onOriginShift
public void onOriginShift()- Specified by:
onOriginShiftin interfaceInstancingEngine.OriginShiftListener
-
detachLightListeners
public void detachLightListeners() -
queueAddAll
-