Class TargetBlock
- All Implemented Interfaces:
ItemConvertible
,ToggleableFeature
- Mappings:
Namespace Name named net/minecraft/block/TargetBlock
intermediary net/minecraft/class_4850
official dni
-
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
Modifier and TypeFieldDescriptionstatic final com.mojang.serialization.MapCodec
<TargetBlock> private static final IntProperty
private static final int
private static final int
Fields inherited from class net.minecraft.block.Block
field_31023, field_31024, field_31025, field_31035, FORCE_STATE, MOVED, NO_REDRAW, NOTIFY_ALL, NOTIFY_ALL_AND_REDRAW, 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, lootTableKey, 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.private static int
calculatePower
(BlockHitResult hitResult, Vec3d pos) protected boolean
emitsRedstonePower
(BlockState state) Returns whether the block is capable of emitting redstone power.com.mojang.serialization.MapCodec
<TargetBlock> getCodec()
protected int
getWeakRedstonePower
(BlockState state, BlockView world, BlockPos pos, Direction direction) Returns the weak redstone power emitted from the block.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
onProjectileHit
(World world, BlockState state, BlockHitResult hit, ProjectileEntity projectile) Called when aProjectileEntity
hits a block.protected void
scheduledTick
(BlockState state, ServerWorld world, BlockPos pos, Random random) Called server-side when a block receives a scheduled tick.private static void
setPower
(WorldAccess world, BlockState state, int power, BlockPos pos, int delay) private static int
trigger
(WorldAccess world, BlockState state, BlockHitResult hitResult, Entity entity) 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, getStateFromRawId, getStateManager, getStateWithProperties, getTranslationKey, getVelocityMultiplier, hasDynamicBounds, hasTopRim, isFaceFullSquare, isShapeFullCube, onBreak, onBroken, onDestroyedByExplosion, onEntityLand, onLandedUpon, onPlaced, onSteppedOn, postProcessState, precipitationTick, pushEntitiesUpBeforeBlockChange, randomDisplayTick, replace, replace, setDefaultState, shouldDrawSide, shouldDropItemsOnExplosion, sideCoversSmallSquare, spawnBreakParticles, toString
Methods inherited from class net.minecraft.block.AbstractBlock
calcBlockBreakingDelta, canBucketPlace, canPathfindThrough, canPlaceAt, canReplace, createCodec, createScreenHandlerFactory, createSettingsCodec, getAmbientOcclusionLightLevel, getCameraCollisionShape, getCollisionShape, getComparatorOutput, getCullingShape, getDefaultMapColor, getDroppedStacks, getFluidState, getHardness, getLootTableKey, getMaxHorizontalModelOffset, getOpacity, getOutlineShape, getRaycastShape, getRenderingSeed, getRenderType, getRequiredFeatures, getSettings, getSidesShape, getSoundGroup, getStateForNeighborUpdate, getStrongRedstonePower, getVerticalModelOffsetMultiplier, hasComparatorOutput, hasRandomTicks, hasSidedTransparency, isCullingShapeFullCube, isShapeFullCube, isSideInvisible, isTransparent, mirror, neighborUpdate, onBlockBreakStart, onEntityCollision, onExploded, onStacksDropped, onStateReplaced, onSyncedBlockEvent, onUse, onUseWithItem, prepare, randomTick, rotate
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
-
CODEC
- Mappings:
Namespace Name Mixin selector named CODEC
Lnet/minecraft/block/TargetBlock;CODEC:Lcom/mojang/serialization/MapCodec;
intermediary field_46472
Lnet/minecraft/class_4850;field_46472:Lcom/mojang/serialization/MapCodec;
official a
Ldni;a:Lcom/mojang/serialization/MapCodec;
-
POWER
- Mappings:
Namespace Name Mixin selector named POWER
Lnet/minecraft/block/TargetBlock;POWER:Lnet/minecraft/state/property/IntProperty;
intermediary field_22428
Lnet/minecraft/class_4850;field_22428:Lnet/minecraft/class_2758;
official b
Ldni;b:Ldte;
-
RECOVERABLE_POWER_DELAY
private static final int RECOVERABLE_POWER_DELAY- See Also:
- Mappings:
Namespace Name Mixin selector named RECOVERABLE_POWER_DELAY
Lnet/minecraft/block/TargetBlock;RECOVERABLE_POWER_DELAY:I
intermediary field_31263
Lnet/minecraft/class_4850;field_31263:I
official c
Ldni;c:I
-
REGULAR_POWER_DELAY
private static final int REGULAR_POWER_DELAY- See Also:
- Mappings:
Namespace Name Mixin selector named REGULAR_POWER_DELAY
Lnet/minecraft/block/TargetBlock;REGULAR_POWER_DELAY:I
intermediary field_31264
Lnet/minecraft/class_4850;field_31264:I
official d
Ldni;d:I
-
-
Constructor Details
-
TargetBlock
- 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>
Ldsd;<init>(Ldsd$d;)V
-
-
Method Details
-
getCodec
- Overrides:
getCodec
in classBlock
- 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
Ldsd;a()Lcom/mojang/serialization/MapCodec;
-
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.
- Overrides:
onProjectileHit
in classAbstractBlock
- 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
Ldsd;a(Ldca;Ldse;Levp;Lcnr;)V
-
trigger
private static int trigger(WorldAccess world, BlockState state, BlockHitResult hitResult, Entity entity) - Mappings:
Namespace Name Mixin selector named trigger
Lnet/minecraft/block/TargetBlock;trigger(Lnet/minecraft/world/WorldAccess;Lnet/minecraft/block/BlockState;Lnet/minecraft/util/hit/BlockHitResult;Lnet/minecraft/entity/Entity;)I
intermediary method_24858
Lnet/minecraft/class_4850;method_24858(Lnet/minecraft/class_1936;Lnet/minecraft/class_2680;Lnet/minecraft/class_3965;Lnet/minecraft/class_1297;)I
official a
Ldni;a(Ldcb;Ldse;Levp;Lbsw;)I
-
calculatePower
- Mappings:
Namespace Name Mixin selector named calculatePower
Lnet/minecraft/block/TargetBlock;calculatePower(Lnet/minecraft/util/hit/BlockHitResult;Lnet/minecraft/util/math/Vec3d;)I
intermediary method_24859
Lnet/minecraft/class_4850;method_24859(Lnet/minecraft/class_3965;Lnet/minecraft/class_243;)I
official a
Ldni;a(Levp;Levt;)I
-
setPower
private static void setPower(WorldAccess world, BlockState state, int power, BlockPos pos, int delay) - Mappings:
Namespace Name Mixin selector named setPower
Lnet/minecraft/block/TargetBlock;setPower(Lnet/minecraft/world/WorldAccess;Lnet/minecraft/block/BlockState;ILnet/minecraft/util/math/BlockPos;I)V
intermediary method_24857
Lnet/minecraft/class_4850;method_24857(Lnet/minecraft/class_1936;Lnet/minecraft/class_2680;ILnet/minecraft/class_2338;I)V
official a
Ldni;a(Ldcb;Ldse;ILiz;I)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
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)
.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.
- Overrides:
scheduledTick
in classAbstractBlock
- 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
Ldsd;a(Ldse;Larf;Liz;Lazh;)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.- Overrides:
getWeakRedstonePower
in classAbstractBlock
- 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
Ldsd;a(Ldse;Ldbg;Liz;Lje;)I
-
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.- Overrides:
emitsRedstonePower
in classAbstractBlock
- 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_
Ldsd;e_(Ldse;)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 named appendProperties
Lnet/minecraft/block/Block;appendProperties(Lnet/minecraft/state/StateManager$Builder;)V
intermediary method_9515
Lnet/minecraft/class_2248;method_9515(Lnet/minecraft/class_2689$class_2690;)V
official a
Ldfb;a(Ldsf$a;)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,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 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
Ldsd;b(Ldse;Ldca;Liz;Ldse;Z)V
- When activating a redstone component on placement (used along with
-