Package com.minecolonies.api.blocks
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.BlockStatePairKeyNested 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
FieldsModifier and TypeFieldDescriptionstatic final net.minecraft.world.level.block.state.properties.DirectionPropertyThe direction the block is facing.static final floatThe default hardness.static final floatThe 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_DROPSFields inherited from class net.minecraft.world.level.block.state.BlockBehaviour
drops, dynamicShape, explosionResistance, friction, hasCollision, isRandomlyTicking, jumpFactor, properties, requiredFeatures, soundType, speedFactor, UPDATE_SHAPE_ORDERFields inherited from interface net.minecraft.world.flag.FeatureElement
FILTERED_REGISTRIES -
Constructor Summary
ConstructorsConstructorDescriptionConstructor for a hut block.AbstractColonyBlock(net.minecraft.world.level.block.state.BlockBehaviour.Properties properties) Constructor for a hut block. -
Method Summary
Modifier and TypeMethodDescriptionprotected voidcreateBlockStateDefinition(net.minecraft.world.level.block.state.StateDefinition.Builder<net.minecraft.world.level.block.Block, net.minecraft.world.level.block.state.BlockState> builder) abstract BuildingEntryMethod to get the building registry entry.floatgetDestroyProgress(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 StringMethod to return the name of the block.net.minecraft.resources.ResourceLocationGet the registry name frm the blck hut.@NotNull net.minecraft.world.phys.shapes.VoxelShapegetShape(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.BlockStategetStateForPlacement(net.minecraft.world.item.context.BlockPlaceContext context) @Nullable net.minecraft.world.level.block.entity.BlockEntitynewBlockEntity(@NotNull net.minecraft.core.BlockPos blockPos, @NotNull net.minecraft.world.level.block.state.BlockState blockState) voidonRemove(@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.voidregisterBlockItem(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.BlockStaterotate(net.minecraft.world.level.block.state.BlockState state, net.minecraft.world.level.block.Rotation rot) voidsetPlacedBy(@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.InteractionResultuse(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, withPropertiesOfMethods 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, useShapeForLightOcclusionMethods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, waitMethods inherited from interface net.minecraft.world.level.block.EntityBlock
getListenerMethods inherited from interface net.minecraft.world.flag.FeatureElement
isEnabledMethods 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, supportsExternalFaceHidingMethods inherited from interface com.minecolonies.api.blocks.interfaces.ITickableBlockMinecolonies
getTicker
-
Field Details
-
FACING
public static final net.minecraft.world.level.block.state.properties.DirectionProperty FACINGThe direction the block is facing. -
HARDNESS
public static final float HARDNESSThe default hardness.- See Also:
-
RESISTANCE
public static final float RESISTANCEThe 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:
getDestroyProgressin classnet.minecraft.world.level.block.state.BlockBehaviour
-
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:
newBlockEntityin interfacenet.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:
onRemovein classnet.minecraft.world.level.block.state.BlockBehaviour
-
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:
getShapein classnet.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:
usein classnet.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:
getStateForPlacementin classnet.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:
rotatein classnet.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:
setPlacedByin classnet.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:
createBlockStateDefinitionin classnet.minecraft.world.level.block.Block
-
getRegistryName
public net.minecraft.resources.ResourceLocation getRegistryName()Get the registry name frm the blck hut.- Specified by:
getRegistryNamein interfaceIBlockMinecolonies<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:IBlockMinecoloniesRegistery block at gameregistry.- Specified by:
registerBlockin interfaceIBlockMinecolonies<B extends AbstractColonyBlock<B>>- Overrides:
registerBlockin classAbstractBlockMinecolonies<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:IBlockMinecoloniesRegistery block at gameregistry.- Specified by:
registerBlockItemin interfaceIBlockMinecolonies<B extends AbstractColonyBlock<B>>- Overrides:
registerBlockItemin classAbstractBlockMinecolonies<B extends AbstractColonyBlock<B>>- Parameters:
registry- the registry to use.properties- the item properties.
-