public interface IForgeBlockState
| Modifier and Type | Method and Description |
|---|---|
default boolean |
addDestroyEffects(World world,
BlockPos pos,
ParticleManager manager)
Spawn particles for when the block is destroyed.
|
default boolean |
addHitEffects(World world,
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.
|
default boolean |
addLandingEffects(ServerWorld worldserver,
BlockPos pos,
BlockState state2,
LivingEntity 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.
|
default boolean |
addRunningEffects(World world,
BlockPos pos,
Entity entity)
Allows a block to override the standard vanilla running particles.
|
default void |
beginLeaveDecay(IWorldReader world,
BlockPos pos)
Called when a leaf should start its decay process.
|
default boolean |
canBeConnectedTo(IBlockReader world,
BlockPos pos,
Direction facing)
Determines if another block can connect to this block
|
default boolean |
canBeReplacedByLeaves(IWorldReader world,
BlockPos pos)
Used during tree growth to determine if newly generated leaves can replace this block.
|
default boolean |
canBeReplacedByLogs(IWorldReader world,
BlockPos pos)
Used during tree growth to determine if newly generated logs can replace this block.
|
default boolean |
canConnectRedstone(IBlockReader world,
BlockPos pos,
Direction 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.
|
default boolean |
canCreatureSpawn(IWorldReader world,
BlockPos pos,
EntitySpawnPlacementRegistry.PlacementType type,
EntityType<?> entityType)
Determines if a specified mob type can spawn on this block, returning false will
prevent any mob from spawning on the block.
|
default boolean |
canDropFromExplosion(IBlockReader world,
BlockPos pos,
Explosion explosion)
Determines if this block should drop loot when exploded.
|
default boolean |
canEntityDestroy(IBlockReader world,
BlockPos pos,
Entity entity)
Determines if this block is can be destroyed by the specified entities normal behavior.
|
default boolean |
canHarvestBlock(IBlockReader world,
BlockPos pos,
PlayerEntity player)
Determines if the player can harvest this block, obtaining it's drops when the block is destroyed.
|
default boolean |
canStickTo(BlockState other)
Determines if this block can stick to another block when pushed by a piston.
|
default boolean |
canSustainPlant(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.
|
default void |
catchFire(World world,
BlockPos pos,
Direction face,
LivingEntity igniter)
If the block is flammable, this is called when it gets lit on fire.
|
default boolean |
collisionExtendsVertically(IBlockReader world,
BlockPos pos,
Entity collidingEntity)
Determines if this block's collision box should be treated as though it can extend above its block space.
|
default TileEntity |
createTileEntity(IBlockReader world)
Called throughout the code as a replacement for ITileEntityProvider.createNewTileEntity
Return the same thing you would from that function.
|
default PathNodeType |
getAiPathNodeType(IBlockReader world,
BlockPos pos)
Get the
PathNodeType for this block. |
default PathNodeType |
getAiPathNodeType(IBlockReader world,
BlockPos pos,
MobEntity entity)
Get the
PathNodeType for this block. |
default float[] |
getBeaconColorMultiplier(IWorldReader world,
BlockPos pos,
BlockPos beacon) |
default Direction |
getBedDirection(IWorldReader world,
BlockPos pos)
Returns the direction of the block.
|
default java.util.Optional<Vec3d> |
getBedSpawnPosition(EntityType<?> type,
IWorldReader world,
BlockPos pos,
LivingEntity sleeper)
Returns the position that the sleeper is moved to upon
waking up, or respawning at the bed.
|
default BlockState |
getBlockState() |
default float |
getEnchantPowerBonus(IWorldReader world,
BlockPos pos)
Determines the amount of enchanting power this block can provide to an enchanting table.
|
default int |
getExpDrop(IWorldReader world,
BlockPos pos,
int fortune,
int silktouch)
Gathers how much experience this block drops when broken.
|
default float |
getExplosionResistance(IWorldReader world,
BlockPos pos,
Entity exploder,
Explosion explosion)
Location sensitive version of getExplosionResistance
|
default int |
getFireSpreadSpeed(IBlockReader world,
BlockPos pos,
Direction face)
Called when fire is updating on a neighbor block.
|
default int |
getFlammability(IBlockReader world,
BlockPos pos,
Direction face)
Chance that fire will spread and consume this block.
|
default Vec3d |
getFogColor(IWorldReader world,
BlockPos pos,
Entity entity,
Vec3d originalColor,
float partialTicks)
Use this to change the fog color used when the entity is "inside" a material.
|
default int |
getHarvestLevel() |
default ToolType |
getHarvestTool()
Queries the class of tool required to harvest this block, if null is returned
we assume that anything can harvest this block.
|
default int |
getLightValue(IBlockReader world,
BlockPos pos)
Get a light value for this block, taking into account the given state and coordinates, normal ranges are between 0 and 15
|
default ItemStack |
getPickBlock(RayTraceResult target,
IBlockReader world,
BlockPos pos,
PlayerEntity player)
Called when A user uses the creative pick block button on this block
|
default float |
getSlipperiness(IWorldReader world,
BlockPos pos,
Entity entity)
Gets the slipperiness at the given location at the given state.
|
default SoundType |
getSoundType(IWorldReader world,
BlockPos pos,
Entity entity)
Sensitive version of getSoundType
|
default BlockState |
getStateAtViewpoint(IBlockReader world,
BlockPos pos,
Vec3d viewpoint)
Used to determine the state 'viewed' by an entity (see
ActiveRenderInfo#getBlockStateAtEntityViewpoint(World, Entity, float)). |
default BlockState |
getStateForPlacement(Direction facing,
BlockState state2,
IWorld world,
BlockPos pos1,
BlockPos pos2,
Hand hand)
//TODO: Re-Evaluate
Gets the
IBlockState to place |
default Direction[] |
getValidRotations(IBlockReader world,
BlockPos pos)
Get the rotations that can apply to the block at the specified coordinates.
|
default boolean |
getWeakChanges(IWorldReader world,
BlockPos pos)
If this block should be notified of weak changes.
|
default boolean |
hasTileEntity()
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.
|
default boolean |
isAir(IBlockReader world,
BlockPos pos)
Determines this block should be treated as an air block
by the rest of the code.
|
default boolean |
isBeaconBase(IWorldReader world,
BlockPos pos,
BlockPos beacon)
Determines if this block can be used as the base of a beacon.
|
default boolean |
isBed(IBlockReader world,
BlockPos pos,
LivingEntity 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.
|
default boolean |
isBedFoot(IWorldReader world,
BlockPos pos)
Determines if the current block is the foot half of the bed.
|
default boolean |
isBurning(IBlockReader world,
BlockPos pos)
Determines if this block should set fire and deal fire damage
to entities coming into contact with it.
|
default boolean |
isConduitFrame(IWorldReader world,
BlockPos pos,
BlockPos conduit)
Determines if this block can be used as the frame of a conduit.
|
default boolean |
isFertile(IBlockReader 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.
|
default boolean |
isFireSource(IBlockReader world,
BlockPos pos,
Direction side)
Currently only called by fire when it is on top of this block.
|
default boolean |
isFlammable(IBlockReader world,
BlockPos pos,
Direction face)
Called when fire is updating, checks if a block face can catch fire.
|
default boolean |
isFoliage(IWorldReader world,
BlockPos pos)
Used by getTopSoilidOrLiquidBlock while placing biome decorations, villages, etc
Also used to determine if the player can spawn in this block.
|
default boolean |
isLadder(IWorldReader world,
BlockPos pos,
LivingEntity entity)
Checks if a player or entity can use this block to 'climb' like a ladder.
|
default boolean |
isPortalFrame(IWorldReader world,
BlockPos pos)
Determines if this block can be used as part of a frame of a nether portal.
|
default boolean |
isReplaceableOreGen(IWorldReader world,
BlockPos pos,
java.util.function.Predicate<BlockState> target)
Determines if the current block is replaceable by Ore veins during world generation.
|
default boolean |
isSlimeBlock() |
default boolean |
isStickyBlock() |
default boolean |
isToolEffective(ToolType tool)
Checks if the specified tool type is efficient on this block,
meaning that it digs at full speed.
|
default void |
observedNeighborChange(World world,
BlockPos pos,
Block changed,
BlockPos changedPos)
Called on an Observer block whenever an update for an Observer is received.
|
default void |
onBlockExploded(World world,
BlockPos pos,
Explosion explosion)
Called when the block is destroyed by an explosion.
|
default void |
onNeighborChange(IWorldReader world,
BlockPos pos,
BlockPos neighbor)
Called when a tile entity on a side of this block changes is created or is destroyed.
|
default void |
onPlantGrow(IWorld world,
BlockPos pos,
BlockPos source)
Called when a plant grows on this block, only implemented for saplings using the WorldGen*Trees classes right now.
|
default boolean |
recolorBlock(IWorld world,
BlockPos pos,
Direction facing,
DyeColor color)
//TODO: Re-Evaluate
Gathers how much experience this block drops when broken.
|
default boolean |
removedByPlayer(World world,
BlockPos pos,
PlayerEntity player,
boolean willHarvest,
IFluidState fluid)
Called when a player removes a block.
|
default BlockState |
rotate(IWorld world,
BlockPos pos,
Rotation direction) |
default void |
setBedOccupied(IWorldReader world,
BlockPos pos,
LivingEntity sleeper,
boolean occupied)
Called when a user either starts or stops sleeping in the bed.
|
default boolean |
shouldCheckWeakPower(IWorldReader world,
BlockPos pos,
Direction side)
Called to determine whether to allow the a block to handle its own indirect power rather than using the default rules.
|
default boolean |
shouldDisplayFluidOverlay(ILightReader world,
BlockPos pos,
IFluidState fluidState)
Called to determine whether this block should use the fluid overlay texture or flowing texture when it is placed under the fluid.
|
default BlockState getBlockState()
default float getSlipperiness(IWorldReader world, BlockPos pos, @Nullable Entity entity)
Note that entities may reduce slipperiness by a certain factor of their own;
for net.minecraft.entity.EntityLivingBase, this is .91.
net.minecraft.entity.item.EntityItem uses .98, and
net.minecraft.entity.projectile.EntityFishHook uses .92.
world - the worldpos - the position in the worldentity - the entity in questiondefault int getLightValue(IBlockReader world, BlockPos pos)
default boolean isLadder(IWorldReader world, BlockPos pos, LivingEntity entity)
world - The current worldpos - Block position in worldentity - The entity trying to use the ladder, CAN be null.default boolean hasTileEntity()
@Nullable default TileEntity createTileEntity(IBlockReader world)
world - The world to create the TE indefault boolean canHarvestBlock(IBlockReader world, BlockPos pos, PlayerEntity player)
world - The current worldpos - The block's current positionplayer - The player damaging the blockdefault boolean removedByPlayer(World world, BlockPos pos, PlayerEntity player, boolean willHarvest, IFluidState fluid)
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 harvestBlockfluid - The current fluid and block state for the position in the world.default boolean isBed(IBlockReader world, BlockPos pos, @Nullable LivingEntity player)
world - The current worldpos - Block position in worldplayer - The player or camera entity, null in some cases.default boolean canCreatureSpawn(IWorldReader world, BlockPos pos, EntitySpawnPlacementRegistry.PlacementType type, EntityType<?> entityType)
world - The current worldpos - Block position in worldtype - The Mob Category Typedefault java.util.Optional<Vec3d> getBedSpawnPosition(EntityType<?> type, IWorldReader world, BlockPos pos, @Nullable LivingEntity sleeper)
world - The current worldpos - Block position in worldsleeper - The sleeper or camera entity, null in some cases.default void setBedOccupied(IWorldReader world, BlockPos pos, LivingEntity sleeper, boolean occupied)
world - The current worldpos - Block position in worldsleeper - The sleeper or camera entity, null in some cases.occupied - True if we are occupying the bed, or false if they are stopping use of the beddefault Direction getBedDirection(IWorldReader world, BlockPos pos)
world - The current worldpos - Block position in worlddefault boolean isBedFoot(IWorldReader world, BlockPos pos)
world - The current worldpos - Block position in worlddefault void beginLeaveDecay(IWorldReader world, BlockPos pos)
world - The current worldpos - Block position in worlddefault boolean isAir(IBlockReader world, BlockPos pos)
world - The current worldpos - Block position in worlddefault boolean canBeReplacedByLeaves(IWorldReader world, BlockPos pos)
world - The current worldpos - Block position in worlddefault boolean canBeReplacedByLogs(IWorldReader world, BlockPos pos)
state - The current stateworld - The current worldpos - Block position in worlddefault boolean isReplaceableOreGen(IWorldReader world, BlockPos pos, java.util.function.Predicate<BlockState> target)
world - 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.default float getExplosionResistance(IWorldReader world, BlockPos pos, @Nullable Entity exploder, Explosion explosion)
world - The current worldpos - Block position in worldexploder - The entity that caused the explosion, can be nullexplosion - The explosiondefault boolean canConnectRedstone(IBlockReader world, BlockPos pos, @Nullable Direction side)
world - The current worldpos - Block position in worldside - The side that is trying to make the connection, CAN BE NULLdefault ItemStack getPickBlock(RayTraceResult target, IBlockReader world, BlockPos pos, PlayerEntity player)
target - The full target the player is looking atdefault boolean isFoliage(IWorldReader world, BlockPos pos)
default boolean addLandingEffects(ServerWorld worldserver, BlockPos pos, BlockState state2, LivingEntity entity, int numberOfParticles)
worldserver - The current Server Worldpos - The position of the block.state2 - The state at the specific world/posentity - The entity that hit landed on the blocknumberOfParticles - That vanilla world have spawneddefault boolean addRunningEffects(World world, BlockPos pos, Entity entity)
Entity.spawnRunningParticles() and is called both,
Client and server side, it's up to the implementor to client check / server check.
By default vanilla spawns particles only on the client and the server methods no-op.world - The world.pos - The position at the entities feet.entity - The entity running on the block.default boolean addHitEffects(World world, RayTraceResult target, ParticleManager manager)
world - The current worldtarget - The target the player is looking at {x/y/z/side/sub}manager - A reference to the current particle manager.default boolean addDestroyEffects(World world, BlockPos pos, ParticleManager manager)
world - The current worldpos - Position to spawn the particlemanager - A reference to the current particle manager.default boolean canSustainPlant(IBlockReader world, BlockPos pos, Direction facing, IPlantable plantable)
world - The current worldfacing - The direction relative to the given position the plant wants to be, typically its UPplantable - The plant that wants to checkdefault void onPlantGrow(IWorld world, BlockPos pos, BlockPos source)
world - Current worldpos - Block position in worldsource - Source plant's position in worlddefault boolean isFertile(IBlockReader world, BlockPos pos)
world - The current worldpos - Block position in worlddefault boolean isBeaconBase(IWorldReader world, BlockPos pos, BlockPos beacon)
world - The current worldpos - Block position in worldbeacon - Beacon position in worlddefault boolean isConduitFrame(IWorldReader world, BlockPos pos, BlockPos conduit)
world - The current worldpos - Block position in worldconduit - Conduit position in worlddefault boolean isPortalFrame(IWorldReader world, BlockPos pos)
world - The current worldpos - Block position in worlddefault int getExpDrop(IWorldReader world, BlockPos pos, int fortune, int silktouch)
world - The worldpos - Block positionfortune - default BlockState rotate(IWorld world, BlockPos pos, Rotation direction)
default float getEnchantPowerBonus(IWorldReader world, BlockPos pos)
world - The Worldpos - Block position in worlddefault boolean recolorBlock(IWorld world, BlockPos pos, Direction facing, DyeColor color)
state - The current stateworld - The worldpos - Block positionfortune - default void onNeighborChange(IWorldReader world, BlockPos pos, BlockPos neighbor)
world - The worldpos - Block position in worldneighbor - Block position of neighbordefault void observedNeighborChange(World world, BlockPos pos, Block changed, BlockPos changedPos)
observerState - The Observer block's state.world - The current world.pos - The Observer block's position.changed - The updated block.changedPos - The updated block's position.default boolean shouldCheckWeakPower(IWorldReader world, BlockPos pos, Direction 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 sidedefault boolean getWeakChanges(IWorldReader world, BlockPos pos)
world - The current worldpos - Block position in worlddefault ToolType getHarvestTool()
default int getHarvestLevel()
default boolean isToolEffective(ToolType tool)
default SoundType getSoundType(IWorldReader world, BlockPos pos, @Nullable Entity entity)
world - 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 context@Nullable default float[] getBeaconColorMultiplier(IWorldReader world, BlockPos pos, BlockPos beacon)
world - The worldpos - The position of this statebeaconPos - The position of the beacondefault Vec3d getFogColor(IWorldReader world, BlockPos pos, Entity entity, Vec3d originalColor, float partialTicks)
world - The world.pos - The position at the entity viewport.entity - the entityoriginalColor - The current fog color, You are not expected to use this, Return as the default if applicable.default BlockState getStateAtViewpoint(IBlockReader world, BlockPos pos, Vec3d viewpoint)
ActiveRenderInfo#getBlockStateAtEntityViewpoint(World, Entity, float)).
Can be used by fluid blocks to determine if the viewpoint is within the fluid or not.world - the worldpos - the positionviewpoint - the viewpointdefault BlockState getStateForPlacement(Direction facing, BlockState state2, IWorld world, BlockPos pos1, BlockPos pos2, Hand 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 blockdefault boolean canBeConnectedTo(IBlockReader world, BlockPos pos, Direction facing)
world - The current worldpos - The position of this blockfacing - The side the connecting block is ondefault boolean isSlimeBlock()
state - The statedefault boolean isStickyBlock()
state - The statedefault boolean canStickTo(BlockState other)
other - Other blockdefault int getFlammability(IBlockReader world, BlockPos pos, Direction face)
world - The current worldpos - Block position in worldface - The face that the fire is coming fromdefault boolean isFlammable(IBlockReader world, BlockPos pos, Direction face)
world - The current worldpos - Block position in worldface - The face that the fire is coming fromdefault void catchFire(World world, BlockPos pos, @Nullable Direction face, @Nullable LivingEntity igniter)
world - The current worldpos - Block position in worldface - The face that the fire is coming fromigniter - The entity that lit the firedefault int getFireSpreadSpeed(IBlockReader world, BlockPos pos, Direction face)
world - The current worldpos - Block position in worldface - The face that the fire is coming fromdefault boolean isFireSource(IBlockReader world, BlockPos pos, Direction side)
world - The current worldpos - Block position in worldside - The face that the fire is coming fromdefault boolean canEntityDestroy(IBlockReader world, BlockPos pos, Entity entity)
world - The current worldpos - Block position in world@Nullable default Direction[] getValidRotations(IBlockReader world, BlockPos pos)
world - The worldpos - Block position in worlddefault boolean isBurning(IBlockReader world, BlockPos pos)
world - The current worldpos - Block position in world@Nullable default PathNodeType getAiPathNodeType(IBlockReader world, BlockPos pos)
PathNodeType for this block. Return null for vanilla behavior.@Nullable default PathNodeType getAiPathNodeType(IBlockReader world, BlockPos pos, @Nullable MobEntity entity)
PathNodeType for this block. Return null for vanilla behavior.default boolean canDropFromExplosion(IBlockReader world, BlockPos pos, Explosion explosion)
default void onBlockExploded(World world, BlockPos pos, Explosion explosion)
world - The current worldpos - Block position in worldexplosion - The explosion instance affecting the blockdefault boolean collisionExtendsVertically(IBlockReader world, BlockPos pos, Entity collidingEntity)
default boolean shouldDisplayFluidOverlay(ILightReader world, BlockPos pos, IFluidState fluidState)
world - The worldpos - Block position in worldfluidState - The state of the fluid