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

java.lang.Object
com.jozufozu.flywheel.backend.instancing.AbstractInstance
com.jozufozu.flywheel.backend.instancing.blockentity.BlockEntityInstance<T>
Type Parameters:
T - The type of BlockEntity your class is an instance of.
All Implemented Interfaces:
Instance, LightListener
Direct Known Subclasses:
BellInstance, ChestInstance, ShulkerBoxInstance

public abstract class BlockEntityInstance<T extends net.minecraft.world.level.block.entity.BlockEntity> extends AbstractInstance
The layer between a BlockEntity and the Flywheel backend.

AbstractInstance.updateLight() is called after construction.

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 a BlockEntityInstance 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
    • instancePos

      protected final net.minecraft.core.BlockPos instancePos
    • blockState

      protected final net.minecraft.world.level.block.state.BlockState blockState
  • Constructor Details

    • BlockEntityInstance

      public BlockEntityInstance(MaterialManager materialManager, T blockEntity)
  • Method Details

    • shouldReset

      public boolean shouldReset()
      Just before AbstractInstance.update() would be called, shouldReset() is checked. If this function returns true, then this instance will be removed, 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.
      Overrides:
      shouldReset in class AbstractInstance
      Returns:
      true if this instance should be discarded and refreshed.
    • getInstancePosition

      public net.minecraft.core.BlockPos getInstancePosition()
      In order to accommodate for floating point precision errors at high coordinates, BlockEntityInstanceManagers are allowed to arbitrarily adjust the origin, and shift the world matrix provided as a shader uniform accordingly.
      Returns:
      The position of the BlockEntity this instance represents should be rendered at to appear in the correct location.
    • getWorldPosition

      public net.minecraft.core.BlockPos getWorldPosition()
    • getTransformMaterial

      protected Material<ModelData> getTransformMaterial()
    • getOrientedMaterial

      protected Material<OrientedData> getOrientedMaterial()
    • getVolume

      public ImmutableBox getVolume()