Interface IMultiBlock
- All Known Subinterfaces:
IPreviewableMultiblock
- All Known Implementing Classes:
AbstractMultiBlock,TestBlock
public interface IMultiBlock
-
Method Summary
Modifier and TypeMethodDescriptiondefault booleanallBlocksPresent(net.minecraft.world.level.LevelReader level, net.minecraft.core.BlockPos pos, net.minecraft.world.level.block.state.BlockState state) default booleancanPlace(net.minecraft.world.level.LevelReader level, net.minecraft.core.BlockPos center, net.minecraft.world.level.block.state.BlockState state) default booleancanSurviveHelper(net.minecraft.world.level.block.state.BlockState state, net.minecraft.world.level.LevelReader level, net.minecraft.core.BlockPos pos) Helper forBlockBehaviour.canSurvive(BlockState, LevelReader, BlockPos)default voiddestroy(net.minecraft.core.BlockPos center, net.minecraft.world.level.Level level, net.minecraft.world.level.block.state.BlockState state) default booleanextraSurviveRequirements(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 multiblockdefault voidfixInStructures(net.minecraft.world.level.block.state.BlockState state, net.minecraft.world.level.ServerLevelAccessor level, net.minecraft.core.BlockPos pos) Prevents desyncs and ghost blocks when multiblocks are used in structuresdefault voidfixTick(net.minecraft.world.level.block.state.BlockState state, net.minecraft.world.level.Level level, net.minecraft.core.BlockPos pos) Tries to fix the multiblock, called afterfixInStructures(BlockState, ServerLevelAccessor, BlockPos)default Stream<net.minecraft.core.BlockPos>fullBlockShape(net.minecraft.core.BlockPos center, net.minecraft.world.level.block.state.BlockState state) Stream<net.minecraft.core.BlockPos>fullBlockShape(net.minecraft.core.Direction direction, net.minecraft.core.BlockPos center) Returns a BlockPos Stream of every block in this multiblock.default net.minecraft.world.level.block.BlockgetBlock()static net.minecraft.core.BlockPosgetCenter(net.minecraft.world.level.BlockGetter level, net.minecraft.core.BlockPos pos) Returns the center BlockPos of the multiblockdefault net.minecraft.core.DirectiongetDirection(net.minecraft.world.level.block.state.BlockState state) default net.minecraft.world.level.block.state.properties.DirectionPropertyReturns the multiblocks DirectionProperty.static Stream<net.minecraft.core.BlockPos>getFullShape(net.minecraft.world.level.Level level, net.minecraft.core.BlockPos pos) default intgetMaxAge(net.minecraft.world.level.block.state.properties.IntegerProperty ageProperty) default net.minecraft.world.level.block.state.BlockStategetStateForPlacementHelper(net.minecraft.world.item.context.BlockPlaceContext context) default net.minecraft.world.level.block.state.BlockStategetStateForPlacementHelper(net.minecraft.world.item.context.BlockPlaceContext context, net.minecraft.core.Direction direction) Helper forBlock.getStateForPlacement(BlockPlaceContext)default BiFunction<net.minecraft.world.level.block.state.BlockState,net.minecraft.core.BlockPos, net.minecraft.world.level.block.state.BlockState> Changes the BlockState for each Block based on its offset from centerstatic intgetXOffset(net.minecraft.world.level.BlockGetter level, net.minecraft.core.BlockPos pos) static intgetYOffset(net.minecraft.world.level.BlockGetter level, net.minecraft.core.BlockPos pos) static intgetZOffset(net.minecraft.world.level.BlockGetter level, net.minecraft.core.BlockPos pos) default voidgrowHelper(net.minecraft.world.level.Level level, net.minecraft.core.BlockPos blockPos, net.minecraft.world.level.block.state.properties.IntegerProperty ageProperty) Increases age in each block at the same timedefault booleanisBroken(net.minecraft.world.level.LevelReader level, net.minecraft.core.BlockPos pos, net.minecraft.world.level.block.state.BlockState state) Checks if the multiblock needs fixing byfixTick(BlockState, Level, BlockPos)static booleanisCenter(net.minecraft.world.level.block.state.BlockState state) static booleanisCenter(net.minecraft.world.level.LevelReader level, net.minecraft.core.BlockPos pos) static booleanisMultiblock(net.minecraft.world.level.block.state.BlockState state) static booleanisMultiblock(net.minecraft.world.level.BlockGetter level, net.minecraft.core.BlockPos pos) default voidplace(net.minecraft.world.level.Level level, net.minecraft.core.BlockPos posOriginal, net.minecraft.world.level.block.state.BlockState stateOriginal) Places the multiblock, sets its BlockStates and BlockEntity centerdefault voidpreventCreativeDrops(net.minecraft.world.entity.player.Player player, net.minecraft.world.level.Level level, net.minecraft.core.BlockPos pos) Should be added intoBlock.playerDestroy(Level, Player, BlockPos, BlockState, BlockEntity, ItemStack)default net.minecraft.world.level.block.state.BlockStateupdateShapeHelper(net.minecraft.world.level.block.state.BlockState state, net.minecraft.world.level.LevelAccessor level, net.minecraft.core.BlockPos pos) Helper forBlockBehaviour.updateShape(BlockState, Direction, BlockState, LevelAccessor, BlockPos, BlockPos)default net.minecraft.world.phys.shapes.VoxelShapevoxelShapeHelper(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.VoxelShapevoxelShapeHelper(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.VoxelShapevoxelShapeHelper(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
-
Method Details
-
fullBlockShape
Stream<net.minecraft.core.BlockPos> fullBlockShape(@Nullable net.minecraft.core.Direction direction, net.minecraft.core.BlockPos center) Returns a BlockPos Stream of every block in this multiblock. -
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) -
getBlock
default net.minecraft.world.level.block.Block getBlock() -
fullBlockShape
default Stream<net.minecraft.core.BlockPos> fullBlockShape(net.minecraft.core.BlockPos center, @Nullable net.minecraft.world.level.block.state.BlockState state) -
getFullShape
static Stream<net.minecraft.core.BlockPos> getFullShape(net.minecraft.world.level.Level level, net.minecraft.core.BlockPos pos) -
getStateFromOffset
@Nullable default BiFunction<net.minecraft.world.level.block.state.BlockState,net.minecraft.core.BlockPos, getStateFromOffset()net.minecraft.world.level.block.state.BlockState> Changes the BlockState for each Block based on its offset from centerCode Example:
((state, pos) -> state.setValue(yourStateProperty, IBlockPosOffsetEnum.fromOffset(params)))
-
place
default void place(net.minecraft.world.level.Level level, net.minecraft.core.BlockPos posOriginal, net.minecraft.world.level.block.state.BlockState stateOriginal) Places the multiblock, sets its BlockStates and BlockEntity center -
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 forBlock.getStateForPlacement(BlockPlaceContext)- Parameters:
direction- The direction the block will have when placed, ignored whengetDirectionProperty()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) -
destroy
default void destroy(net.minecraft.core.BlockPos center, net.minecraft.world.level.Level 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.world.level.LevelAccessor level, net.minecraft.core.BlockPos pos) Helper forBlockBehaviour.updateShape(BlockState, Direction, BlockState, LevelAccessor, BlockPos, BlockPos)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 forBlockBehaviour.canSurvive(BlockState, LevelReader, BlockPos) -
extraSurviveRequirements
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 -
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 intoBlock.playerDestroy(Level, Player, BlockPos, BlockState, BlockEntity, ItemStack) -
fixInStructures
default void fixInStructures(net.minecraft.world.level.block.state.BlockState state, net.minecraft.world.level.ServerLevelAccessor level, net.minecraft.core.BlockPos pos) Prevents desyncs and ghost blocks when multiblocks are used in structures -
fixTick
default void fixTick(net.minecraft.world.level.block.state.BlockState state, net.minecraft.world.level.Level level, net.minecraft.core.BlockPos pos) Tries to fix the multiblock, called afterfixInStructures(BlockState, ServerLevelAccessor, BlockPos) -
isBroken
default boolean isBroken(net.minecraft.world.level.LevelReader level, net.minecraft.core.BlockPos pos, net.minecraft.world.level.block.state.BlockState state) Checks if the multiblock needs fixing byfixTick(BlockState, Level, BlockPos) -
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 -
isCenter
static boolean isCenter(net.minecraft.world.level.LevelReader level, net.minecraft.core.BlockPos pos) -
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) -
getXOffset
static int getXOffset(net.minecraft.world.level.BlockGetter level, net.minecraft.core.BlockPos pos) -
getYOffset
static int getYOffset(net.minecraft.world.level.BlockGetter level, net.minecraft.core.BlockPos pos) -
getZOffset
static int getZOffset(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
-
growHelper
default void growHelper(net.minecraft.world.level.Level level, net.minecraft.core.BlockPos blockPos, net.minecraft.world.level.block.state.properties.IntegerProperty ageProperty) Increases age in each block at the same timeIf used in the randomTick method, don't forget to check
isCenter(BlockState)first, otherwise the block will grow significantly faster (each block tick separately) -
getMaxAge
default int getMaxAge(net.minecraft.world.level.block.state.properties.IntegerProperty ageProperty)
-