Made empty multipart block replaceable

This commit is contained in:
Chicken Bones committed 2013-09-10 20:20:08 +10:00
1 parent f17fa03f98
commit af07735e7c
2 files changed
+17 -10

No files matched your search

+13 -4
View File
@@ -174,7 +174,15 @@ trait BlockMultipart extends Block
override def getRenderType() = TileMultipart.renderID
override def isAirBlock(world:World, x:Int, y:Int, z:Int) = getTile(world, x, y, z) == null || getTile(world, x, y, z).partList.isEmpty
override def isAirBlock(world:World, x:Int, y:Int, z:Int):Boolean =
{
return getTile(world, x, y, z) match {
case null => true
case tile => tile.partList.isEmpty
}
}
override def isBlockReplaceable(world:World, x:Int, y:Int, z:Int) = isAirBlock(world, x, y, z)
override def getRenderBlockPass = 1
@@ -291,9 +299,10 @@ trait BlockMultipart extends Block
override def onNeighborTileChange(world:World, x:Int, y:Int, z:Int, tileX:Int, tileY:Int, tileZ:Int)
{
val tile = getTile(world, x, y, z)
if(tile != null)
tile.onNeighborTileChange(tileX, tileY, tileZ)
getTile(world, x, y, z) match {
case null => world.setBlockToAir(x, y, z)
case tile => tile.onNeighborTileChange(tileX, tileY, tileZ)
}
}
override def weakTileChanges() = true
+4 -6
View File
@@ -139,7 +139,7 @@ class TileMultipart extends TileEntity
{
internalPartChange(part)
worldObj.notifyBlocksOfNeighborChange(xCoord, yCoord, zCoord, getBlockType().blockID)
worldObj.notifyBlocksOfNeighborChange(xCoord, yCoord, zCoord, MultipartProxy.block.blockID)
worldObj.updateAllLightTypes(xCoord, yCoord, zCoord)
}
@@ -291,15 +291,13 @@ class TileMultipart extends TileEntity
{
remPart_do(part, !worldObj.isRemote)
if(!isInvalid())
if(!isInvalid)
{
notifyPartChange(part)
markDirty()
markRender()
}
if(!isInvalid())
return MultipartGenerator.partRemoved(this, part)
}
return null
}
@@ -428,7 +426,7 @@ class TileMultipart extends TileEntity
def notifyNeighborChange(side:Int)
{
val pos = new BlockCoord(this).offset(side)
worldObj.notifyBlocksOfNeighborChange(pos.x, pos.y, pos.z, getBlockType().blockID)
worldObj.notifyBlocksOfNeighborChange(pos.x, pos.y, pos.z, MultipartProxy.block.blockID)
}
}