Let upright posts support torches on top.

This commit is contained in:
Chicken-Bones committed 2015-03-25 13:42:54 +10:00
1 parent 8872d700aa
commit 8f17874412
4 files changed
+19 -8

No files matched your search

@@ -259,4 +259,6 @@ class PostMicroblock(shape$:Byte = 0, material$:Int = 0) extends Microblock(shap
}
def getResistanceFactor = PostMicroClass.getResistanceFactor
override def canPlaceTorchOnTop = getShape == 0
}
@@ -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)
@@ -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
@@ -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)