mirror of
https://github.com/MightyPirates/OpenComputers.git
synced 2025-09-17 19:25:20 -04:00
fixed cable interaction with hollow covers (and similar)
This commit is contained in:
parent
dd38ad4cba
commit
461e4abbbf
@ -1,6 +1,7 @@
|
||||
package li.cil.oc.common.block
|
||||
|
||||
import codechicken.multipart.TileMultipart
|
||||
import codechicken.lib.vec.Cuboid6
|
||||
import codechicken.multipart.{JNormalOcclusion, NormalOcclusionTest, TileMultipart}
|
||||
import cpw.mods.fml.common.Loader
|
||||
import cpw.mods.fml.relauncher.{SideOnly, Side}
|
||||
import java.util
|
||||
@ -66,7 +67,7 @@ class Cable(val parent: SpecialDelegator) extends SpecialDelegate {
|
||||
}
|
||||
|
||||
object Cable {
|
||||
private val cachedBounds = {
|
||||
val cachedBounds = {
|
||||
// 6 directions = 6 bits = 11111111b >> 2 = 0xFF >> 2
|
||||
(0 to 0xFF >> 2).map(mask => {
|
||||
val bounds = AxisAlignedBB.getBoundingBox(-0.125, -0.125, -0.125, 0.125, 0.125, 0.125)
|
||||
@ -125,7 +126,15 @@ object Cable {
|
||||
|
||||
private def canConnectFromSide(tileEntity: TileEntity, side: ForgeDirection) =
|
||||
tileEntity match {
|
||||
case host: TileMultipart => !host.isSolid(side.ordinal)
|
||||
case host: TileMultipart =>
|
||||
!host.partList.exists {
|
||||
case part: JNormalOcclusion if !part.isInstanceOf[CablePart] =>
|
||||
import scala.collection.convert.WrapAsScala._
|
||||
val ownBounds = Iterable(new Cuboid6(cachedBounds(side.flag)))
|
||||
val otherBounds = part.getOcclusionBoxes
|
||||
!NormalOcclusionTest(ownBounds, otherBounds)
|
||||
case _ => false
|
||||
}
|
||||
case _ => true
|
||||
}
|
||||
}
|
@ -1,9 +1,11 @@
|
||||
package li.cil.oc.server.network
|
||||
|
||||
import codechicken.multipart.TileMultipart
|
||||
import codechicken.lib.vec.Cuboid6
|
||||
import codechicken.multipart.{JNormalOcclusion, NormalOcclusionTest, TileMultipart}
|
||||
import cpw.mods.fml.common.{Loader, FMLCommonHandler}
|
||||
import cpw.mods.fml.relauncher.Side
|
||||
import li.cil.oc.api.network.{Node => ImmutableNode, SidedEnvironment, Environment, Visibility}
|
||||
import li.cil.oc.common.block.Cable
|
||||
import li.cil.oc.common.multipart.CablePart
|
||||
import li.cil.oc.common.tileentity.PassiveNode
|
||||
import li.cil.oc.server.network.{Node => MutableNode}
|
||||
@ -434,7 +436,15 @@ object Network extends api.detail.NetworkAPI {
|
||||
|
||||
private def canConnectFromSide(tileEntity: TileEntity, side: ForgeDirection) =
|
||||
tileEntity match {
|
||||
case host: TileMultipart => !host.isSolid(side.ordinal)
|
||||
case host: TileMultipart =>
|
||||
!host.partList.exists {
|
||||
case part: JNormalOcclusion if !part.isInstanceOf[CablePart] =>
|
||||
import scala.collection.convert.WrapAsScala._
|
||||
val ownBounds = Iterable(new Cuboid6(Cable.cachedBounds(side.flag)))
|
||||
val otherBounds = part.getOcclusionBoxes
|
||||
!NormalOcclusionTest(ownBounds, otherBounds)
|
||||
case _ => false
|
||||
}
|
||||
case _ => true
|
||||
}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user