Class AbstractBlockEntityVisual<T extends net.minecraft.world.level.block.entity.BlockEntity>

java.lang.Object
dev.engine_room.flywheel.lib.visual.AbstractVisual
dev.engine_room.flywheel.lib.visual.AbstractBlockEntityVisual<T>
Type Parameters:
T - The type of BlockEntity.
All Implemented Interfaces:
BlockEntityVisual<T>, LightUpdatedVisual, SectionTrackedVisual, Visual

public abstract class AbstractBlockEntityVisual<T extends net.minecraft.world.level.block.entity.BlockEntity> extends AbstractVisual implements BlockEntityVisual<T>, LightUpdatedVisual
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
    • lightSections

      protected @UnknownNullability SectionTrackedVisual.SectionCollector lightSections
  • Constructor Details

    • AbstractBlockEntityVisual

      public AbstractBlockEntityVisual(VisualizationContext ctx, T blockEntity, float partialTick)
  • Method Details

    • setSectionCollector

      public void setSectionCollector(SectionTrackedVisual.SectionCollector sectionCollector)
      Description copied from interface: SectionTrackedVisual
      Set the section collector object.

      This method is only called once, upon visual creation.
      If the collector is invoked in this method, the visual will immediately be tracked in the given sections.

      Specified by:
      setSectionCollector in interface SectionTrackedVisual
      Parameters:
      sectionCollector - The collector.
    • 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.
    • computePackedLight

      protected int computePackedLight()
    • relight

      protected void relight(net.minecraft.core.BlockPos pos, @Nullable @Nullable FlatLit... instances)
    • relight

      protected void relight(@Nullable @Nullable FlatLit... instances)
    • relight

      protected void relight(net.minecraft.core.BlockPos pos, Iterator<@Nullable FlatLit> instances)
    • relight

      protected void relight(Iterator<@Nullable FlatLit> instances)
    • relight

      protected void relight(net.minecraft.core.BlockPos pos, Iterable<@Nullable FlatLit> instances)
    • relight

      protected void relight(Iterable<@Nullable FlatLit> instances)