mirror of
https://github.com/MightyPirates/OpenComputers.git
synced 2025-09-18 11:48:02 -04:00
Fixery of (partially weird) stuff.
This commit is contained in:
parent
92691ae318
commit
223f981ae6
@ -125,6 +125,7 @@ processResources {
|
|||||||
}
|
}
|
||||||
|
|
||||||
jar {
|
jar {
|
||||||
|
exclude "cofh/**"
|
||||||
configurations.embedded.each { dep ->
|
configurations.embedded.each { dep ->
|
||||||
from(project.zipTree(dep)){
|
from(project.zipTree(dep)){
|
||||||
exclude 'META-INF', 'META-INF/**'
|
exclude 'META-INF', 'META-INF/**'
|
||||||
@ -144,6 +145,7 @@ javadoc {
|
|||||||
// because the normal default jar task has been modified to be obfuscated
|
// because the normal default jar task has been modified to be obfuscated
|
||||||
task deobfJar(type: Jar) {
|
task deobfJar(type: Jar) {
|
||||||
from sourceSets.main.output
|
from sourceSets.main.output
|
||||||
|
exclude "cofh/**"
|
||||||
configurations.embedded.each { dep ->
|
configurations.embedded.each { dep ->
|
||||||
from(project.zipTree(dep)){
|
from(project.zipTree(dep)){
|
||||||
exclude 'META-INF', 'META-INF/**'
|
exclude 'META-INF', 'META-INF/**'
|
||||||
|
Before Width: | Height: | Size: 374 B After Width: | Height: | Size: 374 B |
@ -1,33 +1,19 @@
|
|||||||
package li.cil.oc.integration.computercraft
|
package li.cil.oc.integration.computercraft
|
||||||
|
|
||||||
import dan200.computercraft.api.ComputerCraftAPI
|
|
||||||
import dan200.computercraft.api.lua.ILuaContext
|
|
||||||
import dan200.computercraft.api.peripheral.IComputerAccess
|
|
||||||
import dan200.computercraft.api.peripheral.IPeripheral
|
|
||||||
import dan200.computercraft.api.peripheral.IPeripheralProvider
|
|
||||||
import li.cil.oc.api.Driver
|
import li.cil.oc.api.Driver
|
||||||
import li.cil.oc.common.tileentity.Switch
|
|
||||||
import li.cil.oc.integration.ModProxy
|
import li.cil.oc.integration.ModProxy
|
||||||
import li.cil.oc.integration.Mods
|
import li.cil.oc.integration.Mods
|
||||||
import net.minecraft.world.World
|
|
||||||
|
|
||||||
import scala.collection.mutable
|
|
||||||
|
|
||||||
object ModComputerCraft extends ModProxy {
|
object ModComputerCraft extends ModProxy {
|
||||||
override def getMod = Mods.ComputerCraft
|
override def getMod = Mods.ComputerCraft
|
||||||
|
|
||||||
override def initialize() {
|
override def initialize() {
|
||||||
ComputerCraftAPI.registerPeripheralProvider(new IPeripheralProvider {
|
PeripheralProvider.init()
|
||||||
override def getPeripheral(world: World, x: Int, y: Int, z: Int, side: Int) = world.getTileEntity(x, y, z) match {
|
|
||||||
case switch: Switch => new SwitchPeripheral(switch)
|
|
||||||
case _ => null
|
|
||||||
}
|
|
||||||
})
|
|
||||||
|
|
||||||
Driver.add(DriverComputerCraftMedia)
|
Driver.add(DriverComputerCraftMedia)
|
||||||
|
|
||||||
try {
|
try {
|
||||||
val driver: DriverPeripheral = new DriverPeripheral
|
val driver = new DriverPeripheral()
|
||||||
if (driver.isValid) {
|
if (driver.isValid) {
|
||||||
Driver.add(new ConverterLuaObject)
|
Driver.add(new ConverterLuaObject)
|
||||||
Driver.add(driver)
|
Driver.add(driver)
|
||||||
@ -37,29 +23,4 @@ object ModComputerCraft extends ModProxy {
|
|||||||
case ignored: Throwable =>
|
case ignored: Throwable =>
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
class SwitchPeripheral(val switch: Switch) extends IPeripheral {
|
|
||||||
override def getType = switch.getType
|
|
||||||
|
|
||||||
override def attach(computer: IComputerAccess) {
|
|
||||||
switch.computers += computer
|
|
||||||
switch.openPorts += computer -> mutable.Set.empty
|
|
||||||
}
|
|
||||||
|
|
||||||
override def detach(computer: IComputerAccess) {
|
|
||||||
switch.computers -= computer
|
|
||||||
switch.openPorts -= computer
|
|
||||||
}
|
|
||||||
|
|
||||||
override def getMethodNames = switch.getMethodNames
|
|
||||||
|
|
||||||
override def callMethod(computer: IComputerAccess, context: ILuaContext, method: Int, arguments: Array[AnyRef]) =
|
|
||||||
switch.callMethod(computer, context, method, arguments)
|
|
||||||
|
|
||||||
override def equals(other: IPeripheral) = other match {
|
|
||||||
case peripheral: SwitchPeripheral => peripheral.switch == switch
|
|
||||||
case _ => false
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
}
|
@ -0,0 +1,17 @@
|
|||||||
|
package li.cil.oc.integration.computercraft
|
||||||
|
|
||||||
|
import dan200.computercraft.api.ComputerCraftAPI
|
||||||
|
import dan200.computercraft.api.peripheral.IPeripheralProvider
|
||||||
|
import li.cil.oc.common.tileentity.Switch
|
||||||
|
import net.minecraft.world.World
|
||||||
|
|
||||||
|
object PeripheralProvider extends IPeripheralProvider {
|
||||||
|
def init() {
|
||||||
|
ComputerCraftAPI.registerPeripheralProvider(this)
|
||||||
|
}
|
||||||
|
|
||||||
|
override def getPeripheral(world: World, x: Int, y: Int, z: Int, side: Int) = world.getTileEntity(x, y, z) match {
|
||||||
|
case switch: Switch => new SwitchPeripheral(switch)
|
||||||
|
case _ => null
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,32 @@
|
|||||||
|
package li.cil.oc.integration.computercraft
|
||||||
|
|
||||||
|
import dan200.computercraft.api.lua.ILuaContext
|
||||||
|
import dan200.computercraft.api.peripheral.IComputerAccess
|
||||||
|
import dan200.computercraft.api.peripheral.IPeripheral
|
||||||
|
import li.cil.oc.common.tileentity.Switch
|
||||||
|
|
||||||
|
import scala.collection.mutable
|
||||||
|
|
||||||
|
class SwitchPeripheral(val switch: Switch) extends IPeripheral {
|
||||||
|
override def getType = switch.getType
|
||||||
|
|
||||||
|
override def attach(computer: IComputerAccess) {
|
||||||
|
switch.computers += computer
|
||||||
|
switch.openPorts += computer -> mutable.Set.empty
|
||||||
|
}
|
||||||
|
|
||||||
|
override def detach(computer: IComputerAccess) {
|
||||||
|
switch.computers -= computer
|
||||||
|
switch.openPorts -= computer
|
||||||
|
}
|
||||||
|
|
||||||
|
override def getMethodNames = switch.getMethodNames
|
||||||
|
|
||||||
|
override def callMethod(computer: IComputerAccess, context: ILuaContext, method: Int, arguments: Array[AnyRef]) =
|
||||||
|
switch.callMethod(computer, context, method, arguments)
|
||||||
|
|
||||||
|
override def equals(other: IPeripheral) = other match {
|
||||||
|
case peripheral: SwitchPeripheral => peripheral.switch == switch
|
||||||
|
case _ => false
|
||||||
|
}
|
||||||
|
}
|
@ -1,7 +1,5 @@
|
|||||||
package li.cil.oc.integration.fmp
|
package li.cil.oc.integration.fmp
|
||||||
|
|
||||||
import codechicken.multipart.MultiPartRegistry
|
|
||||||
import li.cil.oc.Settings
|
|
||||||
import li.cil.oc.integration.ModProxy
|
import li.cil.oc.integration.ModProxy
|
||||||
import li.cil.oc.integration.Mods
|
import li.cil.oc.integration.Mods
|
||||||
import net.minecraftforge.common.MinecraftForge
|
import net.minecraftforge.common.MinecraftForge
|
||||||
@ -10,8 +8,8 @@ object ModForgeMultipart extends ModProxy {
|
|||||||
override def getMod = Mods.ForgeMultipart
|
override def getMod = Mods.ForgeMultipart
|
||||||
|
|
||||||
override def initialize() {
|
override def initialize() {
|
||||||
MultiPartRegistry.registerConverter(MultipartConverter)
|
MultipartConverter.init()
|
||||||
MultiPartRegistry.registerParts(MultipartFactory, Array(Settings.namespace + "cable"))
|
MultipartFactory.init()
|
||||||
|
|
||||||
MinecraftForge.EVENT_BUS.register(EventHandler)
|
MinecraftForge.EVENT_BUS.register(EventHandler)
|
||||||
}
|
}
|
||||||
|
@ -3,12 +3,17 @@ package li.cil.oc.integration.fmp
|
|||||||
import java.util
|
import java.util
|
||||||
|
|
||||||
import codechicken.lib.vec.BlockCoord
|
import codechicken.lib.vec.BlockCoord
|
||||||
|
import codechicken.multipart.MultiPartRegistry
|
||||||
import codechicken.multipart.MultiPartRegistry.IPartConverter
|
import codechicken.multipart.MultiPartRegistry.IPartConverter
|
||||||
import li.cil.oc.api.Items
|
import li.cil.oc.api.Items
|
||||||
import li.cil.oc.common.tileentity.Cable
|
import li.cil.oc.common.tileentity.Cable
|
||||||
import net.minecraft.world.World
|
import net.minecraft.world.World
|
||||||
|
|
||||||
object MultipartConverter extends IPartConverter {
|
object MultipartConverter extends IPartConverter {
|
||||||
|
def init() {
|
||||||
|
MultiPartRegistry.registerConverter(this)
|
||||||
|
}
|
||||||
|
|
||||||
override def blockTypes = util.Arrays.asList(Items.get("cable").block)
|
override def blockTypes = util.Arrays.asList(Items.get("cable").block)
|
||||||
|
|
||||||
override def convert(world: World, pos: BlockCoord) = {
|
override def convert(world: World, pos: BlockCoord) = {
|
||||||
|
@ -1,10 +1,15 @@
|
|||||||
package li.cil.oc.integration.fmp
|
package li.cil.oc.integration.fmp
|
||||||
|
|
||||||
|
import codechicken.multipart.MultiPartRegistry
|
||||||
import codechicken.multipart.MultiPartRegistry.IPartFactory
|
import codechicken.multipart.MultiPartRegistry.IPartFactory
|
||||||
import codechicken.multipart.TMultiPart
|
import codechicken.multipart.TMultiPart
|
||||||
import li.cil.oc.Settings
|
import li.cil.oc.Settings
|
||||||
|
|
||||||
object MultipartFactory extends IPartFactory {
|
object MultipartFactory extends IPartFactory {
|
||||||
|
def init() {
|
||||||
|
MultiPartRegistry.registerParts(MultipartFactory, Array(Settings.namespace + "cable"))
|
||||||
|
}
|
||||||
|
|
||||||
override def createPart(name: String, client: Boolean): TMultiPart = {
|
override def createPart(name: String, client: Boolean): TMultiPart = {
|
||||||
if (name.equals(Settings.namespace + "cable"))
|
if (name.equals(Settings.namespace + "cable"))
|
||||||
return new CablePart()
|
return new CablePart()
|
Loading…
x
Reference in New Issue
Block a user