Package net.minecraft.block
Class Block
- java.lang.Object
-
- net.minecraftforge.registries.ForgeRegistryEntry<Block>
-
- net.minecraft.block.AbstractBlock
-
- net.minecraft.block.Block
-
- All Implemented Interfaces:
IItemProvider
,IForgeBlock
,IForgeRegistryEntry<Block>
- Direct Known Subclasses:
AbstractCoralPlantBlock
,AbstractFireBlock
,AbstractPlantBlock
,AbstractPressurePlateBlock
,AbstractRailBlock
,AirBlock
,BambooBlock
,BambooSaplingBlock
,BarrierBlock
,BreakableBlock
,BubbleColumnBlock
,BushBlock
,CactusBlock
,CakeBlock
,CarpetBlock
,CartographyTableBlock
,CauldronBlock
,ChorusFlowerBlock
,ComposterBlock
,ContainerBlock
,CoralBlock
,CraftingTableBlock
,CryingObsidianBlock
,CustomPlantTypeTest.CustomBlock
,CustomRespawnTest.CustomRespawnBlock
,DirectionalBlock
,DoorBlock
,EndPortalFrameBlock
,FallingBlock
,FarmlandBlock
,FlowerPotBlock
,FlowingFluidBlock
,ForgeChunkManagerTest.ChunkLoaderBlock
,FourWayBlock
,FullPotsAccessorDemo.DioriteFlowerPotBlock
,GrassPathBlock
,HorizontalBlock
,HugeMushroomBlock
,JigsawBlock
,LadderBlock
,LanternBlock
,LeavesBlock
,MagmaBlock
,NetherPortalBlock
,NetherrackBlock
,NewFluidTest.FluidloggableBlock
,NoteBlock
,NyliumBlock
,OreBlock
,RedstoneBlock
,RedstoneLampBlock
,RedstoneOreBlock
,RedstoneWireBlock
,RespawnAnchorBlock
,RotatedPillarBlock
,ScaffoldingBlock
,SilverfishBlock
,SixWayBlock
,SlabBlock
,SnowBlock
,SnowyDirtBlock
,SoulSandBlock
,SpongeBlock
,StairsBlock
,StemGrownBlock
,StonecutterBlock
,StructureVoidBlock
,SugarCaneBlock
,TargetBlock
,TNTBlock
,TorchBlock
,TripWireBlock
,TripWireHookBlock
,TurtleEggBlock
,VineBlock
,WallBlock
,WebBlock
,WetSpongeBlock
public class Block extends AbstractBlock implements IItemProvider, IForgeBlock
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static class
Block.RenderSideCacheKey
-
Nested classes/interfaces inherited from class net.minecraft.block.AbstractBlock
AbstractBlock.AbstractBlockState, AbstractBlock.IExtendedPositionPredicate<A>, AbstractBlock.IPositionPredicate, AbstractBlock.OffsetType, AbstractBlock.Properties
-
Nested classes/interfaces inherited from class net.minecraftforge.registries.ForgeRegistryEntry
ForgeRegistryEntry.UncheckedRegistryEntry<V extends IForgeRegistryEntry<V>>
-
-
Field Summary
Fields Modifier and Type Field Description static ObjectIntIdentityMap<BlockState>
BLOCK_STATE_REGISTRY
Deprecated.private BlockState
defaultBlockState
private java.lang.String
descriptionId
private int
harvestLevel
private ToolType
harvestTool
private Item
item
protected static org.apache.logging.log4j.Logger
LOGGER
private static java.lang.ThreadLocal<it.unimi.dsi.fastutil.objects.Object2ByteLinkedOpenHashMap<Block.RenderSideCacheKey>>
OCCLUSION_CACHE
protected java.util.Random
RANDOM
private ReverseTagWrapper<Block>
reverseTags
private static com.google.common.cache.LoadingCache<VoxelShape,java.lang.Boolean>
SHAPE_FULL_BLOCK_CACHE
protected StateContainer<Block,BlockState>
stateDefinition
-
Fields inherited from class net.minecraft.block.AbstractBlock
drops, dynamicShape, explosionResistance, friction, hasCollision, isRandomlyTicking, jumpFactor, material, properties, soundType, speedFactor, UPDATE_SHAPE_ORDER
-
Fields inherited from class net.minecraftforge.registries.ForgeRegistryEntry
delegate
-
-
Constructor Summary
Constructors Constructor Description Block(AbstractBlock.Properties p_i48440_1_)
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Deprecated Methods Modifier and Type Method Description void
animateTick(BlockState p_180655_1_, World p_180655_2_, BlockPos p_180655_3_, java.util.Random p_180655_4_)
void
appendHoverText(ItemStack p_190948_1_, IBlockReader p_190948_2_, java.util.List<ITextComponent> p_190948_3_, ITooltipFlag p_190948_4_)
protected Block
asBlock()
Item
asItem()
static VoxelShape
box(double p_208617_0_, double p_208617_2_, double p_208617_4_, double p_208617_6_, double p_208617_8_, double p_208617_10_)
static Block
byItem(Item p_149634_0_)
static boolean
canSupportCenter(IWorldReader p_220055_0_, BlockPos p_220055_1_, Direction p_220055_2_)
static boolean
canSupportRigidBlock(IBlockReader p_220064_0_, BlockPos p_220064_1_)
boolean
canSustainPlant(BlockState state, IBlockReader 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 void
createBlockStateDefinition(StateContainer.Builder<Block,BlockState> p_206840_1_)
BlockState
defaultBlockState()
void
destroy(IWorld p_176206_1_, BlockPos p_176206_2_, BlockState p_176206_3_)
boolean
dropFromExplosion(Explosion p_149659_1_)
Deprecated.static void
dropResources(BlockState p_220059_0_, IWorld p_220059_1_, BlockPos p_220059_2_, TileEntity p_220059_3_)
static void
dropResources(BlockState p_220075_0_, World p_220075_1_, BlockPos p_220075_2_)
static void
dropResources(BlockState p_220054_0_, World p_220054_1_, BlockPos p_220054_2_, TileEntity p_220054_3_, Entity p_220054_4_, ItemStack p_220054_5_)
void
fallOn(World p_180658_1_, BlockPos p_180658_2_, Entity p_180658_3_, float p_180658_4_)
void
fillItemCategory(ItemGroup p_149666_1_, NonNullList<ItemStack> p_149666_2_)
ItemStack
getCloneItemStack(IBlockReader p_185473_1_, BlockPos p_185473_2_, BlockState p_185473_3_)
Deprecated.java.lang.String
getDescriptionId()
static java.util.List<ItemStack>
getDrops(BlockState p_220070_0_, ServerWorld p_220070_1_, BlockPos p_220070_2_, TileEntity p_220070_3_)
static java.util.List<ItemStack>
getDrops(BlockState p_220077_0_, ServerWorld p_220077_1_, BlockPos p_220077_2_, TileEntity p_220077_3_, Entity p_220077_4_, ItemStack p_220077_5_)
float
getExplosionResistance()
Deprecated.float
getFriction()
int
getHarvestLevel(BlockState state)
Queries the harvest level of this item stack for the specified tool class, Returns -1 if this tool is not of the specified typeToolType
getHarvestTool(BlockState state)
Queries the class of tool required to harvest this block, if null is returned we assume that anything can harvest this block.static int
getId(BlockState p_196246_0_)
float
getJumpFactor()
IFormattableTextComponent
getName()
SoundType
getSoundType(BlockState p_220072_1_)
Deprecated.float
getSpeedFactor()
StateContainer<Block,BlockState>
getStateDefinition()
BlockState
getStateForPlacement(BlockItemUseContext p_196258_1_)
java.util.Set<ResourceLocation>
getTags()
Retrieves a list of tags names this is known to be associated with.void
handleRain(World p_176224_1_, BlockPos p_176224_2_)
boolean
hasDynamicShape()
boolean
is(Block p_235332_1_)
boolean
is(ITag<Block> p_203417_1_)
static boolean
isExceptionForConnection(Block p_220073_0_)
static boolean
isFaceFull(VoxelShape p_208061_0_, Direction p_208061_1_)
boolean
isPossibleToRespawnInThis()
boolean
isRandomlyTicking(BlockState p_149653_1_)
static boolean
isShapeFullBlock(VoxelShape p_208062_0_)
void
playerDestroy(World p_180657_1_, PlayerEntity p_180657_2_, BlockPos p_180657_3_, BlockState p_180657_4_, TileEntity p_180657_5_, ItemStack p_180657_6_)
void
playerWillDestroy(World p_176208_1_, BlockPos p_176208_2_, BlockState p_176208_3_, PlayerEntity p_176208_4_)
void
popExperience(ServerWorld p_180637_1_, BlockPos p_180637_2_, int p_180637_3_)
static void
popResource(World p_180635_0_, BlockPos p_180635_1_, ItemStack p_180635_2_)
boolean
propagatesSkylightDown(BlockState p_200123_1_, IBlockReader p_200123_2_, BlockPos p_200123_3_)
static BlockState
pushEntitiesUp(BlockState p_199601_0_, BlockState p_199601_1_, World p_199601_2_, BlockPos p_199601_3_)
protected void
registerDefaultState(BlockState p_180632_1_)
void
setPlacedBy(World p_180633_1_, BlockPos p_180633_2_, BlockState p_180633_3_, LivingEntity p_180633_4_, ItemStack p_180633_5_)
static boolean
shouldRenderFace(BlockState p_176225_0_, IBlockReader p_176225_1_, BlockPos p_176225_2_, Direction p_176225_3_)
static BlockState
stateById(int p_196257_0_)
void
stepOn(World p_176199_1_, BlockPos p_176199_2_, Entity p_176199_3_)
java.lang.String
toString()
void
updateEntityAfterFallOn(IBlockReader p_176216_1_, Entity p_176216_2_)
static BlockState
updateFromNeighbourShapes(BlockState p_199770_0_, IWorld p_199770_1_, BlockPos p_199770_2_)
static void
updateOrDestroy(BlockState p_196263_0_, BlockState p_196263_1_, IWorld p_196263_2_, BlockPos p_196263_3_, int p_196263_4_)
static void
updateOrDestroy(BlockState p_241468_0_, BlockState p_241468_1_, IWorld p_241468_2_, BlockPos p_241468_3_, int p_241468_4_, int p_241468_5_)
void
wasExploded(World p_180652_1_, BlockPos p_180652_2_, Explosion p_180652_3_)
-
Methods inherited from class net.minecraft.block.AbstractBlock
attack, canBeReplaced, canBeReplaced, canSurvive, defaultMaterialColor, entityInside, getAnalogOutputSignal, getBlockSupportShape, getCollisionShape, getDestroyProgress, getDirectSignal, getDrops, getFluidState, getInteractionShape, getLightBlock, getLootTable, getMenuProvider, getOcclusionShape, getOffsetType, getPistonPushReaction, getRenderShape, getSeed, getShadeBrightness, getShape, getSignal, getVisualShape, hasAnalogOutputSignal, isAir, isEntityBlock, isPathfindable, isSignalSource, mirror, neighborChanged, onPlace, onProjectileHit, onRemove, randomTick, rotate, skipRendering, spawnAfterBreak, tick, triggerEvent, updateIndirectNeighbourShapes, updateShape, use, useShapeForLightOcclusion
-
Methods inherited from class net.minecraftforge.registries.ForgeRegistryEntry
getRegistryName, getRegistryType, setRegistryName, setRegistryName, setRegistryName
-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
-
Methods inherited from interface net.minecraftforge.common.extensions.IForgeBlock
addDestroyEffects, addHitEffects, addLandingEffects, addRunningEffects, canBeReplacedByLeaves, canBeReplacedByLogs, canConnectRedstone, canCreatureSpawn, canDropFromExplosion, canEntityDestroy, canHarvestBlock, canStickTo, catchFire, collisionExtendsVertically, createTileEntity, getAiPathNodeType, getBeaconColorMultiplier, getBedDirection, getBedSpawnPosition, getBlock, getEnchantPowerBonus, getExpDrop, getExplosionResistance, getFireSpreadSpeed, getFlammability, getFogColor, getLightValue, getPickBlock, getRespawnPosition, getSlipperiness, getSoundType, getStateAtViewpoint, getToolModifiedState, getWeakChanges, hasTileEntity, isAir, isBed, isBurning, isConduitFrame, isFertile, isFireSource, isFlammable, isLadder, isPortalFrame, isScaffolding, isSlimeBlock, isStickyBlock, isToolEffective, makesOpenTrapdoorAboveClimbable, observedNeighborChange, onBlockExploded, onNeighborChange, onPlantGrow, removedByPlayer, rotate, setBedOccupied, shouldCheckWeakPower, shouldDisplayFluidOverlay
-
-
-
-
Field Detail
-
LOGGER
protected static final org.apache.logging.log4j.Logger LOGGER
-
BLOCK_STATE_REGISTRY
@Deprecated public static final ObjectIntIdentityMap<BlockState> BLOCK_STATE_REGISTRY
Deprecated.
-
SHAPE_FULL_BLOCK_CACHE
private static final com.google.common.cache.LoadingCache<VoxelShape,java.lang.Boolean> SHAPE_FULL_BLOCK_CACHE
-
stateDefinition
protected final StateContainer<Block,BlockState> stateDefinition
-
defaultBlockState
private BlockState defaultBlockState
-
descriptionId
@Nullable private java.lang.String descriptionId
-
item
@Nullable private Item item
-
OCCLUSION_CACHE
private static final java.lang.ThreadLocal<it.unimi.dsi.fastutil.objects.Object2ByteLinkedOpenHashMap<Block.RenderSideCacheKey>> OCCLUSION_CACHE
-
RANDOM
protected java.util.Random RANDOM
-
harvestTool
private ToolType harvestTool
-
harvestLevel
private int harvestLevel
-
reverseTags
private final ReverseTagWrapper<Block> reverseTags
-
-
Constructor Detail
-
Block
public Block(AbstractBlock.Properties p_i48440_1_)
-
-
Method Detail
-
getId
public static int getId(@Nullable BlockState p_196246_0_)
-
stateById
public static BlockState stateById(int p_196257_0_)
-
pushEntitiesUp
public static BlockState pushEntitiesUp(BlockState p_199601_0_, BlockState p_199601_1_, World p_199601_2_, BlockPos p_199601_3_)
-
box
public static VoxelShape box(double p_208617_0_, double p_208617_2_, double p_208617_4_, double p_208617_6_, double p_208617_8_, double p_208617_10_)
-
is
public boolean is(Block p_235332_1_)
-
updateFromNeighbourShapes
public static BlockState updateFromNeighbourShapes(BlockState p_199770_0_, IWorld p_199770_1_, BlockPos p_199770_2_)
-
updateOrDestroy
public static void updateOrDestroy(BlockState p_196263_0_, BlockState p_196263_1_, IWorld p_196263_2_, BlockPos p_196263_3_, int p_196263_4_)
-
updateOrDestroy
public static void updateOrDestroy(BlockState p_241468_0_, BlockState p_241468_1_, IWorld p_241468_2_, BlockPos p_241468_3_, int p_241468_4_, int p_241468_5_)
-
isExceptionForConnection
public static boolean isExceptionForConnection(Block p_220073_0_)
-
isRandomlyTicking
public boolean isRandomlyTicking(BlockState p_149653_1_)
-
shouldRenderFace
public static boolean shouldRenderFace(BlockState p_176225_0_, IBlockReader p_176225_1_, BlockPos p_176225_2_, Direction p_176225_3_)
-
canSupportRigidBlock
public static boolean canSupportRigidBlock(IBlockReader p_220064_0_, BlockPos p_220064_1_)
-
canSupportCenter
public static boolean canSupportCenter(IWorldReader p_220055_0_, BlockPos p_220055_1_, Direction p_220055_2_)
-
isFaceFull
public static boolean isFaceFull(VoxelShape p_208061_0_, Direction p_208061_1_)
-
isShapeFullBlock
public static boolean isShapeFullBlock(VoxelShape p_208062_0_)
-
propagatesSkylightDown
public boolean propagatesSkylightDown(BlockState p_200123_1_, IBlockReader p_200123_2_, BlockPos p_200123_3_)
-
animateTick
public void animateTick(BlockState p_180655_1_, World p_180655_2_, BlockPos p_180655_3_, java.util.Random p_180655_4_)
-
destroy
public void destroy(IWorld p_176206_1_, BlockPos p_176206_2_, BlockState p_176206_3_)
-
getDrops
public static java.util.List<ItemStack> getDrops(BlockState p_220070_0_, ServerWorld p_220070_1_, BlockPos p_220070_2_, @Nullable TileEntity p_220070_3_)
-
getDrops
public static java.util.List<ItemStack> getDrops(BlockState p_220077_0_, ServerWorld p_220077_1_, BlockPos p_220077_2_, @Nullable TileEntity p_220077_3_, @Nullable Entity p_220077_4_, ItemStack p_220077_5_)
-
dropResources
public static void dropResources(BlockState p_220075_0_, World p_220075_1_, BlockPos p_220075_2_)
-
dropResources
public static void dropResources(BlockState p_220059_0_, IWorld p_220059_1_, BlockPos p_220059_2_, @Nullable TileEntity p_220059_3_)
-
dropResources
public static void dropResources(BlockState p_220054_0_, World p_220054_1_, BlockPos p_220054_2_, @Nullable TileEntity p_220054_3_, Entity p_220054_4_, ItemStack p_220054_5_)
-
popResource
public static void popResource(World p_180635_0_, BlockPos p_180635_1_, ItemStack p_180635_2_)
-
popExperience
public void popExperience(ServerWorld p_180637_1_, BlockPos p_180637_2_, int p_180637_3_)
-
getExplosionResistance
@Deprecated public float getExplosionResistance()
Deprecated.
-
wasExploded
public void wasExploded(World p_180652_1_, BlockPos p_180652_2_, Explosion p_180652_3_)
-
getStateForPlacement
@Nullable public BlockState getStateForPlacement(BlockItemUseContext p_196258_1_)
-
playerDestroy
public void playerDestroy(World p_180657_1_, PlayerEntity p_180657_2_, BlockPos p_180657_3_, BlockState p_180657_4_, @Nullable TileEntity p_180657_5_, ItemStack p_180657_6_)
-
setPlacedBy
public void setPlacedBy(World p_180633_1_, BlockPos p_180633_2_, BlockState p_180633_3_, @Nullable LivingEntity p_180633_4_, ItemStack p_180633_5_)
-
isPossibleToRespawnInThis
public boolean isPossibleToRespawnInThis()
-
getName
public IFormattableTextComponent getName()
-
getDescriptionId
public java.lang.String getDescriptionId()
-
fallOn
public void fallOn(World p_180658_1_, BlockPos p_180658_2_, Entity p_180658_3_, float p_180658_4_)
-
updateEntityAfterFallOn
public void updateEntityAfterFallOn(IBlockReader p_176216_1_, Entity p_176216_2_)
-
getCloneItemStack
@Deprecated public ItemStack getCloneItemStack(IBlockReader p_185473_1_, BlockPos p_185473_2_, BlockState p_185473_3_)
Deprecated.
-
fillItemCategory
public void fillItemCategory(ItemGroup p_149666_1_, NonNullList<ItemStack> p_149666_2_)
-
getFriction
public float getFriction()
-
getSpeedFactor
public float getSpeedFactor()
-
getJumpFactor
public float getJumpFactor()
-
playerWillDestroy
public void playerWillDestroy(World p_176208_1_, BlockPos p_176208_2_, BlockState p_176208_3_, PlayerEntity p_176208_4_)
-
dropFromExplosion
@Deprecated public boolean dropFromExplosion(Explosion p_149659_1_)
Deprecated.
-
createBlockStateDefinition
protected void createBlockStateDefinition(StateContainer.Builder<Block,BlockState> p_206840_1_)
-
getStateDefinition
public StateContainer<Block,BlockState> getStateDefinition()
-
registerDefaultState
protected final void registerDefaultState(BlockState p_180632_1_)
-
defaultBlockState
public final BlockState defaultBlockState()
-
getSoundType
@Deprecated public SoundType getSoundType(BlockState p_220072_1_)
Deprecated.
-
asItem
public Item asItem()
- Specified by:
asItem
in interfaceIItemProvider
- Specified by:
asItem
in classAbstractBlock
-
hasDynamicShape
public boolean hasDynamicShape()
-
toString
public java.lang.String toString()
- Overrides:
toString
in classjava.lang.Object
-
appendHoverText
public void appendHoverText(ItemStack p_190948_1_, @Nullable IBlockReader p_190948_2_, java.util.List<ITextComponent> p_190948_3_, ITooltipFlag p_190948_4_)
-
asBlock
protected Block asBlock()
- Specified by:
asBlock
in classAbstractBlock
-
getHarvestTool
@Nullable public ToolType getHarvestTool(BlockState state)
Description copied from interface:IForgeBlock
Queries the class of tool required to harvest this block, if null is returned we assume that anything can harvest this block.- Specified by:
getHarvestTool
in interfaceIForgeBlock
-
getHarvestLevel
public int getHarvestLevel(BlockState state)
Description copied from interface:IForgeBlock
Queries the harvest level of this item stack for the specified tool class, Returns -1 if this tool is not of the specified type- Specified by:
getHarvestLevel
in interfaceIForgeBlock
- Returns:
- Harvest level, or -1 if not the specified tool type.
-
canSustainPlant
public boolean canSustainPlant(BlockState state, IBlockReader world, BlockPos pos, Direction facing, IPlantable plantable)
Description copied from interface:IForgeBlock
Determines 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:
canSustainPlant
in interfaceIForgeBlock
- Parameters:
state
- The Current stateworld
- The current worldfacing
- 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.
-
getTags
public final java.util.Set<ResourceLocation> getTags()
Description copied from interface:IForgeBlock
Retrieves a list of tags names this is known to be associated with. This should be used in favor of TagCollection.getOwningTags, as this caches the result and automatically updates when the TagCollection changes.- Specified by:
getTags
in interfaceIForgeBlock
-
-