Package net.minecraft.world.level.block
Class Block
java.lang.Object
net.minecraft.world.level.block.state.BlockBehaviour
net.minecraft.world.level.block.Block
- All Implemented Interfaces:
FeatureElement,ItemLike,IBlockExtension
- Direct Known Subclasses:
AbstractCandleBlock,AbstractCauldronBlock,AirBlock,AmethystBlock,BambooSaplingBlock,BambooStalkBlock,BarrierBlock,BaseCoralPlantTypeBlock,BaseEntityBlock,BaseFireBlock,BasePressurePlateBlock,BaseRailBlock,BaseTorchBlock,BlockPropertyTests.LightBlock,BlockTests.CustomBubbleColumnSustainingBlock,BubbleColumnBlock,BushBlock,CactusBlock,CakeBlock,CarpetBlock,CartographyTableBlock,ChorusFlowerBlock,ComposterBlock,CopperBulbBlock,CoralBlock,CraftingTableBlock,CrossCollisionBlock,CryingObsidianBlock,CustomBreakSoundTest.TestBlock,CustomPlantTypeTest.CustomBlock,DirectionalBlock,DirtPathBlock,DoorBlock,DropExperienceBlock,EndPortalFrameBlock,FallingBlock,FarmBlock,FlowerPotBlock,ForgeChunkManagerTest.ChunkLoaderBlock,FrogspawnBlock,FullPotsAccessorDemo.DioriteFlowerPotBlock,GameTestTest.EnergyBlock,GrowingPlantBlock,HalfTransparentBlock,HangingRootsBlock,HeavyCoreBlock,HorizontalDirectionalBlock,HugeMushroomBlock,InfestedBlock,JigsawBlock,LadderBlock,LanternBlock,LeavesBlock,LightBlock,LiquidBlock,MagmaBlock,MangroveRootsBlock,MegaModelTest.TestBlock,MossBlock,MudBlock,MultifaceBlock,NetherPortalBlock,NetherrackBlock,NewFluidTest.FluidloggableBlock,NoteBlock,NyliumBlock,OnDestroyedByPushReactionTests.DestroyedByPushReactionListeningBlock,PipeBlock,PointedDripstoneBlock,PowderSnowBlock,PoweredBlock,PumpkinBlock,RedstoneLampBlock,RedStoneOreBlock,RedstoneSidedConnectivityTest.EastRedstoneBlock,RedStoneWireBlock,RespawnAnchorBlock,RootedDirtBlock,RotatedPillarBlock,ScaffoldingBlock,SlabBlock,SnifferEggBlock,SnowLayerBlock,SnowyDirtBlock,SoulSandBlock,SpongeBlock,SporeBlossomBlock,StairBlock,StonecutterBlock,StructureVoidBlock,SugarCaneBlock,TargetBlock,TntBlock,TripWireBlock,TripWireHookBlock,TurtleEggBlock,VineBlock,WallBlock,WeatheringCopperFullBlock,WebBlock,WetSpongeBlock
-
Nested Class Summary
Nested ClassesNested classes/interfaces inherited from class net.minecraft.world.level.block.state.BlockBehaviour
BlockBehaviour.BlockStateBase, BlockBehaviour.OffsetFunction, BlockBehaviour.OffsetType, BlockBehaviour.Properties, BlockBehaviour.StateArgumentPredicate<A>, BlockBehaviour.StatePredicate -
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final IdMapper<BlockState> Deprecated.private final Holder.Reference<Block> private static final intprivate static List<ItemEntity> Short-lived holder of dropped item entities.static final com.mojang.serialization.MapCodec<Block> private BlockStateprivate Stringstatic final floatstatic final floatprivate Itemprivate static final org.slf4j.Loggerprivate static final ThreadLocal<it.unimi.dsi.fastutil.objects.Object2ByteLinkedOpenHashMap<Block.BlockStatePairKey>> private Objectprivate static final com.google.common.cache.LoadingCache<VoxelShape, Boolean> protected final StateDefinition<Block, BlockState> static final intstatic final intstatic final intstatic final intstatic final intstatic final intstatic final intstatic final intstatic final intstatic final intstatic final intFields inherited from class net.minecraft.world.level.block.state.BlockBehaviour
drops, dynamicShape, explosionResistance, friction, hasCollision, isRandomlyTicking, jumpFactor, properties, requiredFeatures, soundType, speedFactor, UPDATE_SHAPE_ORDERFields inherited from interface net.minecraft.world.flag.FeatureElement
FILTERED_REGISTRIES -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidanimateTick(BlockState p_220827_, Level p_220828_, BlockPos p_220829_, RandomSource p_220830_) voidappendHoverText(ItemStack p_49816_, Item.TooltipContext p_339606_, List<Component> p_49818_, TooltipFlag p_49819_) protected BlockasBlock()asItem()private static voidInitializescapturedDrops, starting the drop capture process.static VoxelShapebox(double p_49797_, double p_49798_, double p_49799_, double p_49800_, double p_49801_, double p_49802_) Deprecated.static Blockstatic booleancanSupportCenter(LevelReader p_49864_, BlockPos p_49865_, Direction p_49866_) static booleancanSupportRigidBlock(BlockGetter p_49937_, BlockPos p_49938_) booleancanSustainPlant(BlockState state, BlockGetter world, BlockPos pos, Direction facing, IPlantable plantable) Determines if this block can support the passed in plant, allowing it to be planted and grow.protected com.mojang.serialization.MapCodec<? extends Block> codec()private static <T extends Comparable<T>>
BlockStatecopyProperty(BlockState p_152455_, BlockState p_152456_, Property<T> p_152457_) protected voidfinal BlockStatevoiddestroy(LevelAccessor p_49860_, BlockPos p_49861_, BlockState p_49862_) booleandropFromExplosion(Explosion p_49826_) Deprecated.static voiddropResources(BlockState p_49893_, LevelAccessor p_49894_, BlockPos p_49895_, BlockEntity p_49896_) static voiddropResources(BlockState p_49951_, Level p_49952_, BlockPos p_49953_) static voiddropResources(BlockState p_49882_, Level p_49883_, BlockPos p_49884_, BlockEntity p_49885_, Entity p_49886_, ItemStack p_49887_) voidfallOn(Level p_152426_, BlockState p_152427_, BlockPos p_152428_, Entity p_152429_, float p_152430_) getCloneItemStack(LevelReader p_304395_, BlockPos p_49824_, BlockState p_49825_) Deprecated.getDrops(BlockState p_49870_, ServerLevel p_49871_, BlockPos p_49872_, BlockEntity p_49873_) getDrops(BlockState p_49875_, ServerLevel p_49876_, BlockPos p_49877_, BlockEntity p_49878_, Entity p_49879_, ItemStack p_49880_) floatDeprecated.floatstatic intgetId(BlockState p_49957_) floatgetName()protected com.google.common.collect.ImmutableMap<BlockState, VoxelShape> getShapeForEachState(Function<BlockState, VoxelShape> p_152459_) floatgetStateForPlacement(BlockPlaceContext p_49820_) voidhandlePrecipitation(BlockState p_152450_, Level p_152451_, BlockPos p_152452_, Biome.Precipitation p_152453_) booleanprivate voidvoidinitializeClient(Consumer<IClientBlockExtensions> consumer) static booleanisExceptionForConnection(BlockState p_152464_) static booleanisFaceFull(VoxelShape p_49919_, Direction p_49920_) booleanisPossibleToRespawnInThis(BlockState p_279289_) static booleanisShapeFullBlock(VoxelShape p_49917_) voidplayerDestroy(Level p_49827_, Player p_49828_, BlockPos p_49829_, BlockState p_49830_, BlockEntity p_49831_, ItemStack p_49832_) playerWillDestroy(Level p_49852_, BlockPos p_49853_, BlockState p_49854_, Player p_49855_) voidpopExperience(ServerLevel p_49806_, BlockPos p_49807_, int p_49808_) private static voidpopResource(Level p_152441_, Supplier<ItemEntity> p_152442_, ItemStack p_152443_) static voidpopResource(Level p_49841_, BlockPos p_49842_, ItemStack p_49843_) static voidpopResourceFromFace(Level p_152436_, BlockPos p_152437_, Direction p_152438_, ItemStack p_152439_) static BlockStatepushEntitiesUp(BlockState p_49898_, BlockState p_49899_, LevelAccessor p_238252_, BlockPos p_49901_) protected final voidregisterDefaultState(BlockState p_49960_) voidsetPlacedBy(Level p_49847_, BlockPos p_49848_, BlockState p_49849_, LivingEntity p_49850_, ItemStack p_49851_) static booleanshouldRenderFace(BlockState p_152445_, BlockGetter p_152446_, BlockPos p_152447_, Direction p_152448_, BlockPos p_152449_) protected voidspawnDestroyParticles(Level p_152422_, Player p_152423_, BlockPos p_152424_, BlockState p_152425_) static BlockStatestateById(int p_49804_) voidstepOn(Level p_152431_, BlockPos p_152432_, BlockState p_152433_, Entity p_152434_) private static List<ItemEntity> Ends the drop capture process by settingcapturedDropsto null and returning the old list.toString()protected voidtryDropExperience(ServerLevel p_220823_, BlockPos p_220824_, ItemStack p_220825_, IntProvider p_220826_) voidupdateEntityAfterFallOn(BlockGetter p_49821_, Entity p_49822_) static BlockStateupdateFromNeighbourShapes(BlockState p_49932_, LevelAccessor p_49933_, BlockPos p_49934_) static voidupdateOrDestroy(BlockState p_49903_, BlockState p_49904_, LevelAccessor p_49905_, BlockPos p_49906_, int p_49907_) static voidupdateOrDestroy(BlockState p_49909_, BlockState p_49910_, LevelAccessor p_49911_, BlockPos p_49912_, int p_49913_, int p_49914_) voidwasExploded(Level p_49844_, BlockPos p_49845_, Explosion p_49846_) final BlockStatewithPropertiesOf(BlockState p_152466_) Methods inherited from class net.minecraft.world.level.block.state.BlockBehaviour
attack, canBeReplaced, canBeReplaced, canSurvive, defaultDestroyTime, defaultMapColor, entityInside, getAnalogOutputSignal, getBlockSupportShape, getCollisionShape, getDestroyProgress, getDirectSignal, getDrops, getFluidState, getInteractionShape, getLightBlock, getLootTable, getMaxHorizontalOffset, getMaxVerticalOffset, getMenuProvider, getOcclusionShape, getRenderShape, getSeed, getShadeBrightness, getShape, getSignal, getSoundType, getVisualShape, hasAnalogOutputSignal, isAir, isCollisionShapeFullBlock, isOcclusionShapeFullBlock, isPathfindable, isRandomlyTicking, isSignalSource, mirror, neighborChanged, onExplosionHit, onPlace, onProjectileHit, onRemove, propagatesSkylightDown, properties, propertiesCodec, randomTick, requiredFeatures, rotate, simpleCodec, skipRendering, spawnAfterBreak, tick, triggerEvent, updateIndirectNeighbourShapes, updateShape, useItemOn, useShapeForLightOcclusion, useWithoutItemMethods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, waitMethods inherited from interface net.minecraft.world.flag.FeatureElement
isEnabledMethods inherited from interface net.neoforged.neoforge.common.extensions.IBlockExtension
addLandingEffects, addRunningEffects, canBeHydrated, canConnectRedstone, canDropFromExplosion, canEntityDestroy, canHarvestBlock, canStickTo, collisionExtendsVertically, getAdjacentBlockPathType, getAppearance, getBeaconColorMultiplier, getBedDirection, getBlockPathType, getBubbleColumnDirection, getCloneItemStack, getEnchantPowerBonus, getExpDrop, getExplosionResistance, getFireSpreadSpeed, getFlammability, getFriction, getLightEmission, getMapColor, getPistonPushReaction, getRespawnPosition, getSoundType, getStateAtViewpoint, getToolModifiedState, getWeakChanges, hasDynamicLightEmission, hidesNeighborFace, isBed, isBurning, isConduitFrame, isEmpty, isFertile, isFireSource, isFlammable, isLadder, isPortalFrame, isScaffolding, isSlimeBlock, isStickyBlock, makesOpenTrapdoorAboveClimbable, onBlockExploded, onBlockStateChange, onCaughtFire, onDestroyedByPlayer, onDestroyedByPushReaction, onNeighborChange, onTreeGrow, rotate, setBedOccupied, shouldCheckWeakPower, shouldDisplayFluidOverlay, supportsExternalFaceHiding
-
Field Details
-
CODEC
-
LOGGER
private static final org.slf4j.Logger LOGGER -
builtInRegistryHolder
-
BLOCK_STATE_REGISTRY
Deprecated. -
SHAPE_FULL_BLOCK_CACHE
private static final com.google.common.cache.LoadingCache<VoxelShape,Boolean> SHAPE_FULL_BLOCK_CACHE -
UPDATE_NEIGHBORS
public static final int UPDATE_NEIGHBORS- See Also:
-
UPDATE_CLIENTS
public static final int UPDATE_CLIENTS- See Also:
-
UPDATE_INVISIBLE
public static final int UPDATE_INVISIBLE- See Also:
-
UPDATE_IMMEDIATE
public static final int UPDATE_IMMEDIATE- See Also:
-
UPDATE_KNOWN_SHAPE
public static final int UPDATE_KNOWN_SHAPE- See Also:
-
UPDATE_SUPPRESS_DROPS
public static final int UPDATE_SUPPRESS_DROPS- See Also:
-
UPDATE_MOVE_BY_PISTON
public static final int UPDATE_MOVE_BY_PISTON- See Also:
-
UPDATE_NONE
public static final int UPDATE_NONE- See Also:
-
UPDATE_ALL
public static final int UPDATE_ALL- See Also:
-
UPDATE_ALL_IMMEDIATE
public static final int UPDATE_ALL_IMMEDIATE- See Also:
-
INDESTRUCTIBLE
public static final float INDESTRUCTIBLE- See Also:
-
INSTANT
public static final float INSTANT- See Also:
-
UPDATE_LIMIT
public static final int UPDATE_LIMIT- See Also:
-
stateDefinition
-
defaultBlockState
-
descriptionId
-
item
-
CACHE_SIZE
private static final int CACHE_SIZE- See Also:
-
OCCLUSION_CACHE
private static final ThreadLocal<it.unimi.dsi.fastutil.objects.Object2ByteLinkedOpenHashMap<Block.BlockStatePairKey>> OCCLUSION_CACHE -
capturedDrops
Short-lived holder of dropped item entities. When not null, records all item entities frompopResource(Level, Supplier, ItemStack)instead of adding them to the world. -
renderProperties
-
-
Constructor Details
-
Block
-
-
Method Details
-
codec
- Specified by:
codecin classBlockBehaviour
-
getId
-
stateById
-
byItem
-
pushEntitiesUp
public static BlockState pushEntitiesUp(BlockState p_49898_, BlockState p_49899_, LevelAccessor p_238252_, BlockPos p_49901_) -
box
public static VoxelShape box(double p_49797_, double p_49798_, double p_49799_, double p_49800_, double p_49801_, double p_49802_) -
updateFromNeighbourShapes
public static BlockState updateFromNeighbourShapes(BlockState p_49932_, LevelAccessor p_49933_, BlockPos p_49934_) -
updateOrDestroy
public static void updateOrDestroy(BlockState p_49903_, BlockState p_49904_, LevelAccessor p_49905_, BlockPos p_49906_, int p_49907_) -
updateOrDestroy
public static void updateOrDestroy(BlockState p_49909_, BlockState p_49910_, LevelAccessor p_49911_, BlockPos p_49912_, int p_49913_, int p_49914_) -
isExceptionForConnection
-
shouldRenderFace
public static boolean shouldRenderFace(BlockState p_152445_, BlockGetter p_152446_, BlockPos p_152447_, Direction p_152448_, BlockPos p_152449_) -
canSupportRigidBlock
-
canSupportCenter
-
isFaceFull
-
isShapeFullBlock
-
animateTick
public void animateTick(BlockState p_220827_, Level p_220828_, BlockPos p_220829_, RandomSource p_220830_) -
destroy
-
getDrops
public static List<ItemStack> getDrops(BlockState p_49870_, ServerLevel p_49871_, BlockPos p_49872_, @Nullable BlockEntity p_49873_) -
getDrops
public static List<ItemStack> getDrops(BlockState p_49875_, ServerLevel p_49876_, BlockPos p_49877_, @Nullable BlockEntity p_49878_, @Nullable Entity p_49879_, ItemStack p_49880_) -
dropResources
-
dropResources
public static void dropResources(BlockState p_49893_, LevelAccessor p_49894_, BlockPos p_49895_, @Nullable BlockEntity p_49896_) -
dropResources
public static void dropResources(BlockState p_49882_, Level p_49883_, BlockPos p_49884_, @Nullable BlockEntity p_49885_, @Nullable Entity p_49886_, ItemStack p_49887_) -
popResource
-
popResourceFromFace
-
popResource
private static void popResource(Level p_152441_, Supplier<ItemEntity> p_152442_, ItemStack p_152443_) -
popExperience
-
getExplosionResistance
Deprecated. -
wasExploded
-
stepOn
-
getStateForPlacement
-
playerDestroy
public void playerDestroy(Level p_49827_, Player p_49828_, BlockPos p_49829_, BlockState p_49830_, @Nullable BlockEntity p_49831_, ItemStack p_49832_) -
setPlacedBy
public void setPlacedBy(Level p_49847_, BlockPos p_49848_, BlockState p_49849_, @Nullable LivingEntity p_49850_, ItemStack p_49851_) -
isPossibleToRespawnInThis
-
getName
-
getDescriptionId
-
fallOn
public void fallOn(Level p_152426_, BlockState p_152427_, BlockPos p_152428_, Entity p_152429_, float p_152430_) -
updateEntityAfterFallOn
-
getCloneItemStack
@Deprecated public ItemStack getCloneItemStack(LevelReader p_304395_, BlockPos p_49824_, BlockState p_49825_) Deprecated. -
getFriction
public float getFriction() -
getSpeedFactor
public float getSpeedFactor() -
getJumpFactor
public float getJumpFactor() -
spawnDestroyParticles
protected void spawnDestroyParticles(Level p_152422_, Player p_152423_, BlockPos p_152424_, BlockState p_152425_) -
playerWillDestroy
public BlockState playerWillDestroy(Level p_49852_, BlockPos p_49853_, BlockState p_49854_, Player p_49855_) -
handlePrecipitation
public void handlePrecipitation(BlockState p_152450_, Level p_152451_, BlockPos p_152452_, Biome.Precipitation p_152453_) -
dropFromExplosion
Deprecated. -
createBlockStateDefinition
-
getStateDefinition
-
registerDefaultState
-
defaultBlockState
-
withPropertiesOf
-
copyProperty
private static <T extends Comparable<T>> BlockState copyProperty(BlockState p_152455_, BlockState p_152456_, Property<T> p_152457_) -
asItem
- Specified by:
asItemin interfaceItemLike- Specified by:
asItemin classBlockBehaviour
-
hasDynamicShape
public boolean hasDynamicShape() -
toString
-
appendHoverText
public void appendHoverText(ItemStack p_49816_, Item.TooltipContext p_339606_, List<Component> p_49818_, TooltipFlag p_49819_) -
asBlock
- Specified by:
asBlockin classBlockBehaviour
-
getShapeForEachState
protected com.google.common.collect.ImmutableMap<BlockState,VoxelShape> getShapeForEachState(Function<BlockState, VoxelShape> p_152459_) -
beginCapturingDrops
private static void beginCapturingDrops()InitializescapturedDrops, starting the drop capture process. Must only be called on the server thread. -
stopCapturingDrops
Ends the drop capture process by settingcapturedDropsto null and returning the old list. Must only be called on the server thread. -
getRenderPropertiesInternal
-
initClient
private void initClient() -
initializeClient
-
canSustainPlant
public boolean canSustainPlant(BlockState state, BlockGetter world, BlockPos pos, Direction facing, IPlantable plantable) Description copied from interface:IBlockExtensionDetermines if this block can support the passed in plant, allowing it to be planted and grow. Some examples: Reeds check if its a reed, or if its sand/dirt/grass and adjacent to water Cacti checks if its a cacti, or if its sand Nether types check for soul sand Crops check for tilled soil Caves check if it's a solid surface Plains check if its grass or dirt Water check if its still water- Specified by:
canSustainPlantin interfaceIBlockExtension- Parameters:
state- The Current stateworld- The current levelfacing- The direction relative to the given position the plant wants to be, typically its UPplantable- The plant that wants to check- Returns:
- True to allow the plant to be planted/stay.
-
builtInRegistryHolder
Deprecated. -
tryDropExperience
protected void tryDropExperience(ServerLevel p_220823_, BlockPos p_220824_, ItemStack p_220825_, IntProvider p_220826_)
-