Interface IMultiBlock

All Superinterfaces:
IMBStateSyncer
All Known Subinterfaces:
IExpandingMultiblock, IMovableMultiblock, IPreviewableMultiblock
All Known Implementing Classes:
AbstractMultiBlock, TestBlock

public interface IMultiBlock extends IMBStateSyncer
  • 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, 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.Level 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, 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)
    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 net.minecraft.core.Direction
    getDirection(net.minecraft.world.level.block.state.BlockState state)
     
    default net.minecraft.world.level.block.state.properties.DirectionProperty
    Returns the multiblocks DirectionProperty.
    default List<net.minecraft.core.BlockPos>
    getFullBlockShape(net.minecraft.core.BlockPos pos, net.minecraft.world.level.block.state.BlockState state, net.minecraft.world.level.BlockGetter level)
     
    default List<net.minecraft.core.BlockPos>
    getFullBlockShapeNoCache(net.minecraft.core.BlockPos center, net.minecraft.world.level.block.state.BlockState state)
     
    static List<net.minecraft.core.BlockPos>
    getFullShape(net.minecraft.world.level.Level level, net.minecraft.core.BlockPos pos)
     
    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, 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.core.Direction direction, net.minecraft.core.BlockPos center, net.minecraft.world.level.block.state.BlockState state)
    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<com.mojang.datafixers.util.Pair<net.minecraft.core.BlockPos,net.minecraft.world.level.block.state.BlockState>>
    prepareForPlace(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.world.level.LevelAccessor level, net.minecraft.core.BlockPos pos)
    Helper for Block.updateShape()
    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.nikdo53.tinymultiblocklib.block.IMBStateSyncer

    createSyncedBlockStates, getSyncedStateProperties, getSyncedStatePropertiesBuilder, syncBlockStates
  • Method Details

    • makeFullBlockShape

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

      Should only be used for overriding

      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

      @Nullable default net.minecraft.world.level.block.state.properties.DirectionProperty getDirectionProperty()
      Returns the multiblocks DirectionProperty.

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

    • getDirection

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

      default List<net.minecraft.core.BlockPos> getFullBlockShapeNoCache(net.minecraft.core.BlockPos center, net.minecraft.world.level.block.state.BlockState state)
    • getFullBlockShape

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

      static List<net.minecraft.core.BlockPos> getFullShape(net.minecraft.world.level.Level 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<com.mojang.datafixers.util.Pair<net.minecraft.core.BlockPos,net.minecraft.world.level.block.state.BlockState>> prepareForPlace(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.Level level, net.minecraft.world.level.block.state.BlockState state, boolean dropBlock)
    • 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.world.level.LevelAccessor level, net.minecraft.core.BlockPos pos)
      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

      @Deprecated default boolean extraSurviveRequirements(net.minecraft.world.level.LevelReader level, net.minecraft.core.BlockPos pos, net.minecraft.world.level.block.state.BlockState state)
      Extra requirements for the block to survive or be placed, runs for every single block in the multiblock
    • 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)