Class DispenserBlock
- All Implemented Interfaces:
BlockEntityProvider
,ItemConvertible
,ToggleableFeature
- Direct Known Subclasses:
DropperBlock
- Mappings:
Namespace Name named net/minecraft/block/DispenserBlock
intermediary net/minecraft/class_2315
official dhn
-
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 Map
<Item, DispenserBehavior> static final com.mojang.serialization.MapCodec
<DispenserBlock> private static final ItemDispenserBehavior
static final DirectionProperty
private static final Logger
private static final int
static final BooleanProperty
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.createBlockEntity
(BlockPos pos, BlockState state) Returns a new block entity instance.protected void
dispense
(ServerWorld world, BlockState state, BlockPos pos) protected DispenserBehavior
getBehaviorForItem
(World world, ItemStack stack) com.mojang.serialization.MapCodec
<? extends DispenserBlock> getCodec()
protected int
getComparatorOutput
(BlockState state, World world, BlockPos pos) Returns the comparator output of the block, from0
to15
.static Position
getOutputLocation
(BlockPointer pointer) static Position
getOutputLocation
(BlockPointer pointer, double facingOffset, Vec3d constantOffset) protected BlockRenderType
getRenderType
(BlockState state) Returns the block's render type (invisible, animated, model).protected boolean
hasComparatorOutput
(BlockState state) Returns whether the block can have a comparator output.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
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 ActionResult
onUse
(BlockState state, World world, BlockPos pos, PlayerEntity player, BlockHitResult hit) static void
registerBehavior
(ItemConvertible provider, DispenserBehavior behavior) static void
registerProjectileBehavior
(ItemConvertible projectile) 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 net.minecraft.block.BlockWithEntity
createScreenHandlerFactory, onSyncedBlockEvent, validateTicker
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, 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, createSettingsCodec, emitsRedstonePower, getAmbientOcclusionLightLevel, getCameraCollisionShape, getCollisionShape, getCullingShape, getDefaultMapColor, getDroppedStacks, getFluidState, getHardness, getLootTableKey, getMaxHorizontalModelOffset, getOpacity, getOutlineShape, getRaycastShape, getRenderingSeed, getRequiredFeatures, getSettings, getSidesShape, getSoundGroup, getStateForNeighborUpdate, getStrongRedstonePower, getVerticalModelOffsetMultiplier, getWeakRedstonePower, hasRandomTicks, hasSidedTransparency, isCullingShapeFullCube, isShapeFullCube, isSideInvisible, isTransparent, onBlockAdded, onBlockBreakStart, onEntityCollision, onExploded, onProjectileHit, onStacksDropped, onUseWithItem, prepare, randomTick
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
Methods inherited from interface net.minecraft.block.BlockEntityProvider
getGameEventListener, getTicker
Methods inherited from interface net.minecraft.resource.featuretoggle.ToggleableFeature
isEnabled
-
Field Details
-
LOGGER
- Mappings:
Namespace Name Mixin selector named LOGGER
Lnet/minecraft/block/DispenserBlock;LOGGER:Lorg/slf4j/Logger;
intermediary field_46212
Lnet/minecraft/class_2315;field_46212:Lorg/slf4j/Logger;
official e
Ldhn;e:Lorg/slf4j/Logger;
-
CODEC
- Mappings:
Namespace Name Mixin selector named CODEC
Lnet/minecraft/block/DispenserBlock;CODEC:Lcom/mojang/serialization/MapCodec;
intermediary field_46336
Lnet/minecraft/class_2315;field_46336:Lcom/mojang/serialization/MapCodec;
official a
Ldhn;a:Lcom/mojang/serialization/MapCodec;
-
FACING
- Mappings:
Namespace Name Mixin selector named FACING
Lnet/minecraft/block/DispenserBlock;FACING:Lnet/minecraft/state/property/DirectionProperty;
intermediary field_10918
Lnet/minecraft/class_2315;field_10918:Lnet/minecraft/class_2753;
official b
Ldhn;b:Ldtf;
-
TRIGGERED
- Mappings:
Namespace Name Mixin selector named TRIGGERED
Lnet/minecraft/block/DispenserBlock;TRIGGERED:Lnet/minecraft/state/property/BooleanProperty;
intermediary field_10920
Lnet/minecraft/class_2315;field_10920:Lnet/minecraft/class_2746;
official c
Ldhn;c:Ldtc;
-
DEFAULT_BEHAVIOR
- Mappings:
Namespace Name Mixin selector named DEFAULT_BEHAVIOR
Lnet/minecraft/block/DispenserBlock;DEFAULT_BEHAVIOR:Lnet/minecraft/block/dispenser/ItemDispenserBehavior;
intermediary field_51412
Lnet/minecraft/class_2315;field_51412:Lnet/minecraft/class_2347;
official f
Ldhn;f:Lkt;
-
BEHAVIORS
- Mappings:
Namespace Name Mixin selector named BEHAVIORS
Lnet/minecraft/block/DispenserBlock;BEHAVIORS:Ljava/util/Map;
intermediary field_10919
Lnet/minecraft/class_2315;field_10919:Ljava/util/Map;
official d
Ldhn;d:Ljava/util/Map;
-
SCHEDULED_TICK_DELAY
private static final int SCHEDULED_TICK_DELAY- See Also:
- Mappings:
Namespace Name Mixin selector named SCHEDULED_TICK_DELAY
Lnet/minecraft/block/DispenserBlock;SCHEDULED_TICK_DELAY:I
intermediary field_31082
Lnet/minecraft/class_2315;field_31082:I
official g
Ldhn;g:I
-
-
Constructor Details
-
DispenserBlock
- 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>
Ldsk;<init>(Ldsk$d;)V
-
-
Method Details
-
getCodec
- Specified by:
getCodec
in classBlockWithEntity
- 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
Ldsk;a()Lcom/mojang/serialization/MapCodec;
-
registerBehavior
- Mappings:
Namespace Name Mixin selector named registerBehavior
Lnet/minecraft/block/DispenserBlock;registerBehavior(Lnet/minecraft/item/ItemConvertible;Lnet/minecraft/block/dispenser/DispenserBehavior;)V
intermediary method_10009
Lnet/minecraft/class_2315;method_10009(Lnet/minecraft/class_1935;Lnet/minecraft/class_2357;)V
official a
Ldhn;a(Ldcf;Lku;)V
-
registerProjectileBehavior
- Mappings:
Namespace Name Mixin selector named registerProjectileBehavior
Lnet/minecraft/block/DispenserBlock;registerProjectileBehavior(Lnet/minecraft/item/ItemConvertible;)V
intermediary method_58681
Lnet/minecraft/class_2315;method_58681(Lnet/minecraft/class_1935;)V
official a
Ldhn;a(Ldcf;)V
-
onUse
protected ActionResult onUse(BlockState state, World world, BlockPos pos, PlayerEntity player, BlockHitResult hit) - Overrides:
onUse
in classAbstractBlock
- 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
Ldsk;a(Ldsl;Ldcg;Lja;Lcml;Lewd;)Lbqh;
-
dispense
- Mappings:
Namespace Name Mixin selector named dispense
Lnet/minecraft/block/DispenserBlock;dispense(Lnet/minecraft/server/world/ServerWorld;Lnet/minecraft/block/BlockState;Lnet/minecraft/util/math/BlockPos;)V
intermediary method_10012
Lnet/minecraft/class_2315;method_10012(Lnet/minecraft/class_3218;Lnet/minecraft/class_2680;Lnet/minecraft/class_2338;)V
official a
Ldhn;a(Laqm;Ldsl;Lja;)V
-
getBehaviorForItem
- Mappings:
Namespace Name Mixin selector named getBehaviorForItem
Lnet/minecraft/block/DispenserBlock;getBehaviorForItem(Lnet/minecraft/world/World;Lnet/minecraft/item/ItemStack;)Lnet/minecraft/block/dispenser/DispenserBehavior;
intermediary method_10011
Lnet/minecraft/class_2315;method_10011(Lnet/minecraft/class_1937;Lnet/minecraft/class_1799;)Lnet/minecraft/class_2357;
official a
Ldhn;a(Ldcg;Lcud;)Lku;
-
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
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 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
Ldsk;a(Ldsl;Ldcg;Lja;Ldfi;Lja;Z)V
-
scheduledTick
Called server-side when a block receives a scheduled tick. This can be used like a timer. Scheduled ticks are added usinginvalid reference
WorldAccess#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
Ldsk;a(Ldsl;Laqm;Lja;Layo;)V
-
createBlockEntity
Returns a new block entity instance.For example:
@Override public BlockEntity createBlockEntity(BlockPos pos, BlockState state) { return new MyBlockEntity(pos, state); }
- Returns:
- a new block entity instance
- Implementation Note:
- While this is marked as nullable, in practice this should never return
null
.PistonExtensionBlock
is the only block in vanilla that returnsnull
inside the implementation. - Mappings:
Namespace Name Mixin selector named createBlockEntity
Lnet/minecraft/block/BlockEntityProvider;createBlockEntity(Lnet/minecraft/util/math/BlockPos;Lnet/minecraft/block/BlockState;)Lnet/minecraft/block/entity/BlockEntity;
intermediary method_10123
Lnet/minecraft/class_2343;method_10123(Lnet/minecraft/class_2338;Lnet/minecraft/class_2680;)Lnet/minecraft/class_2586;
official a
Ldia;a(Lja;Ldsl;)Ldpq;
-
getPlacementState
- Overrides:
getPlacementState
in classBlock
- Mappings:
Namespace Name Mixin selector named getPlacementState
Lnet/minecraft/block/Block;getPlacementState(Lnet/minecraft/item/ItemPlacementContext;)Lnet/minecraft/block/BlockState;
intermediary method_9605
Lnet/minecraft/class_2248;method_9605(Lnet/minecraft/class_1750;)Lnet/minecraft/class_2680;
official a
Ldfi;a(Lcxn;)Ldsl;
-
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.- Overrides:
onStateReplaced
in classAbstractBlock
- 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
Ldsk;a(Ldsl;Ldcg;Lja;Ldsl;Z)V
-
getOutputLocation
- Mappings:
Namespace Name Mixin selector named getOutputLocation
Lnet/minecraft/block/DispenserBlock;getOutputLocation(Lnet/minecraft/util/math/BlockPointer;)Lnet/minecraft/util/math/Position;
intermediary method_58682
Lnet/minecraft/class_2315;method_58682(Lnet/minecraft/class_2342;)Lnet/minecraft/class_2374;
official a
Ldhn;a(Lkr;)Ljt;
-
getOutputLocation
public static Position getOutputLocation(BlockPointer pointer, double facingOffset, Vec3d constantOffset) - Mappings:
Namespace Name Mixin selector named getOutputLocation
Lnet/minecraft/block/DispenserBlock;getOutputLocation(Lnet/minecraft/util/math/BlockPointer;DLnet/minecraft/util/math/Vec3d;)Lnet/minecraft/util/math/Position;
intermediary method_10010
Lnet/minecraft/class_2315;method_10010(Lnet/minecraft/class_2342;DLnet/minecraft/class_243;)Lnet/minecraft/class_2374;
official a
Ldhn;a(Lkr;DLewh;)Ljt;
-
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.- Overrides:
hasComparatorOutput
in classAbstractBlock
- 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_
Ldsk;c_(Ldsl;)Z
-
getComparatorOutput
Returns the comparator output of the block, from0
to15
.When overriding this,
hasComparatorOutput(net.minecraft.block.BlockState)
must also be overridden.- Overrides:
getComparatorOutput
in classAbstractBlock
- 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
Ldsk;a(Ldsl;Ldcg;Lja;)I
-
getRenderType
Returns the block's render type (invisible, animated, model).- Overrides:
getRenderType
in classBlockWithEntity
- 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_
Ldsk;a_(Ldsl;)Ldlo;
-
rotate
Returnsstate
rotated byrotation
.By default, this returns the provided block state.
- Overrides:
rotate
in classAbstractBlock
- 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
Ldsk;a(Ldsl;Ldlv;)Ldsl;
-
mirror
Returnsstate
mirrored bymirror
.By default, this returns the provided block state.
- Overrides:
mirror
in classAbstractBlock
- 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
Ldsk;a(Ldsl;Ldkf;)Ldsl;
-
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
Ldfi;a(Ldsm$a;)V
-