Class TntBlock
- All Implemented Interfaces:
ItemConvertible
,ToggleableFeature
- Mappings:
Namespace Name official cxx
intermediary net/minecraft/class_2530
named net/minecraft/block/TntBlock
-
Nested Class Summary
Nested classes/interfaces inherited from class net.minecraft.block.Block
Block.NeighborGroup
Nested classes/interfaces inherited from class net.minecraft.block.AbstractBlock
AbstractBlock.AbstractBlockState, AbstractBlock.ContextPredicate, AbstractBlock.Offsetter, AbstractBlock.OffsetType, AbstractBlock.Settings, AbstractBlock.TypedContextPredicate<A>
-
Field Summary
Fields inherited from class net.minecraft.block.Block
field_31022, field_31023, field_31024, field_31025, field_31035, FORCE_STATE, MOVED, NO_REDRAW, NOTIFY_ALL, NOTIFY_LISTENERS, NOTIFY_NEIGHBORS, REDRAW_ON_MAIN_THREAD, SKIP_DROPS, STATE_IDS, stateManager
Fields inherited from class net.minecraft.block.AbstractBlock
collidable, DIRECTIONS, dynamicBounds, jumpVelocityMultiplier, lootTableId, randomTicks, requiredFeatures, resistance, settings, slipperiness, soundGroup, velocityMultiplier
Fields inherited from interface net.minecraft.resource.featuretoggle.ToggleableFeature
FEATURE_ENABLED_REGISTRY_KEYS
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionprotected void
appendProperties
(StateManager.Builder<Block, BlockState> builder) Appends block state properties to this block.void
neighborUpdate
(BlockState state, World world, BlockPos pos, Block sourceBlock, BlockPos sourcePos, boolean notify) Called when a neighboring block is updated.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.void
onBreak
(World world, BlockPos pos, BlockState state, PlayerEntity player) Called when a player breaks a block before the block is removed from the world.void
onDestroyedByExplosion
(World world, BlockPos pos, Explosion explosion) Called when this block is destroyed by an explosion.void
onProjectileHit
(World world, BlockState state, BlockHitResult hit, ProjectileEntity projectile) Called when aProjectileEntity
hits a block.onUse
(BlockState state, World world, BlockPos pos, PlayerEntity player, Hand hand, BlockHitResult hit) Called when this block is used by a player.static void
private static void
primeTnt
(World world, BlockPos pos, @Nullable LivingEntity igniter) boolean
shouldDropItemsOnExplosion
(Explosion explosion) Returns whether an explosion can drop the block as an item.Methods inherited from class net.minecraft.block.Block
afterBreak, appendTooltip, asBlock, asItem, canMobSpawnInside, cannotConnect, createCuboidShape, dropExperience, dropExperienceWhenMined, dropStack, dropStack, dropStacks, dropStacks, dropStacks, getBlastResistance, getBlockFromItem, getDefaultState, getDroppedStacks, getDroppedStacks, getJumpVelocityMultiplier, getName, getPickStack, getPlacementState, getRawIdFromState, getRegistryEntry, getShapesForStates, getSlipperiness, getSoundGroup, getStateFromRawId, getStateManager, getStateWithProperties, getTranslationKey, getVelocityMultiplier, hasDynamicBounds, hasRandomTicks, hasTopRim, isFaceFullSquare, isShapeFullCube, isTransparent, onBroken, onEntityLand, onLandedUpon, onPlaced, onSteppedOn, postProcessState, precipitationTick, pushEntitiesUpBeforeBlockChange, randomDisplayTick, replace, replace, setDefaultState, shouldDrawSide, sideCoversSmallSquare, spawnBreakParticles, toString
Methods inherited from class net.minecraft.block.AbstractBlock
calcBlockBreakingDelta, canBucketPlace, canPathfindThrough, canPlaceAt, canReplace, createScreenHandlerFactory, emitsRedstonePower, getAmbientOcclusionLightLevel, getCameraCollisionShape, getCollisionShape, getComparatorOutput, getCullingShape, getDefaultMapColor, getDroppedStacks, getFluidState, getHardness, getLootTableId, getMaxHorizontalModelOffset, getOpacity, getOutlineShape, getRaycastShape, getRenderingSeed, getRenderType, getRequiredFeatures, getSidesShape, getStateForNeighborUpdate, getStrongRedstonePower, getVerticalModelOffsetMultiplier, getWeakRedstonePower, hasComparatorOutput, hasSidedTransparency, isCullingShapeFullCube, isShapeFullCube, isSideInvisible, mirror, onBlockBreakStart, onEntityCollision, onStacksDropped, onStateReplaced, onSyncedBlockEvent, prepare, randomTick, rotate, scheduledTick
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
Methods inherited from interface net.minecraft.resource.featuretoggle.ToggleableFeature
isEnabled
-
Field Details
-
UNSTABLE
- Mappings:
Namespace Name Mixin selector official a
Lcxx;a:Ldcs;
intermediary field_11621
Lnet/minecraft/class_2530;field_11621:Lnet/minecraft/class_2746;
named UNSTABLE
Lnet/minecraft/block/TntBlock;UNSTABLE:Lnet/minecraft/state/property/BooleanProperty;
-
-
Constructor Details
-
TntBlock
- Mappings:
Namespace Name Mixin selector official <init>
Ldca;<init>(Ldca$d;)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
-
onBlockAdded
public 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,AbstractBlock.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)
orAbstractBlock.neighborUpdate(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
AbstractBlock.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
- Overrides:
onBlockAdded
in classAbstractBlock
- See Also:
- Mappings:
Namespace Name Mixin selector official b
Ldca;b(Ldcb;Lcmm;Lgu;Ldcb;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
-
neighborUpdate
public 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
AbstractBlock.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
.- Overrides:
neighborUpdate
in classAbstractBlock
- See Also:
- Mappings:
Namespace Name Mixin selector official a
Ldca;a(Ldcb;Lcmm;Lgu;Lcpn;Lgu;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
-
onBreak
Called when a player breaks a block before the block is removed from the world. Explosions do not trigger this.Default implementation spawns block breaking particles, angers piglins, and emits game events. Tall or wide blocks such as doors or beds should override this to break the other part (along with
AbstractBlock.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 most cases,
AbstractBlock.onStateReplaced(net.minecraft.block.BlockState, net.minecraft.world.World, net.minecraft.util.math.BlockPos, net.minecraft.block.BlockState, boolean)
orAbstractBlock.onStacksDropped(net.minecraft.block.BlockState, net.minecraft.server.world.ServerWorld, net.minecraft.util.math.BlockPos, net.minecraft.item.ItemStack, boolean)
should be used instead. Note that they are called when blocks are broken by explosions as well as players breaking them.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
.- Overrides:
onBreak
in classBlock
- See Also:
- Mappings:
Namespace Name Mixin selector official a
Lcpn;a(Lcmm;Lgu;Ldcb;Lbyo;)V
intermediary method_9576
Lnet/minecraft/class_2248;method_9576(Lnet/minecraft/class_1937;Lnet/minecraft/class_2338;Lnet/minecraft/class_2680;Lnet/minecraft/class_1657;)V
named onBreak
Lnet/minecraft/block/Block;onBreak(Lnet/minecraft/world/World;Lnet/minecraft/util/math/BlockPos;Lnet/minecraft/block/BlockState;Lnet/minecraft/entity/player/PlayerEntity;)V
-
onDestroyedByExplosion
Called when this block is destroyed by an explosion.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
.- Overrides:
onDestroyedByExplosion
in classBlock
- Mappings:
Namespace Name Mixin selector official a
Lcpn;a(Lcmm;Lgu;Lcme;)V
intermediary method_9586
Lnet/minecraft/class_2248;method_9586(Lnet/minecraft/class_1937;Lnet/minecraft/class_2338;Lnet/minecraft/class_1927;)V
named onDestroyedByExplosion
Lnet/minecraft/block/Block;onDestroyedByExplosion(Lnet/minecraft/world/World;Lnet/minecraft/util/math/BlockPos;Lnet/minecraft/world/explosion/Explosion;)V
-
primeTnt
- Mappings:
Namespace Name Mixin selector official a
Lcxx;a(Lcmm;Lgu;)V
intermediary method_10738
Lnet/minecraft/class_2530;method_10738(Lnet/minecraft/class_1937;Lnet/minecraft/class_2338;)V
named primeTnt
Lnet/minecraft/block/TntBlock;primeTnt(Lnet/minecraft/world/World;Lnet/minecraft/util/math/BlockPos;)V
-
primeTnt
- Mappings:
Namespace Name Mixin selector official a
Lcxx;a(Lcmm;Lgu;Lbfz;)V
intermediary method_10737
Lnet/minecraft/class_2530;method_10737(Lnet/minecraft/class_1937;Lnet/minecraft/class_2338;Lnet/minecraft/class_1309;)V
named primeTnt
Lnet/minecraft/block/TntBlock;primeTnt(Lnet/minecraft/world/World;Lnet/minecraft/util/math/BlockPos;Lnet/minecraft/entity/LivingEntity;)V
-
onUse
public ActionResult onUse(BlockState state, World world, BlockPos pos, PlayerEntity player, Hand hand, BlockHitResult hit) 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.
- Overrides:
onUse
in classAbstractBlock
- Returns:
- an action result that specifies if using the block was successful.
- Mappings:
Namespace Name Mixin selector official a
Ldca;a(Ldcb;Lcmm;Lgu;Lbyo;Lbdw;Leee;)Lbdx;
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;
-
onProjectileHit
public 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.
- Overrides:
onProjectileHit
in classAbstractBlock
- See Also:
- Mappings:
Namespace Name Mixin selector official a
Ldca;a(Lcmm;Ldcb;Leee;Lbzg;)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
-
shouldDropItemsOnExplosion
Returns whether an explosion can drop the block as an item.This should be overridden if an explosion affects the block in other ways, like
TntBlock
that triggers the chain reaction. This should not consider the randomness, since it is defined in the loot table.- Overrides:
shouldDropItemsOnExplosion
in classBlock
- Returns:
- whether an explosion can drop the block as an item
- See Also:
- Mappings:
Namespace Name Mixin selector official a
Lcpn;a(Lcme;)Z
intermediary method_9533
Lnet/minecraft/class_2248;method_9533(Lnet/minecraft/class_1927;)Z
named shouldDropItemsOnExplosion
Lnet/minecraft/block/Block;shouldDropItemsOnExplosion(Lnet/minecraft/world/explosion/Explosion;)Z
-
appendProperties
Appends block state properties to this block. To use this, override and callStateManager.Builder.add(net.minecraft.state.property.Property<?>[])
inside the method. SeeProperties
for the list of pre-defined properties.- Overrides:
appendProperties
in classBlock
- Mappings:
Namespace Name Mixin selector official a
Lcpn;a(Ldcc$a;)V
intermediary method_9515
Lnet/minecraft/class_2248;method_9515(Lnet/minecraft/class_2689$class_2690;)V
named appendProperties
Lnet/minecraft/block/Block;appendProperties(Lnet/minecraft/state/StateManager$Builder;)V
-