mirror of
https://github.com/MightyPirates/OpenComputers.git
synced 2025-09-14 09:46:53 -04:00
only allow placing keyboards on screens
This commit is contained in:
parent
4623641fd6
commit
0325cbb61d
@ -52,10 +52,4 @@ object BlockRenderer extends ISimpleBlockRenderingHandler {
|
||||
}
|
||||
|
||||
def renderWorldBlock(world: IBlockAccess, x: Int, y: Int, z: Int, block: Block, modelId: Int, renderer: RenderBlocks) = renderer.renderStandardBlock(block, x, y, z)
|
||||
|
||||
// Delegator.subBlock(block, world.getBlockMetadata(x, y, z)) match {
|
||||
// case Some(keyboard: Keyboard) =>
|
||||
// false
|
||||
// case _ => renderer.renderStandardBlock(block, x, y, z)
|
||||
// }
|
||||
}
|
||||
|
@ -33,6 +33,8 @@ trait Delegate {
|
||||
|
||||
def canConnectRedstone(world: IBlockAccess, x: Int, y: Int, z: Int, side: ForgeDirection) = false
|
||||
|
||||
def canPlaceBlockOnSide(world: World, x: Int, y: Int, z: Int, side: Int) = true
|
||||
|
||||
def colorMultiplier(world: IBlockAccess, x: Int, y: Int, z: Int) = getRenderColor
|
||||
|
||||
def collisionRayTrace(world: World, x: Int, y: Int, z: Int, origin: Vec3, direction: Vec3) =
|
||||
|
@ -110,6 +110,14 @@ class Delegator[Child <: Delegate](id: Int) extends Block(id, Material.iron) {
|
||||
super.breakBlock(world, x, y, z, blockId, metadata)
|
||||
}
|
||||
|
||||
override def canPlaceBlockOnSide(world: World, x: Int, y: Int, z: Int, side: Int, stack: ItemStack) =
|
||||
subBlock(stack) match {
|
||||
case Some(subBlock) => subBlock.canPlaceBlockOnSide(world, x, y, z, side)
|
||||
case _ => super.canPlaceBlockOnSide(world, x, y, z, side, stack)
|
||||
}
|
||||
|
||||
override def canBeReplacedByLeaves(world: World, x: Int, y: Int, z: Int) = false
|
||||
|
||||
override def canCreatureSpawn(creature: EnumCreatureType, world: World, x: Int, y: Int, z: Int) = false
|
||||
|
||||
override def damageDropped(metadata: Int) =
|
||||
|
@ -20,6 +20,13 @@ class Keyboard(val parent: SpecialDelegator) extends SpecialDelegate {
|
||||
case _ =>
|
||||
}
|
||||
|
||||
override def canPlaceBlockOnSide(world: World, x: Int, y: Int, z: Int, side: Int) =
|
||||
ForgeDirection.VALID_DIRECTIONS.
|
||||
map(side => world.getBlockTileEntity(x + side.offsetX, y + side.offsetY, z + side.offsetZ)).
|
||||
collect {
|
||||
case screen: tileentity.Screen => screen
|
||||
}.exists(_.facing.ordinal() != side)
|
||||
|
||||
override def isBlockNormalCube(world: World, x: Int, y: Int, z: Int) = false
|
||||
|
||||
override def getLightOpacity(world: World, x: Int, y: Int, z: Int) = 0
|
||||
|
@ -275,6 +275,7 @@ class Robot(isRemote: Boolean) extends Computer(isRemote) with ISidedInventory w
|
||||
computer.node.connect(gpu.node)
|
||||
distributor.node.connect(battery)
|
||||
buffer.node.connect(keyboard.node)
|
||||
distributor.changeBuffer(distributor.globalBufferSize / 2) // TODO for testing only
|
||||
}
|
||||
}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user