public class Block extends AbstractBlock implements ItemConvertible
Modifier and Type | Class and Description |
---|---|
static class |
Block.NeighborGroup |
AbstractBlock.AbstractBlockState, AbstractBlock.ContextPredicate, AbstractBlock.OffsetType, AbstractBlock.Settings, AbstractBlock.TypedContextPredicate<A>
Modifier and Type | Field and Description |
---|---|
private Item |
cachedItem |
private BlockState |
defaultState |
private static ThreadLocal<it.unimi.dsi.fastutil.objects.Object2ByteLinkedOpenHashMap<Block.NeighborGroup>> |
FACE_CULL_MAP |
private static LoadingCache<VoxelShape,Boolean> |
FULL_CUBE_SHAPE_CACHE |
protected static Logger |
LOGGER |
static IdList<BlockState> |
STATE_IDS |
protected StateManager<Block,BlockState> |
stateManager |
private String |
translationKey |
collidable, dynamicBounds, FACINGS, jumpVelocityMultiplier, lootTableId, material, randomTicks, resistance, settings, slipperiness, soundGroup, velocityMultiplier
Constructor and Description |
---|
Block(AbstractBlock.Settings settings) |
calcBlockBreakingDelta, canBucketPlace, canPathfindThrough, canPlaceAt, canReplace, createScreenHandlerFactory, emitsRedstonePower, getAmbientOcclusionLightLevel, getCollisionShape, getComparatorOutput, getCullingShape, getDefaultMaterialColor, getDroppedStacks, getFluidState, getLootTableId, getOffsetType, getOpacity, getOutlineShape, getPistonBehavior, getRaycastShape, getRenderingSeed, getRenderType, getSidesShape, getStateForNeighborUpdate, getStrongRedstonePower, getVisualShape, getWeakRedstonePower, hasBlockEntity, hasComparatorOutput, hasSidedTransparency, isSideInvisible, mirror, neighborUpdate, onBlockAdded, onBlockBreakStart, onEntityCollision, onProjectileHit, onStacksDropped, onStateReplaced, onSyncedBlockEvent, onUse, prepare, randomTick, rotate, scheduledTick
protected static final Logger LOGGER
public static final IdList<BlockState> STATE_IDS
private static final LoadingCache<VoxelShape,Boolean> FULL_CUBE_SHAPE_CACHE
private static final ThreadLocal<it.unimi.dsi.fastutil.objects.Object2ByteLinkedOpenHashMap<Block.NeighborGroup>> FACE_CULL_MAP
protected final StateManager<Block,BlockState> stateManager
private BlockState defaultState
public Block(AbstractBlock.Settings settings)
public static int getRawIdFromState(@Nullable BlockState state)
public static BlockState getStateFromRawId(int stateId)
public static BlockState pushEntitiesUpBeforeBlockChange(BlockState from, BlockState to, World world, BlockPos pos)
public static VoxelShape createCuboidShape(double xMin, double yMin, double zMin, double xMax, double yMax, double zMax)
public boolean is(Block block)
public static BlockState postProcessState(BlockState state, WorldAccess world, BlockPos pos)
public static void replace(BlockState state, BlockState newState, WorldAccess world, BlockPos pos, int flags)
state
with the newState
at the pos
.
If the two state objects are identical, this method does nothing.
If the new state is air, breaks the block at the position instead.
state
- the existing block statenewState
- the new block stateworld
- the worldpos
- the position of the replaced block stateflags
- the bitwise flags for ModifiableWorld.setBlockState(BlockPos, BlockState, int, int)
public static void replace(BlockState state, BlockState newState, WorldAccess world, BlockPos pos, int flags, int maxUpdateDepth)
state
with the newState
at the pos
.
If the two state objects are identical, this method does nothing.
If the new state is air, breaks the block at the position instead.
state
- the existing block statenewState
- the new block stateworld
- the worldpos
- the position of the replaced block stateflags
- the bitwise flags for ModifiableWorld.setBlockState(BlockPos, BlockState, int, int)
maxUpdateDepth
- the limit for the cascading block updatespublic static boolean cannotConnect(Block block)
public boolean hasRandomTicks(BlockState state)
@Environment(value=CLIENT) public static boolean shouldDrawSide(BlockState state, BlockView world, BlockPos pos, Direction facing)
public static boolean sideCoversSmallSquare(WorldView world, BlockPos pos, Direction side)
public static boolean isFaceFullSquare(VoxelShape shape, Direction side)
public static boolean isShapeFullCube(VoxelShape shape)
public boolean isTranslucent(BlockState state, BlockView world, BlockPos pos)
@Environment(value=CLIENT) public void randomDisplayTick(BlockState state, World world, BlockPos pos, Random random)
public void onBroken(WorldAccess world, BlockPos pos, BlockState state)
public static List<ItemStack> getDroppedStacks(BlockState state, ServerWorld world, BlockPos pos, @Nullable BlockEntity blockEntity)
public static List<ItemStack> getDroppedStacks(BlockState state, ServerWorld world, BlockPos pos, @Nullable BlockEntity blockEntity, @Nullable Entity entity, ItemStack stack)
public static void dropStacks(BlockState state, World world, BlockPos pos)
public static void dropStacks(BlockState state, WorldAccess world, BlockPos pos, @Nullable BlockEntity blockEntity)
public static void dropStacks(BlockState state, World world, BlockPos pos, @Nullable BlockEntity blockEntity, Entity entity, ItemStack stack)
protected void dropExperience(ServerWorld world, BlockPos pos, int size)
public float getBlastResistance()
public void onDestroyedByExplosion(World world, BlockPos pos, Explosion explosion)
public void onSteppedOn(World world, BlockPos pos, Entity entity)
@Nullable public BlockState getPlacementState(ItemPlacementContext ctx)
public void afterBreak(World world, PlayerEntity player, BlockPos pos, BlockState state, @Nullable BlockEntity blockEntity, ItemStack stack)
public void onPlaced(World world, BlockPos pos, BlockState state, @Nullable LivingEntity placer, ItemStack itemStack)
public boolean canMobSpawnInside()
@Environment(value=CLIENT) public MutableText getName()
public String getTranslationKey()
@Environment(value=CLIENT) public ItemStack getPickStack(BlockView world, BlockPos pos, BlockState state)
public void addStacksForDisplay(ItemGroup group, DefaultedList<ItemStack> list)
public float getSlipperiness()
public float getVelocityMultiplier()
public float getJumpVelocityMultiplier()
public void onBreak(World world, BlockPos pos, BlockState state, PlayerEntity player)
public boolean shouldDropItemsOnExplosion(Explosion explosion)
protected void appendProperties(StateManager.Builder<Block,BlockState> builder)
public StateManager<Block,BlockState> getStateManager()
protected final void setDefaultState(BlockState state)
public final BlockState getDefaultState()
public BlockSoundGroup getSoundGroup(BlockState state)
public Item asItem()
ItemConvertible
asItem
in interface ItemConvertible
asItem
in class AbstractBlock
public boolean hasDynamicBounds()
@Environment(value=CLIENT) public void appendTooltip(ItemStack stack, @Nullable BlockView world, List<Text> tooltip, TooltipContext options)
protected Block asBlock()
asBlock
in class AbstractBlock