public class Block extends IForgeRegistryEntry.Impl<Block>
Modifier and Type | Class and Description |
---|---|
static class |
Block.EnumOffsetType |
IForgeRegistryEntry.Impl<T extends IForgeRegistryEntry<T>>
Modifier and Type | Field and Description |
---|---|
static ObjectIntIdentityMap<IBlockState> |
BLOCK_STATE_IDS
Deprecated.
|
protected float |
blockHardness
Indicates how many hits it takes to break a block.
|
protected MapColor |
blockMapColor
The Block's MapColor
|
protected Material |
blockMaterial |
float |
blockParticleGravity |
protected float |
blockResistance
Indicates how much this block can resist explosions
|
protected SoundType |
blockSoundType
Sound of stepping on the block
|
protected BlockStateContainer |
blockState |
protected static java.lang.ThreadLocal<java.util.List<ItemStack>> |
capturedDrops |
protected static java.lang.ThreadLocal<java.lang.Boolean> |
captureDrops |
protected boolean |
enableStats |
static AxisAlignedBB |
FULL_BLOCK_AABB |
protected boolean |
fullBlock |
protected java.lang.ThreadLocal<EntityPlayer> |
harvesters |
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 boolean |
needsRandomTick
Flags whether or not this block is of a type that needs random ticking.
|
static AxisAlignedBB |
NULL_AABB |
protected static java.util.Random |
RANDOM |
static RegistryNamespacedDefaultedByKey<ResourceLocation,Block> |
REGISTRY |
float |
slipperiness
Determines how much velocity is maintained while moving on top of this block
|
protected boolean |
translucent |
protected boolean |
useNeighborBrightness
Flag if block should use the brightest neighbor light value as its own
|
delegate
Constructor and Description |
---|
Block(Material materialIn) |
Block(Material blockMaterialIn,
MapColor blockMapColorIn) |
Modifier and Type | Method and Description |
---|---|
protected static void |
addCollisionBoxToList(BlockPos pos,
AxisAlignedBB entityBox,
java.util.List<AxisAlignedBB> collidingBoxes,
AxisAlignedBB blockBox) |
void |
addCollisionBoxToList(IBlockState state,
World worldIn,
BlockPos pos,
AxisAlignedBB entityBox,
java.util.List<AxisAlignedBB> collidingBoxes,
Entity entityIn,
boolean p_185477_7_)
Deprecated.
|
boolean |
addDestroyEffects(World world,
BlockPos pos,
ParticleManager manager)
Spawn particles for when the block is destroyed.
|
boolean |
addHitEffects(IBlockState state,
World worldObj,
RayTraceResult target,
ParticleManager manager)
Spawn a digging particle effect in the world, this is a wrapper
around EffectRenderer.addBlockHitEffects to allow the block more
control over the particles.
|
void |
addInformation(ItemStack stack,
EntityPlayer player,
java.util.List<java.lang.String> tooltip,
boolean advanced) |
boolean |
addLandingEffects(IBlockState state,
WorldServer worldObj,
BlockPos blockPosition,
IBlockState iblockstate,
EntityLivingBase entity,
int numberOfParticles)
Allows a block to override the standard EntityLivingBase.updateFallState
particles, this is a server side method that spawns particles with
WorldServer.spawnParticle
|
void |
beginLeavesDecay(IBlockState state,
World world,
BlockPos pos)
Called when a leaf should start its decay process.
|
void |
breakBlock(World worldIn,
BlockPos pos,
IBlockState state)
Called serverside after this block is replaced with another in Chunk, but before the Tile Entity is updated
|
boolean |
canBeConnectedTo(IBlockAccess world,
BlockPos pos,
EnumFacing facing)
Determines if another block can connect to this block
|
boolean |
canBeReplacedByLeaves(IBlockState state,
IBlockAccess world,
BlockPos pos)
Used during tree growth to determine if newly generated leaves can replace this block.
|
boolean |
canCollideCheck(IBlockState state,
boolean hitIfLiquid) |
boolean |
canConnectRedstone(IBlockState state,
IBlockAccess world,
BlockPos pos,
EnumFacing side)
Determine if this block can make a redstone connection on the side provided,
Useful to control which sides are inputs and outputs for redstone wires.
|
boolean |
canCreatureSpawn(IBlockState state,
IBlockAccess world,
BlockPos pos,
EntityLiving.SpawnPlacementType type)
Determines if a specified mob type can spawn on this block, returning false will
prevent any mob from spawning on the block.
|
boolean |
canDropFromExplosion(Explosion explosionIn)
Return whether this block can drop from an explosion.
|
boolean |
canEntityDestroy(IBlockState state,
IBlockAccess world,
BlockPos pos,
Entity entity)
Determines if this block is can be destroyed by the specified entities normal behavior.
|
boolean |
canEntitySpawn(IBlockState state,
Entity entityIn)
Deprecated.
|
boolean |
canHarvestBlock(IBlockAccess world,
BlockPos pos,
EntityPlayer player)
Determines if the player can harvest this block, obtaining it's drops when the block is destroyed.
|
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 |
canPlaceTorchOnTop(IBlockState state,
IBlockAccess world,
BlockPos pos)
Determines if a torch can be placed on the top surface of this block.
|
boolean |
canProvidePower(IBlockState state)
Deprecated.
|
boolean |
canRenderInLayer(IBlockState state,
BlockRenderLayer layer)
Queries if this block should render in a given layer.
|
protected boolean |
canSilkHarvest()
Deprecated.
|
boolean |
canSilkHarvest(World world,
BlockPos pos,
IBlockState state,
EntityPlayer player)
Return true from this function if the player with silk touch can harvest this block directly, and not it's normal drops.
|
boolean |
canSpawnInBlock()
Return true if an entity can be spawned inside the block (used to get the player's bed spawn location)
|
boolean |
canSustainLeaves(IBlockState state,
IBlockAccess world,
BlockPos pos)
Determines if this block can prevent leaves connected to it from decaying.
|
boolean |
canSustainPlant(IBlockState state,
IBlockAccess world,
BlockPos pos,
EnumFacing direction,
IPlantable plantable)
Determines if this block can support the passed in plant, allowing it to be planted and grow.
|
protected java.util.List<ItemStack> |
captureDrops(boolean start) |
boolean |
causesSuffocation(IBlockState state)
Deprecated.
|
RayTraceResult |
collisionRayTrace(IBlockState blockState,
World worldIn,
BlockPos pos,
Vec3d start,
Vec3d end)
Deprecated.
|
protected BlockStateContainer |
createBlockState() |
TileEntity |
createTileEntity(World world,
IBlockState state)
Called throughout the code as a replacement for ITileEntityProvider.createNewTileEntity
Return the same thing you would from that function.
|
int |
damageDropped(IBlockState state)
Gets the metadata of the item this Block can drop.
|
protected Block |
disableStats() |
boolean |
doesSideBlockRendering(IBlockState state,
IBlockAccess world,
BlockPos pos,
EnumFacing face)
Check if the face of a block should block rendering.
|
void |
dropBlockAsItem(World worldIn,
BlockPos pos,
IBlockState state,
int fortune)
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.
|
void |
dropXpOnBlockBreak(World worldIn,
BlockPos pos,
int amount)
Spawns the given amount of experience into the World as XP orb entities
|
boolean |
eventReceived(IBlockState state,
World worldIn,
BlockPos pos,
int id,
int param)
Deprecated.
|
void |
fillWithRain(World worldIn,
BlockPos pos)
Called similar to random ticks, but only when it is raining.
|
IBlockState |
getActualState(IBlockState state,
IBlockAccess worldIn,
BlockPos pos)
Deprecated.
|
PathNodeType |
getAiPathNodeType(IBlockState state,
IBlockAccess world,
BlockPos pos)
Get the
PathNodeType for this block. |
float |
getAmbientOcclusionLightValue(IBlockState state)
Deprecated.
|
float[] |
getBeaconColorMultiplier(IBlockState state,
World world,
BlockPos pos,
BlockPos beaconPos) |
EnumFacing |
getBedDirection(IBlockState state,
IBlockAccess world,
BlockPos pos)
Returns the direction of the block.
|
BlockPos |
getBedSpawnPosition(IBlockState state,
IBlockAccess world,
BlockPos pos,
EntityPlayer player)
Returns the position that the player is moved to upon
waking up, or respawning at the bed.
|
static Block |
getBlockById(int id) |
static Block |
getBlockFromItem(Item itemIn) |
static Block |
getBlockFromName(java.lang.String name) |
float |
getBlockHardness(IBlockState blockState,
World worldIn,
BlockPos pos)
Deprecated.
|
BlockRenderLayer |
getBlockLayer() |
BlockStateContainer |
getBlockState() |
AxisAlignedBB |
getBoundingBox(IBlockState state,
IBlockAccess source,
BlockPos pos)
Deprecated.
|
AxisAlignedBB |
getCollisionBoundingBox(IBlockState blockState,
IBlockAccess worldIn,
BlockPos pos)
Deprecated.
|
int |
getComparatorInputOverride(IBlockState blockState,
World worldIn,
BlockPos pos)
Deprecated.
|
CreativeTabs |
getCreativeTabToDisplayOn()
Returns the CreativeTab to display the given block on.
|
IBlockState |
getDefaultState() |
java.util.List<ItemStack> |
getDrops(IBlockAccess world,
BlockPos pos,
IBlockState state,
int fortune)
This returns a complete list of items dropped from this block.
|
boolean |
getEnableStats()
Return the state of blocks statistics flags - if the block is counted for mined and placed.
|
float |
getEnchantPowerBonus(World world,
BlockPos pos)
Determines the amount of enchanting power this block can provide to an enchanting table.
|
int |
getExpDrop(IBlockState state,
IBlockAccess world,
BlockPos pos,
int fortune)
Gathers how much experience this block drops when broken.
|
float |
getExplosionResistance(Entity exploder)
Deprecated.
|
float |
getExplosionResistance(World world,
BlockPos pos,
Entity exploder,
Explosion explosion)
Location sensitive version of getExplosionResistance
|
IBlockState |
getExtendedState(IBlockState state,
IBlockAccess world,
BlockPos pos)
Can return IExtendedBlockState
|
int |
getFireSpreadSpeed(IBlockAccess world,
BlockPos pos,
EnumFacing face)
Called when fire is updating on a neighbor block.
|
int |
getFlammability(IBlockAccess world,
BlockPos pos,
EnumFacing face)
Chance that fire will spread and consume this block.
|
int |
getHarvestLevel(IBlockState state)
Queries the harvest level of this item stack for the specified tool class,
Returns -1 if this tool is not of the specified type
|
java.lang.String |
getHarvestTool(IBlockState 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 |
getIdFromBlock(Block blockIn) |
ItemStack |
getItem(World worldIn,
BlockPos pos,
IBlockState state)
Deprecated.
|
Item |
getItemDropped(IBlockState state,
java.util.Random rand,
int fortune)
Get the Item that this Block should drop when harvested.
|
int |
getLightOpacity(IBlockState state)
Deprecated.
|
int |
getLightOpacity(IBlockState state,
IBlockAccess world,
BlockPos pos)
Location aware and overrideable version of the lightOpacity array,
return the number to subtract from the light value when it passes through this block.
|
int |
getLightValue(IBlockState state)
Deprecated.
|
int |
getLightValue(IBlockState state,
IBlockAccess world,
BlockPos pos)
Get a light value for the block at the specified coordinates, normal ranges are between 0 and 15
|
java.lang.String |
getLocalizedName()
Gets the localized name of this block.
|
MapColor |
getMapColor(IBlockState state)
Deprecated.
|
Material |
getMaterial(IBlockState state)
Deprecated.
|
int |
getMetaFromState(IBlockState state)
Convert the BlockState into the correct metadata value
|
EnumPushReaction |
getMobilityFlag(IBlockState state)
Deprecated.
|
Vec3d |
getOffset(IBlockState state,
IBlockAccess worldIn,
BlockPos pos)
Deprecated.
|
Block.EnumOffsetType |
getOffsetType()
Get the OffsetType for this Block.
|
int |
getPackedLightmapCoords(IBlockState state,
IBlockAccess source,
BlockPos pos)
Deprecated.
|
ItemStack |
getPickBlock(IBlockState state,
RayTraceResult target,
World world,
BlockPos pos,
EntityPlayer player)
Called when a user uses the creative pick block button on this block
|
float |
getPlayerRelativeBlockHardness(IBlockState state,
EntityPlayer player,
World worldIn,
BlockPos pos)
Deprecated.
|
EnumBlockRenderType |
getRenderType(IBlockState state)
Deprecated.
|
AxisAlignedBB |
getSelectedBoundingBox(IBlockState state,
World worldIn,
BlockPos pos)
Deprecated.
|
protected ItemStack |
getSilkTouchDrop(IBlockState state) |
SoundType |
getSoundType()
Deprecated.
|
SoundType |
getSoundType(IBlockState state,
World world,
BlockPos pos,
Entity entity)
Sensitive version of getSoundType
|
static IBlockState |
getStateById(int id)
Get a BlockState by it's ID (see getStateId)
|
IBlockState |
getStateForPlacement(World worldIn,
BlockPos pos,
EnumFacing facing,
float hitX,
float hitY,
float hitZ,
int meta,
EntityLivingBase placer)
Deprecated.
|
IBlockState |
getStateForPlacement(World world,
BlockPos pos,
EnumFacing facing,
float hitX,
float hitY,
float hitZ,
int meta,
EntityLivingBase placer,
EnumHand hand)
Gets the
IBlockState to place |
IBlockState |
getStateFromMeta(int meta)
Deprecated.
|
static int |
getStateId(IBlockState state)
Get a unique ID for the given BlockState, containing both BlockID and metadata
|
int |
getStrongPower(IBlockState blockState,
IBlockAccess blockAccess,
BlockPos pos,
EnumFacing side)
Deprecated.
|
void |
getSubBlocks(Item itemIn,
CreativeTabs tab,
NonNullList<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(IBlockState state)
Deprecated.
|
EnumFacing[] |
getValidRotations(World world,
BlockPos pos)
Get the rotations that can apply to the block at the specified coordinates.
|
boolean |
getWeakChanges(IBlockAccess world,
BlockPos pos)
If this block should be notified of weak changes.
|
int |
getWeakPower(IBlockState blockState,
IBlockAccess blockAccess,
BlockPos pos,
EnumFacing side)
Deprecated.
|
void |
harvestBlock(World worldIn,
EntityPlayer player,
BlockPos pos,
IBlockState state,
TileEntity te,
ItemStack stack) |
boolean |
hasComparatorInputOverride(IBlockState state)
Deprecated.
|
boolean |
hasCustomBreakingProgress(IBlockState state)
Deprecated.
|
boolean |
hasTileEntity()
Deprecated.
|
boolean |
hasTileEntity(IBlockState state)
Called throughout the code as a replacement for block instanceof BlockContainer
Moving this to the Block base class allows for mods that wish to extend vanilla
blocks, and also want to have a tile entity on that block, may.
|
java.lang.Boolean |
isAABBInsideMaterial(World world,
BlockPos pos,
AxisAlignedBB boundingBox,
Material materialIn)
Called when boats or fishing hooks are inside the block to check if they are inside
the material requested.
|
boolean |
isAir(IBlockState state,
IBlockAccess world,
BlockPos pos)
Determines this block should be treated as an air block
by the rest of the code.
|
boolean |
isAssociatedBlock(Block other) |
boolean |
isBeaconBase(IBlockAccess worldObj,
BlockPos pos,
BlockPos beacon)
Determines if this block can be used as the base of a beacon.
|
boolean |
isBed(IBlockState state,
IBlockAccess world,
BlockPos pos,
Entity player)
Determines if this block is classified as a Bed, Allowing
players to sleep in it, though the block has to specifically
perform the sleeping functionality in it's activated event.
|
boolean |
isBedFoot(IBlockAccess world,
BlockPos pos)
Determines if the current block is the foot half of the bed.
|
boolean |
isBlockNormalCube(IBlockState state)
Deprecated.
|
boolean |
isBlockSolid(IBlockAccess worldIn,
BlockPos pos,
EnumFacing side)
Whether this Block is solid on the given Side
|
boolean |
isBurning(IBlockAccess world,
BlockPos pos)
Determines if this block should set fire and deal fire damage
to entities coming into contact with it.
|
boolean |
isCollidable()
Returns if this block is collidable.
|
java.lang.Boolean |
isEntityInsideMaterial(IBlockAccess world,
BlockPos blockpos,
IBlockState iblockstate,
Entity entity,
double yToTest,
Material materialIn,
boolean testingHead)
Called when the entity is inside this block, may be used to determined if the entity can breathing,
display material overlays, or if the entity can swim inside a block.
|
static boolean |
isEqualTo(Block blockIn,
Block other) |
boolean |
isFertile(World world,
BlockPos pos)
Checks if this soil is fertile, typically this means that growth rates
of plants on this soil will be slightly sped up.
|
boolean |
isFireSource(World world,
BlockPos pos,
EnumFacing side)
Currently only called by fire when it is on top of this block.
|
boolean |
isFlammable(IBlockAccess world,
BlockPos pos,
EnumFacing face)
Called when fire is updating, checks if a block face can catch fire.
|
boolean |
isFoliage(IBlockAccess world,
BlockPos pos)
Used by getTopSolidOrLiquidBlock while placing biome decorations, villages, etc
Also used to determine if the player can spawn on this block.
|
boolean |
isFullBlock(IBlockState state)
Deprecated.
|
boolean |
isFullCube(IBlockState state)
Deprecated.
|
boolean |
isFullyOpaque(IBlockState state)
Deprecated.
|
boolean |
isLadder(IBlockState state,
IBlockAccess world,
BlockPos pos,
EntityLivingBase entity)
Checks if a player or entity can use this block to 'climb' like a ladder.
|
boolean |
isLeaves(IBlockState state,
IBlockAccess world,
BlockPos pos)
Determines if this block is considered a leaf block, used to apply the leaf decay and generation system.
|
boolean |
isNormalCube(IBlockState state)
Deprecated.
|
boolean |
isNormalCube(IBlockState state,
IBlockAccess world,
BlockPos pos)
Return true if the block is a normal, solid cube.
|
boolean |
isOpaqueCube(IBlockState state)
Deprecated.
|
boolean |
isPassable(IBlockAccess worldIn,
BlockPos pos) |
boolean |
isReplaceable(IBlockAccess worldIn,
BlockPos pos)
Whether this Block can be replaced directly by other blocks (true for e.g.
|
boolean |
isReplaceableOreGen(IBlockState state,
IBlockAccess world,
BlockPos pos,
<any> target)
Determines if the current block is replaceable by Ore veins during world generation.
|
boolean |
isSideSolid(IBlockState base_state,
IBlockAccess world,
BlockPos pos,
EnumFacing side)
Checks if the block is a solid face on the given side, used by placement logic.
|
boolean |
isToolEffective(java.lang.String type,
IBlockState state)
Checks if the specified tool type is efficient on this block,
meaning that it digs at full speed.
|
boolean |
isTranslucent(IBlockState state)
Deprecated.
|
boolean |
isWood(IBlockAccess world,
BlockPos pos) |
Vec3d |
modifyAcceleration(World worldIn,
BlockPos pos,
Entity entityIn,
Vec3d motion) |
void |
neighborChanged(IBlockState state,
World worldIn,
BlockPos pos,
Block blockIn,
BlockPos fromPos)
Deprecated.
|
void |
observedNeighborChange(IBlockState observerState,
World world,
BlockPos observerPos,
Block changedBlock,
BlockPos changedBlockPos)
Called on an Observer block whenever an update for an Observer is received.
|
boolean |
onBlockActivated(World worldIn,
BlockPos pos,
IBlockState state,
EntityPlayer playerIn,
EnumHand hand,
EnumFacing facing,
float hitX,
float hitY,
float hitZ)
Called when the block is right clicked by a player.
|
void |
onBlockAdded(World worldIn,
BlockPos pos,
IBlockState state)
Called after the block is set in the Chunk data, but before the Tile Entity is set
|
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
|
void |
onBlockExploded(World world,
BlockPos pos,
Explosion explosion)
Called when the block is destroyed by an explosion.
|
void |
onBlockHarvested(World worldIn,
BlockPos pos,
IBlockState state,
EntityPlayer player) |
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,
IBlockState state,
Entity entityIn)
Called When an Entity Collided with the Block
|
void |
onEntityWalk(World worldIn,
BlockPos pos,
Entity entityIn)
Triggered whenever an entity collides with this block (enters into 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 |
onNeighborChange(IBlockAccess world,
BlockPos pos,
BlockPos neighbor)
Called when a tile entity on a side of this block changes is created or is destroyed.
|
void |
onPlantGrow(IBlockState state,
World world,
BlockPos pos,
BlockPos source)
Called when a plant grows on this block, only implemented for saplings using the WorldGen*Trees classes right now.
|
int |
quantityDropped(IBlockState state,
int fortune,
java.util.Random random)
State and fortune sensitive version, this replaces the old (int meta, Random rand)
version in 1.1.
|
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(IBlockState stateIn,
World worldIn,
BlockPos pos,
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.
|
protected RayTraceResult |
rayTrace(BlockPos pos,
Vec3d start,
Vec3d end,
AxisAlignedBB boundingBox) |
boolean |
recolorBlock(World world,
BlockPos pos,
EnumFacing side,
EnumDyeColor color)
Common way to recolor a block with an external tool
|
static void |
registerBlocks() |
boolean |
removedByPlayer(IBlockState state,
World world,
BlockPos pos,
EntityPlayer player,
boolean willHarvest)
Called when a player removes a block.
|
boolean |
requiresUpdates() |
boolean |
rotateBlock(World world,
BlockPos pos,
EnumFacing axis)
Rotate the block.
|
void |
setBedOccupied(IBlockAccess world,
BlockPos pos,
EntityPlayer player,
boolean occupied)
Called when a user either starts or stops sleeping in the bed.
|
Block |
setBlockUnbreakable() |
Block |
setCreativeTab(CreativeTabs tab) |
protected void |
setDefaultState(IBlockState state) |
Block |
setHardness(float hardness)
Sets how many hits it takes to break a block.
|
void |
setHarvestLevel(java.lang.String toolClass,
int level)
Sets or removes the tool and level required to harvest this block.
|
void |
setHarvestLevel(java.lang.String toolClass,
int level,
IBlockState state)
Sets or removes the tool and level required to harvest this block.
|
Block |
setLightLevel(float value)
Sets the light value that the block emits.
|
Block |
setLightOpacity(int opacity)
Sets how much light is blocked going through this block.
|
Block |
setResistance(float resistance)
Sets the the blocks resistance to explosions.
|
protected Block |
setSoundType(SoundType sound)
Sets the footstep sound for the block.
|
Block |
setTickRandomly(boolean shouldTick)
Sets whether this block type will receive random update ticks
|
Block |
setUnlocalizedName(java.lang.String name) |
boolean |
shouldCheckWeakPower(IBlockState state,
IBlockAccess world,
BlockPos pos,
EnumFacing side)
Called to determine whether to allow the a block to handle its own indirect power rather than using the default rules.
|
boolean |
shouldSideBeRendered(IBlockState blockState,
IBlockAccess blockAccess,
BlockPos pos,
EnumFacing side)
Deprecated.
|
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) |
IBlockState |
withMirror(IBlockState state,
Mirror mirrorIn)
Deprecated.
|
IBlockState |
withRotation(IBlockState state,
Rotation rot)
Deprecated.
|
getRegistryName, getRegistryType, setRegistryName, setRegistryName, setRegistryName
public static final RegistryNamespacedDefaultedByKey<ResourceLocation,Block> REGISTRY
@Deprecated public static final ObjectIntIdentityMap<IBlockState> BLOCK_STATE_IDS
public static final AxisAlignedBB FULL_BLOCK_AABB
public static final AxisAlignedBB NULL_AABB
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 SoundType blockSoundType
public float blockParticleGravity
protected final Material blockMaterial
protected final MapColor blockMapColor
public float slipperiness
protected final BlockStateContainer blockState
protected java.lang.ThreadLocal<EntityPlayer> harvesters
protected static java.util.Random RANDOM
protected static java.lang.ThreadLocal<java.lang.Boolean> captureDrops
protected static java.lang.ThreadLocal<java.util.List<ItemStack>> capturedDrops
public 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)
@Deprecated public boolean isFullyOpaque(IBlockState state)
@Deprecated public boolean isFullBlock(IBlockState state)
@Deprecated public boolean canEntitySpawn(IBlockState state, Entity entityIn)
@Deprecated public int getLightOpacity(IBlockState state)
@Deprecated public boolean isTranslucent(IBlockState state)
@Deprecated public int getLightValue(IBlockState state)
@Deprecated public boolean getUseNeighborBrightness(IBlockState state)
@Deprecated public Material getMaterial(IBlockState state)
@Deprecated public MapColor getMapColor(IBlockState state)
@Deprecated public IBlockState getStateFromMeta(int meta)
public int getMetaFromState(IBlockState state)
@Deprecated public IBlockState getActualState(IBlockState state, IBlockAccess worldIn, BlockPos pos)
@Deprecated public IBlockState withRotation(IBlockState state, Rotation rot)
@Deprecated public IBlockState withMirror(IBlockState state, Mirror mirrorIn)
protected Block setSoundType(SoundType sound)
public Block setLightOpacity(int opacity)
public Block setLightLevel(float value)
public Block setResistance(float resistance)
@Deprecated public boolean isBlockNormalCube(IBlockState state)
@Deprecated public boolean isNormalCube(IBlockState state)
@Deprecated public boolean causesSuffocation(IBlockState state)
@Deprecated public boolean isFullCube(IBlockState state)
@Deprecated public boolean hasCustomBreakingProgress(IBlockState state)
public boolean isPassable(IBlockAccess worldIn, BlockPos pos)
@Deprecated public EnumBlockRenderType getRenderType(IBlockState state)
public boolean isReplaceable(IBlockAccess worldIn, BlockPos pos)
public Block setHardness(float hardness)
public Block setBlockUnbreakable()
@Deprecated public float getBlockHardness(IBlockState blockState, World worldIn, BlockPos pos)
public Block setTickRandomly(boolean shouldTick)
public boolean getTickRandomly()
@Deprecated public boolean hasTileEntity()
@Deprecated public AxisAlignedBB getBoundingBox(IBlockState state, IBlockAccess source, BlockPos pos)
@Deprecated public int getPackedLightmapCoords(IBlockState state, IBlockAccess source, BlockPos pos)
@Deprecated public boolean shouldSideBeRendered(IBlockState blockState, IBlockAccess blockAccess, BlockPos pos, EnumFacing side)
public boolean isBlockSolid(IBlockAccess worldIn, BlockPos pos, EnumFacing side)
@Deprecated public void addCollisionBoxToList(IBlockState state, World worldIn, BlockPos pos, AxisAlignedBB entityBox, java.util.List<AxisAlignedBB> collidingBoxes, Entity entityIn, boolean p_185477_7_)
protected static void addCollisionBoxToList(BlockPos pos, AxisAlignedBB entityBox, java.util.List<AxisAlignedBB> collidingBoxes, AxisAlignedBB blockBox)
@Deprecated public AxisAlignedBB getCollisionBoundingBox(IBlockState blockState, IBlockAccess worldIn, BlockPos pos)
@Deprecated public AxisAlignedBB getSelectedBoundingBox(IBlockState state, World worldIn, BlockPos pos)
@Deprecated public boolean isOpaqueCube(IBlockState state)
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(IBlockState stateIn, World worldIn, BlockPos pos, java.util.Random rand)
public void onBlockDestroyedByPlayer(World worldIn, BlockPos pos, IBlockState state)
@Deprecated public void neighborChanged(IBlockState state, World worldIn, BlockPos pos, Block blockIn, BlockPos fromPos)
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)
@Deprecated public float getPlayerRelativeBlockHardness(IBlockState state, EntityPlayer player, World worldIn, BlockPos pos)
public final void dropBlockAsItem(World worldIn, BlockPos pos, IBlockState state, int fortune)
public void dropBlockAsItemWithChance(World worldIn, BlockPos pos, IBlockState state, float chance, int fortune)
public static void spawnAsEntity(World worldIn, BlockPos pos, ItemStack stack)
public void dropXpOnBlockBreak(World worldIn, BlockPos pos, int amount)
public int damageDropped(IBlockState state)
@Deprecated public float getExplosionResistance(Entity exploder)
@Deprecated public RayTraceResult collisionRayTrace(IBlockState blockState, World worldIn, BlockPos pos, Vec3d start, Vec3d end)
protected RayTraceResult rayTrace(BlockPos pos, Vec3d start, Vec3d end, AxisAlignedBB boundingBox)
public void onBlockDestroyedByExplosion(World worldIn, BlockPos pos, Explosion explosionIn)
public BlockRenderLayer getBlockLayer()
public boolean canPlaceBlockOnSide(World worldIn, BlockPos pos, EnumFacing side)
public boolean onBlockActivated(World worldIn, BlockPos pos, IBlockState state, EntityPlayer playerIn, EnumHand hand, EnumFacing facing, float hitX, float hitY, float hitZ)
public void onEntityWalk(World worldIn, BlockPos pos, Entity entityIn)
@Deprecated public IBlockState getStateForPlacement(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 Vec3d modifyAcceleration(World worldIn, BlockPos pos, Entity entityIn, Vec3d motion)
@Deprecated public int getWeakPower(IBlockState blockState, IBlockAccess blockAccess, BlockPos pos, EnumFacing side)
@Deprecated public boolean canProvidePower(IBlockState state)
public void onEntityCollidedWithBlock(World worldIn, BlockPos pos, IBlockState state, Entity entityIn)
@Deprecated public int getStrongPower(IBlockState blockState, IBlockAccess blockAccess, BlockPos pos, EnumFacing side)
public void harvestBlock(World worldIn, EntityPlayer player, BlockPos pos, IBlockState state, TileEntity te, ItemStack stack)
@Deprecated protected boolean canSilkHarvest()
protected ItemStack getSilkTouchDrop(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 canSpawnInBlock()
public Block setUnlocalizedName(java.lang.String name)
public java.lang.String getLocalizedName()
public java.lang.String getUnlocalizedName()
@Deprecated public boolean eventReceived(IBlockState state, World worldIn, BlockPos pos, int id, int param)
public boolean getEnableStats()
protected Block disableStats()
@Deprecated public EnumPushReaction getMobilityFlag(IBlockState state)
@Deprecated public float getAmbientOcclusionLightValue(IBlockState state)
public void onFallenUpon(World worldIn, BlockPos pos, Entity entityIn, float fallDistance)
public void onLanded(World worldIn, Entity entityIn)
@Deprecated public ItemStack getItem(World worldIn, BlockPos pos, IBlockState state)
public void getSubBlocks(Item itemIn, CreativeTabs tab, NonNullList<ItemStack> list)
public Block setCreativeTab(CreativeTabs tab)
public void onBlockHarvested(World worldIn, BlockPos pos, IBlockState state, EntityPlayer player)
public CreativeTabs getCreativeTabToDisplayOn()
public void fillWithRain(World worldIn, BlockPos pos)
public boolean requiresUpdates()
public boolean canDropFromExplosion(Explosion explosionIn)
public boolean isAssociatedBlock(Block other)
@Deprecated public boolean hasComparatorInputOverride(IBlockState state)
@Deprecated public int getComparatorInputOverride(IBlockState blockState, World worldIn, BlockPos pos)
protected BlockStateContainer createBlockState()
public BlockStateContainer getBlockState()
protected final void setDefaultState(IBlockState state)
public final IBlockState getDefaultState()
public Block.EnumOffsetType getOffsetType()
@Deprecated public Vec3d getOffset(IBlockState state, IBlockAccess worldIn, BlockPos pos)
@Deprecated public SoundType getSoundType()
public java.lang.String toString()
toString
in class java.lang.Object
public void addInformation(ItemStack stack, EntityPlayer player, java.util.List<java.lang.String> tooltip, boolean advanced)
public int getLightValue(IBlockState state, IBlockAccess world, BlockPos pos)
state
- Block stateworld
- The current worldpos
- Block position in worldpublic boolean isLadder(IBlockState state, IBlockAccess world, BlockPos pos, EntityLivingBase entity)
state
- The current stateworld
- The current worldpos
- Block position in worldentity
- The entity trying to use the ladder, CAN be null.public boolean isNormalCube(IBlockState state, IBlockAccess world, BlockPos pos)
state
- The current stateworld
- The current worldpos
- Block position in worldpublic boolean doesSideBlockRendering(IBlockState state, IBlockAccess world, BlockPos pos, EnumFacing face)
state
- The current block stateworld
- The current worldpos
- Block position in worldface
- The side to checkpublic boolean isSideSolid(IBlockState base_state, IBlockAccess world, BlockPos pos, EnumFacing side)
base_state
- The base state, getActualState should be called firstworld
- The current worldpos
- Block position in worldside
- The side to checkpublic boolean isBurning(IBlockAccess world, BlockPos pos)
world
- The current worldpos
- Block position in worldpublic boolean isAir(IBlockState state, IBlockAccess world, BlockPos pos)
state
- The current stateworld
- The current worldpos
- Block position in worldpublic boolean canHarvestBlock(IBlockAccess world, BlockPos pos, EntityPlayer player)
player
- The player damaging the blockpos
- The block's current positionpublic boolean removedByPlayer(IBlockState state, World world, BlockPos pos, EntityPlayer player, boolean willHarvest)
state
- The current state.world
- The current worldplayer
- The player damaging the block, may be nullpos
- Block position in worldwillHarvest
- True if Block.harvestBlock will be called after this, if the return in true.
Can be useful to delay the destruction of tile entities till after harvestBlockpublic int getFlammability(IBlockAccess world, BlockPos pos, EnumFacing face)
world
- The current worldpos
- Block position in worldface
- The face that the fire is coming frompublic boolean isFlammable(IBlockAccess world, BlockPos pos, EnumFacing face)
world
- The current worldpos
- Block position in worldface
- The face that the fire is coming frompublic int getFireSpreadSpeed(IBlockAccess world, BlockPos pos, EnumFacing face)
world
- The current worldpos
- Block position in worldface
- The face that the fire is coming frompublic boolean isFireSource(World world, BlockPos pos, EnumFacing side)
world
- The current worldpos
- Block position in worldside
- The face that the fire is coming frompublic boolean hasTileEntity(IBlockState state)
state
- State of the current blockpublic TileEntity createTileEntity(World world, IBlockState state)
state
- The state of the current blockpublic int quantityDropped(IBlockState state, int fortune, java.util.Random random)
state
- Current statefortune
- Current item fortune levelrandom
- Random number generatorpublic java.util.List<ItemStack> getDrops(IBlockAccess world, BlockPos pos, IBlockState state, int fortune)
world
- The current worldpos
- Block position in worldstate
- Current statefortune
- Breakers fortune levelpublic boolean canSilkHarvest(World world, BlockPos pos, IBlockState state, EntityPlayer player)
world
- The worldpos
- Block position in worldstate
- current block stateplayer
- The player doing the harvestingpublic boolean canCreatureSpawn(IBlockState state, IBlockAccess world, BlockPos pos, EntityLiving.SpawnPlacementType type)
state
- The current stateworld
- The current worldpos
- Block position in worldtype
- The Mob Category Typepublic boolean isBed(IBlockState state, IBlockAccess world, BlockPos pos, Entity player)
state
- The current stateworld
- The current worldpos
- Block position in worldplayer
- The player or camera entity, null in some cases.public BlockPos getBedSpawnPosition(IBlockState state, IBlockAccess world, BlockPos pos, EntityPlayer player)
state
- The current stateworld
- The current worldpos
- Block position in worldplayer
- The player or camera entity, null in some cases.public void setBedOccupied(IBlockAccess world, BlockPos pos, EntityPlayer player, boolean occupied)
world
- The current worldpos
- Block position in worldplayer
- The player or camera entity, null in some cases.occupied
- True if we are occupying the bed, or false if they are stopping use of the bedpublic EnumFacing getBedDirection(IBlockState state, IBlockAccess world, BlockPos pos)
state
- The current stateworld
- The current worldpos
- Block position in worldpublic boolean isBedFoot(IBlockAccess world, BlockPos pos)
world
- The current worldpos
- Block position in worldpublic void beginLeavesDecay(IBlockState state, World world, BlockPos pos)
state
- The current stateworld
- The current worldpos
- Block position in worldpublic boolean canSustainLeaves(IBlockState state, IBlockAccess world, BlockPos pos)
state
- The current stateworld
- The current worldpos
- Block position in worldpublic boolean isLeaves(IBlockState state, IBlockAccess world, BlockPos pos)
state
- The current stateworld
- The current worldpos
- Block position in worldpublic boolean canBeReplacedByLeaves(IBlockState state, IBlockAccess world, BlockPos pos)
state
- The current stateworld
- The current worldpos
- Block position in worldpublic boolean isWood(IBlockAccess world, BlockPos pos)
world
- The current worldpos
- Block position in worldpublic boolean isReplaceableOreGen(IBlockState state, IBlockAccess world, BlockPos pos, <any> target)
state
- The current stateworld
- The current worldpos
- Block position in worldtarget
- The generic target block the gen is looking for, Standards define stone
for overworld generation, and neatherack for the nether.public float getExplosionResistance(World world, BlockPos pos, Entity exploder, Explosion explosion)
world
- The current worldpos
- Block position in worldexploder
- The entity that caused the explosion, can be nullexplosion
- The explosionpublic void onBlockExploded(World world, BlockPos pos, Explosion explosion)
world
- The current worldpos
- Block position in worldexplosion
- The explosion instance affecting the blockpublic boolean canConnectRedstone(IBlockState state, IBlockAccess world, BlockPos pos, EnumFacing side)
state
- The current stateworld
- The current worldpos
- Block position in worldside
- The side that is trying to make the connection, CAN BE NULLpublic boolean canPlaceTorchOnTop(IBlockState state, IBlockAccess world, BlockPos pos)
state
- The current stateworld
- The current worldpos
- Block position in worldpublic ItemStack getPickBlock(IBlockState state, RayTraceResult target, World world, BlockPos pos, EntityPlayer player)
target
- The full target the player is looking atpublic boolean isFoliage(IBlockAccess world, BlockPos pos)
public boolean addLandingEffects(IBlockState state, WorldServer worldObj, BlockPos blockPosition, IBlockState iblockstate, EntityLivingBase entity, int numberOfParticles)
world
- The current Server worldblockPosition
- of the block that the entity landed on.iblockstate
- State at the specific world/posentity
- the entity that hit landed on the block.numberOfParticles
- that vanilla would have spawned.public boolean addHitEffects(IBlockState state, World worldObj, RayTraceResult target, ParticleManager manager)
state
- The current stateworld
- The current worldtarget
- The target the player is looking at {x/y/z/side/sub}manager
- A reference to the current particle manager.public boolean addDestroyEffects(World world, BlockPos pos, ParticleManager manager)
world
- The current worldpos
- Position to spawn the particlemanager
- A reference to the current particle manager.public boolean canSustainPlant(IBlockState state, IBlockAccess world, BlockPos pos, EnumFacing direction, IPlantable plantable)
state
- The Current stateworld
- The current worldpos
- Block position in worlddirection
- The direction relative to the given position the plant wants to be, typically its UPplantable
- The plant that wants to checkpublic void onPlantGrow(IBlockState state, World world, BlockPos pos, BlockPos source)
state
- The current stateworld
- Current worldpos
- Block position in worldsource
- Source plant's position in worldpublic boolean isFertile(World world, BlockPos pos)
world
- The current worldpos
- Block position in worldpublic int getLightOpacity(IBlockState state, IBlockAccess world, BlockPos pos)
state
- The Block stateworld
- The current worldpos
- Block position in worldpublic boolean canEntityDestroy(IBlockState state, IBlockAccess world, BlockPos pos, Entity entity)
state
- The current stateworld
- The current worldpos
- Block position in worldpublic boolean isBeaconBase(IBlockAccess worldObj, BlockPos pos, BlockPos beacon)
world
- The current worldpos
- Block position in worldbeacon
- Beacon position in worldpublic boolean rotateBlock(World world, BlockPos pos, EnumFacing axis)
world
- The worldpos
- Block position in worldaxis
- The axis to rotate aroundpublic EnumFacing[] getValidRotations(World world, BlockPos pos)
world
- The worldpos
- Block position in worldpublic float getEnchantPowerBonus(World world, BlockPos pos)
world
- The Worldpos
- Block position in worldpublic boolean recolorBlock(World world, BlockPos pos, EnumFacing side, EnumDyeColor color)
world
- The worldpos
- Block position in worldside
- The side hit with the coloring toolcolor
- The color to change topublic int getExpDrop(IBlockState state, IBlockAccess world, BlockPos pos, int fortune)
state
- The current stateworld
- The worldpos
- Block positionfortune
- public void onNeighborChange(IBlockAccess world, BlockPos pos, BlockPos neighbor)
world
- The worldpos
- Block position in worldneighbor
- Block position of neighborpublic void observedNeighborChange(IBlockState observerState, World world, BlockPos observerPos, Block changedBlock, BlockPos changedBlockPos)
observerState
- The Observer block's state.world
- The current world.observerPos
- The Observer block's position.changedBlock
- The updated block.changedBlockPos
- The updated block's position.public boolean shouldCheckWeakPower(IBlockState state, IBlockAccess world, BlockPos pos, EnumFacing side)
world
- The worldpos
- Block position in worldside
- The INPUT side of the block to be powered - ie the opposite of this block's output sidepublic boolean getWeakChanges(IBlockAccess world, BlockPos pos)
world
- The current worldpos
- Block position in worldpublic void setHarvestLevel(java.lang.String toolClass, int level)
toolClass
- Classlevel
- Harvest level:
Wood: 0
Stone: 1
Iron: 2
Diamond: 3
Gold: 0public void setHarvestLevel(java.lang.String toolClass, int level, IBlockState state)
toolClass
- Classlevel
- Harvest level:
Wood: 0
Stone: 1
Iron: 2
Diamond: 3
Gold: 0state
- The specific state.public java.lang.String getHarvestTool(IBlockState state)
public int getHarvestLevel(IBlockState state)
public boolean isToolEffective(java.lang.String type, IBlockState state)
public IBlockState getExtendedState(IBlockState state, IBlockAccess world, BlockPos pos)
public java.lang.Boolean isEntityInsideMaterial(IBlockAccess world, BlockPos blockpos, IBlockState iblockstate, Entity entity, double yToTest, Material materialIn, boolean testingHead)
world
- that is being tested.blockpos
- position thats being tested.iblockstate
- state at world/blockposentity
- that is being tested.yToTest,
- primarily for testingHead, which sends the the eye level of the entity, other wise it sends a y that can be tested vs liquid height.materialIn
- to test for.testingHead
- when true, its testing the entities head for vision, breathing ect... otherwise its testing the body, for swimming and movement adjustment.public java.lang.Boolean isAABBInsideMaterial(World world, BlockPos pos, AxisAlignedBB boundingBox, Material materialIn)
world
- world that is being tested.pos
- block thats being tested.boundingBox
- box to test, generally the bounds of an entity that are besting tested.materialIn
- to check for.public boolean canRenderInLayer(IBlockState state, BlockRenderLayer layer)
MinecraftForgeClient.getRenderLayer()
to alter their model based on layer.protected java.util.List<ItemStack> captureDrops(boolean start)
public SoundType getSoundType(IBlockState state, World world, BlockPos pos, Entity entity)
state
- The stateworld
- The worldpos
- The position. Note that the world may not necessarily have state
here!entity
- The entity that is breaking/stepping on/placing/hitting/falling on this block, or null if no entity is in this contextpublic float[] getBeaconColorMultiplier(IBlockState state, World world, BlockPos pos, BlockPos beaconPos)
state
- The stateworld
- The worldpos
- The position of this statebeaconPos
- The position of the beaconpublic IBlockState getStateForPlacement(World world, BlockPos pos, EnumFacing facing, float hitX, float hitY, float hitZ, int meta, EntityLivingBase placer, EnumHand hand)
IBlockState
to placeworld
- The world the block is being placed inpos
- The position the block is being placed atfacing
- The side the block is being placed onhitX
- The X coordinate of the hit vectorhitY
- The Y coordinate of the hit vectorhitZ
- The Z coordinate of the hit vectormeta
- The metadata of ItemStack
as processed by Item.getMetadata(int)
placer
- The entity placing the blockhand
- The player hand used to place this blockpublic boolean canBeConnectedTo(IBlockAccess world, BlockPos pos, EnumFacing facing)
world
- The current worldpos
- The position of this blockfacing
- The side the connecting block is onpublic PathNodeType getAiPathNodeType(IBlockState state, IBlockAccess world, BlockPos pos)
PathNodeType
for this block. Return null
for vanilla behavior.public static void registerBlocks()