Interface IMultiBlock
- All Superinterfaces:
IMBStateSyncer
- All Known Subinterfaces:
IExpandingMultiblock,IMovableMultiblock,IPreviewableMultiblock
- All Known Implementing Classes:
AbstractMultiBlock,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, 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.Level 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, 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) Deprecated.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 net.minecraft.core.DirectiongetDirection(net.minecraft.world.level.block.state.BlockState state) default net.minecraft.world.level.block.state.properties.DirectionPropertyReturns 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.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, 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.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 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.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 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.world.level.LevelAccessor level, net.minecraft.core.BlockPos pos) Helper for Block.updateShape()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.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
-
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 -
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 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.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) Deprecated.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 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)
-
extraSurviveRequirements(LevelReader, BlockPos, BlockState, BlockPos)instead