Package net.liukrast.multipart.block
Interface IMultipartBlock
- All Known Implementing Classes:
AbstractFacingMultipartBlock,AbstractMultipartBlock,ExampleFacingMultipartBlock,ExampleMultipartBlock
public interface IMultipartBlock
Unimplemented version of
AbstractMultipartBlock. You will have to introduce-
Method Summary
Modifier and TypeMethodDescriptiondefault booleancanSurvive(@NotNull net.minecraft.world.level.block.state.BlockState state, @NotNull net.minecraft.world.level.LevelReader level, @NotNull net.minecraft.core.BlockPos pos) default voidcreateBlockStateDefinition$multipart(net.minecraft.world.level.block.state.StateDefinition.Builder<net.minecraft.world.level.block.Block, net.minecraft.world.level.block.state.BlockState> builder) voidAbstract method to define the relative positions of the block parts.default voiddestroy(@NotNull net.minecraft.world.level.LevelAccessor level, @NotNull net.minecraft.core.BlockPos pos, @NotNull net.minecraft.world.level.block.state.BlockState state) default voidforEachElement(net.minecraft.core.BlockPos pos, net.minecraft.world.level.block.state.BlockState state, Consumer<net.minecraft.core.BlockPos> consumer) Performs an operation on every part of the multipart block.default net.minecraft.core.DirectiongetDirection(net.minecraft.world.level.block.state.BlockState state) Returns the direction of the block.default net.minecraft.core.BlockPosgetOrigin(net.minecraft.core.BlockPos pos, net.minecraft.core.BlockPos statePos, net.minecraft.core.Direction direction) Calculates the origin position of the multipart given a position and direction.net.minecraft.world.level.block.state.properties.IntegerPropertyReturns the integer property representing the part of the block.List<net.minecraft.core.BlockPos> default net.minecraft.core.BlockPosgetRelative(net.minecraft.core.BlockPos pos, net.minecraft.core.BlockPos statePos, net.minecraft.core.Direction direction) Calculates the relative position of a part from the origin.voidsetPartsProperty(net.minecraft.world.level.block.state.properties.IntegerProperty property) default voidsetPlacedBy(@NotNull net.minecraft.world.level.Level level, net.minecraft.core.BlockPos pos, @NotNull net.minecraft.world.level.block.state.BlockState state, net.minecraft.world.entity.LivingEntity placer, @NotNull net.minecraft.world.item.ItemStack stack) voidsetPositions(List<net.minecraft.core.BlockPos> positions) default intsize()Returns the total number of parts composing the multipart block.
-
Method Details
-
defineParts
Abstract method to define the relative positions of the block parts.- Parameters:
builder- the builder used to define positions.
-
getDirection
default net.minecraft.core.Direction getDirection(net.minecraft.world.level.block.state.BlockState state) Returns the direction of the block.- Parameters:
state- the block state.- Returns:
- the block direction (default NORTH).
-
getPositions
-
setPositions
-
getPartsProperty
net.minecraft.world.level.block.state.properties.IntegerProperty getPartsProperty()Returns the integer property representing the part of the block.- Returns:
- the IntegerProperty associated with the parts.
-
setPartsProperty
@OverrideOnly void setPartsProperty(net.minecraft.world.level.block.state.properties.IntegerProperty property) -
setPlacedBy
default void setPlacedBy(@NotNull @NotNull net.minecraft.world.level.Level level, net.minecraft.core.BlockPos pos, @NotNull @NotNull net.minecraft.world.level.block.state.BlockState state, net.minecraft.world.entity.LivingEntity placer, @NotNull @NotNull net.minecraft.world.item.ItemStack stack) -
getOrigin
default net.minecraft.core.BlockPos getOrigin(net.minecraft.core.BlockPos pos, net.minecraft.core.BlockPos statePos, net.minecraft.core.Direction direction) Calculates the origin position of the multipart given a position and direction.- Parameters:
pos- the reference position.statePos- the relative part position.direction- the block direction.- Returns:
- the origin position in the world.
-
getRelative
default net.minecraft.core.BlockPos getRelative(net.minecraft.core.BlockPos pos, net.minecraft.core.BlockPos statePos, net.minecraft.core.Direction direction) Calculates the relative position of a part from the origin.- Parameters:
pos- the origin position.statePos- the relative part position.direction- the block direction.- Returns:
- the relative position in the world.
-
forEachElement
default void forEachElement(net.minecraft.core.BlockPos pos, net.minecraft.world.level.block.state.BlockState state, Consumer<net.minecraft.core.BlockPos> consumer) Performs an operation on every part of the multipart block.- Parameters:
pos- the block position.state- the block state.consumer- the operation to perform on each part position.
-
createBlockStateDefinition$multipart
default void createBlockStateDefinition$multipart(net.minecraft.world.level.block.state.StateDefinition.Builder<net.minecraft.world.level.block.Block, net.minecraft.world.level.block.state.BlockState> builder) -
canSurvive
default boolean canSurvive(@NotNull @NotNull net.minecraft.world.level.block.state.BlockState state, @NotNull @NotNull net.minecraft.world.level.LevelReader level, @NotNull @NotNull net.minecraft.core.BlockPos pos) -
destroy
default void destroy(@NotNull @NotNull net.minecraft.world.level.LevelAccessor level, @NotNull @NotNull net.minecraft.core.BlockPos pos, @NotNull @NotNull net.minecraft.world.level.block.state.BlockState state) -
size
default int size()Returns the total number of parts composing the multipart block.- Returns:
- the number of parts.
-