mirror of
https://github.com/MightyPirates/OpenComputers.git
synced 2025-09-18 11:48:02 -04:00
Added IM support for Keyboards, closes #247. Sorry, cba to fiddle in FMP support for these.
This commit is contained in:
parent
63bdcad60b
commit
6bf9423f35
@ -134,7 +134,7 @@ object Cable {
|
|||||||
|
|
||||||
private def canConnectFromSideIM(tileEntity: TileEntity, side: ForgeDirection) =
|
private def canConnectFromSideIM(tileEntity: TileEntity, side: ForgeDirection) =
|
||||||
tileEntity match {
|
tileEntity match {
|
||||||
case cable: tileentity.Cable => cable.ImmibisMicroblocks_isSideOpen(side.ordinal)
|
case im: tileentity.traits.ImmibisMicroblock => im.ImmibisMicroblocks_isSideOpen(side.ordinal)
|
||||||
case _ => true
|
case _ => true
|
||||||
}
|
}
|
||||||
}
|
}
|
@ -3,21 +3,10 @@ package li.cil.oc.common.tileentity
|
|||||||
import li.cil.oc.api.network.Visibility
|
import li.cil.oc.api.network.Visibility
|
||||||
import li.cil.oc.{api, common}
|
import li.cil.oc.{api, common}
|
||||||
|
|
||||||
class Cable extends traits.Environment with traits.NotAnalyzable {
|
class Cable extends traits.Environment with traits.NotAnalyzable with traits.ImmibisMicroblock {
|
||||||
val node = api.Network.newNode(this, Visibility.None).create()
|
val node = api.Network.newNode(this, Visibility.None).create()
|
||||||
|
|
||||||
override def canUpdate = false
|
override def canUpdate = false
|
||||||
|
|
||||||
override def getRenderBoundingBox = common.block.Cable.bounds(world, x, y, z).offset(x, y, z)
|
override def getRenderBoundingBox = common.block.Cable.bounds(world, x, y, z).offset(x, y, z)
|
||||||
|
|
||||||
// ----------------------------------------------------------------------- //
|
|
||||||
// Immibis Microblock support.
|
|
||||||
|
|
||||||
val ImmibisMicroblocks_TransformableTileEntityMarker = null
|
|
||||||
|
|
||||||
def ImmibisMicroblocks_isSideOpen(side: Int) = true
|
|
||||||
|
|
||||||
def ImmibisMicroblocks_onMicroblocksChanged() {
|
|
||||||
api.Network.joinOrCreateNetwork(this)
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
@ -8,7 +8,7 @@ import net.minecraft.entity.player.EntityPlayer
|
|||||||
import net.minecraft.nbt.NBTTagCompound
|
import net.minecraft.nbt.NBTTagCompound
|
||||||
import net.minecraftforge.common.ForgeDirection
|
import net.minecraftforge.common.ForgeDirection
|
||||||
|
|
||||||
class Keyboard extends traits.Environment with traits.Rotatable with SidedEnvironment with Analyzable {
|
class Keyboard extends traits.Environment with traits.Rotatable with traits.ImmibisMicroblock with SidedEnvironment with Analyzable {
|
||||||
override def validFacings = ForgeDirection.VALID_DIRECTIONS
|
override def validFacings = ForgeDirection.VALID_DIRECTIONS
|
||||||
|
|
||||||
val keyboard = {
|
val keyboard = {
|
||||||
|
@ -0,0 +1,13 @@
|
|||||||
|
package li.cil.oc.common.tileentity.traits
|
||||||
|
|
||||||
|
import li.cil.oc.api
|
||||||
|
|
||||||
|
trait ImmibisMicroblock extends TileEntity {
|
||||||
|
val ImmibisMicroblocks_TransformableTileEntityMarker = null
|
||||||
|
|
||||||
|
def ImmibisMicroblocks_isSideOpen(side: Int) = true
|
||||||
|
|
||||||
|
def ImmibisMicroblocks_onMicroblocksChanged() {
|
||||||
|
api.Network.joinOrCreateNetwork(this)
|
||||||
|
}
|
||||||
|
}
|
@ -440,7 +440,7 @@ object Network extends api.detail.NetworkAPI {
|
|||||||
|
|
||||||
private def canConnectFromSideIM(tileEntity: TileEntity, side: ForgeDirection) =
|
private def canConnectFromSideIM(tileEntity: TileEntity, side: ForgeDirection) =
|
||||||
tileEntity match {
|
tileEntity match {
|
||||||
case cable: tileentity.Cable => cable.ImmibisMicroblocks_isSideOpen(side.ordinal)
|
case im: tileentity.traits.ImmibisMicroblock => im.ImmibisMicroblocks_isSideOpen(side.ordinal)
|
||||||
case _ => true
|
case _ => true
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user