mirror of
https://github.com/MightyPirates/OpenComputers.git
synced 2025-09-16 18:55:03 -04:00
Initial Test
This commit is contained in:
parent
b73f39c443
commit
8718e88df6
BIN
lib/CodeChickenLib-dev-1.6.4-1.0.0.62.jar
Normal file
BIN
lib/CodeChickenLib-dev-1.6.4-1.0.0.62.jar
Normal file
Binary file not shown.
BIN
lib/ForgeMultipart-dev-1.6.4-1.0.0.250.jar
Normal file
BIN
lib/ForgeMultipart-dev-1.6.4-1.0.0.250.jar
Normal file
Binary file not shown.
@ -11,6 +11,7 @@ import li.cil.oc.server.network.Network
|
||||
import li.cil.oc.server.{TickHandler, driver, fs, network}
|
||||
import li.cil.oc.util.WirelessNetwork
|
||||
import net.minecraftforge.common.MinecraftForge
|
||||
import li.cil.oc.common.multipart.{EventHandler, Content}
|
||||
|
||||
class Proxy {
|
||||
def preInit(e: FMLPreInitializationEvent): Unit = {
|
||||
@ -18,7 +19,8 @@ class Proxy {
|
||||
|
||||
Blocks.init()
|
||||
Items.init()
|
||||
|
||||
new Content().init()
|
||||
MinecraftForge.EVENT_BUS.register(new EventHandler())
|
||||
api.Driver.instance = driver.Registry
|
||||
api.FileSystem.instance = fs.FileSystem
|
||||
api.Network.instance = network.Network
|
||||
|
13
src/main/java/li/cil/oc/common/multipart/CablePart.scala
Normal file
13
src/main/java/li/cil/oc/common/multipart/CablePart.scala
Normal file
@ -0,0 +1,13 @@
|
||||
package li.cil.oc.common.multipart
|
||||
|
||||
import codechicken.multipart.TMultiPart
|
||||
|
||||
/**
|
||||
* Created by lordjoda on 02.03.14.
|
||||
*/
|
||||
class CablePart extends TMultiPart{
|
||||
|
||||
def getType: String = {
|
||||
"oc:cable"
|
||||
}
|
||||
}
|
37
src/main/java/li/cil/oc/common/multipart/Content.scala
Normal file
37
src/main/java/li/cil/oc/common/multipart/Content.scala
Normal file
@ -0,0 +1,37 @@
|
||||
package li.cil.oc.common.multipart
|
||||
|
||||
import codechicken.multipart.MultiPartRegistry.{IPartConverter, IPartFactory}
|
||||
import codechicken.multipart.{MultiPartRegistry, TMultiPart}
|
||||
import net.minecraft.world.World
|
||||
import codechicken.lib.vec.BlockCoord
|
||||
import li.cil.oc.Blocks
|
||||
|
||||
class Content extends IPartFactory with IPartConverter {
|
||||
|
||||
override def createPart(name: String, client: Boolean): TMultiPart = {
|
||||
if (name.equals("oc:cable")) return new CablePart
|
||||
null
|
||||
}
|
||||
|
||||
def init() {
|
||||
MultiPartRegistry.registerConverter(this)
|
||||
MultiPartRegistry.registerParts(this, Array(
|
||||
"oc:cable"
|
||||
))
|
||||
}
|
||||
|
||||
override def canConvert(blockID: Int): Boolean = {
|
||||
blockID == Blocks.cable.createItemStack().itemID
|
||||
|
||||
}
|
||||
|
||||
override def convert(world: World, pos: BlockCoord): TMultiPart = {
|
||||
|
||||
val id = world.getBlockId(pos.x, pos.y, pos.z)
|
||||
val meta = world.getBlockMetadata(pos.x, pos.y, pos.z)
|
||||
val cable = Blocks.cable.createItemStack()
|
||||
if (cable.itemID == id && cable.getItemDamage == meta)
|
||||
return new CablePart()
|
||||
null
|
||||
}
|
||||
}
|
@ -0,0 +1,8 @@
|
||||
package li.cil.oc.common.multipart
|
||||
|
||||
/**
|
||||
* Created by lordjoda on 02.03.14.
|
||||
*/
|
||||
class EventHandler {
|
||||
|
||||
}
|
Loading…
x
Reference in New Issue
Block a user