Initial Test

This commit is contained in:
Johannes Lohrer 2014-03-02 13:08:19 +01:00
parent b73f39c443
commit 8718e88df6
6 changed files with 61 additions and 1 deletions

Binary file not shown.

Binary file not shown.

View File

@ -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

View 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"
}
}

View 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
}
}

View File

@ -0,0 +1,8 @@
package li.cil.oc.common.multipart
/**
* Created by lordjoda on 02.03.14.
*/
class EventHandler {
}