Package com.jozufozu.flywheel.lib.visual
Class AbstractBlockEntityVisual<T extends net.minecraft.world.level.block.entity.BlockEntity>
java.lang.Object
com.jozufozu.flywheel.lib.visual.AbstractVisual
com.jozufozu.flywheel.lib.visual.AbstractBlockEntityVisual<T>
- Type Parameters:
T- The type ofBlockEntity.
- All Implemented Interfaces:
BlockEntityVisual<T>,LitVisual,Visual
- Direct Known Subclasses:
BellVisual,ChestVisual,ShulkerBoxVisual
public abstract class AbstractBlockEntityVisual<T extends net.minecraft.world.level.block.entity.BlockEntity>
extends AbstractVisual
implements BlockEntityVisual<T>, LitVisual
The layer between a
There are a few additional features that overriding classes can opt in to: See the interfaces' documentation for more information about each one.
Implementing one or more of these will give an
BlockEntity and the Flywheel backend.
There are a few additional features that overriding classes can opt in to: See the interfaces' documentation for more information about each one.
Implementing one or more of these will give an
AbstractBlockEntityVisual access
to more interesting and regular points within a tick or a frame.-
Nested Class Summary
Nested classes/interfaces inherited from interface com.jozufozu.flywheel.api.visual.LitVisual
LitVisual.Notifier -
Field Summary
FieldsModifier and TypeFieldDescriptionprotected final Tprotected final net.minecraft.world.level.block.state.BlockStateprotected LitVisual.Notifierprotected final net.minecraft.core.BlockPosprotected final net.minecraft.core.BlockPosFields inherited from class com.jozufozu.flywheel.lib.visual.AbstractVisual
deleted, instancerProvider, level, renderOrigin, visualizationContext -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidcollectLightSections(LongConsumer consumer) Collect the sections that this visual is contained in.booleanLimits which frames this visual is updated on based on its distance from the camera.net.minecraft.core.BlockPosIn order to accommodate for floating point precision errors at high coordinates,VisualManagers are allowed to arbitrarily adjust the origin, and shift the level matrix provided as a shader uniform accordingly.voidinit(float partialTick) Initialize instances here.voidinitLightSectionNotifier(LitVisual.Notifier notifier) Set the notifier object.booleanisVisible(org.joml.FrustumIntersection frustum) Check if this visual is within the given frustum.Methods inherited from class com.jozufozu.flywheel.lib.visual.AbstractVisual
_delete, delete, relight, relight, relight, relight, relight, relight, updateMethods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface com.jozufozu.flywheel.api.visual.BlockEntityVisual
collectCrumblingInstancesMethods inherited from interface com.jozufozu.flywheel.api.visual.LitVisual
updateLight
-
Field Details
-
blockEntity
-
pos
protected final net.minecraft.core.BlockPos pos -
visualPos
protected final net.minecraft.core.BlockPos visualPos -
blockState
protected final net.minecraft.world.level.block.state.BlockState blockState -
notifier
-
-
Constructor Details
-
AbstractBlockEntityVisual
-
-
Method Details
-
init
public void init(float partialTick) Description copied from interface:VisualInitialize instances here.This method will be called exactly once upon visual creation.
-
collectLightSections
Description copied from interface:LitVisualCollect the sections that this visual is contained in.This method is called upon visual creation, and the frame after
LitVisual.Notifier.notifySectionsChanged()is called.- Specified by:
collectLightSectionsin interfaceLitVisual- Parameters:
consumer- The consumer to provide the sections to.- See Also:
-
SectionPos.asLong(net.minecraft.core.BlockPos)
-
initLightSectionNotifier
Description copied from interface:LitVisualSet the notifier object.This method is only called once, upon visual creation, after
Visual.init(float)and beforeLitVisual.collectLightSections(java.util.function.LongConsumer).- Specified by:
initLightSectionNotifierin interfaceLitVisual- Parameters:
notifier- The notifier.
-
getVisualPosition
public net.minecraft.core.BlockPos getVisualPosition()In order to accommodate for floating point precision errors at high coordinates,VisualManagers are allowed to arbitrarily adjust the origin, and shift the level matrix provided as a shader uniform accordingly.- Returns:
- The
positionof theBlockEntitythis visual represents should be rendered at to appear in the correct location.
-
isVisible
public boolean isVisible(org.joml.FrustumIntersection frustum) Check if this visual is within the given frustum.- Parameters:
frustum- The current frustum.- Returns:
trueif this visual is possibly visible.
-
doDistanceLimitThisFrame
Limits which frames this visual is updated on based on its distance from the camera.You may optionally do this check to avoid updating your visual every frame when it is far away.
- Parameters:
context- The current frame context.- Returns:
trueif this visual shouldn't be updated this frame based on its distance from the camera.
-