Interface IHasBoundingBlocks

All Known Implementing Classes:
SolarCompressorBlockEntity
Functional Interface:
This is a functional interface and can therefore be used as the assignment target for a lambda expression or method reference.

@FunctionalInterface public interface IHasBoundingBlocks
Implement for Block Entities tied to Blocks that extend AbstractPNCBlockWithBoundingBlocks
  • Method Summary

    Modifier and Type
    Method
    Description
    Gets the BoundingBlockEntityData linked to the implementing block entity which stores all the data relevant to bounding blocks for the block entity
    default boolean
    Returns if all bounding blocks have been placed
    Called in canSurvive() to ensure the main block survival isn't considered until after all bounding blocks have been placed
    default boolean
    Returns if all bounding blocks have been removed Called in onRemove() to check if bounding blocks need to be removed when the main block is removed, preventing redundant removal of bounding blocks
    default net.minecraft.world.level.block.entity.BlockEntity
    getMain(net.minecraft.world.level.block.entity.BlockEntity blockEntity)
    Finds the main block entity for the passed block entity
    default boolean
    Returns if the main block is locked from being automatically removed
    Called in onRemove() when any bounding blocks are removed.
    default net.minecraft.core.Vec3i
    Returns the offset of the calling block entity from the main block entity
    An offset of 0,0,0 means the calling block entity is the main block entity
    default boolean
    isBounding(net.minecraft.world.level.block.entity.BlockEntity blockEntity)
    Returns if passed block entity is a bounding block entity
    default void
    setBoundingPlaced(boolean boundingPlaced)
    Sets if all bounding blocks have been placed
    Set to true after placing all bounding blocks in placeBoundingBlocks()
    default void
    setBoundingRemoved(boolean boundingRemoved)
    Sets if all bounding blocks have been removed
    Set to true after removing all bounding blocks in removeBoundingBlocks()
    default void
    setMainBlockRemovalLock(boolean mainBlockRemovalLock)
    Sets if the main block is locked from being automatically removed
    Set in removeBoundingBlocks() and setRotation() to true at the start of the methods, and then to false at the end of the methods.
    default void
    setOffsetFromMain(net.minecraft.core.Vec3i offsetFromMain)
    Sets the offset of the calling block entity from the main block entity
    An offset of 0,0,0 means the calling block entity is the main block entity
  • Method Details

    • getBoundingBlockEntityData

      @Nonnull BoundingBlockEntityData getBoundingBlockEntityData()
      Gets the BoundingBlockEntityData linked to the implementing block entity which stores all the data relevant to bounding blocks for the block entity
      Returns:
      the BoundingBlockEntityData linked to the implementing block entity
    • getOffsetFromMain

      @Nonnull default net.minecraft.core.Vec3i getOffsetFromMain()
      Returns the offset of the calling block entity from the main block entity
      An offset of 0,0,0 means the calling block entity is the main block entity
      Returns:
      the offset of the calling block entity from the main block entity
    • setOffsetFromMain

      default void setOffsetFromMain(@Nonnull net.minecraft.core.Vec3i offsetFromMain)
      Sets the offset of the calling block entity from the main block entity
      An offset of 0,0,0 means the calling block entity is the main block entity
      Parameters:
      offsetFromMain - the offset of the calling block entity from the main block entity
    • getBoundingPlaced

      default boolean getBoundingPlaced()
      Returns if all bounding blocks have been placed
      Called in canSurvive() to ensure the main block survival isn't considered until after all bounding blocks have been placed
      Returns:
      if all bounding blocks have been placed
    • setBoundingPlaced

      default void setBoundingPlaced(boolean boundingPlaced)
      Sets if all bounding blocks have been placed
      Set to true after placing all bounding blocks in placeBoundingBlocks()
      Parameters:
      boundingPlaced - if all bounding blocks have been placed
    • getBoundingRemoved

      default boolean getBoundingRemoved()
      Returns if all bounding blocks have been removed Called in onRemove() to check if bounding blocks need to be removed when the main block is removed, preventing redundant removal of bounding blocks
      Returns:
      if all bounding blocks have been removed
    • setBoundingRemoved

      default void setBoundingRemoved(boolean boundingRemoved)
      Sets if all bounding blocks have been removed
      Set to true after removing all bounding blocks in removeBoundingBlocks()
      Parameters:
      boundingRemoved - if all bounding blocks have been removed
    • getMainBlockRemovalLock

      default boolean getMainBlockRemovalLock()
      Returns if the main block is locked from being automatically removed
      Called in onRemove() when any bounding blocks are removed.
      Returns:
      if the main block is locked from being automatically removed
    • setMainBlockRemovalLock

      default void setMainBlockRemovalLock(boolean mainBlockRemovalLock)
      Sets if the main block is locked from being automatically removed
      Set in removeBoundingBlocks() and setRotation() to true at the start of the methods, and then to false at the end of the methods.
      Parameters:
      mainBlockRemovalLock - if the main block is locked from being automatically removed
    • isBounding

      default boolean isBounding(net.minecraft.world.level.block.entity.BlockEntity blockEntity)
      Returns if passed block entity is a bounding block entity
      Parameters:
      blockEntity - block entity to check if a bounding block entity
      Returns:
      if passed block entity is a bounding block entity
    • getMain

      default net.minecraft.world.level.block.entity.BlockEntity getMain(net.minecraft.world.level.block.entity.BlockEntity blockEntity)
      Finds the main block entity for the passed block entity
      Parameters:
      blockEntity - block entity to find the main block entity of
      Returns:
      the main block entity of the passed block entity