Class AbstractMultipartBlock

java.lang.Object
net.minecraft.world.level.block.state.BlockBehaviour
net.minecraft.world.level.block.Block
net.liukrast.multipart.block.AbstractMultipartBlock
All Implemented Interfaces:
IMultipartBlock, net.minecraft.world.flag.FeatureElement, net.minecraft.world.level.ItemLike, net.neoforged.neoforge.common.extensions.IBlockExtension
Direct Known Subclasses:
AbstractFacingMultipartBlock, ExampleMultipartBlock

public abstract class AbstractMultipartBlock extends net.minecraft.world.level.block.Block implements IMultipartBlock
Implementation of IMultipartBlock Most cases do not need you to implement the interface, but to use this abstract class instead If you want to see an example implementation, check ExampleMultipartBlock
  • Nested Class Summary

    Nested Classes
    Modifier and Type
    Class
    Description
    static class 
    Builder to define relative positions of multipart block parts.

    Nested classes/interfaces inherited from class net.minecraft.world.level.block.Block

    net.minecraft.world.level.block.Block.BlockStatePairKey

    Nested classes/interfaces inherited from class net.minecraft.world.level.block.state.BlockBehaviour

    net.minecraft.world.level.block.state.BlockBehaviour.BlockStateBase, net.minecraft.world.level.block.state.BlockBehaviour.OffsetFunction, net.minecraft.world.level.block.state.BlockBehaviour.OffsetType, net.minecraft.world.level.block.state.BlockBehaviour.Properties, net.minecraft.world.level.block.state.BlockBehaviour.StateArgumentPredicate<A>, net.minecraft.world.level.block.state.BlockBehaviour.StatePredicate
  • Field Summary

    Fields inherited from class net.minecraft.world.level.block.Block

    BLOCK_STATE_REGISTRY, CODEC, INDESTRUCTIBLE, INSTANT, stateDefinition, UPDATE_ALL, UPDATE_ALL_IMMEDIATE, UPDATE_CLIENTS, UPDATE_IMMEDIATE, UPDATE_INVISIBLE, UPDATE_KNOWN_SHAPE, UPDATE_LIMIT, UPDATE_MOVE_BY_PISTON, UPDATE_NEIGHBORS, UPDATE_NONE, UPDATE_SUPPRESS_DROPS

    Fields inherited from class net.minecraft.world.level.block.state.BlockBehaviour

    drops, dynamicShape, explosionResistance, friction, hasCollision, isRandomlyTicking, jumpFactor, properties, requiredFeatures, soundType, speedFactor, UPDATE_SHAPE_ORDER

    Fields inherited from interface net.minecraft.world.flag.FeatureElement

    FILTERED_REGISTRIES
  • Constructor Summary

    Constructors
    Constructor
    Description
    AbstractMultipartBlock(net.minecraft.world.level.block.state.BlockBehaviour.Properties properties)
    Constructor for the block.
  • Method Summary

    Modifier and Type
    Method
    Description
    boolean
    canSurvive(@NotNull net.minecraft.world.level.block.state.BlockState state, @NotNull net.minecraft.world.level.LevelReader level, @NotNull net.minecraft.core.BlockPos pos)
     
    protected void
    createBlockStateDefinition(@NotNull net.minecraft.world.level.block.state.StateDefinition.Builder<net.minecraft.world.level.block.Block,net.minecraft.world.level.block.state.BlockState> builder)
     
    void
    destroy(@NotNull net.minecraft.world.level.LevelAccessor level, @NotNull net.minecraft.core.BlockPos pos, @NotNull net.minecraft.world.level.block.state.BlockState state)
     
    net.minecraft.world.level.block.state.properties.IntegerProperty
    Returns the integer property representing the part of the block.
    List<net.minecraft.core.BlockPos>
     
    void
    setPartsProperty(net.minecraft.world.level.block.state.properties.IntegerProperty property)
     
    void
    setPlacedBy(@NotNull net.minecraft.world.level.Level level, @NotNull 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)
     
    void
    setPositions(List<net.minecraft.core.BlockPos> positions)
     

    Methods inherited from class net.minecraft.world.level.block.Block

    animateTick, appendHoverText, asBlock, asItem, box, builtInRegistryHolder, byItem, canSupportCenter, canSupportRigidBlock, codec, defaultBlockState, dropFromExplosion, dropResources, dropResources, dropResources, fallOn, getCloneItemStack, getDescriptionId, getDrops, getDrops, getExplosionResistance, getFriction, getId, getJumpFactor, getName, getShapeForEachState, getSpeedFactor, getStateDefinition, getStateForPlacement, handlePrecipitation, hasDynamicShape, initializeClient, isExceptionForConnection, isFaceFull, isPossibleToRespawnInThis, isShapeFullBlock, playerDestroy, playerWillDestroy, popExperience, popResource, popResourceFromFace, pushEntitiesUp, registerDefaultState, shouldRenderFace, spawnDestroyParticles, stateById, stepOn, toString, tryDropExperience, updateEntityAfterFallOn, updateFromNeighbourShapes, updateOrDestroy, updateOrDestroy, wasExploded, withPropertiesOf

    Methods inherited from class net.minecraft.world.level.block.state.BlockBehaviour

    attack, canBeReplaced, canBeReplaced, defaultDestroyTime, defaultMapColor, entityInside, getAnalogOutputSignal, getBlockSupportShape, getCollisionShape, getDestroyProgress, getDirectSignal, getDrops, getFluidState, getInteractionShape, getLightBlock, getLootTable, getMaxHorizontalOffset, getMaxVerticalOffset, getMenuProvider, getOcclusionShape, getRenderShape, getSeed, getShadeBrightness, getShape, getSignal, getSoundType, getVisualShape, hasAnalogOutputSignal, isAir, isCollisionShapeFullBlock, isOcclusionShapeFullBlock, isPathfindable, isRandomlyTicking, isSignalSource, mirror, neighborChanged, onExplosionHit, onPlace, onProjectileHit, onRemove, propagatesSkylightDown, properties, propertiesCodec, randomTick, requiredFeatures, rotate, simpleCodec, skipRendering, spawnAfterBreak, tick, triggerEvent, updateIndirectNeighbourShapes, updateShape, useItemOn, useShapeForLightOcclusion, useWithoutItem

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait

    Methods inherited from interface net.minecraft.world.flag.FeatureElement

    isEnabled

    Methods inherited from interface net.neoforged.neoforge.common.extensions.IBlockExtension

    addLandingEffects, addRunningEffects, canBeHydrated, canConnectRedstone, canDropFromExplosion, canEntityDestroy, canHarvestBlock, canStickTo, canSustainPlant, collisionExtendsVertically, getAdjacentBlockPathType, getAppearance, getBeaconColorMultiplier, getBedDirection, getBlockPathType, getBubbleColumnDirection, getCloneItemStack, getEnchantPowerBonus, getExpDrop, getExplosionResistance, getFireSpreadSpeed, getFlammability, getFriction, getLightEmission, getMapColor, getPistonPushReaction, getRespawnPosition, getSoundType, getStateAtViewpoint, getToolModifiedState, getWeakChanges, hasDynamicLightEmission, hidesNeighborFace, isBed, isBurning, isConduitFrame, isEmpty, isFertile, isFireSource, isFlammable, isLadder, isPortalFrame, isScaffolding, isSlimeBlock, isStickyBlock, makesOpenTrapdoorAboveClimbable, onBlockExploded, onBlockStateChange, onCaughtFire, onDestroyedByPlayer, onDestroyedByPushReaction, onNeighborChange, onTreeGrow, rotate, setBedOccupied, shouldCheckWeakPower, shouldDisplayFluidOverlay, shouldHideAdjacentFluidFace, supportsExternalFaceHiding

    Methods inherited from interface net.liukrast.multipart.block.IMultipartBlock

    createBlockStateDefinition$multipart, defineParts, forEachElement, getDirection, getOrigin, getRelative, size
  • Constructor Details

    • AbstractMultipartBlock

      public AbstractMultipartBlock(net.minecraft.world.level.block.state.BlockBehaviour.Properties properties)
      Constructor for the block.
      Parameters:
      properties - the block properties.
  • Method Details

    • getPositions

      public List<net.minecraft.core.BlockPos> getPositions()
      Specified by:
      getPositions in interface IMultipartBlock
    • setPositions

      public void setPositions(List<net.minecraft.core.BlockPos> positions)
      Specified by:
      setPositions in interface IMultipartBlock
    • getPartsProperty

      public net.minecraft.world.level.block.state.properties.IntegerProperty getPartsProperty()
      Description copied from interface: IMultipartBlock
      Returns the integer property representing the part of the block.
      Specified by:
      getPartsProperty in interface IMultipartBlock
      Returns:
      the IntegerProperty associated with the parts.
    • setPartsProperty

      public void setPartsProperty(net.minecraft.world.level.block.state.properties.IntegerProperty property)
      Specified by:
      setPartsProperty in interface IMultipartBlock
    • setPlacedBy

      public void setPlacedBy(@NotNull @NotNull net.minecraft.world.level.Level level, @NotNull @NotNull 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)
      Specified by:
      setPlacedBy in interface IMultipartBlock
      Overrides:
      setPlacedBy in class net.minecraft.world.level.block.Block
    • createBlockStateDefinition

      protected void createBlockStateDefinition(@NotNull net.minecraft.world.level.block.state.StateDefinition.Builder<net.minecraft.world.level.block.Block,net.minecraft.world.level.block.state.BlockState> builder)
      Overrides:
      createBlockStateDefinition in class net.minecraft.world.level.block.Block
    • canSurvive

      public 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)
      Specified by:
      canSurvive in interface IMultipartBlock
      Overrides:
      canSurvive in class net.minecraft.world.level.block.state.BlockBehaviour
    • destroy

      public 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)
      Specified by:
      destroy in interface IMultipartBlock
      Overrides:
      destroy in class net.minecraft.world.level.block.Block