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 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 named net/minecraft/block/AbstractBlock
intermediary net/minecraft/class_4970
official dsz
-
Nested Class Summary
Modifier and TypeClassDescriptionstatic class
static interface
static interface
static enum
static class
static interface
-
Field Summary
Modifier and TypeFieldDescriptionprotected final boolean
Whether this block can be walked on or through.protected static final Direction[]
protected final boolean
Whether this block's collision shape can change.protected final float
The multiplier applied to the velocity of aLivingEntity
when it jumps off this block.protected @Nullable RegistryKey
<LootTable> TheRegistryKey
of the loot table that determines what this block drops.protected final boolean
Whether this block should tick when randomly selected when ticking the world.protected final FeatureSet
The set ofFeatureFlags
that are required for this block to work correctly.protected final float
The blast resistance of the block.protected final AbstractBlock.Settings
TheAbstractBlock.Settings
to apply to this block.protected final float
A speed reduction applied to aLivingEntity
that tries to move across this block.protected final BlockSoundGroup
The collection of sounds played when breaking, stepping on, placing, hitting (with a projectile), or falling on this block.protected final float
The multiplier applied to the velocity of anEntity
when it walks on this block.Fields inherited from interface net.minecraft.resource.featuretoggle.ToggleableFeature
FEATURE_ENABLED_REGISTRY_KEYS
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionprotected abstract Block
asBlock()
Returns the block asBlock
.abstract Item
asItem()
Returns the block's corresponding item.protected float
calcBlockBreakingDelta
(BlockState state, PlayerEntity player, BlockView world, BlockPos pos) protected boolean
canBucketPlace
(BlockState state, Fluid fluid) Returns whether a bucket can replace the block with the fluid.protected boolean
canPathfindThrough
(BlockState state, NavigationType type) Returns if an entity using navigation typetype
can navigate through this block.protected boolean
canPlaceAt
(BlockState state, WorldView world, BlockPos pos) Returns whether the block can be placed atpos
.protected boolean
canReplace
(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 NamedScreenHandlerFactory
createScreenHandlerFactory
(BlockState state, World world, BlockPos pos) Returns the screen handler factory ornull
if screen handler cannot be created.protected static <B extends Block>
com.mojang.serialization.codecs.RecordCodecBuilder<B, AbstractBlock.Settings> protected boolean
emitsRedstonePower
(BlockState state) Returns whether the block is capable of emitting redstone power.protected float
getAmbientOcclusionLightLevel
(BlockState state, BlockView world, BlockPos pos) protected VoxelShape
getCameraCollisionShape
(BlockState state, BlockView world, BlockPos pos, ShapeContext context) protected abstract com.mojang.serialization.MapCodec
<? extends Block> getCodec()
protected VoxelShape
getCollisionShape
(BlockState state, BlockView world, BlockPos pos, ShapeContext context) protected int
getComparatorOutput
(BlockState state, World world, BlockPos pos) Returns the comparator output of the block, from0
to15
.protected VoxelShape
getCullingShape
(BlockState state, BlockView world, BlockPos pos) getDroppedStacks
(BlockState state, LootContextParameterSet.Builder builder) Returns the block's dropped item stacks.protected FluidState
getFluidState
(BlockState state) Returns the state's associated fluid state.float
final RegistryKey
<LootTable> protected float
protected int
getOpacity
(BlockState state, BlockView world, BlockPos pos) protected VoxelShape
getOutlineShape
(BlockState state, BlockView world, BlockPos pos, ShapeContext context) protected VoxelShape
getRaycastShape
(BlockState state, BlockView world, BlockPos pos) protected long
getRenderingSeed
(BlockState state, BlockPos pos) Returns the seed value for rendering.protected BlockRenderType
getRenderType
(BlockState state) Returns the block's render type (invisible, animated, model).protected VoxelShape
getSidesShape
(BlockState state, BlockView world, BlockPos pos) protected BlockSoundGroup
getSoundGroup
(BlockState state) 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.protected int
getStrongRedstonePower
(BlockState state, BlockView world, BlockPos pos, Direction direction) Returns the strong redstone power emitted from the block.protected float
protected int
getWeakRedstonePower
(BlockState state, BlockView world, BlockPos pos, Direction direction) Returns the weak redstone power emitted from the block.protected boolean
hasComparatorOutput
(BlockState state) Returns whether the block can have a comparator output.protected boolean
hasRandomTicks
(BlockState state) protected boolean
hasSidedTransparency
(BlockState state) Returns whether the block's transparency depends on the side of the block, like slabs.protected boolean
isCullingShapeFullCube
(BlockState state, BlockView world, BlockPos pos) protected boolean
isShapeFullCube
(BlockState state, BlockView world, BlockPos pos) protected boolean
isSideInvisible
(BlockState state, BlockState stateFrom, Direction direction) protected boolean
isTransparent
(BlockState state, BlockView world, BlockPos pos) protected BlockState
mirror
(BlockState state, BlockMirror mirror) Returnsstate
mirrored bymirror
.protected void
neighborUpdate
(BlockState state, World world, BlockPos pos, Block sourceBlock, BlockPos sourcePos, boolean notify) Called when a neighboring block is updated.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.protected void
onBlockBreakStart
(BlockState state, World world, BlockPos pos, PlayerEntity player) Called when a player starts breaking the block (including when instant-mining).protected void
onEntityCollision
(BlockState state, World world, BlockPos pos, Entity entity) Called when the entity's collision box intersects the block.protected void
onExploded
(BlockState state, World world, BlockPos pos, Explosion explosion, BiConsumer<ItemStack, BlockPos> stackMerger) protected void
onProjectileHit
(World world, BlockState state, BlockHitResult hit, ProjectileEntity projectile) Called when aProjectileEntity
hits a block.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.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.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.protected ActionResult
onUse
(BlockState state, World world, BlockPos pos, PlayerEntity player, BlockHitResult hit) protected ItemActionResult
onUseWithItem
(ItemStack stack, BlockState state, World world, BlockPos pos, PlayerEntity player, Hand hand, BlockHitResult hit) 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.protected void
randomTick
(BlockState state, ServerWorld world, BlockPos pos, Random random) Called server-side when a block gets ticked randomly.protected BlockState
rotate
(BlockState state, BlockRotation rotation) Returnsstate
rotated byrotation
.protected void
scheduledTick
(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, wait
Methods inherited from interface net.minecraft.resource.featuretoggle.ToggleableFeature
isEnabled
-
Field Details
-
DIRECTIONS
- Mappings:
Namespace Name Mixin selector named DIRECTIONS
Lnet/minecraft/block/AbstractBlock;DIRECTIONS:[Lnet/minecraft/util/math/Direction;
intermediary field_23157
Lnet/minecraft/class_4970;field_23157:[Lnet/minecraft/class_2350;
official aF
Ldsz;aF:[Lji;
-
collidable
protected final boolean collidableWhether this block can be walked on or through.- See Also:
- Mappings:
Namespace Name Mixin selector named collidable
Lnet/minecraft/block/AbstractBlock;collidable:Z
intermediary field_23159
Lnet/minecraft/class_4970;field_23159:Z
official aG
Ldsz;aG:Z
-
resistance
protected final float resistanceThe blast resistance of the block.- See Also:
- Mappings:
Namespace Name Mixin selector named resistance
Lnet/minecraft/block/AbstractBlock;resistance:F
intermediary field_23160
Lnet/minecraft/class_4970;field_23160:F
official aH
Ldsz;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 randomTicks
Lnet/minecraft/block/AbstractBlock;randomTicks:Z
intermediary field_23161
Lnet/minecraft/class_4970;field_23161:Z
official aI
Ldsz;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 soundGroup
Lnet/minecraft/block/AbstractBlock;soundGroup:Lnet/minecraft/sound/BlockSoundGroup;
intermediary field_23162
Lnet/minecraft/class_4970;field_23162:Lnet/minecraft/class_2498;
official aJ
Ldsz;aJ:Ldnk;
-
slipperiness
protected final float slipperinessA speed reduction applied to aLivingEntity
that tries to move across this block.- See Also:
- Mappings:
Namespace Name Mixin selector named slipperiness
Lnet/minecraft/block/AbstractBlock;slipperiness:F
intermediary field_23163
Lnet/minecraft/class_4970;field_23163:F
official aK
Ldsz;aK:F
-
velocityMultiplier
protected final float velocityMultiplierThe multiplier applied to the velocity of anEntity
when it walks on this block.- See Also:
- Mappings:
Namespace Name Mixin selector named velocityMultiplier
Lnet/minecraft/block/AbstractBlock;velocityMultiplier:F
intermediary field_23164
Lnet/minecraft/class_4970;field_23164:F
official aL
Ldsz;aL:F
-
jumpVelocityMultiplier
protected final float jumpVelocityMultiplierThe multiplier applied to the velocity of aLivingEntity
when it jumps off this block.- See Also:
- Mappings:
Namespace Name Mixin selector named jumpVelocityMultiplier
Lnet/minecraft/block/AbstractBlock;jumpVelocityMultiplier:F
intermediary field_23165
Lnet/minecraft/class_4970;field_23165:F
official aM
Ldsz;aM:F
-
dynamicBounds
protected final boolean dynamicBoundsWhether this block's collision shape can change.- See Also:
- Mappings:
Namespace Name Mixin selector named dynamicBounds
Lnet/minecraft/block/AbstractBlock;dynamicBounds:Z
intermediary field_23154
Lnet/minecraft/class_4970;field_23154:Z
official aN
Ldsz;aN:Z
-
requiredFeatures
The set ofFeatureFlags
that are required for this block to work correctly.- See Also:
- Mappings:
Namespace Name Mixin selector named requiredFeatures
Lnet/minecraft/block/AbstractBlock;requiredFeatures:Lnet/minecraft/resource/featuretoggle/FeatureSet;
intermediary field_40337
Lnet/minecraft/class_4970;field_40337:Lnet/minecraft/class_7699;
official aO
Ldsz;aO:Lcpj;
-
settings
TheAbstractBlock.Settings
to apply to this block.- Mappings:
Namespace Name Mixin selector named settings
Lnet/minecraft/block/AbstractBlock;settings:Lnet/minecraft/block/AbstractBlock$Settings;
intermediary field_23155
Lnet/minecraft/class_4970;field_23155:Lnet/minecraft/class_4970$class_2251;
official aP
Ldsz;aP:Ldsz$d;
-
lootTableKey
TheRegistryKey
of the loot table that determines what this block drops.- See Also:
- Mappings:
Namespace Name Mixin selector named lootTableKey
Lnet/minecraft/block/AbstractBlock;lootTableKey:Lnet/minecraft/registry/RegistryKey;
intermediary field_23156
Lnet/minecraft/class_4970;field_23156:Lnet/minecraft/class_5321;
official aQ
Ldsz;aQ:Lakp;
-
-
Constructor Details
-
AbstractBlock
- Mappings:
Namespace Name Mixin selector named <init>
Lnet/minecraft/block/AbstractBlock;<init>(Lnet/minecraft/block/AbstractBlock$Settings;)V
intermediary <init>
Lnet/minecraft/class_4970;<init>(Lnet/minecraft/class_4970$class_2251;)V
official <init>
Ldsz;<init>(Ldsz$d;)V
-
-
Method Details
-
getSettings
- Mappings:
Namespace Name Mixin selector named getSettings
Lnet/minecraft/block/AbstractBlock;getSettings()Lnet/minecraft/block/AbstractBlock$Settings;
intermediary method_54095
Lnet/minecraft/class_4970;method_54095()Lnet/minecraft/class_4970$class_2251;
official t
Ldsz;t()Ldsz$d;
-
getCodec
- Mappings:
Namespace Name Mixin selector named getCodec
Lnet/minecraft/block/AbstractBlock;getCodec()Lcom/mojang/serialization/MapCodec;
intermediary method_53969
Lnet/minecraft/class_4970;method_53969()Lcom/mojang/serialization/MapCodec;
official a
Ldsz;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 createSettingsCodec
Lnet/minecraft/block/AbstractBlock;createSettingsCodec()Lcom/mojang/serialization/codecs/RecordCodecBuilder;
intermediary method_54096
Lnet/minecraft/class_4970;method_54096()Lcom/mojang/serialization/codecs/RecordCodecBuilder;
official u
Ldsz;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 createCodec
Lnet/minecraft/block/AbstractBlock;createCodec(Ljava/util/function/Function;)Lcom/mojang/serialization/MapCodec;
intermediary method_54094
Lnet/minecraft/class_4970;method_54094(Ljava/util/function/Function;)Lcom/mojang/serialization/MapCodec;
official b
Ldsz;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
RedstoneWireBlock
to update connected redstone wire. - Mappings:
Namespace Name Mixin selector named prepare
Lnet/minecraft/block/AbstractBlock;prepare(Lnet/minecraft/block/BlockState;Lnet/minecraft/world/WorldAccess;Lnet/minecraft/util/math/BlockPos;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
official a
Ldsz;a(Ldta;Ldcv;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.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:
- Mappings:
Namespace Name Mixin selector 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;
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;
official a
Ldsz;a(Ldta;Lji;Ldta;Ldcv;Ljd;Ljd;)Ldta;
-
isSideInvisible
- See Also:
- Mappings:
Namespace Name Mixin selector named isSideInvisible
Lnet/minecraft/block/AbstractBlock;isSideInvisible(Lnet/minecraft/block/BlockState;Lnet/minecraft/block/BlockState;Lnet/minecraft/util/math/Direction;)Z
intermediary method_9522
Lnet/minecraft/class_4970;method_9522(Lnet/minecraft/class_2680;Lnet/minecraft/class_2680;Lnet/minecraft/class_2350;)Z
official a
Ldsz;a(Ldta;Ldta;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 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 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
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
official a
Ldsz;a(Ldta;Ldcu;Ljd;Ldfw;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 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
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
official b
Ldsz;b(Ldta;Ldcu;Ljd;Ldta;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 invokingItemScatterer
methods.- See Also:
- Mappings:
Namespace Name Mixin selector 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
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
official a
Ldsz;a(Ldta;Ldcu;Ljd;Ldta;Z)V
-
onExploded
protected void onExploded(BlockState state, World world, BlockPos pos, Explosion explosion, BiConsumer<ItemStack, BlockPos> stackMerger) - Mappings:
Namespace Name Mixin selector named onExploded
Lnet/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;)V
intermediary method_55124
Lnet/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;)V
official a
Ldsz;a(Ldta;Ldcu;Ljd;Ldcm;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 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/hit/BlockHitResult;)Lnet/minecraft/util/ActionResult;
intermediary method_55766
Lnet/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 a
Ldsz;a(Ldta;Ldcu;Ljd;Lcmv;Lews;)Lbqq;
-
onUseWithItem
protected ItemActionResult onUseWithItem(ItemStack stack, BlockState state, World world, BlockPos pos, PlayerEntity player, Hand hand, BlockHitResult hit) - Mappings:
Namespace Name Mixin selector named onUseWithItem
Lnet/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_55765
Lnet/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 a
Ldsz;a(Lcuo;Ldta;Ldcu;Ljd;Lcmv;Lbqp;Lews;)Lbqs;
-
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 onSyncedBlockEvent
Lnet/minecraft/block/AbstractBlock;onSyncedBlockEvent(Lnet/minecraft/block/BlockState;Lnet/minecraft/world/World;Lnet/minecraft/util/math/BlockPos;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
official a
Ldsz;a(Ldta;Ldcu;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:
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 named getRenderType
Lnet/minecraft/block/AbstractBlock;getRenderType(Lnet/minecraft/block/BlockState;)Lnet/minecraft/block/BlockRenderType;
intermediary method_9604
Lnet/minecraft/class_4970;method_9604(Lnet/minecraft/class_2680;)Lnet/minecraft/class_2464;
official a_
Ldsz;a_(Ldta;)Ldmd;
-
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 hasSidedTransparency
Lnet/minecraft/block/AbstractBlock;hasSidedTransparency(Lnet/minecraft/block/BlockState;)Z
intermediary method_9526
Lnet/minecraft/class_4970;method_9526(Lnet/minecraft/class_2680;)Z
official f_
Ldsz;f_(Ldta;)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 emitsRedstonePower
Lnet/minecraft/block/AbstractBlock;emitsRedstonePower(Lnet/minecraft/block/BlockState;)Z
intermediary method_9506
Lnet/minecraft/class_4970;method_9506(Lnet/minecraft/class_2680;)Z
official e_
Ldsz;e_(Ldta;)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 getFluidState
Lnet/minecraft/block/AbstractBlock;getFluidState(Lnet/minecraft/block/BlockState;)Lnet/minecraft/fluid/FluidState;
intermediary method_9545
Lnet/minecraft/class_4970;method_9545(Lnet/minecraft/class_2680;)Lnet/minecraft/class_3610;
official b_
Ldsz;b_(Ldta;)Leoy;
-
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 hasComparatorOutput
Lnet/minecraft/block/AbstractBlock;hasComparatorOutput(Lnet/minecraft/block/BlockState;)Z
intermediary method_9498
Lnet/minecraft/class_4970;method_9498(Lnet/minecraft/class_2680;)Z
official c_
Ldsz;c_(Ldta;)Z
-
getMaxHorizontalModelOffset
protected float getMaxHorizontalModelOffset()- Mappings:
Namespace Name Mixin selector named getMaxHorizontalModelOffset
Lnet/minecraft/block/AbstractBlock;getMaxHorizontalModelOffset()F
intermediary method_32913
Lnet/minecraft/class_4970;method_32913()F
official ar_
Ldsz;ar_()F
-
getVerticalModelOffsetMultiplier
protected float getVerticalModelOffsetMultiplier()- Mappings:
Namespace Name Mixin selector named getVerticalModelOffsetMultiplier
Lnet/minecraft/block/AbstractBlock;getVerticalModelOffsetMultiplier()F
intermediary method_37247
Lnet/minecraft/class_4970;method_37247()F
official at_
Ldsz;at_()F
-
getRequiredFeatures
- Specified by:
getRequiredFeatures
in interfaceToggleableFeature
- Mappings:
Namespace Name Mixin selector named getRequiredFeatures
Lnet/minecraft/resource/featuretoggle/ToggleableFeature;getRequiredFeatures()Lnet/minecraft/resource/featuretoggle/FeatureSet;
intermediary method_45322
Lnet/minecraft/class_7695;method_45322()Lnet/minecraft/class_7699;
official i
Lcpg;i()Lcpj;
-
rotate
Returnsstate
rotated byrotation
.By default, this returns the provided block state.
- Returns:
state
rotated byrotation
- See Also:
- Mappings:
Namespace Name Mixin selector named rotate
Lnet/minecraft/block/AbstractBlock;rotate(Lnet/minecraft/block/BlockState;Lnet/minecraft/util/BlockRotation;)Lnet/minecraft/block/BlockState;
intermediary method_9598
Lnet/minecraft/class_4970;method_9598(Lnet/minecraft/class_2680;Lnet/minecraft/class_2470;)Lnet/minecraft/class_2680;
official a
Ldsz;a(Ldta;Ldmk;)Ldta;
-
mirror
Returnsstate
mirrored bymirror
.By default, this returns the provided block state.
- Returns:
state
mirrored bymirror
- See Also:
- Mappings:
Namespace Name Mixin selector named mirror
Lnet/minecraft/block/AbstractBlock;mirror(Lnet/minecraft/block/BlockState;Lnet/minecraft/util/BlockMirror;)Lnet/minecraft/block/BlockState;
intermediary method_9569
Lnet/minecraft/class_4970;method_9569(Lnet/minecraft/class_2680;Lnet/minecraft/class_2415;)Lnet/minecraft/class_2680;
official a
Ldsz;a(Ldta;Ldkt;)Ldta;
-
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 canReplace
Lnet/minecraft/block/AbstractBlock;canReplace(Lnet/minecraft/block/BlockState;Lnet/minecraft/item/ItemPlacementContext;)Z
intermediary method_9616
Lnet/minecraft/class_4970;method_9616(Lnet/minecraft/class_2680;Lnet/minecraft/class_1750;)Z
official a
Ldsz;a(Ldta;Lcyb;)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 canBucketPlace
Lnet/minecraft/block/AbstractBlock;canBucketPlace(Lnet/minecraft/block/BlockState;Lnet/minecraft/fluid/Fluid;)Z
intermediary method_22358
Lnet/minecraft/class_4970;method_22358(Lnet/minecraft/class_2680;Lnet/minecraft/class_3611;)Z
official a
Ldsz;a(Ldta;Leox;)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
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:
- Mappings:
Namespace Name Mixin selector named getDroppedStacks
Lnet/minecraft/block/AbstractBlock;getDroppedStacks(Lnet/minecraft/block/BlockState;Lnet/minecraft/loot/context/LootContextParameterSet$Builder;)Ljava/util/List;
intermediary method_9560
Lnet/minecraft/class_4970;method_9560(Lnet/minecraft/class_2680;Lnet/minecraft/class_8567$class_8568;)Ljava/util/List;
official a
Ldsz;a(Ldta;Lero$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 getRenderingSeed
Lnet/minecraft/block/AbstractBlock;getRenderingSeed(Lnet/minecraft/block/BlockState;Lnet/minecraft/util/math/BlockPos;)J
intermediary method_9535
Lnet/minecraft/class_4970;method_9535(Lnet/minecraft/class_2680;Lnet/minecraft/class_2338;)J
official a
Ldsz;a(Ldta;Ljd;)J
-
getCullingShape
- See Also:
- Mappings:
Namespace Name Mixin selector 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;
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;
official f
Ldsz;f(Ldta;Ldca;Ljd;)Lexp;
-
getSidesShape
- See Also:
- Mappings:
Namespace Name Mixin selector 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;
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;
official b_
Ldsz;b_(Ldta;Ldca;Ljd;)Lexp;
-
getRaycastShape
- See Also:
- Mappings:
Namespace Name Mixin selector 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;
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;
official a
Ldsz;a(Ldta;Ldca;Ljd;)Lexp;
-
getOpacity
- See Also:
- Mappings:
Namespace Name Mixin selector named getOpacity
Lnet/minecraft/block/AbstractBlock;getOpacity(Lnet/minecraft/block/BlockState;Lnet/minecraft/world/BlockView;Lnet/minecraft/util/math/BlockPos;)I
intermediary method_9505
Lnet/minecraft/class_4970;method_9505(Lnet/minecraft/class_2680;Lnet/minecraft/class_1922;Lnet/minecraft/class_2338;)I
official g
Ldsz;g(Ldta;Ldca;Ljd;)I
-
createScreenHandlerFactory
@Nullable protected @Nullable NamedScreenHandlerFactory createScreenHandlerFactory(BlockState state, World world, BlockPos pos) 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 named createScreenHandlerFactory
Lnet/minecraft/block/AbstractBlock;createScreenHandlerFactory(Lnet/minecraft/block/BlockState;Lnet/minecraft/world/World;Lnet/minecraft/util/math/BlockPos;)Lnet/minecraft/screen/NamedScreenHandlerFactory;
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;
official b
Ldsz;b(Ldta;Ldcu;Ljd;)Lbqu;
-
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 canPlaceAt
Lnet/minecraft/block/AbstractBlock;canPlaceAt(Lnet/minecraft/block/BlockState;Lnet/minecraft/world/WorldView;Lnet/minecraft/util/math/BlockPos;)Z
intermediary method_9558
Lnet/minecraft/class_4970;method_9558(Lnet/minecraft/class_2680;Lnet/minecraft/class_4538;Lnet/minecraft/class_2338;)Z
official a
Ldsz;a(Ldta;Ldcx;Ljd;)Z
-
getAmbientOcclusionLightLevel
- See Also:
- Mappings:
Namespace Name Mixin selector named getAmbientOcclusionLightLevel
Lnet/minecraft/block/AbstractBlock;getAmbientOcclusionLightLevel(Lnet/minecraft/block/BlockState;Lnet/minecraft/world/BlockView;Lnet/minecraft/util/math/BlockPos;)F
intermediary method_9575
Lnet/minecraft/class_4970;method_9575(Lnet/minecraft/class_2680;Lnet/minecraft/class_1922;Lnet/minecraft/class_2338;)F
official d
Ldsz;d(Ldta;Ldca;Ljd;)F
-
getComparatorOutput
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 named getComparatorOutput
Lnet/minecraft/block/AbstractBlock;getComparatorOutput(Lnet/minecraft/block/BlockState;Lnet/minecraft/world/World;Lnet/minecraft/util/math/BlockPos;)I
intermediary method_9572
Lnet/minecraft/class_4970;method_9572(Lnet/minecraft/class_2680;Lnet/minecraft/class_1937;Lnet/minecraft/class_2338;)I
official a
Ldsz;a(Ldta;Ldcu;Ljd;)I
-
getOutlineShape
protected VoxelShape getOutlineShape(BlockState state, BlockView world, BlockPos pos, ShapeContext context) - See Also:
- Mappings:
Namespace Name Mixin selector 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;
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;
official a
Ldsz;a(Ldta;Ldca;Ljd;Lexb;)Lexp;
-
getCollisionShape
protected VoxelShape getCollisionShape(BlockState state, BlockView world, BlockPos pos, ShapeContext context) - See Also:
- Mappings:
Namespace Name Mixin selector 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;
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;
official b
Ldsz;b(Ldta;Ldca;Ljd;Lexb;)Lexp;
-
isShapeFullCube
- See Also:
- Mappings:
Namespace Name Mixin selector named isShapeFullCube
Lnet/minecraft/block/AbstractBlock;isShapeFullCube(Lnet/minecraft/block/BlockState;Lnet/minecraft/world/BlockView;Lnet/minecraft/util/math/BlockPos;)Z
intermediary method_37403
Lnet/minecraft/class_4970;method_37403(Lnet/minecraft/class_2680;Lnet/minecraft/class_1922;Lnet/minecraft/class_2338;)Z
official c
Ldsz;c(Ldta;Ldca;Ljd;)Z
-
isCullingShapeFullCube
- Mappings:
Namespace Name Mixin selector named isCullingShapeFullCube
Lnet/minecraft/block/AbstractBlock;isCullingShapeFullCube(Lnet/minecraft/block/BlockState;Lnet/minecraft/world/BlockView;Lnet/minecraft/util/math/BlockPos;)Z
intermediary method_42326
Lnet/minecraft/class_4970;method_42326(Lnet/minecraft/class_2680;Lnet/minecraft/class_1922;Lnet/minecraft/class_2338;)Z
official h
Ldsz;h(Ldta;Ldca;Ljd;)Z
-
getCameraCollisionShape
protected VoxelShape getCameraCollisionShape(BlockState state, BlockView world, BlockPos pos, ShapeContext context) - See Also:
- Mappings:
Namespace Name Mixin selector 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;
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;
official c
Ldsz;c(Ldta;Ldca;Ljd;Lexb;)Lexp;
-
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
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 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
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
official b
Ldsz;b(Ldta;Laqt;Ljd;Layv;)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:
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:
- Mappings:
Namespace Name Mixin selector 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
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
official a
Ldsz;a(Ldta;Laqt;Ljd;Layv;)V
-
calcBlockBreakingDelta
protected float calcBlockBreakingDelta(BlockState state, PlayerEntity player, BlockView world, BlockPos pos) - See Also:
- Mappings:
Namespace Name Mixin selector 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
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
official a
Ldsz;a(Ldta;Lcmv;Ldca;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
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.ExperienceDroppingBlock
provides the implementation for experience-dropping blocks.- See Also:
- Mappings:
Namespace Name Mixin selector 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
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
official a
Ldsz;a(Ldta;Laqt;Ljd;Lcuo;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 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
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
official a_
Ldsz;a_(Ldta;Ldcu;Ljd;Lcmv;)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,
RedstoneBlock
andTargetBlock
emits weak redstone power only.LeverBlock
andButtonBlock
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 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
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
official a
Ldsz;a(Ldta;Ldca;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:
CactusBlock
damages the entity.AbstractPressurePlateBlock
triggers.CobwebBlock
slows the entity.EndPortalBlock
teleports the entity.HopperBlock
collects the item entity.
- See Also:
- Mappings:
Namespace Name Mixin selector 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
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
official a
Ldsz;a(Ldta;Ldcu;Ljd;Lbsq;)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,
RedstoneBlock
andTargetBlock
emits weak redstone power only.LeverBlock
andButtonBlock
emits both weak and strong redstone power.- Returns:
- the strong redstone power emitted from the block
- See Also:
- Mappings:
Namespace Name Mixin selector 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
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
official b
Ldsz;b(Ldta;Ldca;Ljd;Lji;)I
-
getLootTableKey
- Mappings:
Namespace Name Mixin selector named getLootTableKey
Lnet/minecraft/block/AbstractBlock;getLootTableKey()Lnet/minecraft/registry/RegistryKey;
intermediary method_26162
Lnet/minecraft/class_4970;method_26162()Lnet/minecraft/class_5321;
official v
Ldsz;v()Lakp;
-
onProjectileHit
protected void onProjectileHit(World world, BlockState state, BlockHitResult hit, ProjectileEntity projectile) 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 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
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
official a
Ldsz;a(Ldcu;Ldta;Lews;Lcnn;)V
-
isTransparent
- Mappings:
Namespace Name Mixin selector named isTransparent
Lnet/minecraft/block/AbstractBlock;isTransparent(Lnet/minecraft/block/BlockState;Lnet/minecraft/world/BlockView;Lnet/minecraft/util/math/BlockPos;)Z
intermediary method_9579
Lnet/minecraft/class_4970;method_9579(Lnet/minecraft/class_2680;Lnet/minecraft/class_1922;Lnet/minecraft/class_2338;)Z
official a_
Ldsz;a_(Ldta;Ldca;Ljd;)Z
-
hasRandomTicks
- Mappings:
Namespace Name Mixin selector named hasRandomTicks
Lnet/minecraft/block/AbstractBlock;hasRandomTicks(Lnet/minecraft/block/BlockState;)Z
intermediary method_9542
Lnet/minecraft/class_4970;method_9542(Lnet/minecraft/class_2680;)Z
official d_
Ldsz;d_(Ldta;)Z
-
getSoundGroup
- Mappings:
Namespace Name Mixin selector named getSoundGroup
Lnet/minecraft/block/AbstractBlock;getSoundGroup(Lnet/minecraft/block/BlockState;)Lnet/minecraft/sound/BlockSoundGroup;
intermediary method_9573
Lnet/minecraft/class_4970;method_9573(Lnet/minecraft/class_2680;)Lnet/minecraft/class_2498;
official g_
Ldsz;g_(Ldta;)Ldnk;
-
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 asItem
Lnet/minecraft/block/AbstractBlock;asItem()Lnet/minecraft/item/Item;
intermediary method_8389
Lnet/minecraft/class_4970;method_8389()Lnet/minecraft/class_1792;
official r
Ldsz;r()Lcuj;
-
asBlock
Returns the block asBlock
.This is used for casting purposes.
- Returns:
- the block as
Block
- Mappings:
Namespace Name Mixin selector named asBlock
Lnet/minecraft/block/AbstractBlock;asBlock()Lnet/minecraft/block/Block;
intermediary method_26160
Lnet/minecraft/class_4970;method_26160()Lnet/minecraft/class_2248;
official q
Ldsz;q()Ldfw;
-
getDefaultMapColor
- Mappings:
Namespace Name Mixin selector named getDefaultMapColor
Lnet/minecraft/block/AbstractBlock;getDefaultMapColor()Lnet/minecraft/block/MapColor;
intermediary method_26403
Lnet/minecraft/class_4970;method_26403()Lnet/minecraft/class_3620;
official w
Ldsz;w()Lepc;
-
getHardness
public float getHardness()- Mappings:
Namespace Name Mixin selector named getHardness
Lnet/minecraft/block/AbstractBlock;getHardness()F
intermediary method_36555
Lnet/minecraft/class_4970;method_36555()F
official x
Ldsz;x()F
-