Class JukeboxBlock
- All Implemented Interfaces:
BlockEntityProvider
,ItemConvertible
,ToggleableFeature
- Mappings:
Namespace Name named net/minecraft/block/JukeboxBlock
intermediary net/minecraft/class_2387
official dje
-
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
<JukeboxBlock> 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.boolean
emitsRedstonePower
(BlockState state) Returns whether the block is capable of emitting redstone power.com.mojang.serialization.MapCodec
<JukeboxBlock> getCodec()
protected int
getComparatorOutput
(BlockState state, World world, BlockPos pos) Returns the comparator output of the block, from0
to15
.protected BlockRenderType
getRenderType
(BlockState state) Returns the block's render type (invisible, animated, model).<T extends BlockEntity>
@Nullable BlockEntityTicker<T> getTicker
(World world, BlockState state, BlockEntityType<T> type) Returns the "ticker" for the block's block entity, ornull
if the block entity does not need to be ticked.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.void
onPlaced
(World world, BlockPos pos, BlockState state, @Nullable LivingEntity placer, ItemStack itemStack) Called when the player placed the block.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) 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, getPlacementState, getRawIdFromState, getRegistryEntry, getShapesForStates, getSlipperiness, getStateFromRawId, getStateManager, getStateWithProperties, getTranslationKey, getVelocityMultiplier, hasDynamicBounds, hasTopRim, isFaceFullSquare, isShapeFullCube, onBreak, onBroken, onDestroyedByExplosion, onEntityLand, onLandedUpon, 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, getAmbientOcclusionLightLevel, getCameraCollisionShape, getCollisionShape, getCullingShape, getDefaultMapColor, getDroppedStacks, getFluidState, getHardness, getLootTableKey, getMaxHorizontalModelOffset, getOpacity, getOutlineShape, getRaycastShape, getRenderingSeed, getRequiredFeatures, getSettings, getSidesShape, getSoundGroup, getStateForNeighborUpdate, getStrongRedstonePower, getVerticalModelOffsetMultiplier, hasRandomTicks, hasSidedTransparency, isCullingShapeFullCube, isShapeFullCube, isSideInvisible, isTransparent, mirror, neighborUpdate, onBlockAdded, onBlockBreakStart, onEntityCollision, onExploded, onProjectileHit, onStacksDropped, onUseWithItem, 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.block.BlockEntityProvider
getGameEventListener
Methods inherited from interface net.minecraft.resource.featuretoggle.ToggleableFeature
isEnabled
-
Field Details
-
CODEC
- Mappings:
Namespace Name Mixin selector named CODEC
Lnet/minecraft/block/JukeboxBlock;CODEC:Lcom/mojang/serialization/MapCodec;
intermediary field_46377
Lnet/minecraft/class_2387;field_46377:Lcom/mojang/serialization/MapCodec;
official a
Ldje;a:Lcom/mojang/serialization/MapCodec;
-
HAS_RECORD
- Mappings:
Namespace Name Mixin selector named HAS_RECORD
Lnet/minecraft/block/JukeboxBlock;HAS_RECORD:Lnet/minecraft/state/property/BooleanProperty;
intermediary field_11180
Lnet/minecraft/class_2387;field_11180:Lnet/minecraft/class_2746;
official b
Ldje;b:Ldsv;
-
-
Constructor Details
-
JukeboxBlock
- 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
- 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
Ldsd;a()Lcom/mojang/serialization/MapCodec;
-
onPlaced
public void onPlaced(World world, BlockPos pos, BlockState state, @Nullable @Nullable LivingEntity placer, ItemStack itemStack) Called when the player placed the block.Tall or wide blocks (such as doors or beds) should override this to place the other half of the block. Blocks with block entities can use this to copy the data from the item stack, such as the custom name.
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:
onPlaced
in classBlock
- See Also:
- Mappings:
Namespace Name Mixin selector named onPlaced
Lnet/minecraft/block/Block;onPlaced(Lnet/minecraft/world/World;Lnet/minecraft/util/math/BlockPos;Lnet/minecraft/block/BlockState;Lnet/minecraft/entity/LivingEntity;Lnet/minecraft/item/ItemStack;)V
intermediary method_9567
Lnet/minecraft/class_2248;method_9567(Lnet/minecraft/class_1937;Lnet/minecraft/class_2338;Lnet/minecraft/class_2680;Lnet/minecraft/class_1309;Lnet/minecraft/class_1799;)V
official a
Ldfb;a(Ldca;Liz;Ldse;Lbtr;Lcur;)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
Ldsd;a(Ldse;Ldca;Liz;Lcmz;Levp;)Lbqw;
-
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
Ldsd;a(Ldse;Ldca;Liz;Ldse;Z)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
Ldht;a(Liz;Ldse;)Ldpj;
-
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
-
getWeakRedstonePower
public 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
-
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_
Ldsd;c_(Ldse;)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
Ldsd;a(Ldse;Ldca;Liz;)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_
Ldsd;a_(Ldse;)Ldlh;
-
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
-
getTicker
@Nullable public <T extends BlockEntity> @Nullable BlockEntityTicker<T> getTicker(World world, BlockState state, BlockEntityType<T> type) Returns the "ticker" for the block's block entity, ornull
if the block entity does not need to be ticked.Ticker is a functional interface called every tick to tick the block entity on both the client and the server.
Tickers should validate that the passed
type
is the one this block expects, and returnnull
if it isn't. This is to prevent crashes in rare cases where a mismatch occurs between the position's block and block entity.BlockWithEntity.validateTicker(net.minecraft.block.entity.BlockEntityType<A>, net.minecraft.block.entity.BlockEntityType<E>, net.minecraft.block.entity.BlockEntityTicker<? super E>)
can be used to implement the check.Example:
public <T extends BlockEntity> BlockEntityTicker<T> getTicker(World world, BlockState state, BlockEntityType<T> type) { if (type != YourMod.MY_BLOCK_ENTITY_TYPE) return null; // This should be a static method usable as a BlockEntityTicker. return YourBlockEntity::tick; }
- Returns:
- the "ticker" for the block's block entity, or
null
if the block entity does not need to be ticked - Mappings:
Namespace Name Mixin selector named getTicker
Lnet/minecraft/block/BlockEntityProvider;getTicker(Lnet/minecraft/world/World;Lnet/minecraft/block/BlockState;Lnet/minecraft/block/entity/BlockEntityType;)Lnet/minecraft/block/entity/BlockEntityTicker;
intermediary method_31645
Lnet/minecraft/class_2343;method_31645(Lnet/minecraft/class_1937;Lnet/minecraft/class_2680;Lnet/minecraft/class_2591;)Lnet/minecraft/class_5558;
official a
Ldht;a(Ldca;Ldse;Ldpl;)Ldpk;
-