public class Block
extends java.lang.Object
Modifier and Type | Class and Description |
---|---|
static class |
Block.EnumOffsetType |
static class |
Block.SoundType |
Modifier and Type | Field and Description |
---|---|
private static ResourceLocation |
AIR_ID
ResourceLocation for the Air block
|
static ObjectIntIdentityMap<IBlockState> |
BLOCK_STATE_IDS |
protected float |
blockHardness
Indicates how many hits it takes to break a block.
|
protected Material |
blockMaterial |
float |
blockParticleGravity |
static RegistryNamespacedDefaultedByKey<ResourceLocation,Block> |
blockRegistry |
protected float |
blockResistance
Indicates how much this block can resist explosions
|
protected BlockState |
blockState |
private IBlockState |
defaultBlockState |
private CreativeTabs |
displayOnCreativeTab |
protected boolean |
enableStats |
protected MapColor |
field_181083_K |
protected boolean |
fullBlock |
protected boolean |
isBlockContainer
true if the Block contains a Tile Entity
|
protected int |
lightOpacity
How much light is subtracted for going through this block
|
protected int |
lightValue
Amount of light emitted
|
protected double |
maxX |
protected double |
maxY |
protected double |
maxZ |
protected double |
minX |
protected double |
minY |
protected double |
minZ |
protected boolean |
needsRandomTick
Flags whether or not this block is of a type that needs random ticking.
|
static Block.SoundType |
SLIME_SOUND |
float |
slipperiness
Determines how much velocity is maintained while moving on top of this block
|
static Block.SoundType |
soundTypeAnvil |
static Block.SoundType |
soundTypeCloth |
static Block.SoundType |
soundTypeGlass |
static Block.SoundType |
soundTypeGrass |
static Block.SoundType |
soundTypeGravel
the gravel sound type
|
static Block.SoundType |
soundTypeLadder |
static Block.SoundType |
soundTypeMetal |
static Block.SoundType |
soundTypePiston |
static Block.SoundType |
soundTypeSand |
static Block.SoundType |
soundTypeSnow |
static Block.SoundType |
soundTypeStone |
static Block.SoundType |
soundTypeWood
the wood sound type
|
Block.SoundType |
stepSound
Sound of stepping on the block
|
protected boolean |
translucent |
private java.lang.String |
unlocalizedName |
protected boolean |
useNeighborBrightness
Flag if block should use the brightest neighbor light value as its own
|
Modifier | Constructor and Description |
---|---|
protected |
Block(Material materialIn) |
|
Block(Material p_i46399_1_,
MapColor p_i46399_2_) |
Modifier and Type | Method and Description |
---|---|
void |
addCollisionBoxesToList(World worldIn,
BlockPos pos,
IBlockState state,
AxisAlignedBB mask,
java.util.List<AxisAlignedBB> list,
Entity collidingEntity)
Add all collision boxes of this Block to the list that intersect with the given mask.
|
void |
breakBlock(World worldIn,
BlockPos pos,
IBlockState state) |
boolean |
canCollideCheck(IBlockState state,
boolean hitIfLiquid) |
boolean |
canDropFromExplosion(Explosion explosionIn)
Return whether this block can drop from an explosion.
|
boolean |
canPlaceBlockAt(World worldIn,
BlockPos pos) |
boolean |
canPlaceBlockOnSide(World worldIn,
BlockPos pos,
EnumFacing side)
Check whether this Block can be placed on the given side
|
boolean |
canProvidePower()
Can this block provide power.
|
boolean |
canReplace(World worldIn,
BlockPos pos,
EnumFacing side,
ItemStack stack) |
protected boolean |
canSilkHarvest() |
MovingObjectPosition |
collisionRayTrace(World worldIn,
BlockPos pos,
Vec3 start,
Vec3 end)
Ray traces through the blocks collision from start vector to end vector returning a ray trace hit.
|
int |
colorMultiplier(IBlockAccess worldIn,
BlockPos pos) |
int |
colorMultiplier(IBlockAccess worldIn,
BlockPos pos,
int renderPass) |
protected BlockState |
createBlockState() |
protected ItemStack |
createStackedBlock(IBlockState state) |
int |
damageDropped(IBlockState state)
Gets the metadata of the item this Block can drop.
|
protected Block |
disableStats() |
void |
dropBlockAsItem(World worldIn,
BlockPos pos,
IBlockState state,
int forture)
Spawn this Block's drops into the World as EntityItems
|
void |
dropBlockAsItemWithChance(World worldIn,
BlockPos pos,
IBlockState state,
float chance,
int fortune)
Spawns this Block's drops into the World as EntityItems.
|
protected void |
dropXpOnBlockBreak(World worldIn,
BlockPos pos,
int amount)
Spawns the given amount of experience into the World as XP orb entities
|
void |
fillWithRain(World worldIn,
BlockPos pos)
Called similar to random ticks, but only when it is raining.
|
boolean |
func_181623_g() |
IBlockState |
getActualState(IBlockState state,
IBlockAccess worldIn,
BlockPos pos)
Get the actual Block state of this Block at the given position.
|
float |
getAmbientOcclusionLightValue()
Returns the default ambient occlusion value based on block opacity
|
double |
getBlockBoundsMaxX()
returns the block bounderies maxX value
|
double |
getBlockBoundsMaxY()
returns the block bounderies maxY value
|
double |
getBlockBoundsMaxZ()
returns the block bounderies maxZ value
|
double |
getBlockBoundsMinX()
returns the block bounderies minX value
|
double |
getBlockBoundsMinY()
returns the block bounderies minY value
|
double |
getBlockBoundsMinZ()
returns the block bounderies minZ value
|
static Block |
getBlockById(int id) |
int |
getBlockColor() |
static Block |
getBlockFromItem(Item itemIn) |
static Block |
getBlockFromName(java.lang.String name) |
float |
getBlockHardness(World worldIn,
BlockPos pos) |
EnumWorldBlockLayer |
getBlockLayer() |
BlockState |
getBlockState() |
AxisAlignedBB |
getCollisionBoundingBox(World worldIn,
BlockPos pos,
IBlockState state) |
int |
getComparatorInputOverride(World worldIn,
BlockPos pos) |
CreativeTabs |
getCreativeTabToDisplayOn()
Returns the CreativeTab to display the given block on.
|
int |
getDamageValue(World worldIn,
BlockPos pos) |
IBlockState |
getDefaultState() |
boolean |
getEnableStats()
Return the state of blocks statistics flags - if the block is counted for mined and placed.
|
float |
getExplosionResistance(Entity exploder)
Returns how much this block can resist explosions from the passed in entity.
|
static int |
getIdFromBlock(Block blockIn) |
Item |
getItem(World worldIn,
BlockPos pos) |
Item |
getItemDropped(IBlockState state,
java.util.Random rand,
int fortune)
Get the Item that this Block should drop when harvested.
|
int |
getLightOpacity() |
int |
getLightValue() |
java.lang.String |
getLocalizedName()
Gets the localized name of this block.
|
MapColor |
getMapColor(IBlockState state)
Get the MapColor for this Block and the given BlockState
|
Material |
getMaterial()
Get a material of block
|
int |
getMetaFromState(IBlockState state)
Convert the BlockState into the correct metadata value
|
int |
getMixedBrightnessForBlock(IBlockAccess worldIn,
BlockPos pos) |
int |
getMobilityFlag() |
Block.EnumOffsetType |
getOffsetType()
Get the OffsetType for this Block.
|
float |
getPlayerRelativeBlockHardness(EntityPlayer playerIn,
World worldIn,
BlockPos pos)
Get the hardness of this Block relative to the ability of the given player
|
int |
getRenderColor(IBlockState state) |
int |
getRenderType()
The type of render function called.
|
AxisAlignedBB |
getSelectedBoundingBox(World worldIn,
BlockPos pos) |
static IBlockState |
getStateById(int id)
Get a BlockState by it's ID (see getStateId)
|
IBlockState |
getStateForEntityRender(IBlockState state)
Possibly modify the given BlockState before rendering it on an Entity (Minecarts, Endermen, ...)
|
IBlockState |
getStateFromMeta(int meta)
Convert the given metadata into a BlockState for this Block
|
static int |
getStateId(IBlockState state)
Get a unique ID for the given BlockState, containing both BlockID and metadata
|
int |
getStrongPower(IBlockAccess worldIn,
BlockPos pos,
IBlockState state,
EnumFacing side) |
void |
getSubBlocks(Item itemIn,
CreativeTabs tab,
java.util.List<ItemStack> list)
returns a list of blocks with the same ID, but different meta (eg: wood returns 4 blocks)
|
boolean |
getTickRandomly()
Returns whether or not this block is of a type that needs random ticking.
|
java.lang.String |
getUnlocalizedName()
Returns the unlocalized name of the block with "tile." appended to the front.
|
boolean |
getUseNeighborBrightness()
Should block use the brightest neighbor light value as its own
|
int |
getWeakPower(IBlockAccess worldIn,
BlockPos pos,
IBlockState state,
EnumFacing side) |
void |
harvestBlock(World worldIn,
EntityPlayer player,
BlockPos pos,
IBlockState state,
TileEntity te) |
boolean |
hasComparatorInputOverride() |
boolean |
hasTileEntity() |
boolean |
isAssociatedBlock(Block other) |
boolean |
isBlockNormalCube()
Indicate if a material is a normal solid opaque cube
|
boolean |
isBlockSolid(IBlockAccess worldIn,
BlockPos pos,
EnumFacing side)
Whether this Block is solid on the given Side
|
boolean |
isCollidable()
Returns if this block is collidable (only used by Fire).
|
static boolean |
isEqualTo(Block blockIn,
Block other) |
boolean |
isFlowerPot()
Returns true only if block is flowerPot
|
boolean |
isFullBlock() |
boolean |
isFullCube() |
boolean |
isNormalCube()
Used for nearly all game logic (non-rendering) purposes.
|
boolean |
isOpaqueCube()
Used to determine ambient occlusion and culling when rebuilding chunks for render
|
boolean |
isPassable(IBlockAccess worldIn,
BlockPos pos) |
boolean |
isReplaceable(World worldIn,
BlockPos pos)
Whether this Block can be replaced directly by other blocks (true for e.g.
|
boolean |
isTranslucent()
Used in the renderer to apply ambient occlusion
|
private boolean |
isVecInsideXYBounds(Vec3 point)
Checks if a vector is within the X and Y bounds of the block.
|
private boolean |
isVecInsideXZBounds(Vec3 point)
Checks if a vector is within the X and Z bounds of the block.
|
private boolean |
isVecInsideYZBounds(Vec3 point)
Checks if a vector is within the Y and Z bounds of the block.
|
boolean |
isVisuallyOpaque() |
Vec3 |
modifyAcceleration(World worldIn,
BlockPos pos,
Entity entityIn,
Vec3 motion) |
boolean |
onBlockActivated(World worldIn,
BlockPos pos,
IBlockState state,
EntityPlayer playerIn,
EnumFacing side,
float hitX,
float hitY,
float hitZ) |
void |
onBlockAdded(World worldIn,
BlockPos pos,
IBlockState state) |
void |
onBlockClicked(World worldIn,
BlockPos pos,
EntityPlayer playerIn) |
void |
onBlockDestroyedByExplosion(World worldIn,
BlockPos pos,
Explosion explosionIn)
Called when this Block is destroyed by an Explosion
|
void |
onBlockDestroyedByPlayer(World worldIn,
BlockPos pos,
IBlockState state)
Called when a player destroys this Block
|
boolean |
onBlockEventReceived(World worldIn,
BlockPos pos,
IBlockState state,
int eventID,
int eventParam)
Called on both Client and Server when World#addBlockEvent is called
|
void |
onBlockHarvested(World worldIn,
BlockPos pos,
IBlockState state,
EntityPlayer player) |
IBlockState |
onBlockPlaced(World worldIn,
BlockPos pos,
EnumFacing facing,
float hitX,
float hitY,
float hitZ,
int meta,
EntityLivingBase placer)
Called by ItemBlocks just before a block is actually set in the world, to allow for adjustments to the
IBlockstate
|
void |
onBlockPlacedBy(World worldIn,
BlockPos pos,
IBlockState state,
EntityLivingBase placer,
ItemStack stack)
Called by ItemBlocks after a block is set in the world, to allow post-place logic
|
void |
onEntityCollidedWithBlock(World worldIn,
BlockPos pos,
Entity entityIn)
Triggered whenever an entity collides with this block (enters into the block)
|
void |
onEntityCollidedWithBlock(World worldIn,
BlockPos pos,
IBlockState state,
Entity entityIn)
Called When an Entity Collided with the Block
|
void |
onFallenUpon(World worldIn,
BlockPos pos,
Entity entityIn,
float fallDistance)
Block's chance to react to a living entity falling on it.
|
void |
onLanded(World worldIn,
Entity entityIn)
Called when an Entity lands on this Block.
|
void |
onNeighborBlockChange(World worldIn,
BlockPos pos,
IBlockState state,
Block neighborBlock)
Called when a neighboring block changes.
|
int |
quantityDropped(java.util.Random random)
Returns the quantity of items to drop on block destruction.
|
int |
quantityDroppedWithBonus(int fortune,
java.util.Random random)
Get the quantity dropped based on the given fortune level
|
void |
randomDisplayTick(World worldIn,
BlockPos pos,
IBlockState state,
java.util.Random rand) |
void |
randomTick(World worldIn,
BlockPos pos,
IBlockState state,
java.util.Random random)
Called randomly when setTickRandomly is set to true (used by e.g.
|
private static void |
registerBlock(int id,
ResourceLocation textualID,
Block block_) |
private static void |
registerBlock(int id,
java.lang.String textualID,
Block block_) |
static void |
registerBlocks() |
boolean |
requiresUpdates() |
protected void |
setBlockBounds(float minX,
float minY,
float minZ,
float maxX,
float maxY,
float maxZ) |
void |
setBlockBoundsBasedOnState(IBlockAccess worldIn,
BlockPos pos) |
void |
setBlockBoundsForItemRender()
Sets the block's bounds for rendering it as an item
|
protected Block |
setBlockUnbreakable() |
Block |
setCreativeTab(CreativeTabs tab) |
protected void |
setDefaultState(IBlockState state) |
protected Block |
setHardness(float hardness)
Sets how many hits it takes to break a block.
|
protected Block |
setLightLevel(float value)
Sets the light value that the block emits.
|
protected Block |
setLightOpacity(int opacity)
Sets how much light is blocked going through this block.
|
protected Block |
setResistance(float resistance)
Sets the the blocks resistance to explosions.
|
protected Block |
setStepSound(Block.SoundType sound)
Sets the footstep sound for the block.
|
protected Block |
setTickRandomly(boolean shouldTick)
Sets whether this block type will receive random update ticks
|
Block |
setUnlocalizedName(java.lang.String name) |
boolean |
shouldSideBeRendered(IBlockAccess worldIn,
BlockPos pos,
EnumFacing side) |
static void |
spawnAsEntity(World worldIn,
BlockPos pos,
ItemStack stack)
Spawns the given ItemStack as an EntityItem into the World at the given position
|
int |
tickRate(World worldIn)
How many world ticks before ticking
|
java.lang.String |
toString() |
void |
updateTick(World worldIn,
BlockPos pos,
IBlockState state,
java.util.Random rand) |
private static final ResourceLocation AIR_ID
public static final RegistryNamespacedDefaultedByKey<ResourceLocation,Block> blockRegistry
public static final ObjectIntIdentityMap<IBlockState> BLOCK_STATE_IDS
private CreativeTabs displayOnCreativeTab
public static final Block.SoundType soundTypeStone
public static final Block.SoundType soundTypeWood
public static final Block.SoundType soundTypeGravel
public static final Block.SoundType soundTypeGrass
public static final Block.SoundType soundTypePiston
public static final Block.SoundType soundTypeMetal
public static final Block.SoundType soundTypeGlass
public static final Block.SoundType soundTypeCloth
public static final Block.SoundType soundTypeSand
public static final Block.SoundType soundTypeSnow
public static final Block.SoundType soundTypeLadder
public static final Block.SoundType soundTypeAnvil
public static final Block.SoundType SLIME_SOUND
protected boolean fullBlock
protected int lightOpacity
protected boolean translucent
protected int lightValue
protected boolean useNeighborBrightness
protected float blockHardness
protected float blockResistance
protected boolean enableStats
protected boolean needsRandomTick
protected boolean isBlockContainer
protected double minX
protected double minY
protected double minZ
protected double maxX
protected double maxY
protected double maxZ
public Block.SoundType stepSound
public float blockParticleGravity
protected final Material blockMaterial
protected final MapColor field_181083_K
public float slipperiness
protected final BlockState blockState
private IBlockState defaultBlockState
private java.lang.String unlocalizedName
protected Block(Material materialIn)
public static int getIdFromBlock(Block blockIn)
public static int getStateId(IBlockState state)
public static Block getBlockById(int id)
public static IBlockState getStateById(int id)
public static Block getBlockFromName(java.lang.String name)
public boolean isFullBlock()
public int getLightOpacity()
public boolean isTranslucent()
public int getLightValue()
public boolean getUseNeighborBrightness()
public Material getMaterial()
public MapColor getMapColor(IBlockState state)
public IBlockState getStateFromMeta(int meta)
public int getMetaFromState(IBlockState state)
public IBlockState getActualState(IBlockState state, IBlockAccess worldIn, BlockPos pos)
protected Block setStepSound(Block.SoundType sound)
protected Block setLightOpacity(int opacity)
protected Block setLightLevel(float value)
protected Block setResistance(float resistance)
public boolean isBlockNormalCube()
public boolean isNormalCube()
public boolean isVisuallyOpaque()
public boolean isFullCube()
public boolean isPassable(IBlockAccess worldIn, BlockPos pos)
public int getRenderType()
public boolean isReplaceable(World worldIn, BlockPos pos)
protected Block setHardness(float hardness)
protected Block setBlockUnbreakable()
protected Block setTickRandomly(boolean shouldTick)
public boolean getTickRandomly()
public boolean hasTileEntity()
protected final void setBlockBounds(float minX, float minY, float minZ, float maxX, float maxY, float maxZ)
public int getMixedBrightnessForBlock(IBlockAccess worldIn, BlockPos pos)
public boolean shouldSideBeRendered(IBlockAccess worldIn, BlockPos pos, EnumFacing side)
public boolean isBlockSolid(IBlockAccess worldIn, BlockPos pos, EnumFacing side)
public AxisAlignedBB getSelectedBoundingBox(World worldIn, BlockPos pos)
public void addCollisionBoxesToList(World worldIn, BlockPos pos, IBlockState state, AxisAlignedBB mask, java.util.List<AxisAlignedBB> list, Entity collidingEntity)
public AxisAlignedBB getCollisionBoundingBox(World worldIn, BlockPos pos, IBlockState state)
public boolean isOpaqueCube()
public boolean canCollideCheck(IBlockState state, boolean hitIfLiquid)
public boolean isCollidable()
public void randomTick(World worldIn, BlockPos pos, IBlockState state, java.util.Random random)
public void updateTick(World worldIn, BlockPos pos, IBlockState state, java.util.Random rand)
public void randomDisplayTick(World worldIn, BlockPos pos, IBlockState state, java.util.Random rand)
public void onBlockDestroyedByPlayer(World worldIn, BlockPos pos, IBlockState state)
public void onNeighborBlockChange(World worldIn, BlockPos pos, IBlockState state, Block neighborBlock)
public int tickRate(World worldIn)
public void onBlockAdded(World worldIn, BlockPos pos, IBlockState state)
public void breakBlock(World worldIn, BlockPos pos, IBlockState state)
public int quantityDropped(java.util.Random random)
public Item getItemDropped(IBlockState state, java.util.Random rand, int fortune)
public float getPlayerRelativeBlockHardness(EntityPlayer playerIn, World worldIn, BlockPos pos)
public final void dropBlockAsItem(World worldIn, BlockPos pos, IBlockState state, int forture)
public void dropBlockAsItemWithChance(World worldIn, BlockPos pos, IBlockState state, float chance, int fortune)
public static void spawnAsEntity(World worldIn, BlockPos pos, ItemStack stack)
protected void dropXpOnBlockBreak(World worldIn, BlockPos pos, int amount)
public int damageDropped(IBlockState state)
public float getExplosionResistance(Entity exploder)
public MovingObjectPosition collisionRayTrace(World worldIn, BlockPos pos, Vec3 start, Vec3 end)
private boolean isVecInsideYZBounds(Vec3 point)
private boolean isVecInsideXZBounds(Vec3 point)
private boolean isVecInsideXYBounds(Vec3 point)
public void onBlockDestroyedByExplosion(World worldIn, BlockPos pos, Explosion explosionIn)
public EnumWorldBlockLayer getBlockLayer()
public boolean canReplace(World worldIn, BlockPos pos, EnumFacing side, ItemStack stack)
public boolean canPlaceBlockOnSide(World worldIn, BlockPos pos, EnumFacing side)
public boolean onBlockActivated(World worldIn, BlockPos pos, IBlockState state, EntityPlayer playerIn, EnumFacing side, float hitX, float hitY, float hitZ)
public void onEntityCollidedWithBlock(World worldIn, BlockPos pos, Entity entityIn)
public IBlockState onBlockPlaced(World worldIn, BlockPos pos, EnumFacing facing, float hitX, float hitY, float hitZ, int meta, EntityLivingBase placer)
public void onBlockClicked(World worldIn, BlockPos pos, EntityPlayer playerIn)
public Vec3 modifyAcceleration(World worldIn, BlockPos pos, Entity entityIn, Vec3 motion)
public void setBlockBoundsBasedOnState(IBlockAccess worldIn, BlockPos pos)
public final double getBlockBoundsMinX()
public final double getBlockBoundsMaxX()
public final double getBlockBoundsMinY()
public final double getBlockBoundsMaxY()
public final double getBlockBoundsMinZ()
public final double getBlockBoundsMaxZ()
public int getBlockColor()
public int getRenderColor(IBlockState state)
public int colorMultiplier(IBlockAccess worldIn, BlockPos pos, int renderPass)
public final int colorMultiplier(IBlockAccess worldIn, BlockPos pos)
public int getWeakPower(IBlockAccess worldIn, BlockPos pos, IBlockState state, EnumFacing side)
public boolean canProvidePower()
public void onEntityCollidedWithBlock(World worldIn, BlockPos pos, IBlockState state, Entity entityIn)
public int getStrongPower(IBlockAccess worldIn, BlockPos pos, IBlockState state, EnumFacing side)
public void setBlockBoundsForItemRender()
public void harvestBlock(World worldIn, EntityPlayer player, BlockPos pos, IBlockState state, TileEntity te)
protected boolean canSilkHarvest()
protected ItemStack createStackedBlock(IBlockState state)
public int quantityDroppedWithBonus(int fortune, java.util.Random random)
public void onBlockPlacedBy(World worldIn, BlockPos pos, IBlockState state, EntityLivingBase placer, ItemStack stack)
public boolean func_181623_g()
public Block setUnlocalizedName(java.lang.String name)
public java.lang.String getLocalizedName()
public java.lang.String getUnlocalizedName()
public boolean onBlockEventReceived(World worldIn, BlockPos pos, IBlockState state, int eventID, int eventParam)
public boolean getEnableStats()
protected Block disableStats()
public int getMobilityFlag()
public float getAmbientOcclusionLightValue()
public void onFallenUpon(World worldIn, BlockPos pos, Entity entityIn, float fallDistance)
public void onLanded(World worldIn, Entity entityIn)
public void getSubBlocks(Item itemIn, CreativeTabs tab, java.util.List<ItemStack> list)
public CreativeTabs getCreativeTabToDisplayOn()
public Block setCreativeTab(CreativeTabs tab)
public void onBlockHarvested(World worldIn, BlockPos pos, IBlockState state, EntityPlayer player)
public void fillWithRain(World worldIn, BlockPos pos)
public boolean isFlowerPot()
public boolean requiresUpdates()
public boolean canDropFromExplosion(Explosion explosionIn)
public boolean isAssociatedBlock(Block other)
public boolean hasComparatorInputOverride()
public IBlockState getStateForEntityRender(IBlockState state)
protected BlockState createBlockState()
public BlockState getBlockState()
protected final void setDefaultState(IBlockState state)
public final IBlockState getDefaultState()
public Block.EnumOffsetType getOffsetType()
public java.lang.String toString()
toString
in class java.lang.Object
public static void registerBlocks()
private static void registerBlock(int id, ResourceLocation textualID, Block block_)
private static void registerBlock(int id, java.lang.String textualID, Block block_)