Drop Terminal items on block break
This commit is contained in:
parent
5b314120a7
commit
2d3ac4538d
|
@ -46,6 +46,15 @@ class TerminalBlock: DeviceBlock<TerminalBlockEntity>(
|
|||
return ActionResult.SUCCESS
|
||||
}
|
||||
|
||||
override fun onStateReplaced(state: BlockState, world: World, pos: BlockPos, newState: BlockState, moved: Boolean) {
|
||||
if (!state.isOf(newState.block)) {
|
||||
val be = getBlockEntity(world, pos)!!
|
||||
ItemScatterer.spawn(world, pos, be.internalBuffer)
|
||||
|
||||
super.onStateReplaced(state, world, pos, newState, moved)
|
||||
}
|
||||
}
|
||||
|
||||
override fun addAllAttributes(world: World, pos: BlockPos, state: BlockState, to: AttributeList<*>) {
|
||||
to.offer(getBlockEntity(world, pos))
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue