Fix gracefulBlockBreak not dropping correct blockentity drops

This commit is contained in:
DBotThePony 2023-07-06 14:06:57 +07:00
parent a935ce6874
commit 27908cfe83
Signed by: DBot
GPG Key ID: DCC23B5715498507

View File

@ -231,10 +231,12 @@ fun BlockState.getExplosionResistance(level: BlockGetter, pos: BlockPos): Float
}
fun Level.gracefulBlockBreak(blockPos: BlockPos, block: BlockState = getBlockState(blockPos)) {
block.onRemove(this, blockPos, Blocks.AIR.defaultBlockState(), false)
Block.dropResources(block, this, blockPos, getBlockEntity(blockPos))
val tile = getBlockEntity(blockPos)
val state = block.fluidState.createLegacyBlock()
block.onRemove(this, blockPos, state, false)
Block.dropResources(block, this, blockPos, tile)
block.block.destroy(this, blockPos, block)
setBlock(blockPos, block.fluidState.createLegacyBlock(), Block.UPDATE_ALL)
setBlock(blockPos, state, Block.UPDATE_ALL)
}
fun <E> MutableCollection<E>.addAll(elements: Iterator<E>) {