Class AbstractColonyBlock<B extends AbstractColonyBlock<B>>

java.lang.Object
net.minecraft.world.level.block.state.BlockBehaviour
net.minecraft.world.level.block.Block
com.minecolonies.api.blocks.AbstractBlockMinecolonies<B>
com.minecolonies.api.blocks.AbstractColonyBlock<B>
All Implemented Interfaces:
IBlockMinecolonies<B>, ITickableBlockMinecolonies, IBuilderUndestroyable, net.minecraft.world.flag.FeatureElement, net.minecraft.world.level.block.EntityBlock, net.minecraft.world.level.ItemLike, net.minecraftforge.common.extensions.IForgeBlock
Direct Known Subclasses:
AbstractBlockHut, BlockPostBox, BlockStash

public abstract class AbstractColonyBlock<B extends AbstractColonyBlock<B>> extends AbstractBlockMinecolonies<B> implements IBuilderUndestroyable, ITickableBlockMinecolonies
Base class for all blocks that have a functionality within a colony. This applies to both buildings as well as functional blocks like postbox/stash.
  • Nested Class Summary

    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 extends Object>, net.minecraft.world.level.block.state.BlockBehaviour.StatePredicate
  • Field Summary

    Fields
    Modifier and Type
    Field
    Description
    static final net.minecraft.world.level.block.state.properties.DirectionProperty
    The direction the block is facing.
    static final float
    The default hardness.
    static final float
    The default resistance (against explosions).

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

    BLOCK_STATE_REGISTRY, 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
    Constructor for a hut block.
    AbstractColonyBlock(net.minecraft.world.level.block.state.BlockBehaviour.Properties properties)
    Constructor for a hut block.
  • Method Summary

    Modifier and Type
    Method
    Description
    protected void
    createBlockStateDefinition(net.minecraft.world.level.block.state.StateDefinition.Builder<net.minecraft.world.level.block.Block,net.minecraft.world.level.block.state.BlockState> builder)
     
    abstract BuildingEntry
    Method to get the building registry entry.
    float
    getDestroyProgress(net.minecraft.world.level.block.state.BlockState state, @NotNull net.minecraft.world.entity.player.Player player, @NotNull net.minecraft.world.level.BlockGetter world, @NotNull net.minecraft.core.BlockPos pos)
     
    abstract String
    Method to return the name of the block.
    net.minecraft.resources.ResourceLocation
    Get the registry name frm the blck hut.
    @NotNull net.minecraft.world.phys.shapes.VoxelShape
    getShape(net.minecraft.world.level.block.state.BlockState state, net.minecraft.world.level.BlockGetter worldIn, net.minecraft.core.BlockPos pos, net.minecraft.world.phys.shapes.CollisionContext context)
     
    @Nullable net.minecraft.world.level.block.state.BlockState
    getStateForPlacement(net.minecraft.world.item.context.BlockPlaceContext context)
     
    @Nullable net.minecraft.world.level.block.entity.BlockEntity
    newBlockEntity(@NotNull net.minecraft.core.BlockPos blockPos, @NotNull net.minecraft.world.level.block.state.BlockState blockState)
     
    void
    onRemove(@NotNull net.minecraft.world.level.block.state.BlockState blockState, @NotNull net.minecraft.world.level.Level level, @NotNull net.minecraft.core.BlockPos pos, @NotNull net.minecraft.world.level.block.state.BlockState newBlockState, boolean p_60519_)
     
    registerBlock(net.minecraftforge.registries.IForgeRegistry<net.minecraft.world.level.block.Block> registry)
    Registery block at gameregistry.
    void
    registerBlockItem(net.minecraftforge.registries.IForgeRegistry<net.minecraft.world.item.Item> registry, net.minecraft.world.item.Item.Properties properties)
    Registery block at gameregistry.
    @NotNull net.minecraft.world.level.block.state.BlockState
    rotate(net.minecraft.world.level.block.state.BlockState state, net.minecraft.world.level.block.Rotation rot)
     
    void
    setPlacedBy(@NotNull net.minecraft.world.level.Level worldIn, @NotNull net.minecraft.core.BlockPos pos, net.minecraft.world.level.block.state.BlockState state, net.minecraft.world.entity.LivingEntity placer, net.minecraft.world.item.ItemStack stack)
     
    @NotNull net.minecraft.world.InteractionResult
    use(net.minecraft.world.level.block.state.BlockState state, net.minecraft.world.level.Level worldIn, net.minecraft.core.BlockPos pos, net.minecraft.world.entity.player.Player player, net.minecraft.world.InteractionHand hand, net.minecraft.world.phys.BlockHitResult ray)
     

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

    animateTick, appendHoverText, asBlock, asItem, box, builtInRegistryHolder, byItem, canSupportCenter, canSupportRigidBlock, canSustainPlant, defaultBlockState, destroy, dropFromExplosion, dropResources, dropResources, dropResources, dropResources, fallOn, getCloneItemStack, getDescriptionId, getDrops, getDrops, getExplosionResistance, getFriction, getId, getJumpFactor, getName, getRenderPropertiesInternal, getShapeForEachState, getSoundType, getSpeedFactor, getStateDefinition, handlePrecipitation, hasDynamicShape, initializeClient, isExceptionForConnection, isFaceFull, isPossibleToRespawnInThis, isRandomlyTicking, isShapeFullBlock, playerDestroy, playerWillDestroy, popExperience, popResource, popResourceFromFace, propagatesSkylightDown, 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, canSurvive, defaultDestroyTime, defaultMapColor, entityInside, getAnalogOutputSignal, getBlockSupportShape, getCollisionShape, getDirectSignal, getDrops, getFluidState, getInteractionShape, getLightBlock, getLootTable, getMaxHorizontalOffset, getMaxVerticalOffset, getMenuProvider, getOcclusionShape, getRenderShape, getSeed, getShadeBrightness, getSignal, getVisualShape, hasAnalogOutputSignal, isAir, isCollisionShapeFullBlock, isOcclusionShapeFullBlock, isPathfindable, isSignalSource, mirror, neighborChanged, onPlace, onProjectileHit, randomTick, requiredFeatures, skipRendering, spawnAfterBreak, tick, triggerEvent, updateIndirectNeighbourShapes, updateShape, useShapeForLightOcclusion

    Methods inherited from class java.lang.Object

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

    Methods inherited from interface net.minecraft.world.level.block.EntityBlock

    getListener

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

    isEnabled

    Methods inherited from interface net.minecraftforge.common.extensions.IForgeBlock

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

    Methods inherited from interface com.minecolonies.api.blocks.interfaces.ITickableBlockMinecolonies

    getTicker
  • Field Details

    • FACING

      public static final net.minecraft.world.level.block.state.properties.DirectionProperty FACING
      The direction the block is facing.
    • HARDNESS

      public static final float HARDNESS
      The default hardness.
      See Also:
    • RESISTANCE

      public static final float RESISTANCE
      The default resistance (against explosions).
      See Also:
  • Constructor Details

    • AbstractColonyBlock

      public AbstractColonyBlock()
      Constructor for a hut block.

      Registers the block, sets the creative tab, as well as the resistance and the hardness.

    • AbstractColonyBlock

      public AbstractColonyBlock(net.minecraft.world.level.block.state.BlockBehaviour.Properties properties)
      Constructor for a hut block.

      Registers the block, sets the creative tab, as well as the resistance and the hardness.

      Parameters:
      properties - custom properties.
  • Method Details

    • getDestroyProgress

      public float getDestroyProgress(net.minecraft.world.level.block.state.BlockState state, @NotNull @NotNull net.minecraft.world.entity.player.Player player, @NotNull @NotNull net.minecraft.world.level.BlockGetter world, @NotNull @NotNull net.minecraft.core.BlockPos pos)
      Overrides:
      getDestroyProgress in class net.minecraft.world.level.block.state.BlockBehaviour
    • getHutName

      public abstract String getHutName()
      Method to return the name of the block.
      Returns:
      Name of the block.
    • newBlockEntity

      @Nullable public @Nullable net.minecraft.world.level.block.entity.BlockEntity newBlockEntity(@NotNull @NotNull net.minecraft.core.BlockPos blockPos, @NotNull @NotNull net.minecraft.world.level.block.state.BlockState blockState)
      Specified by:
      newBlockEntity in interface net.minecraft.world.level.block.EntityBlock
    • onRemove

      public void onRemove(@NotNull @NotNull net.minecraft.world.level.block.state.BlockState blockState, @NotNull @NotNull net.minecraft.world.level.Level level, @NotNull @NotNull net.minecraft.core.BlockPos pos, @NotNull @NotNull net.minecraft.world.level.block.state.BlockState newBlockState, boolean p_60519_)
      Overrides:
      onRemove in class net.minecraft.world.level.block.state.BlockBehaviour
    • getBuildingEntry

      public abstract BuildingEntry getBuildingEntry()
      Method to get the building registry entry.
      Returns:
      The building entry.
    • getShape

      @NotNull public @NotNull net.minecraft.world.phys.shapes.VoxelShape getShape(net.minecraft.world.level.block.state.BlockState state, net.minecraft.world.level.BlockGetter worldIn, net.minecraft.core.BlockPos pos, net.minecraft.world.phys.shapes.CollisionContext context)
      Overrides:
      getShape in class net.minecraft.world.level.block.state.BlockBehaviour
    • use

      @NotNull public @NotNull net.minecraft.world.InteractionResult use(net.minecraft.world.level.block.state.BlockState state, net.minecraft.world.level.Level worldIn, net.minecraft.core.BlockPos pos, net.minecraft.world.entity.player.Player player, net.minecraft.world.InteractionHand hand, net.minecraft.world.phys.BlockHitResult ray)
      Overrides:
      use in class net.minecraft.world.level.block.state.BlockBehaviour
    • getStateForPlacement

      @Nullable public @Nullable net.minecraft.world.level.block.state.BlockState getStateForPlacement(net.minecraft.world.item.context.BlockPlaceContext context)
      Overrides:
      getStateForPlacement in class net.minecraft.world.level.block.Block
    • rotate

      @NotNull public @NotNull net.minecraft.world.level.block.state.BlockState rotate(net.minecraft.world.level.block.state.BlockState state, net.minecraft.world.level.block.Rotation rot)
      Overrides:
      rotate in class net.minecraft.world.level.block.state.BlockBehaviour
    • setPlacedBy

      public void setPlacedBy(@NotNull @NotNull net.minecraft.world.level.Level worldIn, @NotNull @NotNull net.minecraft.core.BlockPos pos, net.minecraft.world.level.block.state.BlockState state, net.minecraft.world.entity.LivingEntity placer, net.minecraft.world.item.ItemStack stack)
      Overrides:
      setPlacedBy in class net.minecraft.world.level.block.Block
    • createBlockStateDefinition

      protected void createBlockStateDefinition(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
    • getRegistryName

      public net.minecraft.resources.ResourceLocation getRegistryName()
      Get the registry name frm the blck hut.
      Specified by:
      getRegistryName in interface IBlockMinecolonies<B extends AbstractColonyBlock<B>>
      Returns:
      the key.
    • registerBlock

      public B registerBlock(net.minecraftforge.registries.IForgeRegistry<net.minecraft.world.level.block.Block> registry)
      Description copied from interface: IBlockMinecolonies
      Registery block at gameregistry.
      Specified by:
      registerBlock in interface IBlockMinecolonies<B extends AbstractColonyBlock<B>>
      Overrides:
      registerBlock in class AbstractBlockMinecolonies<B extends AbstractColonyBlock<B>>
      Parameters:
      registry - the registry to use.
      Returns:
      the block itself.
    • registerBlockItem

      public void registerBlockItem(net.minecraftforge.registries.IForgeRegistry<net.minecraft.world.item.Item> registry, net.minecraft.world.item.Item.Properties properties)
      Description copied from interface: IBlockMinecolonies
      Registery block at gameregistry.
      Specified by:
      registerBlockItem in interface IBlockMinecolonies<B extends AbstractColonyBlock<B>>
      Overrides:
      registerBlockItem in class AbstractBlockMinecolonies<B extends AbstractColonyBlock<B>>
      Parameters:
      registry - the registry to use.
      properties - the item properties.