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
-
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, @Nullable net.minecraft.world.entity.Entity player, boolean ignoreEntities) default booleancanReplaceBlock(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 shapedefault booleancanSurviveHelper(net.minecraft.world.level.block.state.BlockState state, net.minecraft.world.level.LevelReader level, net.minecraft.core.BlockPos pos) Helper for Block.canSurvive()default voiddestroy(net.minecraft.core.BlockPos center, net.minecraft.world.level.LevelAccessor level, net.minecraft.world.level.block.state.BlockState state, boolean dropBlock) default booleanentityUnobstructed(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 booleanextraSurviveRequirements(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 multiblockstatic net.minecraft.core.BlockPosgetCenter(net.minecraft.world.level.BlockGetter level, net.minecraft.core.BlockPos pos) Returns the center BlockPos of the multiblockdefault @Nullable net.minecraft.core.DirectiongetDirection(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.BlockPosgetOffset(net.minecraft.world.level.BlockGetter level, net.minecraft.core.BlockPos pos) Returns the offset BlockPos from center of the multiblockdefault net.minecraft.world.level.block.state.BlockStategetStateForEachBlock(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.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)static voidinvalidateCaches(net.minecraft.world.level.BlockGetter level, net.minecraft.core.BlockPos pos) static booleanisCenter(net.minecraft.world.level.block.state.BlockState state) static booleanisMultiblock(net.minecraft.world.level.block.state.BlockState state) static booleanisMultiblock(net.minecraft.world.level.BlockGetter level, net.minecraft.core.BlockPos pos) static booleanisSameMultiblock(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 voidonPlaceHelper(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 voidplace(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 centerstatic List<net.minecraft.core.BlockPos> posStreamToList(Stream<net.minecraft.core.BlockPos> posStream) Mojangs BetweenClosed methods return a mutable BlockPos, which breaks everything.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 Placeddefault 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.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 voidverifyValidBlockEntity(net.minecraft.world.level.Level level, net.minecraft.core.BlockPos pos) 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 blockMethods inherited from interface net.minecraft.world.level.block.EntityBlock
getListener, getTicker, newBlockEntityMethods inherited from interface IMBStateSharer
createSharedBlockStates, getSharedStateProperties, getSharedStatePropertiesBuilder, shareBlockStates
-
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 placedblockEntity- null when being placeddirection- present only whengetDirectionProperty()is overridden with a valid property- See Also:
-
posStreamToList
-
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
-
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, @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 intoBlock.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)
-