Class AbstractBlock
- 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
.
Deprecated methods in this class mean they
should only be called from the corresponding method in AbstractBlock.AbstractBlockState
or subclasses of this class. Overriding the
methods is an expected usage and is not deprecated in any way.
- API Note:
- In vanilla subclasses, these methods are called either to do the
default behavior (e.g.
super.onUse(...)
) or to delegate logic to other blocks (e.g.StairsBlock#randomTick
callsrandomTick
of its base block).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 setBlockState
calloldState. canReplace
Checking if the current block can be replaced Yes Yes No newBlock. getPlacementState
Getting the placed state Yes Yes No newState. canPlaceAt
Checking the block's placement restriction Yes Yes No oldState. onStateReplaced
Dropping inventory, updating redstone circuit, etc Yes Yes Yes newState. onBlockAdded
Activating redstone component, etc Yes Yes Yes neighborState. neighborUpdate
Activating neighboring redstone component, etc Yes Yes Yes oldState. prepare
Updating redstone wire connection Yes Yes Yes neighborState. getStateForNeighborUpdate
Checking the neighboring block's placement restriction, updating connection, etc Yes Yes Yes newState. prepare
Updating redstone wire connection Yes Yes Yes newBlock. onPlaced
Placing 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
/removeBlock
callbreakBlock
callstate. onBlockBreakStart
Doing something when player starts breaking a block Yes No No No state. calcBlockBreakingDelta
Calculating the player's mining speed Yes No No No block. onBreak
Spawning particles, breaking the other half of tall or wide block, etc Yes No No No state. onStateReplaced
Dropping inventory, updating redstone circuit, etc Yes Yes Yes Yes neighborState. neighborUpdate
Activating neighboring redstone component, etc Yes Yes Yes Yes state. prepare
Updating redstone wire connection Yes Yes Yes Yes neighborState. getStateForNeighborUpdate
Checking the neighboring block's placement restriction, updating connection, etc Yes Yes Yes Yes block. onBroken
Unused in most cases Yes No No No block. afterBreak
Dropping stacks, replacing the broken block with another block, etc Yes No No No state. getDroppedStacks
Supplying information to loot context builder Yes Yes Yes Yes1 state. onStacksDropped
Dropping experience orbs Yes Yes2 Yes Yes1 Notes:
- Called before
onStateReplaced
in this case. - Called before
getDroppedStacks
in this case.
- Called before
- Mappings:
Namespace Name official cvn
intermediary net/minecraft/class_4970
named net/minecraft/block/AbstractBlock
-
Nested Class Summary
Modifier and TypeClassDescriptionstatic class
static interface
static enum
static class
static interface
-
Field Summary
Modifier and TypeFieldDescriptionprotected final boolean
protected static final Direction[]
protected final boolean
protected final float
protected @Nullable Identifier
protected final Material
protected final boolean
protected final float
protected final AbstractBlock.Settings
protected final float
protected final BlockSoundGroup
protected final float
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionprotected abstract Block
asBlock()
Returns the block asBlock
.abstract Item
asItem()
Returns the block's corresponding item.float
calcBlockBreakingDelta
(BlockState state, PlayerEntity player, BlockView world, BlockPos pos) Deprecated.boolean
canBucketPlace
(BlockState state, Fluid fluid) Deprecated.Consider callingAbstractBlock.AbstractBlockState.canBucketPlace(net.minecraft.fluid.Fluid)
instead.boolean
canPathfindThrough
(BlockState state, BlockView world, BlockPos pos, NavigationType type) boolean
canPlaceAt
(BlockState state, WorldView world, BlockPos pos) Deprecated.boolean
canReplace
(BlockState state, ItemPlacementContext context) Deprecated.Consider callingAbstractBlock.AbstractBlockState.canReplace(net.minecraft.item.ItemPlacementContext)
instead.createScreenHandlerFactory
(BlockState state, World world, BlockPos pos) Deprecated.boolean
emitsRedstonePower
(BlockState state) Deprecated.Consider callingAbstractBlock.AbstractBlockState.emitsRedstonePower()
instead.float
getAmbientOcclusionLightLevel
(BlockState state, BlockView world, BlockPos pos) Deprecated.getCameraCollisionShape
(BlockState state, BlockView world, BlockPos pos, ShapeContext context) getCollisionShape
(BlockState state, BlockView world, BlockPos pos, ShapeContext context) Deprecated.Consider callingAbstractBlock.AbstractBlockState.getCollisionShape(BlockView, BlockPos, ShapeContext)
instead.int
getComparatorOutput
(BlockState state, World world, BlockPos pos) Deprecated.getCullingShape
(BlockState state, BlockView world, BlockPos pos) Deprecated.getDroppedStacks
(BlockState state, LootContext.Builder builder) Deprecated.Consider callingAbstractBlock.AbstractBlockState.getDroppedStacks(net.minecraft.loot.context.LootContext.Builder)
instead.getFluidState
(BlockState state) Deprecated.Consider callingAbstractBlock.AbstractBlockState.getFluidState()
instead.float
final Identifier
float
int
getOpacity
(BlockState state, BlockView world, BlockPos pos) Deprecated.getOutlineShape
(BlockState state, BlockView world, BlockPos pos, ShapeContext context) Deprecated.Consider callingAbstractBlock.AbstractBlockState.getOutlineShape(BlockView, BlockPos, ShapeContext)
instead.getPistonBehavior
(BlockState state) Deprecated.Consider callingAbstractBlock.AbstractBlockState.getPistonBehavior()
instead.getRaycastShape
(BlockState state, BlockView world, BlockPos pos) Deprecated.long
getRenderingSeed
(BlockState state, BlockPos pos) Deprecated.Consider callingAbstractBlock.AbstractBlockState.getRenderingSeed(net.minecraft.util.math.BlockPos)
instead.getRenderType
(BlockState state) Deprecated.Consider callingAbstractBlock.AbstractBlockState.getRenderType()
instead.getSidesShape
(BlockState state, BlockView world, BlockPos pos) Deprecated.getStateForNeighborUpdate
(BlockState state, Direction direction, BlockState neighborState, WorldAccess world, BlockPos pos, BlockPos neighborPos) int
getStrongRedstonePower
(BlockState state, BlockView world, BlockPos pos, Direction direction) float
int
getWeakRedstonePower
(BlockState state, BlockView world, BlockPos pos, Direction direction) boolean
hasComparatorOutput
(BlockState state) Deprecated.Consider callingAbstractBlock.AbstractBlockState.hasComparatorOutput()
instead.boolean
hasSidedTransparency
(BlockState state) Deprecated.Consider callingAbstractBlock.AbstractBlockState.hasSidedTransparency
instead.boolean
isCullingShapeFullCube
(BlockState state, BlockView world, BlockPos pos) Deprecated.boolean
isShapeFullCube
(BlockState state, BlockView world, BlockPos pos) Deprecated.boolean
isSideInvisible
(BlockState state, BlockState stateFrom, Direction direction) Deprecated.mirror
(BlockState state, BlockMirror mirror) Deprecated.Consider callingAbstractBlock.AbstractBlockState.mirror(net.minecraft.util.BlockMirror)
instead.void
neighborUpdate
(BlockState state, World world, BlockPos pos, Block sourceBlock, BlockPos sourcePos, boolean notify) void
onBlockAdded
(BlockState state, World world, BlockPos pos, BlockState oldState, boolean notify) Deprecated.void
onBlockBreakStart
(BlockState state, World world, BlockPos pos, PlayerEntity player) void
onEntityCollision
(BlockState state, World world, BlockPos pos, Entity entity) Deprecated.void
onProjectileHit
(World world, BlockState state, BlockHitResult hit, ProjectileEntity projectile) void
onStacksDropped
(BlockState state, ServerWorld world, BlockPos pos, ItemStack stack, boolean dropExperience) void
onStateReplaced
(BlockState state, World world, BlockPos pos, BlockState newState, boolean moved) Deprecated.boolean
onSyncedBlockEvent
(BlockState state, World world, BlockPos pos, int type, int data) Deprecated.onUse
(BlockState state, World world, BlockPos pos, PlayerEntity player, Hand hand, BlockHitResult hit) void
prepare
(BlockState state, WorldAccess world, BlockPos pos, int flags, int maxUpdateDepth) Deprecated.Consider callingAbstractBlock.AbstractBlockState.prepare(WorldAccess, BlockPos, int, int)
instead.void
randomTick
(BlockState state, ServerWorld world, BlockPos pos, Random random) rotate
(BlockState state, BlockRotation rotation) Deprecated.Consider callingAbstractBlock.AbstractBlockState.rotate(net.minecraft.util.BlockRotation)
instead.void
scheduledTick
(BlockState state, ServerWorld world, BlockPos pos, Random random)
-
Field Details
-
DIRECTIONS
- Mappings:
Namespace Name Mixin selector official aE
Lcvn;aE:[Lgy;
intermediary field_23157
Lnet/minecraft/class_4970;field_23157:[Lnet/minecraft/class_2350;
named DIRECTIONS
Lnet/minecraft/block/AbstractBlock;DIRECTIONS:[Lnet/minecraft/util/math/Direction;
-
material
- Mappings:
Namespace Name Mixin selector official aF
Lcvn;aF:Ldpz;
intermediary field_23158
Lnet/minecraft/class_4970;field_23158:Lnet/minecraft/class_3614;
named material
Lnet/minecraft/block/AbstractBlock;material:Lnet/minecraft/block/Material;
-
collidable
protected final boolean collidable- Mappings:
Namespace Name Mixin selector official aG
Lcvn;aG:Z
intermediary field_23159
Lnet/minecraft/class_4970;field_23159:Z
named collidable
Lnet/minecraft/block/AbstractBlock;collidable:Z
-
resistance
protected final float resistance- Mappings:
Namespace Name Mixin selector official aH
Lcvn;aH:F
intermediary field_23160
Lnet/minecraft/class_4970;field_23160:F
named resistance
Lnet/minecraft/block/AbstractBlock;resistance:F
-
randomTicks
protected final boolean randomTicks- Mappings:
Namespace Name Mixin selector official aI
Lcvn;aI:Z
intermediary field_23161
Lnet/minecraft/class_4970;field_23161:Z
named randomTicks
Lnet/minecraft/block/AbstractBlock;randomTicks:Z
-
soundGroup
- Mappings:
Namespace Name Mixin selector official aJ
Lcvn;aJ:Lcqw;
intermediary field_23162
Lnet/minecraft/class_4970;field_23162:Lnet/minecraft/class_2498;
named soundGroup
Lnet/minecraft/block/AbstractBlock;soundGroup:Lnet/minecraft/sound/BlockSoundGroup;
-
slipperiness
protected final float slipperiness- Mappings:
Namespace Name Mixin selector official aK
Lcvn;aK:F
intermediary field_23163
Lnet/minecraft/class_4970;field_23163:F
named slipperiness
Lnet/minecraft/block/AbstractBlock;slipperiness:F
-
velocityMultiplier
protected final float velocityMultiplier- Mappings:
Namespace Name Mixin selector official aL
Lcvn;aL:F
intermediary field_23164
Lnet/minecraft/class_4970;field_23164:F
named velocityMultiplier
Lnet/minecraft/block/AbstractBlock;velocityMultiplier:F
-
jumpVelocityMultiplier
protected final float jumpVelocityMultiplier- Mappings:
Namespace Name Mixin selector official aM
Lcvn;aM:F
intermediary field_23165
Lnet/minecraft/class_4970;field_23165:F
named jumpVelocityMultiplier
Lnet/minecraft/block/AbstractBlock;jumpVelocityMultiplier:F
-
dynamicBounds
protected final boolean dynamicBounds- Mappings:
Namespace Name Mixin selector official aN
Lcvn;aN:Z
intermediary field_23154
Lnet/minecraft/class_4970;field_23154:Z
named dynamicBounds
Lnet/minecraft/block/AbstractBlock;dynamicBounds:Z
-
settings
- Mappings:
Namespace Name Mixin selector official aO
Lcvn;aO:Lcvn$c;
intermediary field_23155
Lnet/minecraft/class_4970;field_23155:Lnet/minecraft/class_4970$class_2251;
named settings
Lnet/minecraft/block/AbstractBlock;settings:Lnet/minecraft/block/AbstractBlock$Settings;
-
lootTableId
- Mappings:
Namespace Name Mixin selector official aP
Lcvn;aP:Labb;
intermediary field_23156
Lnet/minecraft/class_4970;field_23156:Lnet/minecraft/class_2960;
named lootTableId
Lnet/minecraft/block/AbstractBlock;lootTableId:Lnet/minecraft/util/Identifier;
-
-
Constructor Details
-
AbstractBlock
- Mappings:
Namespace Name Mixin selector official <init>
Lcvn;<init>(Lcvn$c;)V
intermediary <init>
Lnet/minecraft/class_4970;<init>(Lnet/minecraft/class_4970$class_2251;)V
named <init>
Lnet/minecraft/block/AbstractBlock;<init>(Lnet/minecraft/block/AbstractBlock$Settings;)V
-
-
Method Details
-
prepare
@Deprecated public void prepare(BlockState state, WorldAccess world, BlockPos pos, int flags, int maxUpdateDepth) Deprecated.Consider callingAbstractBlock.AbstractBlockState.prepare(WorldAccess, BlockPos, int, int)
instead. See why these methods are deprecated.Called when the block state changes, before the {#linkplain #getStateForNeighborUpdate 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:
-
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)
neighborUpdate(net.minecraft.block.BlockState, net.minecraft.world.World, net.minecraft.util.math.BlockPos, net.minecraft.block.Block, net.minecraft.util.math.BlockPos, boolean)
- API Note:
- This is used by
RedstoneWireBlock
to update connected redstone wire. - Mappings:
Namespace Name Mixin selector official a
Lcvn;a(Lcvo;Lcgy;Lgt;II)V
intermediary method_9517
Lnet/minecraft/class_4970;method_9517(Lnet/minecraft/class_2680;Lnet/minecraft/class_1936;Lnet/minecraft/class_2338;II)V
named prepare
Lnet/minecraft/block/AbstractBlock;prepare(Lnet/minecraft/block/BlockState;Lnet/minecraft/world/WorldAccess;Lnet/minecraft/util/math/BlockPos;II)V
-
getStateForNeighborUpdate
@Deprecated public BlockState getStateForNeighborUpdate(BlockState state, Direction direction, BlockState neighborState, WorldAccess world, BlockPos pos, BlockPos neighborPos) Deprecated.Returns the state of the block after a neighboring block's state change.Returning
Blocks.AIR
breaks 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_STATE
flag is set in thesetBlockState
call.This method can be used for multiple purposes. Here are some examples:
FenceBlock
uses it to update the fence's connection when a horizontally neighboring block's state is changed.PlantBlock
uses it to break the plant if the state change causes it to lose its supporting block.DoorBlock
uses it to copy the state of the other half of the door.SlabBlock
uses it to schedule the fluid to tick if waterlogged.SoulSandBlock
uses it to schedule the water block above to tick so that it becomes a bubble column.FallingBlock
uses 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:
-
neighborUpdate(net.minecraft.block.BlockState, net.minecraft.world.World, net.minecraft.util.math.BlockPos, net.minecraft.block.Block, net.minecraft.util.math.BlockPos, boolean)
prepare(net.minecraft.block.BlockState, net.minecraft.world.WorldAccess, net.minecraft.util.math.BlockPos, int, int)
canPlaceAt(net.minecraft.block.BlockState, net.minecraft.world.WorldView, net.minecraft.util.math.BlockPos)
Block.FORCE_STATE
- Mappings:
Namespace Name Mixin selector official a
Lcvn;a(Lcvo;Lgy;Lcvo;Lcgy;Lgt;Lgt;)Lcvo;
intermediary method_9559
Lnet/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;
named getStateForNeighborUpdate
Lnet/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;
-
isSideInvisible
@Deprecated public boolean isSideInvisible(BlockState state, BlockState stateFrom, Direction direction) Deprecated.- Mappings:
Namespace Name Mixin selector official a
Lcvn;a(Lcvo;Lcvo;Lgy;)Z
intermediary method_9522
Lnet/minecraft/class_4970;method_9522(Lnet/minecraft/class_2680;Lnet/minecraft/class_2680;Lnet/minecraft/class_2350;)Z
named isSideInvisible
Lnet/minecraft/block/AbstractBlock;isSideInvisible(Lnet/minecraft/block/BlockState;Lnet/minecraft/block/BlockState;Lnet/minecraft/util/math/Direction;)Z
-
neighborUpdate
@Deprecated public void neighborUpdate(BlockState state, World world, BlockPos pos, Block sourceBlock, BlockPos sourcePos, boolean notify) Deprecated.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 asSpongeBlock
which 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 official a
Lcvn;a(Lcvo;Lcgx;Lgt;Lcjt;Lgt;Z)V
intermediary method_9612
Lnet/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)V
named neighborUpdate
Lnet/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)V
-
onBlockAdded
@Deprecated public void onBlockAdded(BlockState state, World world, BlockPos pos, BlockState oldState, boolean notify) Deprecated.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 official b
Lcvn;b(Lcvo;Lcgx;Lgt;Lcvo;Z)V
intermediary method_9615
Lnet/minecraft/class_4970;method_9615(Lnet/minecraft/class_2680;Lnet/minecraft/class_1937;Lnet/minecraft/class_2338;Lnet/minecraft/class_2680;Z)V
named onBlockAdded
Lnet/minecraft/block/AbstractBlock;onBlockAdded(Lnet/minecraft/block/BlockState;Lnet/minecraft/world/World;Lnet/minecraft/util/math/BlockPos;Lnet/minecraft/block/BlockState;Z)V
- When activating a redstone component on placement (used along with
-
onStateReplaced
@Deprecated public void onStateReplaced(BlockState state, World world, BlockPos pos, BlockState newState, boolean moved) Deprecated.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.- See Also:
- Mappings:
Namespace Name Mixin selector official a
Lcvn;a(Lcvo;Lcgx;Lgt;Lcvo;Z)V
intermediary method_9536
Lnet/minecraft/class_4970;method_9536(Lnet/minecraft/class_2680;Lnet/minecraft/class_1937;Lnet/minecraft/class_2338;Lnet/minecraft/class_2680;Z)V
named onStateReplaced
Lnet/minecraft/block/AbstractBlock;onStateReplaced(Lnet/minecraft/block/BlockState;Lnet/minecraft/world/World;Lnet/minecraft/util/math/BlockPos;Lnet/minecraft/block/BlockState;Z)V
-
onUse
@Deprecated public ActionResult onUse(BlockState state, World world, BlockPos pos, PlayerEntity player, Hand hand, BlockHitResult hit) Deprecated.Called when this block is used by a player. This, by default, is bound to using the right mouse button.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()
.If the action result is successful on a logical client, then the action will be sent to the logical server for processing.
- Returns:
- an action result that specifies if using the block was successful.
- Mappings:
Namespace Name Mixin selector official a
Lcvn;a(Lcvo;Lcgx;Lgt;Lbuc;Lbai;Ldwm;)Lbaj;
intermediary method_9534
Lnet/minecraft/class_4970;method_9534(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_1269;
named onUse
Lnet/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/Hand;Lnet/minecraft/util/hit/BlockHitResult;)Lnet/minecraft/util/ActionResult;
-
onSyncedBlockEvent
@Deprecated public boolean onSyncedBlockEvent(BlockState state, World world, BlockPos pos, int type, int data) Deprecated.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 official a
Lcvn;a(Lcvo;Lcgx;Lgt;II)Z
intermediary method_9592
Lnet/minecraft/class_4970;method_9592(Lnet/minecraft/class_2680;Lnet/minecraft/class_1937;Lnet/minecraft/class_2338;II)Z
named onSyncedBlockEvent
Lnet/minecraft/block/AbstractBlock;onSyncedBlockEvent(Lnet/minecraft/block/BlockState;Lnet/minecraft/world/World;Lnet/minecraft/util/math/BlockPos;II)Z
-
getRenderType
Deprecated.Consider callingAbstractBlock.AbstractBlockState.getRenderType()
instead. See why these methods are deprecated.Returns the block's render type (invisible, animated, model).- Returns:
- the block's render type (invisible, animated, model)
- API Note:
BlockWithEntity
overrides this to returnBlockRenderType.INVISIBLE
; therefore, custom blocks extending that class must override it again to render the block.- Mappings:
Namespace Name Mixin selector official b_
Lcvn;b_(Lcvo;)Lcpp;
intermediary method_9604
Lnet/minecraft/class_4970;method_9604(Lnet/minecraft/class_2680;)Lnet/minecraft/class_2464;
named getRenderType
Lnet/minecraft/block/AbstractBlock;getRenderType(Lnet/minecraft/block/BlockState;)Lnet/minecraft/block/BlockRenderType;
-
hasSidedTransparency
Deprecated.Consider callingAbstractBlock.AbstractBlockState.hasSidedTransparency
instead. See why these methods are deprecated.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
- Mappings:
Namespace Name Mixin selector official g_
Lcvn;g_(Lcvo;)Z
intermediary method_9526
Lnet/minecraft/class_4970;method_9526(Lnet/minecraft/class_2680;)Z
named hasSidedTransparency
Lnet/minecraft/block/AbstractBlock;hasSidedTransparency(Lnet/minecraft/block/BlockState;)Z
-
emitsRedstonePower
Deprecated.Consider callingAbstractBlock.AbstractBlockState.emitsRedstonePower()
instead. See why these methods are deprecated.Returns whether the block is capable of emitting redstone power.This does not return whether the block is currently emitting redstone power. Use
World.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 official f_
Lcvn;f_(Lcvo;)Z
intermediary method_9506
Lnet/minecraft/class_4970;method_9506(Lnet/minecraft/class_2680;)Z
named emitsRedstonePower
Lnet/minecraft/block/AbstractBlock;emitsRedstonePower(Lnet/minecraft/block/BlockState;)Z
-
getPistonBehavior
Deprecated.Consider callingAbstractBlock.AbstractBlockState.getPistonBehavior()
instead. See why these methods are deprecated.Returns how the piston should handle the block.Notes on piston behavior:
PistonBehavior.IGNORE
is ignored for blocks.PistonBehavior.DESTROY
andPistonBehavior.PUSH_ONLY
causes pistons to ignore the block entity restriction.- If the hardness equals
-1.0f
like bedrock, it blocks the piston regardless of the return value. - Behavior of several unpushable blocks are hardcoded at
PistonBlock.isMovable(net.minecraft.block.BlockState, net.minecraft.world.World, net.minecraft.util.math.BlockPos, net.minecraft.util.math.Direction, boolean, net.minecraft.util.math.Direction)
instead.
- Returns:
- how the piston should handle the block
- See Also:
- Mappings:
Namespace Name Mixin selector official d
Lcvn;d(Lcvo;)Ldqb;
intermediary method_9527
Lnet/minecraft/class_4970;method_9527(Lnet/minecraft/class_2680;)Lnet/minecraft/class_3619;
named getPistonBehavior
Lnet/minecraft/block/AbstractBlock;getPistonBehavior(Lnet/minecraft/block/BlockState;)Lnet/minecraft/block/piston/PistonBehavior;
-
getFluidState
Deprecated.Consider callingAbstractBlock.AbstractBlockState.getFluidState()
instead. See why these methods are deprecated.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 official c_
Lcvn;c_(Lcvo;)Ldpv;
intermediary method_9545
Lnet/minecraft/class_4970;method_9545(Lnet/minecraft/class_2680;)Lnet/minecraft/class_3610;
named getFluidState
Lnet/minecraft/block/AbstractBlock;getFluidState(Lnet/minecraft/block/BlockState;)Lnet/minecraft/fluid/FluidState;
-
hasComparatorOutput
Deprecated.Consider callingAbstractBlock.AbstractBlockState.hasComparatorOutput()
instead. See why these methods are deprecated.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 official d_
Lcvn;d_(Lcvo;)Z
intermediary method_9498
Lnet/minecraft/class_4970;method_9498(Lnet/minecraft/class_2680;)Z
named hasComparatorOutput
Lnet/minecraft/block/AbstractBlock;hasComparatorOutput(Lnet/minecraft/block/BlockState;)Z
-
getMaxHorizontalModelOffset
public float getMaxHorizontalModelOffset()- Mappings:
Namespace Name Mixin selector official V_
Lcvn;V_()F
intermediary method_32913
Lnet/minecraft/class_4970;method_32913()F
named getMaxHorizontalModelOffset
Lnet/minecraft/block/AbstractBlock;getMaxHorizontalModelOffset()F
-
getVerticalModelOffsetMultiplier
public float getVerticalModelOffsetMultiplier()- Mappings:
Namespace Name Mixin selector official Z_
Lcvn;Z_()F
intermediary method_37247
Lnet/minecraft/class_4970;method_37247()F
named getVerticalModelOffsetMultiplier
Lnet/minecraft/block/AbstractBlock;getVerticalModelOffsetMultiplier()F
-
rotate
Deprecated.Consider callingAbstractBlock.AbstractBlockState.rotate(net.minecraft.util.BlockRotation)
instead. See why these methods are deprecated.Returnsstate
rotated byrotation
.By default, this returns the provided block state.
- Returns:
state
rotated byrotation
- Mappings:
Namespace Name Mixin selector official a
Lcvn;a(Lcvo;Lcpw;)Lcvo;
intermediary method_9598
Lnet/minecraft/class_4970;method_9598(Lnet/minecraft/class_2680;Lnet/minecraft/class_2470;)Lnet/minecraft/class_2680;
named rotate
Lnet/minecraft/block/AbstractBlock;rotate(Lnet/minecraft/block/BlockState;Lnet/minecraft/util/BlockRotation;)Lnet/minecraft/block/BlockState;
-
mirror
Deprecated.Consider callingAbstractBlock.AbstractBlockState.mirror(net.minecraft.util.BlockMirror)
instead. See why these methods are deprecated.Returnsstate
mirrored bymirror
.By default, this returns the provided block state.
- Returns:
state
mirrored bymirror
- Mappings:
Namespace Name Mixin selector official a
Lcvn;a(Lcvo;Lcoh;)Lcvo;
intermediary method_9569
Lnet/minecraft/class_4970;method_9569(Lnet/minecraft/class_2680;Lnet/minecraft/class_2415;)Lnet/minecraft/class_2680;
named mirror
Lnet/minecraft/block/AbstractBlock;mirror(Lnet/minecraft/block/BlockState;Lnet/minecraft/util/BlockMirror;)Lnet/minecraft/block/BlockState;
-
canReplace
Deprecated.Consider callingAbstractBlock.AbstractBlockState.canReplace(net.minecraft.item.ItemPlacementContext)
instead. See why these methods are deprecated.Returns whether the item can replace the block.By default, this checks if the block's material 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 official a
Lcvn;a(Lcvo;Lccx;)Z
intermediary method_9616
Lnet/minecraft/class_4970;method_9616(Lnet/minecraft/class_2680;Lnet/minecraft/class_1750;)Z
named canReplace
Lnet/minecraft/block/AbstractBlock;canReplace(Lnet/minecraft/block/BlockState;Lnet/minecraft/item/ItemPlacementContext;)Z
-
canBucketPlace
Deprecated.Consider callingAbstractBlock.AbstractBlockState.canBucketPlace(net.minecraft.fluid.Fluid)
instead. See why these methods are deprecated.Returns whether a bucket can replace the block with the fluid.By default, this checks if the block's material 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 official a
Lcvn;a(Lcvo;Ldpu;)Z
intermediary method_22358
Lnet/minecraft/class_4970;method_22358(Lnet/minecraft/class_2680;Lnet/minecraft/class_3611;)Z
named canBucketPlace
Lnet/minecraft/block/AbstractBlock;canBucketPlace(Lnet/minecraft/block/BlockState;Lnet/minecraft/fluid/Fluid;)Z
-
getDroppedStacks
Deprecated.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
builder
before 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:
-
onStateReplaced(net.minecraft.block.BlockState, net.minecraft.world.World, net.minecraft.util.math.BlockPos, net.minecraft.block.BlockState, boolean)
onStacksDropped(net.minecraft.block.BlockState, net.minecraft.server.world.ServerWorld, net.minecraft.util.math.BlockPos, net.minecraft.item.ItemStack, boolean)
ItemStack.split(int)
LootContextParameters
- Mappings:
Namespace Name Mixin selector official a
Lcvn;a(Lcvo;Ldsd$a;)Ljava/util/List;
intermediary method_9560
Lnet/minecraft/class_4970;method_9560(Lnet/minecraft/class_2680;Lnet/minecraft/class_47$class_48;)Ljava/util/List;
named getDroppedStacks
Lnet/minecraft/block/AbstractBlock;getDroppedStacks(Lnet/minecraft/block/BlockState;Lnet/minecraft/loot/context/LootContext$Builder;)Ljava/util/List;
-
getRenderingSeed
Deprecated.Consider callingAbstractBlock.AbstractBlockState.getRenderingSeed(net.minecraft.util.math.BlockPos)
instead. See why these methods are deprecated.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
- Mappings:
Namespace Name Mixin selector official a
Lcvn;a(Lcvo;Lgt;)J
intermediary method_9535
Lnet/minecraft/class_4970;method_9535(Lnet/minecraft/class_2680;Lnet/minecraft/class_2338;)J
named getRenderingSeed
Lnet/minecraft/block/AbstractBlock;getRenderingSeed(Lnet/minecraft/block/BlockState;Lnet/minecraft/util/math/BlockPos;)J
-
getCullingShape
Deprecated.- Mappings:
Namespace Name Mixin selector official b_
Lcvn;b_(Lcvo;Lcgd;Lgt;)Ldxj;
intermediary method_9571
Lnet/minecraft/class_4970;method_9571(Lnet/minecraft/class_2680;Lnet/minecraft/class_1922;Lnet/minecraft/class_2338;)Lnet/minecraft/class_265;
named getCullingShape
Lnet/minecraft/block/AbstractBlock;getCullingShape(Lnet/minecraft/block/BlockState;Lnet/minecraft/world/BlockView;Lnet/minecraft/util/math/BlockPos;)Lnet/minecraft/util/shape/VoxelShape;
-
getSidesShape
Deprecated.- Mappings:
Namespace Name Mixin selector official f
Lcvn;f(Lcvo;Lcgd;Lgt;)Ldxj;
intermediary method_25959
Lnet/minecraft/class_4970;method_25959(Lnet/minecraft/class_2680;Lnet/minecraft/class_1922;Lnet/minecraft/class_2338;)Lnet/minecraft/class_265;
named getSidesShape
Lnet/minecraft/block/AbstractBlock;getSidesShape(Lnet/minecraft/block/BlockState;Lnet/minecraft/world/BlockView;Lnet/minecraft/util/math/BlockPos;)Lnet/minecraft/util/shape/VoxelShape;
-
getRaycastShape
Deprecated.- Mappings:
Namespace Name Mixin selector official a
Lcvn;a(Lcvo;Lcgd;Lgt;)Ldxj;
intermediary method_9584
Lnet/minecraft/class_4970;method_9584(Lnet/minecraft/class_2680;Lnet/minecraft/class_1922;Lnet/minecraft/class_2338;)Lnet/minecraft/class_265;
named getRaycastShape
Lnet/minecraft/block/AbstractBlock;getRaycastShape(Lnet/minecraft/block/BlockState;Lnet/minecraft/world/BlockView;Lnet/minecraft/util/math/BlockPos;)Lnet/minecraft/util/shape/VoxelShape;
-
getOpacity
Deprecated.- Mappings:
Namespace Name Mixin selector official g
Lcvn;g(Lcvo;Lcgd;Lgt;)I
intermediary method_9505
Lnet/minecraft/class_4970;method_9505(Lnet/minecraft/class_2680;Lnet/minecraft/class_1922;Lnet/minecraft/class_2338;)I
named getOpacity
Lnet/minecraft/block/AbstractBlock;getOpacity(Lnet/minecraft/block/BlockState;Lnet/minecraft/world/BlockView;Lnet/minecraft/util/math/BlockPos;)I
-
createScreenHandlerFactory
@Nullable @Deprecated public @Nullable NamedScreenHandlerFactory createScreenHandlerFactory(BlockState state, World world, BlockPos pos) Deprecated.Returns the screen handler factory ornull
if 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.BlockWithEntity
delegates this logic to the block entity implementingNamedScreenHandlerFactory
. For example, anyBlockWithEntity
whose block entity extendsLockableContainerBlockEntity
needs 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
null
if screen handler cannot be created - See Also:
- Mappings:
Namespace Name Mixin selector official b
Lcvn;b(Lcvo;Lcgx;Lgt;)Lbam;
intermediary method_17454
Lnet/minecraft/class_4970;method_17454(Lnet/minecraft/class_2680;Lnet/minecraft/class_1937;Lnet/minecraft/class_2338;)Lnet/minecraft/class_3908;
named createScreenHandlerFactory
Lnet/minecraft/block/AbstractBlock;createScreenHandlerFactory(Lnet/minecraft/block/BlockState;Lnet/minecraft/world/World;Lnet/minecraft/util/math/BlockPos;)Lnet/minecraft/screen/NamedScreenHandlerFactory;
-
canPlaceAt
Deprecated.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 official a
Lcvn;a(Lcvo;Lcha;Lgt;)Z
intermediary method_9558
Lnet/minecraft/class_4970;method_9558(Lnet/minecraft/class_2680;Lnet/minecraft/class_4538;Lnet/minecraft/class_2338;)Z
named canPlaceAt
Lnet/minecraft/block/AbstractBlock;canPlaceAt(Lnet/minecraft/block/BlockState;Lnet/minecraft/world/WorldView;Lnet/minecraft/util/math/BlockPos;)Z
-
getAmbientOcclusionLightLevel
@Deprecated public float getAmbientOcclusionLightLevel(BlockState state, BlockView world, BlockPos pos) Deprecated.- Mappings:
Namespace Name Mixin selector official b
Lcvn;b(Lcvo;Lcgd;Lgt;)F
intermediary method_9575
Lnet/minecraft/class_4970;method_9575(Lnet/minecraft/class_2680;Lnet/minecraft/class_1922;Lnet/minecraft/class_2338;)F
named getAmbientOcclusionLightLevel
Lnet/minecraft/block/AbstractBlock;getAmbientOcclusionLightLevel(Lnet/minecraft/block/BlockState;Lnet/minecraft/world/BlockView;Lnet/minecraft/util/math/BlockPos;)F
-
getComparatorOutput
Deprecated.Returns the comparator output of the block, from0
to15
.When overriding this,
hasComparatorOutput(net.minecraft.block.BlockState)
must also be overridden.- Returns:
- the comparator output of the block, from
0
to15
- See Also:
- Mappings:
Namespace Name Mixin selector official a
Lcvn;a(Lcvo;Lcgx;Lgt;)I
intermediary method_9572
Lnet/minecraft/class_4970;method_9572(Lnet/minecraft/class_2680;Lnet/minecraft/class_1937;Lnet/minecraft/class_2338;)I
named getComparatorOutput
Lnet/minecraft/block/AbstractBlock;getComparatorOutput(Lnet/minecraft/block/BlockState;Lnet/minecraft/world/World;Lnet/minecraft/util/math/BlockPos;)I
-
getOutlineShape
@Deprecated public VoxelShape getOutlineShape(BlockState state, BlockView world, BlockPos pos, ShapeContext context) Deprecated.Consider callingAbstractBlock.AbstractBlockState.getOutlineShape(BlockView, BlockPos, ShapeContext)
instead. See why these methods are deprecated.- Mappings:
Namespace Name Mixin selector official a
Lcvn;a(Lcvo;Lcgd;Lgt;Ldwv;)Ldxj;
intermediary method_9530
Lnet/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;
named getOutlineShape
Lnet/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;
-
getCollisionShape
@Deprecated public VoxelShape getCollisionShape(BlockState state, BlockView world, BlockPos pos, ShapeContext context) Deprecated.Consider callingAbstractBlock.AbstractBlockState.getCollisionShape(BlockView, BlockPos, ShapeContext)
instead. See why these methods are deprecated.- Mappings:
Namespace Name Mixin selector official c
Lcvn;c(Lcvo;Lcgd;Lgt;Ldwv;)Ldxj;
intermediary method_9549
Lnet/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;
named getCollisionShape
Lnet/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;
-
isShapeFullCube
Deprecated.- Mappings:
Namespace Name Mixin selector official a_
Lcvn;a_(Lcvo;Lcgd;Lgt;)Z
intermediary method_37403
Lnet/minecraft/class_4970;method_37403(Lnet/minecraft/class_2680;Lnet/minecraft/class_1922;Lnet/minecraft/class_2338;)Z
named isShapeFullCube
Lnet/minecraft/block/AbstractBlock;isShapeFullCube(Lnet/minecraft/block/BlockState;Lnet/minecraft/world/BlockView;Lnet/minecraft/util/math/BlockPos;)Z
-
isCullingShapeFullCube
Deprecated.- Mappings:
Namespace Name Mixin selector official h
Lcvn;h(Lcvo;Lcgd;Lgt;)Z
intermediary method_42326
Lnet/minecraft/class_4970;method_42326(Lnet/minecraft/class_2680;Lnet/minecraft/class_1922;Lnet/minecraft/class_2338;)Z
named isCullingShapeFullCube
Lnet/minecraft/block/AbstractBlock;isCullingShapeFullCube(Lnet/minecraft/block/BlockState;Lnet/minecraft/world/BlockView;Lnet/minecraft/util/math/BlockPos;)Z
-
getCameraCollisionShape
@Deprecated public VoxelShape getCameraCollisionShape(BlockState state, BlockView world, BlockPos pos, ShapeContext context) Deprecated.- Mappings:
Namespace Name Mixin selector official b
Lcvn;b(Lcvo;Lcgd;Lgt;Ldwv;)Ldxj;
intermediary method_26159
Lnet/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;
named getCameraCollisionShape
Lnet/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;
-
randomTick
@Deprecated public void randomTick(BlockState state, ServerWorld world, BlockPos pos, Random random) Deprecated.Called server-side when a block gets ticked randomly. This can be overridden to implement various logics, most commonly plant growth. Default implementation callsscheduledTick(net.minecraft.block.BlockState, net.minecraft.server.world.ServerWorld, net.minecraft.util.math.BlockPos, net.minecraft.util.math.random.Random)
. To control the rate of the action, userandom
.Random tick speed is controlled by the game rule
randomTickSpeed
and 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:
SugarCaneBlock
uses this to grow sugar cane.OxidizableBlock
uses this to oxidize.NetherPortalBlock
uses this to spawn zombified piglins.LeavesBlock
uses this to decay when far from logs.
- See Also:
- Mappings:
Namespace Name Mixin selector official b
Lcvn;b(Lcvo;Lagg;Lgt;Lamn;)V
intermediary method_9514
Lnet/minecraft/class_4970;method_9514(Lnet/minecraft/class_2680;Lnet/minecraft/class_3218;Lnet/minecraft/class_2338;Lnet/minecraft/class_5819;)V
named randomTick
Lnet/minecraft/block/AbstractBlock;randomTick(Lnet/minecraft/block/BlockState;Lnet/minecraft/server/world/ServerWorld;Lnet/minecraft/util/math/BlockPos;Lnet/minecraft/util/math/random/Random;)V
-
scheduledTick
@Deprecated public void scheduledTick(BlockState state, ServerWorld world, BlockPos pos, Random random) Deprecated.Called server-side when a block receives a scheduled tick. This can be used like a timer. Scheduled ticks are added usingWorldAccess.createAndScheduleBlockTick(BlockPos, Block, int)
. Additionally,randomTick(net.minecraft.block.BlockState, net.minecraft.server.world.ServerWorld, net.minecraft.util.math.BlockPos, net.minecraft.util.math.random.Random)
by default calls this method; overriderandomTick(net.minecraft.block.BlockState, net.minecraft.server.world.ServerWorld, net.minecraft.util.math.BlockPos, net.minecraft.util.math.random.Random)
to disable this behavior.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:
SugarCaneBlock
checks the placement requirement.DispenserBlock
dispenses its content.CommandBlock
executes its command.FrogspawnBlock
spawns a tadpole.SoulSandBlock
updates a bubble column.FallingBlock
tries to fall.
- See Also:
-
WorldAccess.createAndScheduleBlockTick(BlockPos, Block, int)
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)
randomTick(net.minecraft.block.BlockState, net.minecraft.server.world.ServerWorld, net.minecraft.util.math.BlockPos, net.minecraft.util.math.random.Random)
- Mappings:
Namespace Name Mixin selector official a
Lcvn;a(Lcvo;Lagg;Lgt;Lamn;)V
intermediary method_9588
Lnet/minecraft/class_4970;method_9588(Lnet/minecraft/class_2680;Lnet/minecraft/class_3218;Lnet/minecraft/class_2338;Lnet/minecraft/class_5819;)V
named scheduledTick
Lnet/minecraft/block/AbstractBlock;scheduledTick(Lnet/minecraft/block/BlockState;Lnet/minecraft/server/world/ServerWorld;Lnet/minecraft/util/math/BlockPos;Lnet/minecraft/util/math/random/Random;)V
-
calcBlockBreakingDelta
@Deprecated public float calcBlockBreakingDelta(BlockState state, PlayerEntity player, BlockView world, BlockPos pos) Deprecated.- Mappings:
Namespace Name Mixin selector official a
Lcvn;a(Lcvo;Lbuc;Lcgd;Lgt;)F
intermediary method_9594
Lnet/minecraft/class_4970;method_9594(Lnet/minecraft/class_2680;Lnet/minecraft/class_1657;Lnet/minecraft/class_1922;Lnet/minecraft/class_2338;)F
named calcBlockBreakingDelta
Lnet/minecraft/block/AbstractBlock;calcBlockBreakingDelta(Lnet/minecraft/block/BlockState;Lnet/minecraft/entity/player/PlayerEntity;Lnet/minecraft/world/BlockView;Lnet/minecraft/util/math/BlockPos;)F
-
onStacksDropped
@Deprecated public void onStacksDropped(BlockState state, ServerWorld world, BlockPos pos, ItemStack stack, boolean dropExperience) Deprecated.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.LootContext.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
dropExperience
istrue
.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.OreBlock
provides the implementation for experience-dropping blocks.- See Also:
-
OreBlock
Block.dropExperienceWhenMined(net.minecraft.server.world.ServerWorld, net.minecraft.util.math.BlockPos, net.minecraft.item.ItemStack, net.minecraft.util.math.intprovider.IntProvider)
getDroppedStacks(net.minecraft.block.BlockState, net.minecraft.loot.context.LootContext.Builder)
onStateReplaced(net.minecraft.block.BlockState, net.minecraft.world.World, net.minecraft.util.math.BlockPos, net.minecraft.block.BlockState, boolean)
- Mappings:
Namespace Name Mixin selector official a
Lcvn;a(Lcvo;Lagg;Lgt;Lcax;Z)V
intermediary method_9565
Lnet/minecraft/class_4970;method_9565(Lnet/minecraft/class_2680;Lnet/minecraft/class_3218;Lnet/minecraft/class_2338;Lnet/minecraft/class_1799;Z)V
named onStacksDropped
Lnet/minecraft/block/AbstractBlock;onStacksDropped(Lnet/minecraft/block/BlockState;Lnet/minecraft/server/world/ServerWorld;Lnet/minecraft/util/math/BlockPos;Lnet/minecraft/item/ItemStack;Z)V
-
onBlockBreakStart
@Deprecated public void onBlockBreakStart(BlockState state, World world, BlockPos pos, PlayerEntity player) Deprecated.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
.- Mappings:
Namespace Name Mixin selector official a
Lcvn;a(Lcvo;Lcgx;Lgt;Lbuc;)V
intermediary method_9606
Lnet/minecraft/class_4970;method_9606(Lnet/minecraft/class_2680;Lnet/minecraft/class_1937;Lnet/minecraft/class_2338;Lnet/minecraft/class_1657;)V
named onBlockBreakStart
Lnet/minecraft/block/AbstractBlock;onBlockBreakStart(Lnet/minecraft/block/BlockState;Lnet/minecraft/world/World;Lnet/minecraft/util/math/BlockPos;Lnet/minecraft/entity/player/PlayerEntity;)V
-
getWeakRedstonePower
@Deprecated public int getWeakRedstonePower(BlockState state, BlockView world, BlockPos pos, Direction direction) Deprecated.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,
RedstoneBlock
andTargetBlock
emits weak redstone power only.LeverBlock
andAbstractButtonBlock
emits 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 official a
Lcvn;a(Lcvo;Lcgd;Lgt;Lgy;)I
intermediary method_9524
Lnet/minecraft/class_4970;method_9524(Lnet/minecraft/class_2680;Lnet/minecraft/class_1922;Lnet/minecraft/class_2338;Lnet/minecraft/class_2350;)I
named getWeakRedstonePower
Lnet/minecraft/block/AbstractBlock;getWeakRedstonePower(Lnet/minecraft/block/BlockState;Lnet/minecraft/world/BlockView;Lnet/minecraft/util/math/BlockPos;Lnet/minecraft/util/math/Direction;)I
-
onEntityCollision
@Deprecated public void onEntityCollision(BlockState state, World world, BlockPos pos, Entity entity) Deprecated.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:
CactusBlock
damages the entity.AbstractPressurePlateBlock
triggers.CobwebBlock
slows the entity.EndPortalBlock
teleports the entity.HopperBlock
collects the item entity.
- See Also:
-
Block.onSteppedOn(net.minecraft.world.World, net.minecraft.util.math.BlockPos, net.minecraft.block.BlockState, net.minecraft.entity.Entity)
onProjectileHit(net.minecraft.world.World, net.minecraft.block.BlockState, net.minecraft.util.hit.BlockHitResult, net.minecraft.entity.projectile.ProjectileEntity)
- Mappings:
Namespace Name Mixin selector official a
Lcvn;a(Lcvo;Lcgx;Lgt;Lbbn;)V
intermediary method_9548
Lnet/minecraft/class_4970;method_9548(Lnet/minecraft/class_2680;Lnet/minecraft/class_1937;Lnet/minecraft/class_2338;Lnet/minecraft/class_1297;)V
named onEntityCollision
Lnet/minecraft/block/AbstractBlock;onEntityCollision(Lnet/minecraft/block/BlockState;Lnet/minecraft/world/World;Lnet/minecraft/util/math/BlockPos;Lnet/minecraft/entity/Entity;)V
-
getStrongRedstonePower
@Deprecated public int getStrongRedstonePower(BlockState state, BlockView world, BlockPos pos, Direction direction) Deprecated.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,
RedstoneBlock
andTargetBlock
emits weak redstone power only.LeverBlock
andAbstractButtonBlock
emits both weak and strong redstone power.- Returns:
- the strong redstone power emitted from the block
- See Also:
- Mappings:
Namespace Name Mixin selector official b
Lcvn;b(Lcvo;Lcgd;Lgt;Lgy;)I
intermediary method_9603
Lnet/minecraft/class_4970;method_9603(Lnet/minecraft/class_2680;Lnet/minecraft/class_1922;Lnet/minecraft/class_2338;Lnet/minecraft/class_2350;)I
named getStrongRedstonePower
Lnet/minecraft/block/AbstractBlock;getStrongRedstonePower(Lnet/minecraft/block/BlockState;Lnet/minecraft/world/BlockView;Lnet/minecraft/util/math/BlockPos;Lnet/minecraft/util/math/Direction;)I
-
getLootTableId
- Mappings:
Namespace Name Mixin selector official r
Lcvn;r()Labb;
intermediary method_26162
Lnet/minecraft/class_4970;method_26162()Lnet/minecraft/class_2960;
named getLootTableId
Lnet/minecraft/block/AbstractBlock;getLootTableId()Lnet/minecraft/util/Identifier;
-
onProjectileHit
@Deprecated public void onProjectileHit(World world, BlockState state, BlockHitResult hit, ProjectileEntity projectile) Deprecated.Called when aProjectileEntity
hits 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:
TargetBlock
activates.BellBlock
rings.LightningRodBlock
spawns a lightning.AbstractCandleBlock
lights on fire when hit by a projectile on fire.
- See Also:
- Mappings:
Namespace Name Mixin selector official a
Lcvn;a(Lcgx;Lcvo;Ldwm;Lbuu;)V
intermediary method_19286
Lnet/minecraft/class_4970;method_19286(Lnet/minecraft/class_1937;Lnet/minecraft/class_2680;Lnet/minecraft/class_3965;Lnet/minecraft/class_1676;)V
named onProjectileHit
Lnet/minecraft/block/AbstractBlock;onProjectileHit(Lnet/minecraft/world/World;Lnet/minecraft/block/BlockState;Lnet/minecraft/util/hit/BlockHitResult;Lnet/minecraft/entity/projectile/ProjectileEntity;)V
-
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 official l
Lcvn;l()Lcat;
intermediary method_8389
Lnet/minecraft/class_4970;method_8389()Lnet/minecraft/class_1792;
named asItem
Lnet/minecraft/block/AbstractBlock;asItem()Lnet/minecraft/item/Item;
-
asBlock
Returns the block asBlock
.This is used for casting purposes.
- Returns:
- the block as
Block
- Mappings:
Namespace Name Mixin selector official o
Lcvn;o()Lcjt;
intermediary method_26160
Lnet/minecraft/class_4970;method_26160()Lnet/minecraft/class_2248;
named asBlock
Lnet/minecraft/block/AbstractBlock;asBlock()Lnet/minecraft/block/Block;
-
getDefaultMapColor
- Mappings:
Namespace Name Mixin selector official s
Lcvn;s()Ldqa;
intermediary method_26403
Lnet/minecraft/class_4970;method_26403()Lnet/minecraft/class_3620;
named getDefaultMapColor
Lnet/minecraft/block/AbstractBlock;getDefaultMapColor()Lnet/minecraft/block/MapColor;
-
getHardness
public float getHardness()- Mappings:
Namespace Name Mixin selector official t
Lcvn;t()F
intermediary method_36555
Lnet/minecraft/class_4970;method_36555()F
named getHardness
Lnet/minecraft/block/AbstractBlock;getHardness()F
-
AbstractBlock.AbstractBlockState.calcBlockBreakingDelta(net.minecraft.entity.player.PlayerEntity, net.minecraft.world.BlockView, net.minecraft.util.math.BlockPos)
instead.