Class TargetBlock
- All Implemented Interfaces:
ItemConvertible,ToggleableFeature
- Mappings:
Namespace Name named net/minecraft/block/TargetBlockintermediary net/minecraft/class_4850official dog
-
Nested Class Summary
Nested classes/interfaces inherited from class net.minecraft.block.Block
Block.NeighborGroupNested classes/interfaces inherited from class net.minecraft.block.AbstractBlock
AbstractBlock.AbstractBlockState, AbstractBlock.ContextPredicate, AbstractBlock.Offsetter, AbstractBlock.OffsetType, AbstractBlock.Settings, AbstractBlock.TypedContextPredicate<A> -
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final com.mojang.serialization.MapCodec<TargetBlock> private static final IntPropertyprivate static final intprivate static final intFields 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, stateManagerFields inherited from class net.minecraft.block.AbstractBlock
collidable, DIRECTIONS, dynamicBounds, jumpVelocityMultiplier, lootTableKey, randomTicks, requiredFeatures, resistance, settings, slipperiness, soundGroup, velocityMultiplierFields inherited from interface net.minecraft.resource.featuretoggle.ToggleableFeature
FEATURE_ENABLED_REGISTRY_KEYS -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprotected voidappendProperties(StateManager.Builder<Block, BlockState> builder) Appends block state properties to this block.private static intcalculatePower(BlockHitResult hitResult, Vec3d pos) protected booleanemitsRedstonePower(BlockState state) Returns whether the block is capable of emitting redstone power.com.mojang.serialization.MapCodec<TargetBlock> getCodec()protected intgetWeakRedstonePower(BlockState state, BlockView world, BlockPos pos, Direction direction) Returns the weak redstone power emitted from the block.protected voidonBlockAdded(BlockState state, World world, BlockPos pos, BlockState oldState, boolean notify) Called server-side on the new block when the block state is changed.protected voidonProjectileHit(World world, BlockState state, BlockHitResult hit, ProjectileEntity projectile) Called when aProjectileEntityhits a block.protected voidscheduledTick(BlockState state, ServerWorld world, BlockPos pos, Random random) Called server-side when a block receives a scheduled tick.private static voidsetPower(WorldAccess world, BlockState state, int power, BlockPos pos, int delay) private static inttrigger(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, toStringMethods 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, rotateMethods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, waitMethods inherited from interface net.minecraft.resource.featuretoggle.ToggleableFeature
isEnabled
-
Field Details
-
CODEC
- Mappings:
Namespace Name Mixin selector named CODECLnet/minecraft/block/TargetBlock;CODEC:Lcom/mojang/serialization/MapCodec;intermediary field_46472Lnet/minecraft/class_4850;field_46472:Lcom/mojang/serialization/MapCodec;official aLdog;a:Lcom/mojang/serialization/MapCodec;
-
POWER
- Mappings:
Namespace Name Mixin selector named POWERLnet/minecraft/block/TargetBlock;POWER:Lnet/minecraft/state/property/IntProperty;intermediary field_22428Lnet/minecraft/class_4850;field_22428:Lnet/minecraft/class_2758;official bLdog;b:Lduc;
-
RECOVERABLE_POWER_DELAY
private static final int RECOVERABLE_POWER_DELAY- See Also:
- Mappings:
Namespace Name Mixin selector named RECOVERABLE_POWER_DELAYLnet/minecraft/block/TargetBlock;RECOVERABLE_POWER_DELAY:Iintermediary field_31263Lnet/minecraft/class_4850;field_31263:Iofficial cLdog;c:I
-
REGULAR_POWER_DELAY
private static final int REGULAR_POWER_DELAY- See Also:
- Mappings:
Namespace Name Mixin selector named REGULAR_POWER_DELAYLnet/minecraft/block/TargetBlock;REGULAR_POWER_DELAY:Iintermediary field_31264Lnet/minecraft/class_4850;field_31264:Iofficial dLdog;d:I
-
-
Constructor Details
-
TargetBlock
- Mappings:
Namespace Name Mixin selector named <init>Lnet/minecraft/block/AbstractBlock;<init>(Lnet/minecraft/block/AbstractBlock$Settings;)Vintermediary <init>Lnet/minecraft/class_4970;<init>(Lnet/minecraft/class_4970$class_2251;)Vofficial <init>Ldtb;<init>(Ldtb$d;)V
-
-
Method Details
-
getCodec
- Overrides:
getCodecin classBlock- Mappings:
Namespace Name Mixin selector named getCodecLnet/minecraft/block/AbstractBlock;getCodec()Lcom/mojang/serialization/MapCodec;intermediary method_53969Lnet/minecraft/class_4970;method_53969()Lcom/mojang/serialization/MapCodec;official aLdtb;a()Lcom/mojang/serialization/MapCodec;
-
onProjectileHit
protected void onProjectileHit(World world, BlockState state, BlockHitResult hit, ProjectileEntity projectile) Called when aProjectileEntityhits a block.This method is called on both the logical client and logical server, so take caution when overriding this method. The logical side can be checked using
World.isClient.Here are some examples:
TargetBlockactivates.BellBlockrings.LightningRodBlockspawns a lightning.AbstractCandleBlocklights on fire when hit by a projectile on fire.
- Overrides:
onProjectileHitin classAbstractBlock- See Also:
- Mappings:
Namespace Name Mixin selector named onProjectileHitLnet/minecraft/block/AbstractBlock;onProjectileHit(Lnet/minecraft/world/World;Lnet/minecraft/block/BlockState;Lnet/minecraft/util/hit/BlockHitResult;Lnet/minecraft/entity/projectile/ProjectileEntity;)Vintermediary method_19286Lnet/minecraft/class_4970;method_19286(Lnet/minecraft/class_1937;Lnet/minecraft/class_2680;Lnet/minecraft/class_3965;Lnet/minecraft/class_1676;)Vofficial aLdtb;a(Ldcw;Ldtc;Lewy;Lcnp;)V
-
trigger
private static int trigger(WorldAccess world, BlockState state, BlockHitResult hitResult, Entity entity) - Mappings:
Namespace Name Mixin selector named triggerLnet/minecraft/block/TargetBlock;trigger(Lnet/minecraft/world/WorldAccess;Lnet/minecraft/block/BlockState;Lnet/minecraft/util/hit/BlockHitResult;Lnet/minecraft/entity/Entity;)Iintermediary method_24858Lnet/minecraft/class_4850;method_24858(Lnet/minecraft/class_1936;Lnet/minecraft/class_2680;Lnet/minecraft/class_3965;Lnet/minecraft/class_1297;)Iofficial aLdog;a(Ldcx;Ldtc;Lewy;Lbsr;)I
-
calculatePower
- Mappings:
Namespace Name Mixin selector named calculatePowerLnet/minecraft/block/TargetBlock;calculatePower(Lnet/minecraft/util/hit/BlockHitResult;Lnet/minecraft/util/math/Vec3d;)Iintermediary method_24859Lnet/minecraft/class_4850;method_24859(Lnet/minecraft/class_3965;Lnet/minecraft/class_243;)Iofficial aLdog;a(Lewy;Lexc;)I
-
setPower
private static void setPower(WorldAccess world, BlockState state, int power, BlockPos pos, int delay) - Mappings:
Namespace Name Mixin selector named setPowerLnet/minecraft/block/TargetBlock;setPower(Lnet/minecraft/world/WorldAccess;Lnet/minecraft/block/BlockState;ILnet/minecraft/util/math/BlockPos;I)Vintermediary method_24857Lnet/minecraft/class_4850;method_24857(Lnet/minecraft/class_1936;Lnet/minecraft/class_2680;ILnet/minecraft/class_2338;I)Vofficial aLdog;a(Ldcx;Ldtc;ILjd;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:
SugarCaneBlockchecks the placement requirement.DispenserBlockdispenses its content.CommandBlockexecutes its command.FrogspawnBlockspawns a tadpole.SoulSandBlockupdates a bubble column.FallingBlocktries to fall.
- Overrides:
scheduledTickin classAbstractBlock- See Also:
- Mappings:
Namespace Name Mixin selector named scheduledTickLnet/minecraft/block/AbstractBlock;scheduledTick(Lnet/minecraft/block/BlockState;Lnet/minecraft/server/world/ServerWorld;Lnet/minecraft/util/math/BlockPos;Lnet/minecraft/util/math/random/Random;)Vintermediary method_9588Lnet/minecraft/class_4970;method_9588(Lnet/minecraft/class_2680;Lnet/minecraft/class_3218;Lnet/minecraft/class_2338;Lnet/minecraft/class_5819;)Vofficial aLdtb;a(Ldtc;Laqu;Ljd;Layw;)V
-
getWeakRedstonePower
protected int getWeakRedstonePower(BlockState state, BlockView world, BlockPos pos, Direction direction) Returns the weak redstone power emitted from the block.When overriding this, make sure to also override
emitsRedstonePower(net.minecraft.block.BlockState)to returntrue.Weak redstone power is a power that cannot power a redstone wire when a solid block is in between. For example,
RedstoneBlockandTargetBlockemits weak redstone power only.LeverBlockandButtonBlockemits both weak and strong redstone power depending on the direction.- Overrides:
getWeakRedstonePowerin classAbstractBlock- Returns:
- the weak redstone power emitted from the block
- See Also:
- Mappings:
Namespace Name Mixin selector named getWeakRedstonePowerLnet/minecraft/block/AbstractBlock;getWeakRedstonePower(Lnet/minecraft/block/BlockState;Lnet/minecraft/world/BlockView;Lnet/minecraft/util/math/BlockPos;Lnet/minecraft/util/math/Direction;)Iintermediary method_9524Lnet/minecraft/class_4970;method_9524(Lnet/minecraft/class_2680;Lnet/minecraft/class_1922;Lnet/minecraft/class_2338;Lnet/minecraft/class_2350;)Iofficial aLdtb;a(Ldtc;Ldcc;Ljd;Lji;)I
-
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:
emitsRedstonePowerin classAbstractBlock- Returns:
- whether the block is capable of emitting redstone power
- See Also:
- Mappings:
Namespace Name Mixin selector named emitsRedstonePowerLnet/minecraft/block/AbstractBlock;emitsRedstonePower(Lnet/minecraft/block/BlockState;)Zintermediary method_9506Lnet/minecraft/class_4970;method_9506(Lnet/minecraft/class_2680;)Zofficial e_Ldtb;e_(Ldtc;)Z
-
appendProperties
Appends block state properties to this block. To use this, override and callStateManager.Builder.add(net.minecraft.state.property.Property<?>[])inside the method. SeePropertiesfor the list of pre-defined properties.- Overrides:
appendPropertiesin classBlock- Mappings:
Namespace Name Mixin selector named appendPropertiesLnet/minecraft/block/Block;appendProperties(Lnet/minecraft/state/StateManager$Builder;)Vintermediary method_9515Lnet/minecraft/class_2248;method_9515(Lnet/minecraft/class_2689$class_2690;)Vofficial aLdfy;a(Ldtd$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:
onBlockAddedin classAbstractBlock- See Also:
- Mappings:
Namespace Name Mixin selector named onBlockAddedLnet/minecraft/block/AbstractBlock;onBlockAdded(Lnet/minecraft/block/BlockState;Lnet/minecraft/world/World;Lnet/minecraft/util/math/BlockPos;Lnet/minecraft/block/BlockState;Z)Vintermediary method_9615Lnet/minecraft/class_4970;method_9615(Lnet/minecraft/class_2680;Lnet/minecraft/class_1937;Lnet/minecraft/class_2338;Lnet/minecraft/class_2680;Z)Vofficial bLdtb;b(Ldtc;Ldcw;Ljd;Ldtc;Z)V
- When activating a redstone component on placement (used along with
-