mirror of
https://github.com/MightyPirates/OpenComputers.git
synced 2025-09-15 10:21:45 -04:00
Fixed bounding box weirdness for blocks with stateful bounds (keyboards and cables, most notably). Closes #699.
This commit is contained in:
parent
3966def5d3
commit
42f5fb7c6b
@ -57,7 +57,7 @@ class Keyboard extends SimpleBlock with traits.SpecialBlock {
|
||||
})
|
||||
}
|
||||
|
||||
override def doSetBlockBoundsBasedOnState(world: IBlockAccess, x: Int, y: Int, z: Int) =
|
||||
override protected def doSetBlockBoundsBasedOnState(world: IBlockAccess, x: Int, y: Int, z: Int) =
|
||||
world.getTileEntity(x, y, z) match {
|
||||
case keyboard: tileentity.Keyboard => setBlockBounds(keyboard.pitch, keyboard.yaw)
|
||||
case _ =>
|
||||
|
@ -193,7 +193,7 @@ class SimpleBlock(material: Material = Material.iron) extends Block(material) {
|
||||
protected def doSetBlockBoundsBasedOnState(world: IBlockAccess, x: Int, y: Int, z: Int): Unit =
|
||||
super.setBlockBoundsBasedOnState(world, x, y, z)
|
||||
|
||||
def setBlockBounds(bounds: AxisAlignedBB) {
|
||||
protected def setBlockBounds(bounds: AxisAlignedBB) {
|
||||
setBlockBounds(
|
||||
bounds.minX.toFloat,
|
||||
bounds.minY.toFloat,
|
||||
@ -207,6 +207,11 @@ class SimpleBlock(material: Material = Material.iron) extends Block(material) {
|
||||
override def collisionRayTrace(world: World, x: Int, y: Int, z: Int, origin: Vec3, direction: Vec3) =
|
||||
this.synchronized(intersect(world, x, y, z, origin, direction))
|
||||
|
||||
override def getCollisionBoundingBoxFromPool(world: World, x: Int, y: Int, z: Int) = this.synchronized {
|
||||
doSetBlockBoundsBasedOnState(world, x, y, z)
|
||||
super.getCollisionBoundingBoxFromPool(world, x, y, z)
|
||||
}
|
||||
|
||||
protected def intersect(world: World, x: Int, y: Int, z: Int, origin: Vec3, direction: Vec3) =
|
||||
super.collisionRayTrace(world, x, y, z, origin, direction)
|
||||
|
||||
|
@ -97,7 +97,7 @@ object DebugCard {
|
||||
}
|
||||
}
|
||||
|
||||
@Callback(doc = """function():userdata -- Get the container's world object.""")
|
||||
@Callback(doc = """function():userdata -- Get the player's world object.""")
|
||||
def getWorld(context: Context, args: Arguments): Array[AnyRef] = {
|
||||
withPlayer(player => result(new DebugCard.WorldValue(player.getEntityWorld)))
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user