Fixed inventories not dropping their contents when broken.

This commit is contained in:
Florian Nücke 2015-01-08 15:49:33 +01:00
parent 75e19824a3
commit 789c8b600d

View File

@ -16,7 +16,6 @@ import net.minecraft.entity.player.EntityPlayer
import net.minecraft.item.EnumDyeColor
import net.minecraft.item.EnumRarity
import net.minecraft.item.ItemStack
import net.minecraft.tileentity.TileEntity
import net.minecraft.util._
import net.minecraft.world.IBlockAccess
import net.minecraft.world.World
@ -118,12 +117,12 @@ abstract class SimpleBlock(material: Material = Material.iron) extends BlockCont
override def getValidRotations(world: World, pos: BlockPos) = validRotations_
override def harvestBlock(world: World, player: EntityPlayer, pos: BlockPos, state: IBlockState, te: TileEntity) = {
if (!world.isRemote) te match {
override def breakBlock(world: World, pos: BlockPos, state: IBlockState): Unit = {
if (!world.isRemote) world.getTileEntity(pos) match {
case inventory: Inventory => inventory.dropAllSlots()
case _ => // Ignore.
}
super.harvestBlock(world, player, pos, state, te)
super.breakBlock(world, pos, state)
}
// ----------------------------------------------------------------------- //