Class AbstractBlock
- All Implemented Interfaces:
ToggleableFeature
- Direct Known Subclasses:
Block
blocks.
This class should not be extended directly. Extend Block instead.
Custom block behaviors are specified either through block settings or by overriding methods in this class.
Methods in this class may be executed during world generation if they take
WorldAccess as a parameter. In this case, a ChunkRegion
is passed to the parameter, which is not a subclass of World.
- API Note:
- In vanilla subclasses, these methods are called either to do the
default behavior (e.g.
super.onUse(...)). Because the methods areprotected, you must use these methods via the corresponding method inAbstractBlock.AbstractBlockState.Many methods of this class are called on both the logical client and logical server, so take caution when using those methods. The logical side can be checked using
World.isClient.Quick view
Notes: "Tall or wide block" refers to a block that has multiple parts, such as doors, sunflowers, or beds. "Neighboring block" refers to blocks adjacent to a block on all 6 sides (but not diagonally.)
Placement related methods
Block placement related methods (sorted by execution order) Method Purpose Player/dispenser Falling block setBlockStatecalloldState. canReplaceChecking if the current block can be replaced Yes Yes No newBlock. getPlacementStateGetting the placed state Yes Yes No newState. canPlaceAtChecking the block's placement restriction Yes Yes No oldState. onStateReplacedDropping inventory, updating redstone circuit, etc Yes Yes Yes newState. onBlockAddedActivating redstone component, etc Yes Yes Yes neighborState. neighborUpdateActivating neighboring redstone component, etc Yes Yes Yes oldState. prepareUpdating redstone wire connection Yes Yes Yes neighborState. getStateForNeighborUpdateChecking the neighboring block's placement restriction, updating connection, etc Yes Yes Yes newState. prepareUpdating redstone wire connection Yes Yes Yes newBlock. onPlacedPlacing the other half of tall or wide block, setting block entity's custom name, etc Yes No No Breaking related methods
Block breaking related methods (sorted by execution order) Method Purpose Player mining Explosion setBlockState/removeBlockcallbreakBlockcallstate. onBlockBreakStartDoing something when player starts breaking a block Yes No No No state. calcBlockBreakingDeltaCalculating the player's mining speed Yes No No No block. onBreakSpawning particles, breaking the other half of tall or wide block, etc Yes No No No state. onStateReplacedDropping inventory, updating redstone circuit, etc Yes Yes Yes Yes neighborState. neighborUpdateActivating neighboring redstone component, etc Yes Yes Yes Yes state. prepareUpdating redstone wire connection Yes Yes Yes Yes neighborState. getStateForNeighborUpdateChecking the neighboring block's placement restriction, updating connection, etc Yes Yes Yes Yes block. onBrokenUnused in most cases Yes No No No block. afterBreakDropping stacks, replacing the broken block with another block, etc Yes No No No state. getDroppedStacksSupplying information to loot context builder Yes Yes Yes Yes1 state. onStacksDroppedDropping experience orbs Yes Yes2 Yes Yes1 Notes:
- Called before
onStateReplacedin this case. - Called before
getDroppedStacksin this case.
- Called before
- Mappings:
Namespace Name named net/minecraft/block/AbstractBlockintermediary net/minecraft/class_4970official dtb
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic classstatic interfacestatic interfacestatic enumstatic classstatic interface -
Field Summary
FieldsModifier and TypeFieldDescriptionprotected final booleanWhether this block can be walked on or through.protected static final Direction[]protected final booleanWhether this block's collision shape can change.protected final floatThe multiplier applied to the velocity of aLivingEntitywhen it jumps off this block.protected @Nullable RegistryKey<LootTable> TheRegistryKeyof the loot table that determines what this block drops.protected final booleanWhether this block should tick when randomly selected when ticking the world.protected final FeatureSetThe set ofFeatureFlagsthat are required for this block to work correctly.protected final floatThe blast resistance of the block.protected final AbstractBlock.SettingsTheAbstractBlock.Settingsto apply to this block.protected final floatA speed reduction applied to aLivingEntitythat tries to move across this block.protected final BlockSoundGroupThe collection of sounds played when breaking, stepping on, placing, hitting (with a projectile), or falling on this block.protected final floatThe multiplier applied to the velocity of anEntitywhen it walks on this block.Fields inherited from interface net.minecraft.resource.featuretoggle.ToggleableFeature
FEATURE_ENABLED_REGISTRY_KEYS -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprotected abstract BlockasBlock()Returns the block asBlock.abstract ItemasItem()Returns the block's corresponding item.protected floatcalcBlockBreakingDelta(BlockState state, PlayerEntity player, BlockView world, BlockPos pos) protected booleancanBucketPlace(BlockState state, Fluid fluid) Returns whether a bucket can replace the block with the fluid.protected booleancanPathfindThrough(BlockState state, NavigationType type) Returns if an entity using navigation typetypecan navigate through this block.protected booleancanPlaceAt(BlockState state, WorldView world, BlockPos pos) Returns whether the block can be placed atpos.protected booleancanReplace(BlockState state, ItemPlacementContext context) Returns whether the item can replace the block.static <B extends Block>
com.mojang.serialization.MapCodec<B> createCodec(Function<AbstractBlock.Settings, B> blockFromSettings) protected @Nullable NamedScreenHandlerFactorycreateScreenHandlerFactory(BlockState state, World world, BlockPos pos) Returns the screen handler factory ornullif screen handler cannot be created.protected static <B extends Block>
com.mojang.serialization.codecs.RecordCodecBuilder<B, AbstractBlock.Settings> protected booleanemitsRedstonePower(BlockState state) Returns whether the block is capable of emitting redstone power.protected floatgetAmbientOcclusionLightLevel(BlockState state, BlockView world, BlockPos pos) protected VoxelShapegetCameraCollisionShape(BlockState state, BlockView world, BlockPos pos, ShapeContext context) protected abstract com.mojang.serialization.MapCodec<? extends Block> getCodec()protected VoxelShapegetCollisionShape(BlockState state, BlockView world, BlockPos pos, ShapeContext context) protected intgetComparatorOutput(BlockState state, World world, BlockPos pos) Returns the comparator output of the block, from0to15.protected VoxelShapegetCullingShape(BlockState state, BlockView world, BlockPos pos) getDroppedStacks(BlockState state, LootContextParameterSet.Builder builder) Returns the block's dropped item stacks.protected FluidStategetFluidState(BlockState state) Returns the state's associated fluid state.floatfinal RegistryKey<LootTable> protected floatprotected intgetOpacity(BlockState state, BlockView world, BlockPos pos) protected VoxelShapegetOutlineShape(BlockState state, BlockView world, BlockPos pos, ShapeContext context) protected VoxelShapegetRaycastShape(BlockState state, BlockView world, BlockPos pos) protected longgetRenderingSeed(BlockState state, BlockPos pos) Returns the seed value for rendering.protected BlockRenderTypegetRenderType(BlockState state) Returns the block's render type (invisible, animated, model).protected VoxelShapegetSidesShape(BlockState state, BlockView world, BlockPos pos) protected BlockSoundGroupgetSoundGroup(BlockState state) protected BlockStategetStateForNeighborUpdate(BlockState state, Direction direction, BlockState neighborState, WorldAccess world, BlockPos pos, BlockPos neighborPos) Returns the state of the block after a neighboring block's state change.protected intgetStrongRedstonePower(BlockState state, BlockView world, BlockPos pos, Direction direction) Returns the strong redstone power emitted from the block.protected floatprotected intgetWeakRedstonePower(BlockState state, BlockView world, BlockPos pos, Direction direction) Returns the weak redstone power emitted from the block.protected booleanhasComparatorOutput(BlockState state) Returns whether the block can have a comparator output.protected booleanhasRandomTicks(BlockState state) protected booleanhasSidedTransparency(BlockState state) Returns whether the block's transparency depends on the side of the block, like slabs.protected booleanisCullingShapeFullCube(BlockState state, BlockView world, BlockPos pos) protected booleanisShapeFullCube(BlockState state, BlockView world, BlockPos pos) protected booleanisSideInvisible(BlockState state, BlockState stateFrom, Direction direction) protected booleanisTransparent(BlockState state, BlockView world, BlockPos pos) protected BlockStatemirror(BlockState state, BlockMirror mirror) Returnsstatemirrored bymirror.protected voidneighborUpdate(BlockState state, World world, BlockPos pos, Block sourceBlock, BlockPos sourcePos, boolean notify) Called when a neighboring block is updated.protected voidonBlockAdded(BlockState state, World world, BlockPos pos, BlockState oldState, boolean notify) Called server-side on the new block when the block state is changed.protected voidonBlockBreakStart(BlockState state, World world, BlockPos pos, PlayerEntity player) Called when a player starts breaking the block (including when instant-mining).protected voidonEntityCollision(BlockState state, World world, BlockPos pos, Entity entity) Called when the entity's collision box intersects the block.protected voidonExploded(BlockState state, World world, BlockPos pos, Explosion explosion, BiConsumer<ItemStack, BlockPos> stackMerger) protected voidonProjectileHit(World world, BlockState state, BlockHitResult hit, ProjectileEntity projectile) Called when aProjectileEntityhits a block.protected voidonStacksDropped(BlockState state, ServerWorld world, BlockPos pos, ItemStack tool, boolean dropExperience) Called server-side when the stacks are dropped by mining or explosion.protected voidonStateReplaced(BlockState state, World world, BlockPos pos, BlockState newState, boolean moved) Called server-side on the old block when the block state is changed.protected booleanonSyncedBlockEvent(BlockState state, World world, BlockPos pos, int type, int data) Handles the block event, which is an event specific to a block with an integer ID and data.protected ActionResultonUse(BlockState state, World world, BlockPos pos, PlayerEntity player, BlockHitResult hit) protected ItemActionResultonUseWithItem(ItemStack stack, BlockState state, World world, BlockPos pos, PlayerEntity player, Hand hand, BlockHitResult hit) protected voidprepare(BlockState state, WorldAccess world, BlockPos pos, int flags, int maxUpdateDepth) Called when the block state changes, before the neighbor-triggered state update on the original block, and after the neighbor-triggered state update on the replaced block.protected voidrandomTick(BlockState state, ServerWorld world, BlockPos pos, Random random) Called server-side when a block gets ticked randomly.protected BlockStaterotate(BlockState state, BlockRotation rotation) Returnsstaterotated byrotation.protected voidscheduledTick(BlockState state, ServerWorld world, BlockPos pos, Random random) Called server-side when a block receives a scheduled tick.Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface net.minecraft.resource.featuretoggle.ToggleableFeature
isEnabled
-
Field Details
-
DIRECTIONS
- Mappings:
Namespace Name Mixin selector named DIRECTIONSLnet/minecraft/block/AbstractBlock;DIRECTIONS:[Lnet/minecraft/util/math/Direction;intermediary field_23157Lnet/minecraft/class_4970;field_23157:[Lnet/minecraft/class_2350;official aFLdtb;aF:[Lji;
-
collidable
protected final boolean collidableWhether this block can be walked on or through.- See Also:
- Mappings:
Namespace Name Mixin selector named collidableLnet/minecraft/block/AbstractBlock;collidable:Zintermediary field_23159Lnet/minecraft/class_4970;field_23159:Zofficial aGLdtb;aG:Z
-
resistance
protected final float resistanceThe blast resistance of the block.- See Also:
- Mappings:
Namespace Name Mixin selector named resistanceLnet/minecraft/block/AbstractBlock;resistance:Fintermediary field_23160Lnet/minecraft/class_4970;field_23160:Fofficial aHLdtb;aH:F
-
randomTicks
protected final boolean randomTicksWhether this block should tick when randomly selected when ticking the world. An example of this ticking is crop growth.- See Also:
- Mappings:
Namespace Name Mixin selector named randomTicksLnet/minecraft/block/AbstractBlock;randomTicks:Zintermediary field_23161Lnet/minecraft/class_4970;field_23161:Zofficial aILdtb;aI:Z
-
soundGroup
The collection of sounds played when breaking, stepping on, placing, hitting (with a projectile), or falling on this block.- See Also:
- Mappings:
Namespace Name Mixin selector named soundGroupLnet/minecraft/block/AbstractBlock;soundGroup:Lnet/minecraft/sound/BlockSoundGroup;intermediary field_23162Lnet/minecraft/class_4970;field_23162:Lnet/minecraft/class_2498;official aJLdtb;aJ:Ldnm;
-
slipperiness
protected final float slipperinessA speed reduction applied to aLivingEntitythat tries to move across this block.- See Also:
- Mappings:
Namespace Name Mixin selector named slipperinessLnet/minecraft/block/AbstractBlock;slipperiness:Fintermediary field_23163Lnet/minecraft/class_4970;field_23163:Fofficial aKLdtb;aK:F
-
velocityMultiplier
protected final float velocityMultiplierThe multiplier applied to the velocity of anEntitywhen it walks on this block.- See Also:
- Mappings:
Namespace Name Mixin selector named velocityMultiplierLnet/minecraft/block/AbstractBlock;velocityMultiplier:Fintermediary field_23164Lnet/minecraft/class_4970;field_23164:Fofficial aLLdtb;aL:F
-
jumpVelocityMultiplier
protected final float jumpVelocityMultiplierThe multiplier applied to the velocity of aLivingEntitywhen it jumps off this block.- See Also:
- Mappings:
Namespace Name Mixin selector named jumpVelocityMultiplierLnet/minecraft/block/AbstractBlock;jumpVelocityMultiplier:Fintermediary field_23165Lnet/minecraft/class_4970;field_23165:Fofficial aMLdtb;aM:F
-
dynamicBounds
protected final boolean dynamicBoundsWhether this block's collision shape can change.- See Also:
- Mappings:
Namespace Name Mixin selector named dynamicBoundsLnet/minecraft/block/AbstractBlock;dynamicBounds:Zintermediary field_23154Lnet/minecraft/class_4970;field_23154:Zofficial aNLdtb;aN:Z
-
requiredFeatures
The set ofFeatureFlagsthat are required for this block to work correctly.- See Also:
- Mappings:
Namespace Name Mixin selector named requiredFeaturesLnet/minecraft/block/AbstractBlock;requiredFeatures:Lnet/minecraft/resource/featuretoggle/FeatureSet;intermediary field_40337Lnet/minecraft/class_4970;field_40337:Lnet/minecraft/class_7699;official aOLdtb;aO:Lcpl;
-
settings
TheAbstractBlock.Settingsto apply to this block.- Mappings:
Namespace Name Mixin selector named settingsLnet/minecraft/block/AbstractBlock;settings:Lnet/minecraft/block/AbstractBlock$Settings;intermediary field_23155Lnet/minecraft/class_4970;field_23155:Lnet/minecraft/class_4970$class_2251;official aPLdtb;aP:Ldtb$d;
-
lootTableKey
TheRegistryKeyof the loot table that determines what this block drops.- See Also:
- Mappings:
Namespace Name Mixin selector named lootTableKeyLnet/minecraft/block/AbstractBlock;lootTableKey:Lnet/minecraft/registry/RegistryKey;intermediary field_23156Lnet/minecraft/class_4970;field_23156:Lnet/minecraft/class_5321;official aQLdtb;aQ:Lakq;
-
-
Constructor Details
-
AbstractBlock
- Mappings:
Namespace Name Mixin selector named <init>Lnet/minecraft/block/AbstractBlock;<init>(Lnet/minecraft/block/AbstractBlock$Settings;)Vintermediary <init>Lnet/minecraft/class_4970;<init>(Lnet/minecraft/class_4970$class_2251;)Vofficial <init>Ldtb;<init>(Ldtb$d;)V
-
-
Method Details
-
getSettings
- Mappings:
Namespace Name Mixin selector named getSettingsLnet/minecraft/block/AbstractBlock;getSettings()Lnet/minecraft/block/AbstractBlock$Settings;intermediary method_54095Lnet/minecraft/class_4970;method_54095()Lnet/minecraft/class_4970$class_2251;official tLdtb;t()Ldtb$d;
-
getCodec
- Mappings:
Namespace Name Mixin selector named getCodecLnet/minecraft/block/AbstractBlock;getCodec()Lcom/mojang/serialization/MapCodec;intermediary method_53969Lnet/minecraft/class_4970;method_53969()Lcom/mojang/serialization/MapCodec;official aLdtb;a()Lcom/mojang/serialization/MapCodec;
-
createSettingsCodec
protected static <B extends Block> com.mojang.serialization.codecs.RecordCodecBuilder<B,AbstractBlock.Settings> createSettingsCodec()- Mappings:
Namespace Name Mixin selector named createSettingsCodecLnet/minecraft/block/AbstractBlock;createSettingsCodec()Lcom/mojang/serialization/codecs/RecordCodecBuilder;intermediary method_54096Lnet/minecraft/class_4970;method_54096()Lcom/mojang/serialization/codecs/RecordCodecBuilder;official uLdtb;u()Lcom/mojang/serialization/codecs/RecordCodecBuilder;
-
createCodec
public static <B extends Block> com.mojang.serialization.MapCodec<B> createCodec(Function<AbstractBlock.Settings, B> blockFromSettings) - Mappings:
Namespace Name Mixin selector named createCodecLnet/minecraft/block/AbstractBlock;createCodec(Ljava/util/function/Function;)Lcom/mojang/serialization/MapCodec;intermediary method_54094Lnet/minecraft/class_4970;method_54094(Ljava/util/function/Function;)Lcom/mojang/serialization/MapCodec;official bLdtb;b(Ljava/util/function/Function;)Lcom/mojang/serialization/MapCodec;
-
prepare
protected void prepare(BlockState state, WorldAccess world, BlockPos pos, int flags, int maxUpdateDepth) Called when the block state changes, before the neighbor-triggered state update on the original block, and after the neighbor-triggered state update on the replaced block.This method is called on both the logical client and logical server, so take caution when overriding this method. The logical side can be checked using
World.isClient.- See Also:
- API Note:
- This is used by
RedstoneWireBlockto update connected redstone wire. - Mappings:
Namespace Name Mixin selector named prepareLnet/minecraft/block/AbstractBlock;prepare(Lnet/minecraft/block/BlockState;Lnet/minecraft/world/WorldAccess;Lnet/minecraft/util/math/BlockPos;II)Vintermediary method_9517Lnet/minecraft/class_4970;method_9517(Lnet/minecraft/class_2680;Lnet/minecraft/class_1936;Lnet/minecraft/class_2338;II)Vofficial aLdtb;a(Ldtc;Ldcx;Ljd;II)V
-
getStateForNeighborUpdate
protected BlockState getStateForNeighborUpdate(BlockState state, Direction direction, BlockState neighborState, WorldAccess world, BlockPos pos, BlockPos neighborPos) Returns the state of the block after a neighboring block's state change.Returning
Blocks.AIRbreaks the block. This is useful to implement supporting block requirement for blocks (if used along withcanPlaceAt(net.minecraft.block.BlockState, net.minecraft.world.WorldView, net.minecraft.util.math.BlockPos)).Side effects like activating a redstone component (but not scheduling a tick) should be performed in
neighborUpdate(net.minecraft.block.BlockState, net.minecraft.world.World, net.minecraft.util.math.BlockPos, net.minecraft.block.Block, net.minecraft.util.math.BlockPos, boolean)instead. If the block supports waterlogging and currently has water, this method should be overridden to tick the fluid at the block's position.This method is called on both the logical client and logical server, so take caution when overriding this method. The logical side can be checked using
World.isClient. This is not called ifBlock.FORCE_STATEflag is set in thesetBlockStatecall.This method can be used for multiple purposes. Here are some examples:
FenceBlockuses it to update the fence's connection when a horizontally neighboring block's state is changed.PlantBlockuses it to break the plant if the state change causes it to lose its supporting block.DoorBlockuses it to copy the state of the other half of the door.SlabBlockuses it to schedule the fluid to tick if waterlogged.SoulSandBlockuses it to schedule the water block above to tick so that it becomes a bubble column.FallingBlockuses it to schedule the block to tick so that it can fall if needed.
- Parameters:
state- the state of this blockdirection- the direction from this block to the neighborneighborState- the state of the updated neighbor blockworld- the worldpos- the position of this blockneighborPos- the position of the neighbor block- Returns:
- the state of the block after a neighboring block's state change
- See Also:
- Mappings:
Namespace Name Mixin selector named getStateForNeighborUpdateLnet/minecraft/block/AbstractBlock;getStateForNeighborUpdate(Lnet/minecraft/block/BlockState;Lnet/minecraft/util/math/Direction;Lnet/minecraft/block/BlockState;Lnet/minecraft/world/WorldAccess;Lnet/minecraft/util/math/BlockPos;Lnet/minecraft/util/math/BlockPos;)Lnet/minecraft/block/BlockState;intermediary method_9559Lnet/minecraft/class_4970;method_9559(Lnet/minecraft/class_2680;Lnet/minecraft/class_2350;Lnet/minecraft/class_2680;Lnet/minecraft/class_1936;Lnet/minecraft/class_2338;Lnet/minecraft/class_2338;)Lnet/minecraft/class_2680;official aLdtb;a(Ldtc;Lji;Ldtc;Ldcx;Ljd;Ljd;)Ldtc;
-
isSideInvisible
- See Also:
- Mappings:
Namespace Name Mixin selector named isSideInvisibleLnet/minecraft/block/AbstractBlock;isSideInvisible(Lnet/minecraft/block/BlockState;Lnet/minecraft/block/BlockState;Lnet/minecraft/util/math/Direction;)Zintermediary method_9522Lnet/minecraft/class_4970;method_9522(Lnet/minecraft/class_2680;Lnet/minecraft/class_2680;Lnet/minecraft/class_2350;)Zofficial aLdtb;a(Ldtc;Ldtc;Lji;)Z
-
neighborUpdate
protected void neighborUpdate(BlockState state, World world, BlockPos pos, Block sourceBlock, BlockPos sourcePos, boolean notify) Called when a neighboring block is updated. This method should be overridden to perform an action with a side effect, most notably an activation of a redstone component. This can also be used to perform an action changing block states of other blocks, such asSpongeBlockwhich absorbs water.To replace the state of the block itself, override
getStateForNeighborUpdate(net.minecraft.block.BlockState, net.minecraft.util.math.Direction, net.minecraft.block.BlockState, net.minecraft.world.WorldAccess, net.minecraft.util.math.BlockPos, net.minecraft.util.math.BlockPos)instead.This method is called on both the logical client and logical server, so take caution when overriding this method. The logical side can be checked using
World.isClient.- See Also:
- Mappings:
Namespace Name Mixin selector named neighborUpdateLnet/minecraft/block/AbstractBlock;neighborUpdate(Lnet/minecraft/block/BlockState;Lnet/minecraft/world/World;Lnet/minecraft/util/math/BlockPos;Lnet/minecraft/block/Block;Lnet/minecraft/util/math/BlockPos;Z)Vintermediary method_9612Lnet/minecraft/class_4970;method_9612(Lnet/minecraft/class_2680;Lnet/minecraft/class_1937;Lnet/minecraft/class_2338;Lnet/minecraft/class_2248;Lnet/minecraft/class_2338;Z)Vofficial aLdtb;a(Ldtc;Ldcw;Ljd;Ldfy;Ljd;Z)V
-
onBlockAdded
protected void onBlockAdded(BlockState state, World world, BlockPos pos, BlockState oldState, boolean notify) Called server-side on the new block when the block state is changed. This includes block placement. When overriding this method,getStateForNeighborUpdate(net.minecraft.block.BlockState, net.minecraft.util.math.Direction, net.minecraft.block.BlockState, net.minecraft.world.WorldAccess, net.minecraft.util.math.BlockPos, net.minecraft.util.math.BlockPos)orneighborUpdate(net.minecraft.block.BlockState, net.minecraft.world.World, net.minecraft.util.math.BlockPos, net.minecraft.block.Block, net.minecraft.util.math.BlockPos, boolean)should also be overridden. The method is used in the following cases:- When activating a redstone component on placement (used along with
neighborUpdate(net.minecraft.block.BlockState, net.minecraft.world.World, net.minecraft.util.math.BlockPos, net.minecraft.block.Block, net.minecraft.util.math.BlockPos, boolean) - When resetting a position-dependent state (see
TargetBlock) - When converting a block on placement (see
WetSpongeBlock) - When fire lights a portal
- See Also:
- Mappings:
Namespace Name Mixin selector named onBlockAddedLnet/minecraft/block/AbstractBlock;onBlockAdded(Lnet/minecraft/block/BlockState;Lnet/minecraft/world/World;Lnet/minecraft/util/math/BlockPos;Lnet/minecraft/block/BlockState;Z)Vintermediary method_9615Lnet/minecraft/class_4970;method_9615(Lnet/minecraft/class_2680;Lnet/minecraft/class_1937;Lnet/minecraft/class_2338;Lnet/minecraft/class_2680;Z)Vofficial bLdtb;b(Ldtc;Ldcw;Ljd;Ldtc;Z)V
- When activating a redstone component on placement (used along with
-
onStateReplaced
protected void onStateReplaced(BlockState state, World world, BlockPos pos, BlockState newState, boolean moved) Called server-side on the old block when the block state is changed. This includes block removal. This is used to update neighboring blocks when an active redstone power source is removed, or to drop the contents of an inventory. The checkstate.isOf(newState.getBlock())can be used to see if the block was removed or not.For most block entities,
ItemScatterer.onStateReplaced(net.minecraft.block.BlockState, net.minecraft.block.BlockState, net.minecraft.world.World, net.minecraft.util.math.BlockPos)provides a good implementation of this method. Make sure to callsuper.onStateReplaced(state, world, pos, newState, moved);after invokingItemScatterermethods.- See Also:
- Mappings:
Namespace Name Mixin selector named onStateReplacedLnet/minecraft/block/AbstractBlock;onStateReplaced(Lnet/minecraft/block/BlockState;Lnet/minecraft/world/World;Lnet/minecraft/util/math/BlockPos;Lnet/minecraft/block/BlockState;Z)Vintermediary method_9536Lnet/minecraft/class_4970;method_9536(Lnet/minecraft/class_2680;Lnet/minecraft/class_1937;Lnet/minecraft/class_2338;Lnet/minecraft/class_2680;Z)Vofficial aLdtb;a(Ldtc;Ldcw;Ljd;Ldtc;Z)V
-
onExploded
protected void onExploded(BlockState state, World world, BlockPos pos, Explosion explosion, BiConsumer<ItemStack, BlockPos> stackMerger) - Mappings:
Namespace Name Mixin selector named onExplodedLnet/minecraft/block/AbstractBlock;onExploded(Lnet/minecraft/block/BlockState;Lnet/minecraft/world/World;Lnet/minecraft/util/math/BlockPos;Lnet/minecraft/world/explosion/Explosion;Ljava/util/function/BiConsumer;)Vintermediary method_55124Lnet/minecraft/class_4970;method_55124(Lnet/minecraft/class_2680;Lnet/minecraft/class_1937;Lnet/minecraft/class_2338;Lnet/minecraft/class_1927;Ljava/util/function/BiConsumer;)Vofficial aLdtb;a(Ldtc;Ldcw;Ljd;Ldco;Ljava/util/function/BiConsumer;)V
-
onUse
protected ActionResult onUse(BlockState state, World world, BlockPos pos, PlayerEntity player, BlockHitResult hit) - Mappings:
Namespace Name Mixin selector named onUseLnet/minecraft/block/AbstractBlock;onUse(Lnet/minecraft/block/BlockState;Lnet/minecraft/world/World;Lnet/minecraft/util/math/BlockPos;Lnet/minecraft/entity/player/PlayerEntity;Lnet/minecraft/util/hit/BlockHitResult;)Lnet/minecraft/util/ActionResult;intermediary method_55766Lnet/minecraft/class_4970;method_55766(Lnet/minecraft/class_2680;Lnet/minecraft/class_1937;Lnet/minecraft/class_2338;Lnet/minecraft/class_1657;Lnet/minecraft/class_3965;)Lnet/minecraft/class_1269;official aLdtb;a(Ldtc;Ldcw;Ljd;Lcmx;Lewy;)Lbqr;
-
onUseWithItem
protected ItemActionResult onUseWithItem(ItemStack stack, BlockState state, World world, BlockPos pos, PlayerEntity player, Hand hand, BlockHitResult hit) - Mappings:
Namespace Name Mixin selector named onUseWithItemLnet/minecraft/block/AbstractBlock;onUseWithItem(Lnet/minecraft/item/ItemStack;Lnet/minecraft/block/BlockState;Lnet/minecraft/world/World;Lnet/minecraft/util/math/BlockPos;Lnet/minecraft/entity/player/PlayerEntity;Lnet/minecraft/util/Hand;Lnet/minecraft/util/hit/BlockHitResult;)Lnet/minecraft/util/ItemActionResult;intermediary method_55765Lnet/minecraft/class_4970;method_55765(Lnet/minecraft/class_1799;Lnet/minecraft/class_2680;Lnet/minecraft/class_1937;Lnet/minecraft/class_2338;Lnet/minecraft/class_1657;Lnet/minecraft/class_1268;Lnet/minecraft/class_3965;)Lnet/minecraft/class_9062;official aLdtb;a(Lcuq;Ldtc;Ldcw;Ljd;Lcmx;Lbqq;Lewy;)Lbqt;
-
onSyncedBlockEvent
protected boolean onSyncedBlockEvent(BlockState state, World world, BlockPos pos, int type, int data) Handles the block event, which is an event specific to a block with an integer ID and data.- Returns:
- whether the event was handled successfully
- See Also:
- Mappings:
Namespace Name Mixin selector named onSyncedBlockEventLnet/minecraft/block/AbstractBlock;onSyncedBlockEvent(Lnet/minecraft/block/BlockState;Lnet/minecraft/world/World;Lnet/minecraft/util/math/BlockPos;II)Zintermediary method_9592Lnet/minecraft/class_4970;method_9592(Lnet/minecraft/class_2680;Lnet/minecraft/class_1937;Lnet/minecraft/class_2338;II)Zofficial aLdtb;a(Ldtc;Ldcw;Ljd;II)Z
-
getRenderType
Returns the block's render type (invisible, animated, model).- Returns:
- the block's render type (invisible, animated, model)
- See Also:
- API Note:
BlockWithEntityoverrides this to returnBlockRenderType.INVISIBLE; therefore, custom blocks extending that class must override it again to render the block.- Mappings:
Namespace Name Mixin selector named getRenderTypeLnet/minecraft/block/AbstractBlock;getRenderType(Lnet/minecraft/block/BlockState;)Lnet/minecraft/block/BlockRenderType;intermediary method_9604Lnet/minecraft/class_4970;method_9604(Lnet/minecraft/class_2680;)Lnet/minecraft/class_2464;official a_Ldtb;a_(Ldtc;)Ldmf;
-
hasSidedTransparency
Returns whether the block's transparency depends on the side of the block, like slabs.- Returns:
- whether the block's transparency depends on the side of the block, like slabs
- See Also:
- Mappings:
Namespace Name Mixin selector named hasSidedTransparencyLnet/minecraft/block/AbstractBlock;hasSidedTransparency(Lnet/minecraft/block/BlockState;)Zintermediary method_9526Lnet/minecraft/class_4970;method_9526(Lnet/minecraft/class_2680;)Zofficial f_Ldtb;f_(Ldtc;)Z
-
emitsRedstonePower
Returns whether the block is capable of emitting redstone power.This does not return whether the block is currently emitting redstone power. Use
RedstoneView.isEmittingRedstonePower(net.minecraft.util.math.BlockPos, net.minecraft.util.math.Direction)in that case.- Returns:
- whether the block is capable of emitting redstone power
- See Also:
- Mappings:
Namespace Name Mixin selector named emitsRedstonePowerLnet/minecraft/block/AbstractBlock;emitsRedstonePower(Lnet/minecraft/block/BlockState;)Zintermediary method_9506Lnet/minecraft/class_4970;method_9506(Lnet/minecraft/class_2680;)Zofficial e_Ldtb;e_(Ldtc;)Z
-
getFluidState
Returns the state's associated fluid state.Waterloggable blocks must override this to return
Fluids.WATER.getStill(false)when waterlogged.- Returns:
- the state's associated fluid state
- See Also:
- Mappings:
Namespace Name Mixin selector named getFluidStateLnet/minecraft/block/AbstractBlock;getFluidState(Lnet/minecraft/block/BlockState;)Lnet/minecraft/fluid/FluidState;intermediary method_9545Lnet/minecraft/class_4970;method_9545(Lnet/minecraft/class_2680;)Lnet/minecraft/class_3610;official b_Ldtb;b_(Ldtc;)Lepe;
-
hasComparatorOutput
Returns whether the block can have a comparator output.This does not check the current comparator output of the block. Use
getComparatorOutput(net.minecraft.block.BlockState, net.minecraft.world.World, net.minecraft.util.math.BlockPos)in that case.- Returns:
- whether the block can have a comparator output
- See Also:
- Mappings:
Namespace Name Mixin selector named hasComparatorOutputLnet/minecraft/block/AbstractBlock;hasComparatorOutput(Lnet/minecraft/block/BlockState;)Zintermediary method_9498Lnet/minecraft/class_4970;method_9498(Lnet/minecraft/class_2680;)Zofficial c_Ldtb;c_(Ldtc;)Z
-
getMaxHorizontalModelOffset
protected float getMaxHorizontalModelOffset()- Mappings:
Namespace Name Mixin selector named getMaxHorizontalModelOffsetLnet/minecraft/block/AbstractBlock;getMaxHorizontalModelOffset()Fintermediary method_32913Lnet/minecraft/class_4970;method_32913()Fofficial av_Ldtb;av_()F
-
getVerticalModelOffsetMultiplier
protected float getVerticalModelOffsetMultiplier()- Mappings:
Namespace Name Mixin selector named getVerticalModelOffsetMultiplierLnet/minecraft/block/AbstractBlock;getVerticalModelOffsetMultiplier()Fintermediary method_37247Lnet/minecraft/class_4970;method_37247()Fofficial ax_Ldtb;ax_()F
-
getRequiredFeatures
- Specified by:
getRequiredFeaturesin interfaceToggleableFeature- Mappings:
Namespace Name Mixin selector named getRequiredFeaturesLnet/minecraft/resource/featuretoggle/ToggleableFeature;getRequiredFeatures()Lnet/minecraft/resource/featuretoggle/FeatureSet;intermediary method_45322Lnet/minecraft/class_7695;method_45322()Lnet/minecraft/class_7699;official iLcpi;i()Lcpl;
-
rotate
Returnsstaterotated byrotation.By default, this returns the provided block state.
- Returns:
staterotated byrotation- See Also:
- Mappings:
Namespace Name Mixin selector named rotateLnet/minecraft/block/AbstractBlock;rotate(Lnet/minecraft/block/BlockState;Lnet/minecraft/util/BlockRotation;)Lnet/minecraft/block/BlockState;intermediary method_9598Lnet/minecraft/class_4970;method_9598(Lnet/minecraft/class_2680;Lnet/minecraft/class_2470;)Lnet/minecraft/class_2680;official aLdtb;a(Ldtc;Ldmm;)Ldtc;
-
mirror
Returnsstatemirrored bymirror.By default, this returns the provided block state.
- Returns:
statemirrored bymirror- See Also:
- Mappings:
Namespace Name Mixin selector named mirrorLnet/minecraft/block/AbstractBlock;mirror(Lnet/minecraft/block/BlockState;Lnet/minecraft/util/BlockMirror;)Lnet/minecraft/block/BlockState;intermediary method_9569Lnet/minecraft/class_4970;method_9569(Lnet/minecraft/class_2680;Lnet/minecraft/class_2415;)Lnet/minecraft/class_2680;official aLdtb;a(Ldtc;Ldkv;)Ldtc;
-
canReplace
Returns whether the item can replace the block.By default, this checks if the block allows replacing and whether the item differs from the block's item. Items composed of multiple blocks, such as candles, vines, or snow layers, should override this to implement additional checks.
This method is called on both the logical client and logical server, so take caution when overriding this method. The logical side can be checked using
World.isClient.- Returns:
- whether the item can replace the block
- See Also:
- Mappings:
Namespace Name Mixin selector named canReplaceLnet/minecraft/block/AbstractBlock;canReplace(Lnet/minecraft/block/BlockState;Lnet/minecraft/item/ItemPlacementContext;)Zintermediary method_9616Lnet/minecraft/class_4970;method_9616(Lnet/minecraft/class_2680;Lnet/minecraft/class_1750;)Zofficial aLdtb;a(Ldtc;Lcyd;)Z
-
canBucketPlace
Returns whether a bucket can replace the block with the fluid.By default, this checks if the block allows replacing or is not solid. Blocks intended to be unbreakable should override this to implement additional checks.
This method is called on both the logical client and logical server, so take caution when overriding this method. The logical side can be checked using
World.isClient.- Returns:
- whether a bucket can replace the block with the fluid
- See Also:
- Mappings:
Namespace Name Mixin selector named canBucketPlaceLnet/minecraft/block/AbstractBlock;canBucketPlace(Lnet/minecraft/block/BlockState;Lnet/minecraft/fluid/Fluid;)Zintermediary method_22358Lnet/minecraft/class_4970;method_22358(Lnet/minecraft/class_2680;Lnet/minecraft/class_3611;)Zofficial aLdtb;a(Ldtc;Lepd;)Z
-
getDroppedStacks
protected List<ItemStack> getDroppedStacks(BlockState state, LootContextParameterSet.Builder builder) Returns the block's dropped item stacks.The default implementation uses loot tables. Blocks with custom drops should not hardcode the drops; instead, make a new loot table. If the loot table needs an additional context, override this method and modify
builderbefore callingsuper.getDroppedStacks. An example of this isShulkerBoxBlock. Note that to prevent item duplication, when appending item stacks to the builder,ItemStack.split(int)should be called.This method should not be used for dropping inventory contents (
onStateReplaced(net.minecraft.block.BlockState, net.minecraft.world.World, net.minecraft.util.math.BlockPos, net.minecraft.block.BlockState, boolean)should be used instead) or to drop experience orbs (onStacksDropped(net.minecraft.block.BlockState, net.minecraft.server.world.ServerWorld, net.minecraft.util.math.BlockPos, net.minecraft.item.ItemStack, boolean)should be used instead).- Returns:
- the block's dropped item stacks
- See Also:
- Mappings:
Namespace Name Mixin selector named getDroppedStacksLnet/minecraft/block/AbstractBlock;getDroppedStacks(Lnet/minecraft/block/BlockState;Lnet/minecraft/loot/context/LootContextParameterSet$Builder;)Ljava/util/List;intermediary method_9560Lnet/minecraft/class_4970;method_9560(Lnet/minecraft/class_2680;Lnet/minecraft/class_8567$class_8568;)Ljava/util/List;official aLdtb;a(Ldtc;Leru$a;)Ljava/util/List;
-
getRenderingSeed
Returns the seed value for rendering.This is usually the hash code of
pos. Tall or wide blocks (such as doors or beds) should override this to make sure both parts of the block have the same seed.- Returns:
- the seed value for rendering
- See Also:
- Mappings:
Namespace Name Mixin selector named getRenderingSeedLnet/minecraft/block/AbstractBlock;getRenderingSeed(Lnet/minecraft/block/BlockState;Lnet/minecraft/util/math/BlockPos;)Jintermediary method_9535Lnet/minecraft/class_4970;method_9535(Lnet/minecraft/class_2680;Lnet/minecraft/class_2338;)Jofficial aLdtb;a(Ldtc;Ljd;)J
-
getCullingShape
- See Also:
- Mappings:
Namespace Name Mixin selector named getCullingShapeLnet/minecraft/block/AbstractBlock;getCullingShape(Lnet/minecraft/block/BlockState;Lnet/minecraft/world/BlockView;Lnet/minecraft/util/math/BlockPos;)Lnet/minecraft/util/shape/VoxelShape;intermediary method_9571Lnet/minecraft/class_4970;method_9571(Lnet/minecraft/class_2680;Lnet/minecraft/class_1922;Lnet/minecraft/class_2338;)Lnet/minecraft/class_265;official fLdtb;f(Ldtc;Ldcc;Ljd;)Lexv;
-
getSidesShape
- See Also:
- Mappings:
Namespace Name Mixin selector named getSidesShapeLnet/minecraft/block/AbstractBlock;getSidesShape(Lnet/minecraft/block/BlockState;Lnet/minecraft/world/BlockView;Lnet/minecraft/util/math/BlockPos;)Lnet/minecraft/util/shape/VoxelShape;intermediary method_25959Lnet/minecraft/class_4970;method_25959(Lnet/minecraft/class_2680;Lnet/minecraft/class_1922;Lnet/minecraft/class_2338;)Lnet/minecraft/class_265;official b_Ldtb;b_(Ldtc;Ldcc;Ljd;)Lexv;
-
getRaycastShape
- See Also:
- Mappings:
Namespace Name Mixin selector named getRaycastShapeLnet/minecraft/block/AbstractBlock;getRaycastShape(Lnet/minecraft/block/BlockState;Lnet/minecraft/world/BlockView;Lnet/minecraft/util/math/BlockPos;)Lnet/minecraft/util/shape/VoxelShape;intermediary method_9584Lnet/minecraft/class_4970;method_9584(Lnet/minecraft/class_2680;Lnet/minecraft/class_1922;Lnet/minecraft/class_2338;)Lnet/minecraft/class_265;official aLdtb;a(Ldtc;Ldcc;Ljd;)Lexv;
-
getOpacity
- See Also:
- Mappings:
Namespace Name Mixin selector named getOpacityLnet/minecraft/block/AbstractBlock;getOpacity(Lnet/minecraft/block/BlockState;Lnet/minecraft/world/BlockView;Lnet/minecraft/util/math/BlockPos;)Iintermediary method_9505Lnet/minecraft/class_4970;method_9505(Lnet/minecraft/class_2680;Lnet/minecraft/class_1922;Lnet/minecraft/class_2338;)Iofficial gLdtb;g(Ldtc;Ldcc;Ljd;)I
-
createScreenHandlerFactory
@Nullable protected @Nullable NamedScreenHandlerFactory createScreenHandlerFactory(BlockState state, World world, BlockPos pos) Returns the screen handler factory ornullif screen handler cannot be created.This method should be overridden for blocks with screen handlers, such as anvils. The created screen handler is usually passed to
PlayerEntity.openHandledScreen(net.minecraft.screen.NamedScreenHandlerFactory). SeeAnvilBlock.createScreenHandlerFactory(net.minecraft.block.BlockState, net.minecraft.world.World, net.minecraft.util.math.BlockPos)for basic usage.BlockWithEntitydelegates this logic to the block entity implementingNamedScreenHandlerFactory. For example, anyBlockWithEntitywhose block entity extendsLockableContainerBlockEntityneeds to overrideLockableContainerBlockEntity.createScreenHandler(int, net.minecraft.entity.player.PlayerInventory)instead of this method.This method is called on both the logical client and logical server, so take caution when overriding this method. The logical side can be checked using
World.isClient.- Returns:
- the screen handler factory or
nullif screen handler cannot be created - See Also:
- Mappings:
Namespace Name Mixin selector named createScreenHandlerFactoryLnet/minecraft/block/AbstractBlock;createScreenHandlerFactory(Lnet/minecraft/block/BlockState;Lnet/minecraft/world/World;Lnet/minecraft/util/math/BlockPos;)Lnet/minecraft/screen/NamedScreenHandlerFactory;intermediary method_17454Lnet/minecraft/class_4970;method_17454(Lnet/minecraft/class_2680;Lnet/minecraft/class_1937;Lnet/minecraft/class_2338;)Lnet/minecraft/class_3908;official bLdtb;b(Ldtc;Ldcw;Ljd;)Lbqv;
-
canPlaceAt
Returns whether the block can be placed atpos.Blocks with supporting block requirements should override this method. Note that this should also be checked manually during
getStateForNeighborUpdate(net.minecraft.block.BlockState, net.minecraft.util.math.Direction, net.minecraft.block.BlockState, net.minecraft.world.WorldAccess, net.minecraft.util.math.BlockPos, net.minecraft.util.math.BlockPos)in order to break the block that lost its supporting block.This is only checked during the use of block items or by endermen, falling blocks, etc that can place blocks. This does not affect block state changes performed through
World.setBlockState(BlockPos, BlockState)call.This method is called on both the logical client and logical server, so take caution when overriding this method. The logical side can be checked using
World.isClient.- Returns:
- whether the block can be placed at
pos - See Also:
- Mappings:
Namespace Name Mixin selector named canPlaceAtLnet/minecraft/block/AbstractBlock;canPlaceAt(Lnet/minecraft/block/BlockState;Lnet/minecraft/world/WorldView;Lnet/minecraft/util/math/BlockPos;)Zintermediary method_9558Lnet/minecraft/class_4970;method_9558(Lnet/minecraft/class_2680;Lnet/minecraft/class_4538;Lnet/minecraft/class_2338;)Zofficial aLdtb;a(Ldtc;Ldcz;Ljd;)Z
-
getAmbientOcclusionLightLevel
- See Also:
- Mappings:
Namespace Name Mixin selector named getAmbientOcclusionLightLevelLnet/minecraft/block/AbstractBlock;getAmbientOcclusionLightLevel(Lnet/minecraft/block/BlockState;Lnet/minecraft/world/BlockView;Lnet/minecraft/util/math/BlockPos;)Fintermediary method_9575Lnet/minecraft/class_4970;method_9575(Lnet/minecraft/class_2680;Lnet/minecraft/class_1922;Lnet/minecraft/class_2338;)Fofficial dLdtb;d(Ldtc;Ldcc;Ljd;)F
-
getComparatorOutput
Returns the comparator output of the block, from0to15.When overriding this,
hasComparatorOutput(net.minecraft.block.BlockState)must also be overridden.- Returns:
- the comparator output of the block, from
0to15 - See Also:
- Mappings:
Namespace Name Mixin selector named getComparatorOutputLnet/minecraft/block/AbstractBlock;getComparatorOutput(Lnet/minecraft/block/BlockState;Lnet/minecraft/world/World;Lnet/minecraft/util/math/BlockPos;)Iintermediary method_9572Lnet/minecraft/class_4970;method_9572(Lnet/minecraft/class_2680;Lnet/minecraft/class_1937;Lnet/minecraft/class_2338;)Iofficial aLdtb;a(Ldtc;Ldcw;Ljd;)I
-
getOutlineShape
protected VoxelShape getOutlineShape(BlockState state, BlockView world, BlockPos pos, ShapeContext context) - See Also:
- Mappings:
Namespace Name Mixin selector named getOutlineShapeLnet/minecraft/block/AbstractBlock;getOutlineShape(Lnet/minecraft/block/BlockState;Lnet/minecraft/world/BlockView;Lnet/minecraft/util/math/BlockPos;Lnet/minecraft/block/ShapeContext;)Lnet/minecraft/util/shape/VoxelShape;intermediary method_9530Lnet/minecraft/class_4970;method_9530(Lnet/minecraft/class_2680;Lnet/minecraft/class_1922;Lnet/minecraft/class_2338;Lnet/minecraft/class_3726;)Lnet/minecraft/class_265;official aLdtb;a(Ldtc;Ldcc;Ljd;Lexh;)Lexv;
-
getCollisionShape
protected VoxelShape getCollisionShape(BlockState state, BlockView world, BlockPos pos, ShapeContext context) - See Also:
- Mappings:
Namespace Name Mixin selector named getCollisionShapeLnet/minecraft/block/AbstractBlock;getCollisionShape(Lnet/minecraft/block/BlockState;Lnet/minecraft/world/BlockView;Lnet/minecraft/util/math/BlockPos;Lnet/minecraft/block/ShapeContext;)Lnet/minecraft/util/shape/VoxelShape;intermediary method_9549Lnet/minecraft/class_4970;method_9549(Lnet/minecraft/class_2680;Lnet/minecraft/class_1922;Lnet/minecraft/class_2338;Lnet/minecraft/class_3726;)Lnet/minecraft/class_265;official bLdtb;b(Ldtc;Ldcc;Ljd;Lexh;)Lexv;
-
isShapeFullCube
- See Also:
- Mappings:
Namespace Name Mixin selector named isShapeFullCubeLnet/minecraft/block/AbstractBlock;isShapeFullCube(Lnet/minecraft/block/BlockState;Lnet/minecraft/world/BlockView;Lnet/minecraft/util/math/BlockPos;)Zintermediary method_37403Lnet/minecraft/class_4970;method_37403(Lnet/minecraft/class_2680;Lnet/minecraft/class_1922;Lnet/minecraft/class_2338;)Zofficial cLdtb;c(Ldtc;Ldcc;Ljd;)Z
-
isCullingShapeFullCube
- Mappings:
Namespace Name Mixin selector named isCullingShapeFullCubeLnet/minecraft/block/AbstractBlock;isCullingShapeFullCube(Lnet/minecraft/block/BlockState;Lnet/minecraft/world/BlockView;Lnet/minecraft/util/math/BlockPos;)Zintermediary method_42326Lnet/minecraft/class_4970;method_42326(Lnet/minecraft/class_2680;Lnet/minecraft/class_1922;Lnet/minecraft/class_2338;)Zofficial hLdtb;h(Ldtc;Ldcc;Ljd;)Z
-
getCameraCollisionShape
protected VoxelShape getCameraCollisionShape(BlockState state, BlockView world, BlockPos pos, ShapeContext context) - See Also:
- Mappings:
Namespace Name Mixin selector named getCameraCollisionShapeLnet/minecraft/block/AbstractBlock;getCameraCollisionShape(Lnet/minecraft/block/BlockState;Lnet/minecraft/world/BlockView;Lnet/minecraft/util/math/BlockPos;Lnet/minecraft/block/ShapeContext;)Lnet/minecraft/util/shape/VoxelShape;intermediary method_26159Lnet/minecraft/class_4970;method_26159(Lnet/minecraft/class_2680;Lnet/minecraft/class_1922;Lnet/minecraft/class_2338;Lnet/minecraft/class_3726;)Lnet/minecraft/class_265;official cLdtb;c(Ldtc;Ldcc;Ljd;Lexh;)Lexv;
-
randomTick
Called server-side when a block gets ticked randomly. This can be overridden to implement various logics, most commonly plant growth. Default implementation does nothing. To control the rate of the action, userandom.Random tick speed is controlled by the game rule
randomTickSpeedand can be disabled. Only blocks within 128-block cylinder (i.e. ignoring Y coordinates) around players receive random ticks.Blocks overriding this must use
AbstractBlock.Settings.ticksRandomly()block settings.Here are some examples:
SugarCaneBlockuses this to grow sugar cane.OxidizableBlockuses this to oxidize.NetherPortalBlockuses this to spawn zombified piglins.LeavesBlockuses this to decay when far from logs.
- See Also:
- Mappings:
Namespace Name Mixin selector named randomTickLnet/minecraft/block/AbstractBlock;randomTick(Lnet/minecraft/block/BlockState;Lnet/minecraft/server/world/ServerWorld;Lnet/minecraft/util/math/BlockPos;Lnet/minecraft/util/math/random/Random;)Vintermediary method_9514Lnet/minecraft/class_4970;method_9514(Lnet/minecraft/class_2680;Lnet/minecraft/class_3218;Lnet/minecraft/class_2338;Lnet/minecraft/class_5819;)Vofficial bLdtb;b(Ldtc;Laqu;Ljd;Layw;)V
-
scheduledTick
Called server-side when a block receives a scheduled tick. This can be used like a timer. Scheduled ticks are added usingWorldAccess.scheduleBlockTick(BlockPos, Block, int).Scheduled ticks are often used inside
getStateForNeighborUpdate(net.minecraft.block.BlockState, net.minecraft.util.math.Direction, net.minecraft.block.BlockState, net.minecraft.world.WorldAccess, net.minecraft.util.math.BlockPos, net.minecraft.util.math.BlockPos).Here are some examples:
SugarCaneBlockchecks the placement requirement.DispenserBlockdispenses its content.CommandBlockexecutes its command.FrogspawnBlockspawns a tadpole.SoulSandBlockupdates a bubble column.FallingBlocktries to fall.
- See Also:
- Mappings:
Namespace Name Mixin selector named scheduledTickLnet/minecraft/block/AbstractBlock;scheduledTick(Lnet/minecraft/block/BlockState;Lnet/minecraft/server/world/ServerWorld;Lnet/minecraft/util/math/BlockPos;Lnet/minecraft/util/math/random/Random;)Vintermediary method_9588Lnet/minecraft/class_4970;method_9588(Lnet/minecraft/class_2680;Lnet/minecraft/class_3218;Lnet/minecraft/class_2338;Lnet/minecraft/class_5819;)Vofficial aLdtb;a(Ldtc;Laqu;Ljd;Layw;)V
-
calcBlockBreakingDelta
protected float calcBlockBreakingDelta(BlockState state, PlayerEntity player, BlockView world, BlockPos pos) - See Also:
- Mappings:
Namespace Name Mixin selector named calcBlockBreakingDeltaLnet/minecraft/block/AbstractBlock;calcBlockBreakingDelta(Lnet/minecraft/block/BlockState;Lnet/minecraft/entity/player/PlayerEntity;Lnet/minecraft/world/BlockView;Lnet/minecraft/util/math/BlockPos;)Fintermediary method_9594Lnet/minecraft/class_4970;method_9594(Lnet/minecraft/class_2680;Lnet/minecraft/class_1657;Lnet/minecraft/class_1922;Lnet/minecraft/class_2338;)Fofficial aLdtb;a(Ldtc;Lcmx;Ldcc;Ljd;)F
-
onStacksDropped
protected void onStacksDropped(BlockState state, ServerWorld world, BlockPos pos, ItemStack tool, boolean dropExperience) Called server-side when the stacks are dropped by mining or explosion. This is mostly overridden to drop experience orbs. To change the dropped item stacks, use loot tables orgetDroppedStacks(net.minecraft.block.BlockState, net.minecraft.loot.context.LootContextParameterSet.Builder). To drop inventory contents, useonStateReplaced(net.minecraft.block.BlockState, net.minecraft.world.World, net.minecraft.util.math.BlockPos, net.minecraft.block.BlockState, boolean)instead.Experience orbs should only be dropped if
dropExperienceistrue.Block.dropExperienceWhenMined(net.minecraft.server.world.ServerWorld, net.minecraft.util.math.BlockPos, net.minecraft.item.ItemStack, net.minecraft.util.math.intprovider.IntProvider)can be used to drop experience orbs.ExperienceDroppingBlockprovides the implementation for experience-dropping blocks.- See Also:
- Mappings:
Namespace Name Mixin selector named onStacksDroppedLnet/minecraft/block/AbstractBlock;onStacksDropped(Lnet/minecraft/block/BlockState;Lnet/minecraft/server/world/ServerWorld;Lnet/minecraft/util/math/BlockPos;Lnet/minecraft/item/ItemStack;Z)Vintermediary method_9565Lnet/minecraft/class_4970;method_9565(Lnet/minecraft/class_2680;Lnet/minecraft/class_3218;Lnet/minecraft/class_2338;Lnet/minecraft/class_1799;Z)Vofficial aLdtb;a(Ldtc;Laqu;Ljd;Lcuq;Z)V
-
onBlockBreakStart
Called when a player starts breaking the block (including when instant-mining).This method is called on both the logical client and logical server, so take caution when overriding this method. The logical side can be checked using
World.isClient.- See Also:
- Mappings:
Namespace Name Mixin selector named onBlockBreakStartLnet/minecraft/block/AbstractBlock;onBlockBreakStart(Lnet/minecraft/block/BlockState;Lnet/minecraft/world/World;Lnet/minecraft/util/math/BlockPos;Lnet/minecraft/entity/player/PlayerEntity;)Vintermediary method_9606Lnet/minecraft/class_4970;method_9606(Lnet/minecraft/class_2680;Lnet/minecraft/class_1937;Lnet/minecraft/class_2338;Lnet/minecraft/class_1657;)Vofficial a_Ldtb;a_(Ldtc;Ldcw;Ljd;Lcmx;)V
-
getWeakRedstonePower
protected int getWeakRedstonePower(BlockState state, BlockView world, BlockPos pos, Direction direction) Returns the weak redstone power emitted from the block.When overriding this, make sure to also override
emitsRedstonePower(net.minecraft.block.BlockState)to returntrue.Weak redstone power is a power that cannot power a redstone wire when a solid block is in between. For example,
RedstoneBlockandTargetBlockemits weak redstone power only.LeverBlockandButtonBlockemits both weak and strong redstone power depending on the direction.- Returns:
- the weak redstone power emitted from the block
- See Also:
- Mappings:
Namespace Name Mixin selector named getWeakRedstonePowerLnet/minecraft/block/AbstractBlock;getWeakRedstonePower(Lnet/minecraft/block/BlockState;Lnet/minecraft/world/BlockView;Lnet/minecraft/util/math/BlockPos;Lnet/minecraft/util/math/Direction;)Iintermediary method_9524Lnet/minecraft/class_4970;method_9524(Lnet/minecraft/class_2680;Lnet/minecraft/class_1922;Lnet/minecraft/class_2338;Lnet/minecraft/class_2350;)Iofficial aLdtb;a(Ldtc;Ldcc;Ljd;Lji;)I
-
onEntityCollision
Called when the entity's collision box intersects the block. Therefore, this method is not called for blocks with a collision; useBlock.onSteppedOn(net.minecraft.world.World, net.minecraft.util.math.BlockPos, net.minecraft.block.BlockState, net.minecraft.entity.Entity)for those blocks.This method is called on both the logical client and logical server, so take caution when overriding this method. The logical side can be checked using
World.isClient.Here are some examples:
CactusBlockdamages the entity.AbstractPressurePlateBlocktriggers.CobwebBlockslows the entity.EndPortalBlockteleports the entity.HopperBlockcollects the item entity.
- See Also:
- Mappings:
Namespace Name Mixin selector named onEntityCollisionLnet/minecraft/block/AbstractBlock;onEntityCollision(Lnet/minecraft/block/BlockState;Lnet/minecraft/world/World;Lnet/minecraft/util/math/BlockPos;Lnet/minecraft/entity/Entity;)Vintermediary method_9548Lnet/minecraft/class_4970;method_9548(Lnet/minecraft/class_2680;Lnet/minecraft/class_1937;Lnet/minecraft/class_2338;Lnet/minecraft/class_1297;)Vofficial aLdtb;a(Ldtc;Ldcw;Ljd;Lbsr;)V
-
getStrongRedstonePower
protected int getStrongRedstonePower(BlockState state, BlockView world, BlockPos pos, Direction direction) Returns the strong redstone power emitted from the block.When overriding this, make sure to also override
emitsRedstonePower(net.minecraft.block.BlockState)to returntrue.getWeakRedstonePower(net.minecraft.block.BlockState, net.minecraft.world.BlockView, net.minecraft.util.math.BlockPos, net.minecraft.util.math.Direction)might also need to be overridden.Strong redstone power is a power that can power a redstone wire when a solid block is in between. For example,
RedstoneBlockandTargetBlockemits weak redstone power only.LeverBlockandButtonBlockemits both weak and strong redstone power.- Returns:
- the strong redstone power emitted from the block
- See Also:
- Mappings:
Namespace Name Mixin selector named getStrongRedstonePowerLnet/minecraft/block/AbstractBlock;getStrongRedstonePower(Lnet/minecraft/block/BlockState;Lnet/minecraft/world/BlockView;Lnet/minecraft/util/math/BlockPos;Lnet/minecraft/util/math/Direction;)Iintermediary method_9603Lnet/minecraft/class_4970;method_9603(Lnet/minecraft/class_2680;Lnet/minecraft/class_1922;Lnet/minecraft/class_2338;Lnet/minecraft/class_2350;)Iofficial bLdtb;b(Ldtc;Ldcc;Ljd;Lji;)I
-
getLootTableKey
- Mappings:
Namespace Name Mixin selector named getLootTableKeyLnet/minecraft/block/AbstractBlock;getLootTableKey()Lnet/minecraft/registry/RegistryKey;intermediary method_26162Lnet/minecraft/class_4970;method_26162()Lnet/minecraft/class_5321;official vLdtb;v()Lakq;
-
onProjectileHit
protected void onProjectileHit(World world, BlockState state, BlockHitResult hit, ProjectileEntity projectile) Called when aProjectileEntityhits a block.This method is called on both the logical client and logical server, so take caution when overriding this method. The logical side can be checked using
World.isClient.Here are some examples:
TargetBlockactivates.BellBlockrings.LightningRodBlockspawns a lightning.AbstractCandleBlocklights on fire when hit by a projectile on fire.
- See Also:
- Mappings:
Namespace Name Mixin selector named onProjectileHitLnet/minecraft/block/AbstractBlock;onProjectileHit(Lnet/minecraft/world/World;Lnet/minecraft/block/BlockState;Lnet/minecraft/util/hit/BlockHitResult;Lnet/minecraft/entity/projectile/ProjectileEntity;)Vintermediary method_19286Lnet/minecraft/class_4970;method_19286(Lnet/minecraft/class_1937;Lnet/minecraft/class_2680;Lnet/minecraft/class_3965;Lnet/minecraft/class_1676;)Vofficial aLdtb;a(Ldcw;Ldtc;Lewy;Lcnp;)V
-
isTransparent
- Mappings:
Namespace Name Mixin selector named isTransparentLnet/minecraft/block/AbstractBlock;isTransparent(Lnet/minecraft/block/BlockState;Lnet/minecraft/world/BlockView;Lnet/minecraft/util/math/BlockPos;)Zintermediary method_9579Lnet/minecraft/class_4970;method_9579(Lnet/minecraft/class_2680;Lnet/minecraft/class_1922;Lnet/minecraft/class_2338;)Zofficial a_Ldtb;a_(Ldtc;Ldcc;Ljd;)Z
-
hasRandomTicks
- Mappings:
Namespace Name Mixin selector named hasRandomTicksLnet/minecraft/block/AbstractBlock;hasRandomTicks(Lnet/minecraft/block/BlockState;)Zintermediary method_9542Lnet/minecraft/class_4970;method_9542(Lnet/minecraft/class_2680;)Zofficial d_Ldtb;d_(Ldtc;)Z
-
getSoundGroup
- Mappings:
Namespace Name Mixin selector named getSoundGroupLnet/minecraft/block/AbstractBlock;getSoundGroup(Lnet/minecraft/block/BlockState;)Lnet/minecraft/sound/BlockSoundGroup;intermediary method_9573Lnet/minecraft/class_4970;method_9573(Lnet/minecraft/class_2680;)Lnet/minecraft/class_2498;official g_Ldtb;g_(Ldtc;)Ldnm;
-
asItem
Returns the block's corresponding item.This is not affected by loot tables. Blocks without corresponding items, such as piston head, will return
Items.AIR.- Returns:
- the block's corresponding item
- See Also:
- Mappings:
Namespace Name Mixin selector named asItemLnet/minecraft/block/AbstractBlock;asItem()Lnet/minecraft/item/Item;intermediary method_8389Lnet/minecraft/class_4970;method_8389()Lnet/minecraft/class_1792;official rLdtb;r()Lcul;
-
asBlock
Returns the block asBlock.This is used for casting purposes.
- Returns:
- the block as
Block - Mappings:
Namespace Name Mixin selector named asBlockLnet/minecraft/block/AbstractBlock;asBlock()Lnet/minecraft/block/Block;intermediary method_26160Lnet/minecraft/class_4970;method_26160()Lnet/minecraft/class_2248;official qLdtb;q()Ldfy;
-
getDefaultMapColor
- Mappings:
Namespace Name Mixin selector named getDefaultMapColorLnet/minecraft/block/AbstractBlock;getDefaultMapColor()Lnet/minecraft/block/MapColor;intermediary method_26403Lnet/minecraft/class_4970;method_26403()Lnet/minecraft/class_3620;official wLdtb;w()Lepi;
-
getHardness
public float getHardness()- Mappings:
Namespace Name Mixin selector named getHardnessLnet/minecraft/block/AbstractBlock;getHardness()Fintermediary method_36555Lnet/minecraft/class_4970;method_36555()Fofficial xLdtb;x()F
-