mirror of
https://github.com/MinecraftForge/MinecraftForge.git
synced 2026-11-13 16:54:22 +00:00
Re-implement state.onBlockExploded() Closes #5914
This commit is contained in:
1 parent
d88e4fbf36
commit
983e0a93db
3 files changed
+40
-2
No files matched your search
@@ -1009,4 +1009,19 @@ public interface IForgeBlock
|
||||
* This should be used in favor of TagCollection.getOwningTags, as this caches the result and automatically updates when the TagCollection changes.
|
||||
*/
|
||||
Set<ResourceLocation> getTags();
|
||||
|
||||
/**
|
||||
* 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.
|
||||
*
|
||||
* @param world The current world
|
||||
* @param pos Block position in world
|
||||
* @param explosion The explosion instance affecting the block
|
||||
*/
|
||||
default void onBlockExploded(BlockState state, World world, BlockPos pos, Explosion explosion)
|
||||
{
|
||||
world.setBlockState(pos, Blocks.AIR.getDefaultState(), 3);
|
||||
getBlock().onExplosionDestroy(world, pos, explosion);
|
||||
}
|
||||
}
|
||||
@@ -853,4 +853,18 @@ public interface IForgeBlockState
|
||||
{
|
||||
return getBlockState().getBlock().canDropFromExplosion(getBlockState(), world, pos, explosion);
|
||||
}
|
||||
|
||||
/**
|
||||
* 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.
|
||||
*
|
||||
* @param world The current world
|
||||
* @param pos Block position in world
|
||||
* @param explosion The explosion instance affecting the block
|
||||
*/
|
||||
default void onBlockExploded(World world, BlockPos pos, Explosion explosion)
|
||||
{
|
||||
getBlockState().getBlock().onBlockExploded(getBlockState(), world, pos, explosion);
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user