Interface IForgeBlock
- All Known Implementing Classes:
AbstractBannerBlock
,AbstractBodyPlantBlock
,AbstractButtonBlock
,AbstractChestBlock
,AbstractCoralPlantBlock
,AbstractFireBlock
,AbstractFurnaceBlock
,AbstractGlassBlock
,AbstractPlantBlock
,AbstractPressurePlateBlock
,AbstractRailBlock
,AbstractSignBlock
,AbstractSkullBlock
,AbstractTopPlantBlock
,AirBlock
,AnvilBlock
,AttachedStemBlock
,BambooBlock
,BambooSaplingBlock
,BannerBlock
,BarrelBlock
,BarrierBlock
,BeaconBlock
,BedBlock
,BeehiveBlock
,BeetrootBlock
,BellBlock
,BlastFurnaceBlock
,Block
,BreakableBlock
,BrewingStandBlock
,BubbleColumnBlock
,BushBlock
,CactusBlock
,CakeBlock
,CampfireBlock
,CarpetBlock
,CarrotBlock
,CartographyTableBlock
,CarvedPumpkinBlock
,CauldronBlock
,ChainBlock
,ChestBlock
,ChorusFlowerBlock
,ChorusPlantBlock
,CocoaBlock
,CommandBlockBlock
,ComparatorBlock
,ComposterBlock
,ConcretePowderBlock
,ConduitBlock
,ContainerBlock
,CoralBlock
,CoralFanBlock
,CoralFinBlock
,CoralPlantBlock
,CoralWallFanBlock
,CraftingTableBlock
,CropsBlock
,CryingObsidianBlock
,CustomPlantTypeTest.CustomBlock
,CustomPlantTypeTest.CustomPlantBlock
,CustomRespawnTest.CustomRespawnBlock
,CustomSignsTest.CustomStandingSignBlock
,CustomSignsTest.CustomWallSignBlock
,DaylightDetectorBlock
,DeadBushBlock
,DeadCoralPlantBlock
,DeadCoralWallFanBlock
,DetectorRailBlock
,DirectionalBlock
,DispenserBlock
,DoorBlock
,DoublePlantBlock
,DragonEggBlock
,DropperBlock
,EnchantingTableBlock
,EnderChestBlock
,EndGatewayBlock
,EndPortalBlock
,EndPortalFrameBlock
,EndRodBlock
,FallingBlock
,FarmlandBlock
,FenceBlock
,FenceGateBlock
,FireBlock
,FletchingTableBlock
,FlowerBlock
,FlowerPotBlock
,FlowingFluidBlock
,ForgeChunkManagerTest.ChunkLoaderBlock
,FourWayBlock
,FrostedIceBlock
,FullPotsAccessorDemo.DioriteFlowerPotBlock
,FungusBlock
,FurnaceBlock
,GameData.BlockCallbacks.BlockDummyAir
,GlassBlock
,GlazedTerracottaBlock
,GrassBlock
,GrassPathBlock
,GravelBlock
,GrindstoneBlock
,HayBlock
,HoneyBlock
,HopperBlock
,HorizontalBlock
,HorizontalFaceBlock
,HugeMushroomBlock
,IceBlock
,JigsawBlock
,JukeboxBlock
,KelpBlock
,KelpTopBlock
,LadderBlock
,LanternBlock
,LeavesBlock
,LecternBlock
,LeverBlock
,LilyPadBlock
,LoomBlock
,MagmaBlock
,MelonBlock
,MovingPistonBlock
,MushroomBlock
,MyceliumBlock
,NetherPortalBlock
,NetherrackBlock
,NetherRootsBlock
,NetherSproutsBlock
,NetherWartBlock
,NewFluidTest.FluidloggableBlock
,NoteBlock
,NyliumBlock
,ObserverBlock
,OreBlock
,PaneBlock
,PistonBlock
,PistonHeadBlock
,PotatoBlock
,PoweredRailBlock
,PressurePlateBlock
,PumpkinBlock
,RailBlock
,RedstoneBlock
,RedstoneDiodeBlock
,RedstoneLampBlock
,RedstoneOreBlock
,RedstoneTorchBlock
,RedstoneWallTorchBlock
,RedstoneWireBlock
,RepeaterBlock
,RespawnAnchorBlock
,RotatedPillarBlock
,SandBlock
,SaplingBlock
,ScaffoldingBlock
,ScaffoldingTest.ScaffoldingMethodTestBlock
,SeaGrassBlock
,SeaPickleBlock
,ShulkerBoxBlock
,SilverfishBlock
,SixWayBlock
,SkullBlock
,SkullPlayerBlock
,SkullWallPlayerBlock
,SlabBlock
,SlimeBlock
,SmithingTableBlock
,SmokerBlock
,SnowBlock
,SnowyDirtBlock
,SoulFireBlock
,SoulSandBlock
,SpawnerBlock
,SpongeBlock
,SpreadableSnowyDirtBlock
,StainedGlassBlock
,StainedGlassPaneBlock
,StairsBlock
,StandingSignBlock
,StemBlock
,StemGrownBlock
,StoneButtonBlock
,StonecutterBlock
,StructureBlock
,StructureVoidBlock
,SugarCaneBlock
,SweetBerryBushBlock
,TallFlowerBlock
,TallGrassBlock
,TallSeaGrassBlock
,TargetBlock
,TNTBlock
,TorchBlock
,TrapDoorBlock
,TrappedChestBlock
,TripWireBlock
,TripWireHookBlock
,TurtleEggBlock
,TwistingVinesBlock
,TwistingVinesTopBlock
,VineBlock
,WallBannerBlock
,WallBlock
,WallSignBlock
,WallSkullBlock
,WallTorchBlock
,WebBlock
,WeepingVinesBlock
,WeepingVinesTopBlock
,WeightedPressurePlateBlock
,WetSpongeBlock
,WitherRoseBlock
,WitherSkeletonSkullBlock
,WitherSkeletonWallSkullBlock
,WoodButtonBlock
public interface IForgeBlock
-
Method Summary
Modifier and TypeMethodDescriptiondefault boolean
addDestroyEffects
(BlockState state, World world, BlockPos pos, ParticleManager manager) Spawn particles for when the block is destroyed.default boolean
addHitEffects
(BlockState state, 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
(BlockState state1, 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
(BlockState state, World world, BlockPos pos, Entity entity) Allows a block to override the standard vanilla running particles.default boolean
canBeReplacedByLeaves
(BlockState state, IWorldReader world, BlockPos pos) Used during tree growth to determine if newly generated leaves can replace this block.default boolean
canBeReplacedByLogs
(BlockState state, IWorldReader world, BlockPos pos) Used during tree growth to determine if newly generated logs can replace this block.default boolean
canConnectRedstone
(BlockState state, 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
(BlockState state, IBlockReader 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
(BlockState state, IBlockReader world, BlockPos pos, Explosion explosion) Determines if this block should drop loot when exploded.default boolean
canEntityDestroy
(BlockState state, IBlockReader world, BlockPos pos, Entity entity) Determines if this block is can be destroyed by the specified entities normal behavior.default boolean
canHarvestBlock
(BlockState state, 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 state, BlockState other) Determines if this block can stick to another block when pushed by a piston.boolean
canSustainPlant
(BlockState state, IBlockReader world, BlockPos pos, Direction facing, IPlantable plantable) Determines if this block can support the passed in plant, allowing it to be planted and grow.default void
catchFire
(BlockState state, 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
(BlockState state, 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
(BlockState state, IBlockReader world) Called throughout the code as a replacement for ITileEntityProvider.createNewTileEntity Return the same thing you would from that function.default PathNodeType
getAiPathNodeType
(BlockState state, IBlockReader world, BlockPos pos, MobEntity entity) Get thePathNodeType
for this block.default float[]
getBeaconColorMultiplier
(BlockState state, IWorldReader world, BlockPos pos, BlockPos beaconPos) default Direction
getBedDirection
(BlockState state, IWorldReader world, BlockPos pos) Returns the direction of the block.getBedSpawnPosition
(EntityType<?> entityType, BlockState state, IWorldReader world, BlockPos pos, float orientation, LivingEntity sleeper) Deprecated.default Block
getBlock()
default float
getEnchantPowerBonus
(BlockState state, IWorldReader world, BlockPos pos) Determines the amount of enchanting power this block can provide to an enchanting table.default int
getExpDrop
(BlockState state, IWorldReader world, BlockPos pos, int fortune, int silktouch) Gathers how much experience this block drops when broken.default float
getExplosionResistance
(BlockState state, IBlockReader world, BlockPos pos, Explosion explosion) Location sensitive version of getExplosionResistancedefault int
getFireSpreadSpeed
(BlockState state, IBlockReader world, BlockPos pos, Direction face) Called when fire is updating on a neighbor block.default int
getFlammability
(BlockState state, IBlockReader world, BlockPos pos, Direction face) Chance that fire will spread and consume this block.default Vector3d
getFogColor
(BlockState state, IWorldReader world, BlockPos pos, Entity entity, Vector3d originalColor, float partialTicks) Use this to change the fog color used when the entity is "inside" a material.int
getHarvestLevel
(BlockState state) Queries the harvest level of this item stack for the specified tool class, Returns -1 if this tool is not of the specified typegetHarvestTool
(BlockState state) 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
(BlockState state, 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 15default ItemStack
getPickBlock
(BlockState state, RayTraceResult target, IBlockReader world, BlockPos pos, PlayerEntity player) Called when A user uses the creative pick block button on this blockgetRespawnPosition
(BlockState state, EntityType<?> type, IWorldReader world, BlockPos pos, float orientation, LivingEntity entity) Returns the position that the entity is moved to upon respawning at this block.default float
getSlipperiness
(BlockState state, IWorldReader world, BlockPos pos, Entity entity) Gets the slipperiness at the given location at the given state.default SoundType
getSoundType
(BlockState state, IWorldReader world, BlockPos pos, Entity entity) Sensitive version of getSoundTypedefault BlockState
getStateAtViewpoint
(BlockState state, IBlockReader world, BlockPos pos, Vector3d viewpoint) Used to determine the state 'viewed' by an entity (seeActiveRenderInfo#getBlockStateAtEntityViewpoint(World, Entity, float)
).getTags()
Retrieves a list of tags names this is known to be associated with.default BlockState
getToolModifiedState
(BlockState state, World world, BlockPos pos, PlayerEntity player, ItemStack stack, ToolType toolType) Returns the state that this block should transform into when right clicked by a tool.default boolean
getWeakChanges
(BlockState state, IWorldReader world, BlockPos pos) If this block should be notified of weak changes.default boolean
hasTileEntity
(BlockState 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.default boolean
isAir
(BlockState state, IBlockReader world, BlockPos pos) Determines this block should be treated as an air block by the rest of the code.default boolean
isBed
(BlockState state, IBlockReader 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.default boolean
isBurning
(BlockState state, 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
(BlockState state, IWorldReader world, BlockPos pos, BlockPos conduit) Determines if this block can be used as the frame of a conduit.default boolean
isFertile
(BlockState state, 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
(BlockState state, IWorldReader world, BlockPos pos, Direction side) Currently only called by fire when it is on top of this block.default boolean
isFlammable
(BlockState state, IBlockReader world, BlockPos pos, Direction face) Called when fire is updating, checks if a block face can catch fire.default boolean
isLadder
(BlockState state, IWorldReader world, BlockPos pos, LivingEntity entity) Checks if a player or entity can use this block to 'climb' like a ladder.default boolean
isPortalFrame
(BlockState state, IBlockReader world, BlockPos pos) Determines if this block can be used as part of a frame of a nether portal.default boolean
isScaffolding
(BlockState state, IWorldReader world, BlockPos pos, LivingEntity entity) Checks if a player or entity handles movement on this block like scaffolding.default boolean
isSlimeBlock
(BlockState state) default boolean
isStickyBlock
(BlockState state) default boolean
isToolEffective
(BlockState state, ToolType tool) Checks if the specified tool type is efficient on this block, meaning that it digs at full speed.default boolean
makesOpenTrapdoorAboveClimbable
(BlockState state, IWorldReader world, BlockPos pos, BlockState trapdoorState) Checks if this block makes an open trapdoor above it climbable.default void
observedNeighborChange
(BlockState observerState, World world, BlockPos observerPos, Block changedBlock, BlockPos changedBlockPos) Deprecated.default void
onBlockExploded
(BlockState state, World world, BlockPos pos, Explosion explosion) Called when the block is destroyed by an explosion.default void
onNeighborChange
(BlockState state, 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
(BlockState state, IWorld world, BlockPos pos, BlockPos source) Deprecated.default boolean
removedByPlayer
(BlockState state, World world, BlockPos pos, PlayerEntity player, boolean willHarvest, FluidState fluid) Called when a player removes a block.default BlockState
rotate
(BlockState state, IWorld world, BlockPos pos, Rotation direction) default void
setBedOccupied
(BlockState state, World world, BlockPos pos, LivingEntity sleeper, boolean occupied) Called when a user either starts or stops sleeping in the bed.default boolean
shouldCheckWeakPower
(BlockState state, 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
(BlockState state, IBlockDisplayReader world, BlockPos pos, FluidState fluidState) Called to determine whether this block should use the fluid overlay texture or flowing texture when it is placed under the fluid.
-
Method Details
-
getBlock
-
getSlipperiness
default float getSlipperiness(BlockState state, IWorldReader world, BlockPos pos, @Nullable Entity entity) Gets the slipperiness at the given location at the given state. Normally between 0 and 1.Note that entities may reduce slipperiness by a certain factor of their own; for
LivingEntity
, this is.91
.ItemEntity
uses.98
, andFishingBobberEntity
uses.92
.- Parameters:
state
- state of the blockworld
- the worldpos
- the position in the worldentity
- the entity in question- Returns:
- the factor by which the entity's motion should be multiplied
-
getLightValue
Get a light value for this block, taking into account the given state and coordinates, normal ranges are between 0 and 15- Parameters:
state
-world
-pos
-- Returns:
- The light value
-
isLadder
Checks if a player or entity can use this block to 'climb' like a ladder.- Parameters:
state
- The current stateworld
- The current worldpos
- Block position in worldentity
- The entity trying to use the ladder, CAN be null.- Returns:
- True if the block should act like a ladder
-
makesOpenTrapdoorAboveClimbable
default boolean makesOpenTrapdoorAboveClimbable(BlockState state, IWorldReader world, BlockPos pos, BlockState trapdoorState) Checks if this block makes an open trapdoor above it climbable.- Parameters:
state
- The current stateworld
- The current worldpos
- Block position in worldtrapdoorState
- The current state of the open trapdoor above- Returns:
- True if the block should act like a ladder
-
isBurning
Determines if this block should set fire and deal fire damage to entities coming into contact with it.- Parameters:
world
- The current worldpos
- Block position in world- Returns:
- True if the block should deal damage
-
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. Return true from this function to specify this block has a tile entity.- Parameters:
state
- State of the current block- Returns:
- True if block has a tile entity, false otherwise
-
createTileEntity
Called throughout the code as a replacement for ITileEntityProvider.createNewTileEntity Return the same thing you would from that function. This will fall back to ITileEntityProvider.createNewTileEntity(World) if this block is a ITileEntityProvider- Parameters:
state
- The state of the current blockworld
- The world to create the TE in- Returns:
- A instance of a class extending TileEntity
-
canHarvestBlock
default boolean canHarvestBlock(BlockState state, IBlockReader world, BlockPos pos, PlayerEntity player) Determines if the player can harvest this block, obtaining it's drops when the block is destroyed.- Parameters:
world
- The current worldpos
- The block's current positionplayer
- The player damaging the block- Returns:
- True to spawn the drops
-
removedByPlayer
default boolean removedByPlayer(BlockState state, World world, BlockPos pos, PlayerEntity player, boolean willHarvest, FluidState fluid) Called when a player removes a block. This is responsible for actually destroying the block, and the block is intact at time of call. This is called regardless of whether the player can harvest the block or not. Return true if the block is actually destroyed. Note: When used in multiplayer, this is called on both client and server sides!- Parameters:
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 harvestBlockfluid
- The current fluid state at current position- Returns:
- True if the block is actually destroyed.
-
isBed
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.- Parameters:
state
- The current stateworld
- The current worldpos
- Block position in worldplayer
- The player or camera entity, null in some cases.- Returns:
- True to treat this as a bed
-
getRespawnPosition
default Optional<Vector3d> getRespawnPosition(BlockState state, EntityType<?> type, IWorldReader world, BlockPos pos, float orientation, @Nullable LivingEntity entity) Returns the position that the entity is moved to upon respawning at this block.- Parameters:
state
- The current stateworld
- The current worldpos
- Block position in worldorientation
- The angle the entity had when setting the respawn pointentity
- The entity respawning, often null- Returns:
- The spawn position or the empty optional if respawning here is not possible
-
canCreatureSpawn
default boolean canCreatureSpawn(BlockState state, IBlockReader 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.- Parameters:
state
- The current stateworld
- The current worldpos
- Block position in worldtype
- The Mob Category Type- Returns:
- True to allow a mob of the specified category to spawn, false to prevent it.
-
getBedSpawnPosition
@Deprecated default Optional<Vector3d> getBedSpawnPosition(EntityType<?> entityType, BlockState state, IWorldReader world, BlockPos pos, float orientation, @Nullable LivingEntity sleeper) Deprecated.Returns the position that the sleeper is moved to upon waking up, or respawning at the bed.- Parameters:
state
- The current stateworld
- The current worldpos
- Block position in worldorientation
- The direction the entity is facing while getting into bed.sleeper
- The sleeper or camera entity, null in some cases.- Returns:
- The spawn position
-
setBedOccupied
default void setBedOccupied(BlockState state, World world, BlockPos pos, LivingEntity sleeper, boolean occupied) Called when a user either starts or stops sleeping in the bed.- Parameters:
state
-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 bed
-
getBedDirection
Returns the direction of the block. Same values that are returned by BlockDirectional. Called every frame tick for every living entity. Be VERY fast.- Parameters:
state
- The current stateworld
- The current worldpos
- Block position in world- Returns:
- Bed direction
-
isAir
Determines this block should be treated as an air block by the rest of the code. This method is primarily useful for creating pure logic-blocks that will be invisible to the player and otherwise interact as air would.- Parameters:
state
- The current stateworld
- The current worldpos
- Block position in world- Returns:
- True if the block considered air
-
canBeReplacedByLeaves
Used during tree growth to determine if newly generated leaves can replace this block.- Parameters:
state
- The current stateworld
- The current worldpos
- Block position in world- Returns:
- true if this block can be replaced by growing leaves.
-
canBeReplacedByLogs
Used during tree growth to determine if newly generated logs can replace this block.- Parameters:
state
- The current stateworld
- The current worldpos
- Block position in world- Returns:
- true if this block can be replaced by growing leaves.
-
getExplosionResistance
default float getExplosionResistance(BlockState state, IBlockReader world, BlockPos pos, Explosion explosion) Location sensitive version of getExplosionResistance- Parameters:
world
- The current worldpos
- Block position in worldexplosion
- The explosion- Returns:
- The amount of the explosion absorbed.
-
canConnectRedstone
default boolean canConnectRedstone(BlockState state, IBlockReader world, BlockPos pos, @Nullable 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.- Parameters:
state
- The current stateworld
- The current worldpos
- Block position in worldside
- The side that is trying to make the connection, CAN BE NULL- Returns:
- True to make the connection
-
getPickBlock
default ItemStack getPickBlock(BlockState state, RayTraceResult target, IBlockReader world, BlockPos pos, PlayerEntity player) Called when A user uses the creative pick block button on this block- Parameters:
target
- The full target the player is looking at- Returns:
- A ItemStack to add to the player's inventory, empty itemstack if nothing should be added.
-
addLandingEffects
default boolean addLandingEffects(BlockState state1, 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.- Parameters:
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 spawned- Returns:
- True to prevent vanilla landing particles from spawning
-
addRunningEffects
Allows a block to override the standard vanilla running particles. This is called fromEntity#handleRunningEffect
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.- Parameters:
state
- The BlockState the entity is running on.world
- The world.pos
- The position at the entities feet.entity
- The entity running on the block.- Returns:
- True to prevent vanilla running particles from spawning.
-
addHitEffects
default boolean addHitEffects(BlockState state, 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. Useful when you have entirely different texture sheets for different sides/locations in the world.- Parameters:
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.- Returns:
- True to prevent vanilla digging particles form spawning.
-
addDestroyEffects
default boolean addDestroyEffects(BlockState state, World world, BlockPos pos, ParticleManager manager) Spawn particles for when the block is destroyed. Due to the nature of how this is invoked, the x/y/z locations are not always guaranteed to host your block. So be sure to do proper sanity checks before assuming that the location is this block.- Parameters:
world
- The current worldpos
- Position to spawn the particlemanager
- A reference to the current particle manager.- Returns:
- True to prevent vanilla break particles from spawning.
-
canSustainPlant
boolean canSustainPlant(BlockState state, IBlockReader world, BlockPos pos, Direction facing, IPlantable plantable) Determines if this block can support the passed in plant, allowing it to be planted and grow. Some examples: Reeds check if its a reed, or if its sand/dirt/grass and adjacent to water Cacti checks if its a cacti, or if its sand Nether types check for soul sand Crops check for tilled soil Caves check if it's a solid surface Plains check if its grass or dirt Water check if its still water- Parameters:
state
- The Current stateworld
- The current worldfacing
- The direction relative to the given position the plant wants to be, typically its UPplantable
- The plant that wants to check- Returns:
- True to allow the plant to be planted/stay.
-
onPlantGrow
Deprecated.Called when a plant grows on this block, only implemented for saplings using the WorldGen*Trees classes right now. Modder may implement this for custom plants. This does not use ForgeDirection, because large/huge trees can be located in non-representable direction, so the source location is specified. Currently this just changes the block to dirt if it was grass. Note: This happens DURING the generation, the generation may not be complete when this is called.- Parameters:
state
- The current stateworld
- Current worldpos
- Block position in worldsource
- Source plant's position in world
-
isFertile
Checks if this soil is fertile, typically this means that growth rates of plants on this soil will be slightly sped up. Only vanilla case is tilledField when it is within range of water.- Parameters:
world
- The current worldpos
- Block position in world- Returns:
- True if the soil should be considered fertile.
-
isConduitFrame
default boolean isConduitFrame(BlockState state, IWorldReader world, BlockPos pos, BlockPos conduit) Determines if this block can be used as the frame of a conduit.- Parameters:
world
- The current worldpos
- Block position in worldconduit
- Conduit position in world- Returns:
- True, to support the conduit, and make it active with this block.
-
isPortalFrame
Determines if this block can be used as part of a frame of a nether portal.- Parameters:
state
- The current stateworld
- The current worldpos
- Block position in world- Returns:
- True, to support being part of a nether portal frame, false otherwise.
-
getExpDrop
default int getExpDrop(BlockState state, IWorldReader world, BlockPos pos, int fortune, int silktouch) Gathers how much experience this block drops when broken.- Parameters:
state
- The current stateworld
- The worldpos
- Block positionfortune
-- Returns:
- Amount of XP from breaking this block.
-
rotate
-
getEnchantPowerBonus
Determines the amount of enchanting power this block can provide to an enchanting table.- Parameters:
world
- The Worldpos
- Block position in world- Returns:
- The amount of enchanting power this block produces.
-
onNeighborChange
default void onNeighborChange(BlockState state, IWorldReader world, BlockPos pos, BlockPos neighbor) Called when a tile entity on a side of this block changes is created or is destroyed.- Parameters:
world
- The worldpos
- Block position in worldneighbor
- Block position of neighbor
-
observedNeighborChange
@Deprecated default void observedNeighborChange(BlockState observerState, World world, BlockPos observerPos, Block changedBlock, BlockPos changedBlockPos) Deprecated.Called on an Observer block whenever an update for an Observer is received.- Parameters:
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.
-
shouldCheckWeakPower
default boolean shouldCheckWeakPower(BlockState state, 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.- Parameters:
world
- The worldpos
- Block position in worldside
- The INPUT side of the block to be powered - ie the opposite of this block's output side- Returns:
- Whether Block#isProvidingWeakPower should be called when determining indirect power
-
getWeakChanges
If this block should be notified of weak changes. Weak changes are changes 1 block away through a solid block. Similar to comparators.- Parameters:
world
- The current worldpos
- Block position in world- Returns:
- true To be notified of changes
-
getHarvestTool
Queries the class of tool required to harvest this block, if null is returned we assume that anything can harvest this block. -
getHarvestLevel
Queries the harvest level of this item stack for the specified tool class, Returns -1 if this tool is not of the specified type- Returns:
- Harvest level, or -1 if not the specified tool type.
-
isToolEffective
Checks if the specified tool type is efficient on this block, meaning that it digs at full speed. -
getSoundType
default SoundType getSoundType(BlockState state, IWorldReader world, BlockPos pos, @Nullable Entity entity) Sensitive version of getSoundType- Parameters:
state
- The stateworld
- The worldpos
- The position. Note that the world may not necessarily havestate
here!entity
- The entity that is breaking/stepping on/placing/hitting/falling on this block, or null if no entity is in this context- Returns:
- A SoundType to use
-
getBeaconColorMultiplier
@Nullable default float[] getBeaconColorMultiplier(BlockState state, IWorldReader world, BlockPos pos, BlockPos beaconPos) - Parameters:
state
- The stateworld
- The worldpos
- The position of this statebeaconPos
- The position of the beacon- Returns:
- A float RGB [0.0, 1.0] array to be averaged with a beacon's existing beam color, or null to do nothing to the beam
-
getFogColor
default Vector3d getFogColor(BlockState state, IWorldReader world, BlockPos pos, Entity entity, Vector3d originalColor, float partialTicks) Use this to change the fog color used when the entity is "inside" a material. Vec3d is used here as "r/g/b" 0 - 1 values.- Parameters:
world
- The world.pos
- The position at the entity viewport.state
- The state at the entity viewport.entity
- the entityoriginalColor
- The current fog color, You are not expected to use this, Return as the default if applicable.- Returns:
- The new fog color.
-
getStateAtViewpoint
default BlockState getStateAtViewpoint(BlockState state, IBlockReader world, BlockPos pos, Vector3d viewpoint) Used to determine the state 'viewed' by an entity (seeActiveRenderInfo#getBlockStateAtEntityViewpoint(World, Entity, float)
). Can be used by fluid blocks to determine if the viewpoint is within the fluid or not.- Parameters:
state
- the stateworld
- the worldpos
- the positionviewpoint
- the viewpoint- Returns:
- the block state that should be 'seen'
-
getAiPathNodeType
@Nullable default PathNodeType getAiPathNodeType(BlockState state, IBlockReader world, BlockPos pos, @Nullable MobEntity entity) Get thePathNodeType
for this block. Returnnull
for vanilla behavior.- Returns:
- the PathNodeType
-
isSlimeBlock
- Parameters:
state
- The state- Returns:
- true if the block is sticky block which used for pull or push adjacent blocks (use by piston)
-
isStickyBlock
- Parameters:
state
- The state- Returns:
- true if the block is sticky block which used for pull or push adjacent blocks (use by piston)
-
canStickTo
Determines if this block can stick to another block when pushed by a piston.- Parameters:
state
- My stateother
- Other block- Returns:
- True to link blocks
-
getFlammability
Chance that fire will spread and consume this block. 300 being a 100% chance, 0, being a 0% chance.- Parameters:
state
- The current stateworld
- The current worldpos
- Block position in worldface
- The face that the fire is coming from- Returns:
- A number ranging from 0 to 300 relating used to determine if the block will be consumed by fire
-
isFlammable
Called when fire is updating, checks if a block face can catch fire.- Parameters:
state
- The current stateworld
- The current worldpos
- Block position in worldface
- The face that the fire is coming from- Returns:
- True if the face can be on fire, false otherwise.
-
catchFire
default void catchFire(BlockState state, World world, BlockPos pos, @Nullable Direction face, @Nullable LivingEntity igniter) If the block is flammable, this is called when it gets lit on fire.- Parameters:
state
- The current stateworld
- The current worldpos
- Block position in worldface
- The face that the fire is coming fromigniter
- The entity that lit the fire
-
getFireSpreadSpeed
Called when fire is updating on a neighbor block. The higher the number returned, the faster fire will spread around this block.- Parameters:
state
- The current stateworld
- The current worldpos
- Block position in worldface
- The face that the fire is coming from- Returns:
- A number that is used to determine the speed of fire growth around the block
-
isFireSource
Currently only called by fire when it is on top of this block. Returning true will prevent the fire from naturally dying during updating. Also prevents firing from dying from rain.- Parameters:
state
- The current stateworld
- The current worldpos
- Block position in worldside
- The face that the fire is coming from- Returns:
- True if this block sustains fire, meaning it will never go out.
-
canEntityDestroy
Determines if this block is can be destroyed by the specified entities normal behavior.- Parameters:
state
- The current stateworld
- The current worldpos
- Block position in world- Returns:
- True to allow the ender dragon to destroy this block
-
canDropFromExplosion
default boolean canDropFromExplosion(BlockState state, IBlockReader world, BlockPos pos, Explosion explosion) Determines if this block should drop loot when exploded. -
getTags
Set<ResourceLocation> getTags()Retrieves a list of tags names this is known to be associated with. This should be used in favor of TagCollection.getOwningTags, as this caches the result and automatically updates when the TagCollection changes. -
onBlockExploded
Called when the block is destroyed by an explosion. Useful for allowing the block to take into account tile entities, state, etc. when exploded, before it is removed.- Parameters:
world
- The current worldpos
- Block position in worldexplosion
- The explosion instance affecting the block
-
collisionExtendsVertically
default boolean collisionExtendsVertically(BlockState state, 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. Use this to replicate fence and wall behavior. -
shouldDisplayFluidOverlay
default boolean shouldDisplayFluidOverlay(BlockState state, IBlockDisplayReader world, BlockPos pos, FluidState fluidState) Called to determine whether this block should use the fluid overlay texture or flowing texture when it is placed under the fluid.- Parameters:
state
- The current stateworld
- The worldpos
- Block position in worldfluidState
- The state of the fluid- Returns:
- Whether the fluid overlay texture should be used
-
getToolModifiedState
@Nullable default BlockState getToolModifiedState(BlockState state, World world, BlockPos pos, PlayerEntity player, ItemStack stack, ToolType toolType) Returns the state that this block should transform into when right clicked by a tool. For example: Used to determine if an axe can strip, a shovel can path, or a hoe can till. Return null if vanilla behavior should be disabled.- Parameters:
state
- The current stateworld
- The worldpos
- The block position in worldplayer
- The player clicking the blockstack
- The stack being used by the player- Returns:
- The resulting state after the action has been performed
-
isScaffolding
default boolean isScaffolding(BlockState state, IWorldReader world, BlockPos pos, LivingEntity entity) Checks if a player or entity handles movement on this block like scaffolding.- Parameters:
state
- The current stateworld
- The current worldpos
- The block position in worldentity
- The entity on the scaffolding- Returns:
- True if the block should act like scaffolding
-
getRespawnPosition(BlockState, EntityType, IWorldReader, BlockPos, float, LivingEntity)