Reorganized ElectricalContent

This commit is contained in:
Calclavia 2014-10-25 19:36:17 +08:00
parent 79a8147f00
commit 944b7cd4c7

View file

@ -12,7 +12,7 @@ import net.minecraft.util.ResourceLocation
import net.minecraftforge.client.event.TextureStitchEvent import net.minecraftforge.client.event.TextureStitchEvent
import net.minecraftforge.common.MinecraftForge import net.minecraftforge.common.MinecraftForge
import net.minecraftforge.oredict.{OreDictionary, ShapelessOreRecipe} import net.minecraftforge.oredict.{OreDictionary, ShapelessOreRecipe}
import resonant.content.loader.ContentHolder import resonant.content.loader.{ContentHolder, ExplicitContentName}
import resonant.lib.recipe.UniversalRecipe import resonant.lib.recipe.UniversalRecipe
import resonantinduction.atomic.gate.{ItemQuantumGlyph, PartQuantumGlyph} import resonantinduction.atomic.gate.{ItemQuantumGlyph, PartQuantumGlyph}
import resonantinduction.core.{Reference, ResonantPartFactory, ResonantTab} import resonantinduction.core.{Reference, ResonantPartFactory, ResonantTab}
@ -35,24 +35,24 @@ object ElectricalContent extends ContentHolder
{ {
val particleTextures = new ResourceLocation("textures/particle/particles.png") val particleTextures = new ResourceLocation("textures/particle/particles.png")
var itemWire: Item = null var itemWire = new ItemWire
var itemMultimeter: Item = null var itemMultimeter = new ItemMultimeter
var itemTransformer: Item = null var itemTransformer = new ItemElectricTransformer
var itemInsulation: Item = null @ExplicitContentName("insulation") var itemInsulation = new Item
var itemQuantumGlyph: Item = null var itemQuantumGlyph = new ItemQuantumGlyph
var blockTesla: Block = null var itemFocusingMatrix: ItemFocusingMatrix = new ItemFocusingMatrix
var blockBattery: Block = null
var blockSolarPanel: Block = null
var blockMotor: Block = null
var blockThermopile: Block = null
var blockLaserEmitter: BlockLaserEmitter = null var blockTesla: Block = new TileTesla
var blockLaserReceiver: BlockLaserReceiver = null var blockBattery: Block = new TileBattery
var blockMirror: BlockMirror = null var blockSolarPanel: Block = new TileSolarPanel
var blockFocusCrystal: BlockFocusCrystal = null var blockMotor: Block = new TileMotor
var blockThermopile: Block = new TileThermopile
var itemFocusingMatrix: ItemFocusingMatrix = null var blockLaserEmitter: Block = new BlockLaserEmitter
var blockLaserReceiver: Block = new BlockLaserReceiver
var blockMirror = new BlockMirror
var blockFocusCrystal: Block = new BlockFocusCrystal
var tierOneBattery: ItemStack = null var tierOneBattery: ItemStack = null
var tierTwoBattery: ItemStack = null var tierTwoBattery: ItemStack = null
@ -60,25 +60,7 @@ object ElectricalContent extends ContentHolder
override def preInit() override def preInit()
{ {
super.preInit super.preInit()
itemWire = manager.newItem(classOf[ItemWire])
itemMultimeter = manager.newItem(classOf[ItemMultimeter])
itemTransformer = manager.newItem(classOf[ItemElectricTransformer])
itemInsulation = manager.newItem("insulation", classOf[Item])
itemQuantumGlyph = manager.newItem(classOf[ItemQuantumGlyph])
blockTesla = manager.newBlock(classOf[TileTesla])
blockBattery = manager.newBlock(classOf[TileBattery])
blockSolarPanel = manager.newBlock(classOf[TileSolarPanel])
blockMotor = manager.newBlock(classOf[TileMotor])
blockThermopile = manager.newBlock(classOf[TileThermopile])
blockLaserEmitter = new BlockLaserEmitter()
blockLaserReceiver = new BlockLaserReceiver()
blockMirror = new BlockMirror()
blockFocusCrystal = new BlockFocusCrystal()
itemFocusingMatrix = new ItemFocusingMatrix()
tierOneBattery = ItemBlockBattery.setTier(new ItemStack(ElectricalContent.blockBattery, 1, 0), 0) tierOneBattery = ItemBlockBattery.setTier(new ItemStack(ElectricalContent.blockBattery, 1, 0), 0)
tierTwoBattery = ItemBlockBattery.setTier(new ItemStack(ElectricalContent.blockBattery, 1, 0), 1) tierTwoBattery = ItemBlockBattery.setTier(new ItemStack(ElectricalContent.blockBattery, 1, 0), 1)
@ -96,15 +78,10 @@ object ElectricalContent extends ContentHolder
override def init() override def init()
{ {
super.init super.init()
ResonantTab.itemStack(new ItemStack(ElectricalContent.itemTransformer)) ResonantTab.itemStack(new ItemStack(ElectricalContent.itemTransformer))
GameRegistry.registerTileEntity(classOf[TileLaserEmitter], "EMLaserEmitter");
GameRegistry.registerTileEntity(classOf[TileLaserReceiver], "EMLaserReceiver");
GameRegistry.registerTileEntity(classOf[TileMirror], "EMLaserMirror");
GameRegistry.registerTileEntity(classOf[TileFocusCrystal], "EMFocusCrystal");
OreDictionary.registerOre("wire", ElectricalContent.itemWire) OreDictionary.registerOre("wire", ElectricalContent.itemWire)
OreDictionary.registerOre("motor", ElectricalContent.blockMotor) OreDictionary.registerOre("motor", ElectricalContent.blockMotor)
OreDictionary.registerOre("battery", ItemBlockBattery.setTier(new ItemStack(ElectricalContent.blockBattery, 1, 0), 0.asInstanceOf[Byte])) OreDictionary.registerOre("battery", ItemBlockBattery.setTier(new ItemStack(ElectricalContent.blockBattery, 1, 0), 0.asInstanceOf[Byte]))
@ -113,7 +90,6 @@ object ElectricalContent extends ContentHolder
override def postInit override def postInit
{ {
super.postInit
recipes += shaped(blockTesla, "WEW", " C ", "DID", 'W', "wire", 'E', Items.ender_eye, 'C', UniversalRecipe.BATTERY.get, 'D', Items.diamond, 'I', UniversalRecipe.PRIMARY_PLATE.get) recipes += shaped(blockTesla, "WEW", " C ", "DID", 'W', "wire", 'E', Items.ender_eye, 'C', UniversalRecipe.BATTERY.get, 'D', Items.diamond, 'I', UniversalRecipe.PRIMARY_PLATE.get)
recipes += shaped(itemMultimeter, "WWW", "ICI", 'W', "wire", 'C', UniversalRecipe.BATTERY.get, 'I', UniversalRecipe.PRIMARY_METAL.get) recipes += shaped(itemMultimeter, "WWW", "ICI", 'W', "wire", 'C', UniversalRecipe.BATTERY.get, 'I', UniversalRecipe.PRIMARY_METAL.get)
recipes += shaped(tierOneBattery, "III", "IRI", "III", 'R', Blocks.redstone_block, 'I', UniversalRecipe.PRIMARY_METAL.get) recipes += shaped(tierOneBattery, "III", "IRI", "III", 'R', Blocks.redstone_block, 'I', UniversalRecipe.PRIMARY_METAL.get)
@ -142,7 +118,6 @@ object ElectricalContent extends ContentHolder
recipes += shaped(blockFocusCrystal, "GGG", "GDG", "GGG", 'G', Blocks.glass, 'D', Items.diamond) recipes += shaped(blockFocusCrystal, "GGG", "GDG", "GGG", 'G', Blocks.glass, 'D', Items.diamond)
recipes += shaped(itemFocusingMatrix, "GGG", "GNG", "GGG", 'G', Items.redstone, 'N', Items.quartz) recipes += shaped(itemFocusingMatrix, "GGG", "GNG", "GGG", 'G', Items.redstone, 'N', Items.quartz)
if (Loader.isModLoaded("IC2")) if (Loader.isModLoaded("IC2"))
{ {
recipes += shapeless(getWire(WireMaterial.COPPER, 1), IC2Items.getItem("copperCableItem")) recipes += shapeless(getWire(WireMaterial.COPPER, 1), IC2Items.getItem("copperCableItem"))
@ -156,13 +131,9 @@ object ElectricalContent extends ContentHolder
{ {
GameRegistry.addRecipe(new ShapelessOreRecipe(getWire(WireMaterial.COPPER, 1), "universalCable")) GameRegistry.addRecipe(new ShapelessOreRecipe(getWire(WireMaterial.COPPER, 1), "universalCable"))
} }
} }
def getWire(t: WireMaterial, count: Int): ItemStack = def getWire(t: WireMaterial, count: Int): ItemStack =new ItemStack(itemWire, count, t.ordinal())
{
return new ItemStack(itemWire, count, t.ordinal())
}
/** /**
* Handle wire texture * Handle wire texture