mirror of
https://github.com/MightyPirates/OpenComputers.git
synced 2025-09-18 19:56:17 -04:00
skipping 1.11 cc support
This commit is contained in:
parent
e8ba939a33
commit
61dc91350a
@ -1,44 +0,0 @@
|
||||
package li.cil.oc.integration.computercraft
|
||||
|
||||
import dan200.computercraft.api.ComputerCraftAPI
|
||||
import dan200.computercraft.api.redstone.IBundledRedstoneProvider
|
||||
import li.cil.oc.common.tileentity.traits.BundledRedstoneAware
|
||||
import li.cil.oc.integration.util.BundledRedstone
|
||||
import li.cil.oc.integration.util.BundledRedstone.RedstoneProvider
|
||||
import li.cil.oc.util.BlockPosition
|
||||
import net.minecraft.world.World
|
||||
import net.minecraft.util.EnumFacing
|
||||
import net.minecraft.util.math.BlockPos
|
||||
|
||||
object BundledRedstoneProvider extends IBundledRedstoneProvider with RedstoneProvider {
|
||||
def init() {
|
||||
ComputerCraftAPI.registerBundledRedstoneProvider(this)
|
||||
BundledRedstone.addProvider(this)
|
||||
}
|
||||
|
||||
override def getBundledRedstoneOutput(world: World, blockPos: BlockPos, enumFacing: EnumFacing): Int =
|
||||
world.getTileEntity(blockPos) match {
|
||||
case tile: BundledRedstoneAware =>
|
||||
var result = 0
|
||||
val colours = tile.bundledOutput(enumFacing)
|
||||
for (colour <- 0 to 15) {
|
||||
if (colours(colour) > 0) result |= 1 << colour
|
||||
}
|
||||
result
|
||||
case _ => -1
|
||||
}
|
||||
|
||||
override def computeInput(pos: BlockPosition, side: EnumFacing): Int = 0
|
||||
|
||||
override def computeBundledInput(pos: BlockPosition, side: EnumFacing): Array[Int] = {
|
||||
val offset = pos.offset(side)
|
||||
val strength = ComputerCraftAPI.getBundledRedstoneOutput(pos.world.get, offset.toBlockPos, side.getOpposite)
|
||||
if (strength >= 0) {
|
||||
val strengths = new Array[Int](16)
|
||||
for (colour <- 0 to 15) {
|
||||
strengths(colour) = if ((strength & (1 << colour)) == 0) 0 else 15
|
||||
}
|
||||
strengths
|
||||
} else null
|
||||
}
|
||||
}
|
@ -1,19 +0,0 @@
|
||||
package li.cil.oc.integration.computercraft
|
||||
|
||||
import li.cil.oc.api.Driver
|
||||
import li.cil.oc.integration.ModProxy
|
||||
import li.cil.oc.integration.Mods
|
||||
|
||||
object ModComputerCraft extends ModProxy {
|
||||
override def getMod = Mods.ComputerCraft
|
||||
|
||||
override def initialize() {
|
||||
PeripheralProvider.init()
|
||||
BundledRedstoneProvider.init()
|
||||
|
||||
Driver.add(DriverComputerCraftMedia)
|
||||
Driver.add(new DriverPeripheral())
|
||||
|
||||
Driver.add(new ConverterLuaObject)
|
||||
}
|
||||
}
|
Loading…
x
Reference in New Issue
Block a user