Interface IMultiBlock

All Superinterfaces:
net.minecraft.world.level.block.EntityBlock, IMBStateSharer
All Known Subinterfaces:
IExpandingMultiblock, IMovableMultiblock, IPreviewableMultiblock
All Known Implementing Classes:
AbstractMultiBlock, AbstractStructureMultiBlock, DiamondStructureBlock, SimpleMultiBlock, TestBlock

public interface IMultiBlock extends IMBStateSharer, net.minecraft.world.level.block.EntityBlock
  • Method Summary

    Modifier and Type
    Method
    Description
    default boolean
    allBlocksPresent(net.minecraft.world.level.LevelReader level, net.minecraft.core.BlockPos pos, net.minecraft.world.level.block.state.BlockState state)
     
    default boolean
    canPlace(net.minecraft.world.level.LevelReader level, net.minecraft.core.BlockPos center, net.minecraft.world.level.block.state.BlockState state, @Nullable net.minecraft.world.entity.Entity player, boolean ignoreEntities)
     
    default boolean
    canReplaceBlock(net.minecraft.world.level.LevelReader level, net.minecraft.core.BlockPos blockPos, net.minecraft.world.level.block.state.BlockState state)
    Returns true if multiblock can replace this original block, runs for the whole multiblock shape
    default boolean
    canSurviveHelper(net.minecraft.world.level.block.state.BlockState state, net.minecraft.world.level.LevelReader level, net.minecraft.core.BlockPos pos)
    Helper for Block.canSurvive()
    default void
    destroy(net.minecraft.core.BlockPos center, net.minecraft.world.level.LevelAccessor level, net.minecraft.world.level.block.state.BlockState state, boolean dropBlock)
     
    default boolean
    entityUnobstructed(net.minecraft.world.level.CollisionGetter level, net.minecraft.core.BlockPos pos, net.minecraft.world.level.block.state.BlockState state, @Nullable net.minecraft.world.entity.Entity player)
     
    default boolean
    extraSurviveRequirements(net.minecraft.world.level.LevelReader level, net.minecraft.core.BlockPos pos, net.minecraft.world.level.block.state.BlockState state, net.minecraft.core.BlockPos centerOffset)
    Extra requirements for the block to survive or be placed, runs for every single block in the multiblock
    static net.minecraft.core.BlockPos
    getCenter(net.minecraft.world.level.BlockGetter level, net.minecraft.core.BlockPos pos)
    Returns the center BlockPos of the multiblock
    default @Nullable net.minecraft.core.Direction
    getDirection(net.minecraft.world.level.block.state.BlockState state)
     
    default @Nullable net.minecraft.world.level.block.state.properties.EnumProperty<net.minecraft.core.Direction>
    Returns the multiblocks DirectionProperty.
    default List<net.minecraft.core.BlockPos>
    getFullBlockShape(net.minecraft.world.level.BlockGetter level, net.minecraft.core.BlockPos pos, net.minecraft.world.level.block.state.BlockState state)
     
    default List<net.minecraft.core.BlockPos>
    getFullBlockShapeNoCache(net.minecraft.world.level.Level level, @Nullable net.minecraft.world.level.block.entity.BlockEntity blockEntity, net.minecraft.core.BlockPos center, net.minecraft.world.level.block.state.BlockState state)
     
    static List<net.minecraft.core.BlockPos>
    getFullShape(net.minecraft.world.level.BlockGetter level, net.minecraft.core.BlockPos pos)
     
    default List<net.minecraft.core.BlockPos>
    getIsolatedBlocks(net.minecraft.core.BlockPos center, net.minecraft.world.level.LevelAccessor level, net.minecraft.world.level.block.state.BlockState state)
     
    static net.minecraft.core.BlockPos
    getOffset(net.minecraft.world.level.BlockGetter level, net.minecraft.core.BlockPos pos)
    Returns the offset BlockPos from center of the multiblock
    default net.minecraft.world.level.block.state.BlockState
    getStateForEachBlock(net.minecraft.world.level.block.state.BlockState state, net.minecraft.core.BlockPos pos, net.minecraft.core.BlockPos centerOffset, net.minecraft.world.level.Level level, @Nullable net.minecraft.core.Direction direction)
    Changes the BlockState for each Block in this multiblock.
    default net.minecraft.world.level.block.state.BlockState
    getStateForPlacementHelper(net.minecraft.world.item.context.BlockPlaceContext context)
     
    default net.minecraft.world.level.block.state.BlockState
    getStateForPlacementHelper(net.minecraft.world.item.context.BlockPlaceContext context, net.minecraft.core.Direction direction)
    Helper for Block.getStateForPlacement(BlockPlaceContext)
    static void
    invalidateCaches(net.minecraft.world.level.BlockGetter level, net.minecraft.core.BlockPos pos)
     
    static boolean
    isCenter(net.minecraft.world.level.block.state.BlockState state)
     
    static boolean
    isMultiblock(net.minecraft.world.level.block.state.BlockState state)
     
    static boolean
    isMultiblock(net.minecraft.world.level.BlockGetter level, net.minecraft.core.BlockPos pos)
     
    static boolean
    isSameMultiblock(net.minecraft.world.level.Level level, net.minecraft.world.level.block.state.BlockState state1, net.minecraft.world.level.block.state.BlockState state2, net.minecraft.core.BlockPos center, net.minecraft.core.BlockPos posNew)
     
    List<net.minecraft.core.BlockPos>
    makeFullBlockShape(net.minecraft.world.level.Level level, net.minecraft.core.BlockPos center, net.minecraft.world.level.block.state.BlockState state, @Nullable net.minecraft.world.level.block.entity.BlockEntity blockEntity, @Nullable net.minecraft.core.Direction direction)
    Returns a BlockPos Stream of every block in this multiblock.
    default void
    onPlaceHelper(net.minecraft.world.level.block.state.BlockState state, net.minecraft.world.level.Level level, net.minecraft.core.BlockPos pos, net.minecraft.world.level.block.state.BlockState oldState)
     
    default void
    place(net.minecraft.world.level.Level level, net.minecraft.core.BlockPos centerPos, net.minecraft.world.level.block.state.BlockState stateOriginal)
    Places the multiblock, sets its BlockStates and BlockEntity center
    static List<net.minecraft.core.BlockPos>
    posStreamToList(Stream<net.minecraft.core.BlockPos> posStream)
    Mojangs BetweenClosed methods return a mutable BlockPos, which breaks everything.
    default List<BlockLike>
    prepareForPlace(List<net.minecraft.core.BlockPos> shape, net.minecraft.world.level.Level level, net.minecraft.core.BlockPos centerPos, net.minecraft.world.level.block.state.BlockState stateOriginal)
    Prepares all blocks to be Placed
    default void
    preventCreativeDrops(net.minecraft.world.entity.player.Player player, net.minecraft.world.level.Level level, net.minecraft.core.BlockPos pos)
    Should be added into Block.playerDestroy(Level, Player, BlockPos, BlockState, BlockEntity, ItemStack)
    default net.minecraft.world.level.block.state.BlockState
    updateShapeHelper(net.minecraft.world.level.block.state.BlockState state, net.minecraft.core.Direction direction, net.minecraft.world.level.block.state.BlockState neighborState, net.minecraft.world.level.LevelAccessor level, net.minecraft.core.BlockPos pos, net.minecraft.core.BlockPos neighborPos)
    Helper for Block.updateShape()
    static void
    verifyValidBlockEntity(net.minecraft.world.level.Level level, net.minecraft.core.BlockPos pos)
     
    default net.minecraft.world.phys.shapes.VoxelShape
    voxelShapeHelper(net.minecraft.world.level.block.state.BlockState state, net.minecraft.world.level.BlockGetter level, net.minecraft.core.BlockPos pos, net.minecraft.world.phys.shapes.VoxelShape shape)
     
    default net.minecraft.world.phys.shapes.VoxelShape
    voxelShapeHelper(net.minecraft.world.level.block.state.BlockState state, net.minecraft.world.level.BlockGetter level, net.minecraft.core.BlockPos pos, net.minecraft.world.phys.shapes.VoxelShape shape, float xOffset, float yOffset, float zOffset)
     
    default net.minecraft.world.phys.shapes.VoxelShape
    voxelShapeHelper(net.minecraft.world.level.block.state.BlockState state, net.minecraft.world.level.BlockGetter level, net.minecraft.core.BlockPos pos, net.minecraft.world.phys.shapes.VoxelShape shape, float xOffset, float yOffset, float zOffset, boolean hasDirectionOffsets)
    Offsets each Blocks VoxelShape to the center, allowing for VoxelShapes larger than 1 block

    Methods inherited from interface net.minecraft.world.level.block.EntityBlock

    getListener, getTicker, newBlockEntity
  • Method Details

    • makeFullBlockShape

      List<net.minecraft.core.BlockPos> makeFullBlockShape(net.minecraft.world.level.Level level, net.minecraft.core.BlockPos center, net.minecraft.world.level.block.state.BlockState state, @Nullable net.minecraft.world.level.block.entity.BlockEntity blockEntity, @Nullable net.minecraft.core.Direction direction)
      Returns a BlockPos Stream of every block in this multiblock.

      Should only be used for overriding

      Parameters:
      center - The center pos of the multiblock, aka the 1st block placed
      blockEntity - null when being placed
      direction - present only when getDirectionProperty() is overridden with a valid property
      See Also:
    • posStreamToList

      static List<net.minecraft.core.BlockPos> posStreamToList(Stream<net.minecraft.core.BlockPos> posStream)
      Mojangs BetweenClosed methods return a mutable BlockPos, which breaks everything. Use this helper method to convert them safely
    • getDirectionProperty

      default @Nullable net.minecraft.world.level.block.state.properties.EnumProperty<net.minecraft.core.Direction> getDirectionProperty()
      Returns the multiblocks DirectionProperty.

      Only used for multiblocks that can be rotated, otherwise returns null

    • getDirection

      default @Nullable net.minecraft.core.Direction getDirection(net.minecraft.world.level.block.state.BlockState state)
    • getFullBlockShapeNoCache

      default List<net.minecraft.core.BlockPos> getFullBlockShapeNoCache(net.minecraft.world.level.Level level, @Nullable net.minecraft.world.level.block.entity.BlockEntity blockEntity, net.minecraft.core.BlockPos center, net.minecraft.world.level.block.state.BlockState state)
    • getFullBlockShape

      default List<net.minecraft.core.BlockPos> getFullBlockShape(net.minecraft.world.level.BlockGetter level, net.minecraft.core.BlockPos pos, net.minecraft.world.level.block.state.BlockState state)
    • getFullShape

      static List<net.minecraft.core.BlockPos> getFullShape(net.minecraft.world.level.BlockGetter level, net.minecraft.core.BlockPos pos)
    • invalidateCaches

      static void invalidateCaches(net.minecraft.world.level.BlockGetter level, net.minecraft.core.BlockPos pos)
    • getStateForEachBlock

      default net.minecraft.world.level.block.state.BlockState getStateForEachBlock(net.minecraft.world.level.block.state.BlockState state, net.minecraft.core.BlockPos pos, net.minecraft.core.BlockPos centerOffset, net.minecraft.world.level.Level level, @Nullable net.minecraft.core.Direction direction)
      Changes the BlockState for each Block in this multiblock. Works like GetStateForPlacement does in regular blocks
      See Also:
    • onPlaceHelper

      default void onPlaceHelper(net.minecraft.world.level.block.state.BlockState state, net.minecraft.world.level.Level level, net.minecraft.core.BlockPos pos, net.minecraft.world.level.block.state.BlockState oldState)
    • place

      default void place(net.minecraft.world.level.Level level, net.minecraft.core.BlockPos centerPos, net.minecraft.world.level.block.state.BlockState stateOriginal)
      Places the multiblock, sets its BlockStates and BlockEntity center
    • prepareForPlace

      default List<BlockLike> prepareForPlace(List<net.minecraft.core.BlockPos> shape, net.minecraft.world.level.Level level, net.minecraft.core.BlockPos centerPos, net.minecraft.world.level.block.state.BlockState stateOriginal)
      Prepares all blocks to be Placed
    • getStateForPlacementHelper

      default net.minecraft.world.level.block.state.BlockState getStateForPlacementHelper(net.minecraft.world.item.context.BlockPlaceContext context)
    • getStateForPlacementHelper

      default net.minecraft.world.level.block.state.BlockState getStateForPlacementHelper(net.minecraft.world.item.context.BlockPlaceContext context, net.minecraft.core.Direction direction)
      Helper for Block.getStateForPlacement(BlockPlaceContext)
      Parameters:
      direction - The direction the block will have when placed, ignored when getDirectionProperty() is null
    • canPlace

      default boolean canPlace(net.minecraft.world.level.LevelReader level, net.minecraft.core.BlockPos center, net.minecraft.world.level.block.state.BlockState state, @Nullable net.minecraft.world.entity.Entity player, boolean ignoreEntities)
    • canReplaceBlock

      default boolean canReplaceBlock(net.minecraft.world.level.LevelReader level, net.minecraft.core.BlockPos blockPos, net.minecraft.world.level.block.state.BlockState state)
      Returns true if multiblock can replace this original block, runs for the whole multiblock shape
    • entityUnobstructed

      default boolean entityUnobstructed(net.minecraft.world.level.CollisionGetter level, net.minecraft.core.BlockPos pos, net.minecraft.world.level.block.state.BlockState state, @Nullable net.minecraft.world.entity.Entity player)
    • destroy

      default void destroy(net.minecraft.core.BlockPos center, net.minecraft.world.level.LevelAccessor level, net.minecraft.world.level.block.state.BlockState state, boolean dropBlock)
    • getIsolatedBlocks

      default List<net.minecraft.core.BlockPos> getIsolatedBlocks(net.minecraft.core.BlockPos center, net.minecraft.world.level.LevelAccessor level, net.minecraft.world.level.block.state.BlockState state)
    • allBlocksPresent

      default boolean allBlocksPresent(net.minecraft.world.level.LevelReader level, net.minecraft.core.BlockPos pos, net.minecraft.world.level.block.state.BlockState state)
    • updateShapeHelper

      default net.minecraft.world.level.block.state.BlockState updateShapeHelper(net.minecraft.world.level.block.state.BlockState state, net.minecraft.core.Direction direction, net.minecraft.world.level.block.state.BlockState neighborState, net.minecraft.world.level.LevelAccessor level, net.minecraft.core.BlockPos pos, net.minecraft.core.BlockPos neighborPos)
      Helper for Block.updateShape()

      Destroys the multiblock if canSurvive returns false

    • canSurviveHelper

      default boolean canSurviveHelper(net.minecraft.world.level.block.state.BlockState state, net.minecraft.world.level.LevelReader level, net.minecraft.core.BlockPos pos)
      Helper for Block.canSurvive()
    • extraSurviveRequirements

      default boolean extraSurviveRequirements(net.minecraft.world.level.LevelReader level, net.minecraft.core.BlockPos pos, net.minecraft.world.level.block.state.BlockState state, net.minecraft.core.BlockPos centerOffset)
      Extra requirements for the block to survive or be placed, runs for every single block in the multiblock
    • preventCreativeDrops

      default void preventCreativeDrops(net.minecraft.world.entity.player.Player player, net.minecraft.world.level.Level level, net.minecraft.core.BlockPos pos)
      Should be added into Block.playerDestroy(Level, Player, BlockPos, BlockState, BlockEntity, ItemStack)
    • getCenter

      static net.minecraft.core.BlockPos getCenter(net.minecraft.world.level.BlockGetter level, net.minecraft.core.BlockPos pos)
      Returns the center BlockPos of the multiblock
    • getOffset

      static net.minecraft.core.BlockPos getOffset(net.minecraft.world.level.BlockGetter level, net.minecraft.core.BlockPos pos)
      Returns the offset BlockPos from center of the multiblock
    • isCenter

      static boolean isCenter(net.minecraft.world.level.block.state.BlockState state)
    • isMultiblock

      static boolean isMultiblock(net.minecraft.world.level.block.state.BlockState state)
    • isMultiblock

      static boolean isMultiblock(net.minecraft.world.level.BlockGetter level, net.minecraft.core.BlockPos pos)
    • voxelShapeHelper

      default net.minecraft.world.phys.shapes.VoxelShape voxelShapeHelper(net.minecraft.world.level.block.state.BlockState state, net.minecraft.world.level.BlockGetter level, net.minecraft.core.BlockPos pos, net.minecraft.world.phys.shapes.VoxelShape shape)
    • voxelShapeHelper

      default net.minecraft.world.phys.shapes.VoxelShape voxelShapeHelper(net.minecraft.world.level.block.state.BlockState state, net.minecraft.world.level.BlockGetter level, net.minecraft.core.BlockPos pos, net.minecraft.world.phys.shapes.VoxelShape shape, float xOffset, float yOffset, float zOffset)
    • voxelShapeHelper

      default net.minecraft.world.phys.shapes.VoxelShape voxelShapeHelper(net.minecraft.world.level.block.state.BlockState state, net.minecraft.world.level.BlockGetter level, net.minecraft.core.BlockPos pos, net.minecraft.world.phys.shapes.VoxelShape shape, float xOffset, float yOffset, float zOffset, boolean hasDirectionOffsets)
      Offsets each Blocks VoxelShape to the center, allowing for VoxelShapes larger than 1 block
      Parameters:
      hasDirectionOffsets - Larger directional multiblocks may have their center in a different point for every rotation, this offsets the VoxelShapes accordingly
    • isSameMultiblock

      static boolean isSameMultiblock(net.minecraft.world.level.Level level, net.minecraft.world.level.block.state.BlockState state1, net.minecraft.world.level.block.state.BlockState state2, net.minecraft.core.BlockPos center, net.minecraft.core.BlockPos posNew)
    • verifyValidBlockEntity

      static void verifyValidBlockEntity(net.minecraft.world.level.Level level, net.minecraft.core.BlockPos pos)