diff --git a/src/codechicken/microblock/EdgeMicroblock.scala b/src/codechicken/microblock/EdgeMicroblock.scala index cc2708b..bbb993c 100644 --- a/src/codechicken/microblock/EdgeMicroblock.scala +++ b/src/codechicken/microblock/EdgeMicroblock.scala @@ -259,4 +259,6 @@ class PostMicroblock(shape$:Byte = 0, material$:Int = 0) extends Microblock(shap } def getResistanceFactor = PostMicroClass.getResistanceFactor + + override def canPlaceTorchOnTop = getShape == 0 } \ No newline at end of file diff --git a/src/codechicken/multipart/BlockMultipart.scala b/src/codechicken/multipart/BlockMultipart.scala index 9b0eb51..1a22880 100644 --- a/src/codechicken/multipart/BlockMultipart.scala +++ b/src/codechicken/multipart/BlockMultipart.scala @@ -74,6 +74,12 @@ class BlockMultipart extends Block(Material.rock) override def isSideSolid(world:IBlockAccess, x:Int, y:Int, z:Int, side:ForgeDirection):Boolean = isBlockSolid(world, x, y, z, side.ordinal()) + override def canPlaceTorchOnTop(world:World, x:Int, y:Int, z:Int) = + getTile(world, x, y, z) match { + case null => false + case tile => tile.canPlaceTorchOnTop + } + override def onNeighborBlockChange(world:World, x:Int, y:Int, z:Int, block:Block) { val tile = getTile(world, x, y, z) if(tile != null) diff --git a/src/codechicken/multipart/TMultiPart.scala b/src/codechicken/multipart/TMultiPart.scala index 9761766..424608f 100644 --- a/src/codechicken/multipart/TMultiPart.scala +++ b/src/codechicken/multipart/TMultiPart.scala @@ -114,6 +114,11 @@ abstract class TMultiPart */ def getLightValue = 0 + /** + * If any part returns true for this, torches can be placed. Vanilla hacks... + */ + def canPlaceTorchOnTop = false + /** * Explosion resistance of the host tile is the maximum explosion resistance of the contained parts * @param entity The entity responsible for this explosion diff --git a/src/codechicken/multipart/TileMultipart.scala b/src/codechicken/multipart/TileMultipart.scala index 3a52f59..f294cb0 100644 --- a/src/codechicken/multipart/TileMultipart.scala +++ b/src/codechicken/multipart/TileMultipart.scala @@ -206,15 +206,13 @@ class TileMultipart extends TileEntity with IChunkLoadTile worldObj.notifyBlocksOfNeighborChange(pos.x, pos.y, pos.z, MultipartProxy.block) } - def isSolid(side:Int):Boolean = - { - val part = partMap(side) - if(part != null) - return part.asInstanceOf[TFacePart].solid(side) - - return false + def isSolid(side:Int) = partMap(side) match { + case face:TFacePart => face.solid(side) + case _ => false } - + + def canPlaceTorchOnTop = partList.exists(_.canPlaceTorchOnTop) || isSolid(1) + private def setTicking(tick:Boolean) { if(doesTick == tick)