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 of BlockEntity.
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 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.
  • Field Details

    • blockEntity

      protected final T extends net.minecraft.world.level.block.entity.BlockEntity 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

      @Nullable protected LitVisual.Notifier notifier
  • Constructor Details

  • Method Details

    • init

      public void init(float partialTick)
      Description copied from interface: Visual
      Initialize instances here.

      This method will be called exactly once upon visual creation.

      Specified by:
      init in interface Visual
    • collectLightSections

      public void collectLightSections(LongConsumer consumer)
      Description copied from interface: LitVisual
      Collect 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:
      collectLightSections in interface LitVisual
      Parameters:
      consumer - The consumer to provide the sections to.
      See Also:
      • SectionPos.asLong(net.minecraft.core.BlockPos)
    • initLightSectionNotifier

      public void initLightSectionNotifier(LitVisual.Notifier notifier)
      Description copied from interface: LitVisual
      Set the notifier object.

      This method is only called once, upon visual creation, after Visual.init(float) and before LitVisual.collectLightSections(java.util.function.LongConsumer).

      Specified by:
      initLightSectionNotifier in interface LitVisual
      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 position of the BlockEntity this 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:
      true if this visual is possibly visible.
    • doDistanceLimitThisFrame

      public boolean doDistanceLimitThisFrame(DynamicVisual.Context context)
      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:
      true if this visual shouldn't be updated this frame based on its distance from the camera.