From efee4609216542c2eeac07f8edf8474b5bf620a3 Mon Sep 17 00:00:00 2001 From: Chicken-Bones Date: Thu, 26 Jun 2014 20:46:02 +1000 Subject: [PATCH] Revert interactions to default when interfacing with an empty tile --- .../multipart/BlockMultipart.scala | 26 +++++++------------ src/codechicken/multipart/TileMultipart.scala | 2 +- 2 files changed, 10 insertions(+), 18 deletions(-) diff --git a/src/codechicken/multipart/BlockMultipart.scala b/src/codechicken/multipart/BlockMultipart.scala index 81297ea..9b0eb51 100644 --- a/src/codechicken/multipart/BlockMultipart.scala +++ b/src/codechicken/multipart/BlockMultipart.scala @@ -25,24 +25,16 @@ import scala.collection.JavaConversions._ object BlockMultipart { - def getTile(world:IBlockAccess, x:Int, y:Int, z:Int):TileMultipart = - { - val tile = world.getTileEntity(x, y, z) - if(tile.isInstanceOf[TileMultipart]) - tile.asInstanceOf[TileMultipart] - else - null + def getTile(world:IBlockAccess, x:Int, y:Int, z:Int) = world.getTileEntity(x, y, z) match { + case t:TileMultipart if !t.partList.isEmpty => t + case _ => null } - - def getClientTile(world:IBlockAccess, x:Int, y:Int, z:Int):TileMultipartClient = - { - val tile = world.getTileEntity(x, y, z) - if(tile.isInstanceOf[TileMultipartClient]) - tile.asInstanceOf[TileMultipartClient] - else - null + + def getClientTile(world:IBlockAccess, x:Int, y:Int, z:Int) = world.getTileEntity(x, y, z) match { + case t:TileMultipartClient if !t.partList.isEmpty => t + case _ => null } - + def reduceMOP(hit:MovingObjectPosition):(Int, ExtendedMOP) = { val ehit = hit.asInstanceOf[ExtendedMOP] val data:(Int, _) = ExtendedMOP.getData(hit) @@ -296,7 +288,7 @@ class BlockMultipart extends Block(Material.rock) override def getWeakChanges(world:IBlockAccess, x:Int, y:Int, z:Int) = getTile(world, x, y, z) match { case null => false - case tile => tile.getWeakChanges() + case tile => tile.getWeakChanges } override def canProvidePower = true diff --git a/src/codechicken/multipart/TileMultipart.scala b/src/codechicken/multipart/TileMultipart.scala index 4b86eb2..bf0ad83 100644 --- a/src/codechicken/multipart/TileMultipart.scala +++ b/src/codechicken/multipart/TileMultipart.scala @@ -173,7 +173,7 @@ class TileMultipart extends TileEntity /** * Blank implementation, overriden by TTileChangeTile */ - def getWeakChanges() = false + def getWeakChanges = false def getLightValue = partList.view.map(_.getLightValue).max