Package alexiil.mc.lib.multipart.api
Interface SubdividedPart<Sub>
public interface SubdividedPart<Sub>
Optional interface for
AbstractPart implementations which can have sub-parts targeted and broken instead of
the whole thing.-
Method Summary
-
Method Details
-
getSubpartKeyClass
-
onSubpartBreakStart
Multipart version ofAbstractBlock.onBlockBreakStart(BlockState, World, BlockPos, PlayerEntity) -
calcSubpartBreakingDelta
Multipart version ofAbstractBlock.calcBlockBreakingDelta(BlockState, PlayerEntity, BlockView, BlockPos) -
onSubpartBreak
Multipart version ofBlock.onBreak(World, BlockPos, BlockState, PlayerEntity).- Returns:
- True if this should prevent Block.onBreak from being called afterwards, false otherwise.
-
clearSubpart
Called instead ofWorld.removeBlock(BlockPos, boolean)inServerPlayerInteractionManager.tryBreakBlock(net.minecraft.util.math.BlockPos).Generally this should remove the subpart from this
AbstractPart, or return false if the whole part needs to be removed from it's container.- Returns:
- True if this should prevent
MultipartContainer.removePart(AbstractPart)from being called, false otherwise.
-
onSubpartBroken
Multipart version ofBlock.onBroken(WorldAccess, BlockPos, BlockState) -
afterSubpartBreak
Multipart version ofBlock.afterBreak(World, PlayerEntity, BlockPos, BlockState, BlockEntity, ItemStack). -
getSubpartDynamicShape
Subpart equivalent toAbstractPart.getDynamicShape(float). If the given part is invalid then this should returnAbstractPart.getDynamicShape(float). -
spawnBreakingParticles
-
getTargetedSubpart
- Parameters:
hitVec- The exact hit position, relative the the world's origin. (So you need to subtract the position of this part to get a position between 0 and 1).- Returns:
- The targeted subpart, or null if the given position doesn't intersect with a subpart.
-
playHitSound
-