public class JukeboxBlock extends BlockWithEntity
Block.NeighborGroup
AbstractBlock.AbstractBlockState, AbstractBlock.ContextPredicate, AbstractBlock.OffsetType, AbstractBlock.Settings, AbstractBlock.TypedContextPredicate<A>
Modifier and Type | Field and Description |
---|---|
static BooleanProperty |
HAS_RECORD |
LOGGER, STATE_IDS, stateManager
collidable, dynamicBounds, FACINGS, jumpVelocityMultiplier, lootTableId, material, randomTicks, resistance, settings, slipperiness, soundGroup, velocityMultiplier
Modifier | Constructor and Description |
---|---|
protected |
JukeboxBlock(AbstractBlock.Settings settings) |
Modifier and Type | Method and Description |
---|---|
protected void |
appendProperties(StateManager.Builder<Block,BlockState> builder) |
BlockEntity |
createBlockEntity(BlockView world) |
int |
getComparatorOutput(BlockState state,
World world,
BlockPos pos) |
BlockRenderType |
getRenderType(BlockState state) |
boolean |
hasComparatorOutput(BlockState state) |
void |
onPlaced(World world,
BlockPos pos,
BlockState state,
LivingEntity placer,
ItemStack itemStack) |
void |
onStateReplaced(BlockState state,
World world,
BlockPos pos,
BlockState newState,
boolean moved)
Called in
WorldChunk.setBlockState(BlockPos, BlockState, boolean) if newState is different from state . |
ActionResult |
onUse(BlockState state,
World world,
BlockPos pos,
PlayerEntity player,
Hand hand,
BlockHitResult hit)
Called when this block is used by a player.
|
private void |
removeRecord(World world,
BlockPos pos) |
void |
setRecord(WorldAccess world,
BlockPos pos,
BlockState state,
ItemStack stack) |
createScreenHandlerFactory, onSyncedBlockEvent
addStacksForDisplay, afterBreak, appendTooltip, asBlock, asItem, canMobSpawnInside, cannotConnect, createCuboidShape, dropExperience, dropStack, dropStacks, dropStacks, dropStacks, getBlastResistance, getBlockFromItem, getDefaultState, getDroppedStacks, getDroppedStacks, getJumpVelocityMultiplier, getName, getPickStack, getPlacementState, getRawIdFromState, getSlipperiness, getSoundGroup, getStateFromRawId, getStateManager, getTranslationKey, getVelocityMultiplier, hasDynamicBounds, hasRandomTicks, hasTopRim, is, isFaceFullSquare, isIn, isShapeFullCube, isTranslucent, onBreak, onBroken, onDestroyedByExplosion, onEntityLand, onLandedUpon, onSteppedOn, postProcessState, pushEntitiesUpBeforeBlockChange, rainTick, randomDisplayTick, replace, replace, setDefaultState, shouldDrawSide, shouldDropItemsOnExplosion, sideCoversSmallSquare, toString
calcBlockBreakingDelta, canBucketPlace, canPathfindThrough, canPlaceAt, canReplace, emitsRedstonePower, getAmbientOcclusionLightLevel, getCollisionShape, getCullingShape, getDefaultMaterialColor, getDroppedStacks, getFluidState, getLootTableId, getOffsetType, getOpacity, getOutlineShape, getPistonBehavior, getRaycastShape, getRenderingSeed, getSidesShape, getStateForNeighborUpdate, getStrongRedstonePower, getVisualShape, getWeakRedstonePower, hasBlockEntity, hasSidedTransparency, isSideInvisible, mirror, neighborUpdate, onBlockAdded, onBlockBreakStart, onEntityCollision, onProjectileHit, onStacksDropped, prepare, randomTick, rotate, scheduledTick
public static final BooleanProperty HAS_RECORD
protected JukeboxBlock(AbstractBlock.Settings settings)
public void onPlaced(World world, BlockPos pos, BlockState state, @Nullable LivingEntity placer, ItemStack itemStack)
public ActionResult onUse(BlockState state, World world, BlockPos pos, PlayerEntity player, Hand hand, BlockHitResult hit)
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.
onUse
in class AbstractBlock
public void setRecord(WorldAccess world, BlockPos pos, BlockState state, ItemStack stack)
public void onStateReplaced(BlockState state, World world, BlockPos pos, BlockState newState, boolean moved)
WorldChunk.setBlockState(BlockPos, BlockState, boolean)
if newState
is different from state
. Vanilla blocks perform removal cleanups here.onStateReplaced
in class AbstractBlock
public BlockEntity createBlockEntity(BlockView world)
public boolean hasComparatorOutput(BlockState state)
hasComparatorOutput
in class AbstractBlock
public int getComparatorOutput(BlockState state, World world, BlockPos pos)
getComparatorOutput
in class AbstractBlock
public BlockRenderType getRenderType(BlockState state)
getRenderType
in class BlockWithEntity
protected void appendProperties(StateManager.Builder<Block,BlockState> builder)
appendProperties
in class Block