mirror of
https://github.com/MightyPirates/OpenComputers.git
synced 2025-09-17 11:15:12 -04:00
Made robot afterimages declare themselves as air blocks and made robots ignore afterimages when moving, to avoid potential issues when for some reason they were not properly cleaned up (e.g. on chunk borders after world loads). Might help with #440.
This commit is contained in:
parent
4b49b579d2
commit
ab7b88d1a0
@ -50,6 +50,8 @@ trait Delegate {
|
|||||||
|
|
||||||
def explosionResistance(entity: Entity): Float = parent.getExplosionResistance(entity)
|
def explosionResistance(entity: Entity): Float = parent.getExplosionResistance(entity)
|
||||||
|
|
||||||
|
def isAir(world: World, x: Int, y: Int, z: Int) = false
|
||||||
|
|
||||||
def isNormalCube(world: World, x: Int, y: Int, z: Int) = true
|
def isNormalCube(world: World, x: Int, y: Int, z: Int) = true
|
||||||
|
|
||||||
def validRotations(world: World, x: Int, y: Int, z: Int) = validRotations_
|
def validRotations(world: World, x: Int, y: Int, z: Int) = validRotations_
|
||||||
|
@ -146,6 +146,12 @@ class Delegator[Child <: Delegate](id: Int) extends Block(id, Material.iron) {
|
|||||||
case _ => super.getExplosionResistance(entity, world, x, y, z, explosionX, explosionY, explosionZ)
|
case _ => super.getExplosionResistance(entity, world, x, y, z, explosionX, explosionY, explosionZ)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
override def isAirBlock(world: World, x: Int, y: Int, z: Int) =
|
||||||
|
subBlock(world, x, y, z) match {
|
||||||
|
case Some(subBlock) => subBlock.isAir(world, x, y, z)
|
||||||
|
case _ => super.isAirBlock(world, x, y, z)
|
||||||
|
}
|
||||||
|
|
||||||
override def isBlockNormalCube(world: World, x: Int, y: Int, z: Int) =
|
override def isBlockNormalCube(world: World, x: Int, y: Int, z: Int) =
|
||||||
subBlock(world.getBlockMetadata(x, y, z)) match {
|
subBlock(world.getBlockMetadata(x, y, z)) match {
|
||||||
case Some(subBlock) => subBlock.isNormalCube(world, x, y, z)
|
case Some(subBlock) => subBlock.isNormalCube(world, x, y, z)
|
||||||
|
@ -39,6 +39,8 @@ class RobotAfterimage(val parent: SpecialDelegator) extends SpecialDelegate {
|
|||||||
|
|
||||||
override def opacity(world: World, x: Int, y: Int, z: Int) = 0
|
override def opacity(world: World, x: Int, y: Int, z: Int) = 0
|
||||||
|
|
||||||
|
override def isAir(world: World, x: Int, y: Int, z: Int) = true
|
||||||
|
|
||||||
override def isNormalCube(world: World, x: Int, y: Int, z: Int) = false
|
override def isNormalCube(world: World, x: Int, y: Int, z: Int) = false
|
||||||
|
|
||||||
override def isSolid(world: IBlockAccess, x: Int, y: Int, z: Int, side: ForgeDirection) = false
|
override def isSolid(world: IBlockAccess, x: Int, y: Int, z: Int, side: ForgeDirection) = false
|
||||||
|
@ -171,7 +171,7 @@ class Robot extends traits.Computer with traits.PowerInformation with api.machin
|
|||||||
// If we broke some replaceable block (like grass) play its break sound.
|
// If we broke some replaceable block (like grass) play its break sound.
|
||||||
if (blockId > 0) {
|
if (blockId > 0) {
|
||||||
val block = Block.blocksList(blockId)
|
val block = Block.blocksList(blockId)
|
||||||
if (block != null) {
|
if (block != null && !Delegator.subBlock(block, metadata).exists(_ == Blocks.robotAfterimage)) {
|
||||||
if (FluidRegistry.lookupFluidForBlock(block) == null &&
|
if (FluidRegistry.lookupFluidForBlock(block) == null &&
|
||||||
!block.isInstanceOf[BlockFluidBase] &&
|
!block.isInstanceOf[BlockFluidBase] &&
|
||||||
!block.isInstanceOf[BlockFlowing]) {
|
!block.isInstanceOf[BlockFlowing]) {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user