2015-01-14 12:06:03 +01:00
package edx.electrical
2014-08-11 07:44:06 +02:00
2014-08-11 09:47:13 +02:00
import cpw.mods.fml.common.Loader
2014-10-05 02:14:55 +02:00
import cpw.mods.fml.common.eventhandler.SubscribeEvent
2014-08-11 09:47:13 +02:00
import cpw.mods.fml.common.registry.GameRegistry
2014-10-05 02:14:55 +02:00
import cpw.mods.fml.relauncher. { Side , SideOnly }
2015-01-14 12:06:03 +01:00
import edx.core. { EDXCreativeTab , Reference , ResonantPartFactory }
import edx.electrical.battery. { ItemBlockBattery , TileBattery }
import edx.electrical.generator. { TileMotor , TileSolarPanel , TileThermopile }
import edx.electrical.multimeter. { ItemMultimeter , PartMultimeter }
import edx.electrical.tesla.TileTesla
import edx.electrical.transformer. { ItemElectricTransformer , PartElectricTransformer }
import edx.electrical.wire.ItemWire
import edx.electrical.wire.base.WireMaterial
import edx.electrical.wire.flat. { PartFlatWire , RenderFlatWire }
import edx.electrical.wire.framed. { PartFramedWire , RenderFramedWire }
import edx.quantum.gate. { ItemQuantumGlyph , PartQuantumGlyph }
import edx.quantum.laser.focus. { ItemFocusingMatrix , TileFocusCrystal , TileMirror }
import edx.quantum.laser. { TileLaserEmitter , TileLaserReceiver }
2014-08-11 09:47:13 +02:00
import ic2.api.item.IC2Items
2014-08-11 07:44:06 +02:00
import net.minecraft.block.Block
2014-08-11 09:47:13 +02:00
import net.minecraft.init. { Blocks , Items }
import net.minecraft.item. { Item , ItemStack }
2014-10-12 11:13:48 +02:00
import net.minecraft.util.ResourceLocation
2014-10-05 02:14:55 +02:00
import net.minecraftforge.client.event.TextureStitchEvent
import net.minecraftforge.common.MinecraftForge
import net.minecraftforge.oredict. { OreDictionary , ShapelessOreRecipe }
2015-01-26 12:40:32 +01:00
import resonantengine.api.modcontent.ExplicitContentName
import resonantengine.lib.utility.recipe.UniversalRecipe
import resonantengine.prefab.modcontent.ContentHolder
2014-08-11 07:44:06 +02:00
2014-10-05 02:14:55 +02:00
object ElectricalContent extends ContentHolder
{
2014-10-12 09:24:46 +02:00
val particleTextures = new ResourceLocation ( "textures/particle/particles.png" )
2014-10-25 13:36:17 +02:00
var itemWire = new ItemWire
var itemMultimeter = new ItemMultimeter
var itemTransformer = new ItemElectricTransformer
@ExplicitContentName ( "insulation" ) var itemInsulation = new Item
var itemQuantumGlyph = new ItemQuantumGlyph
2014-10-12 09:24:46 +02:00
2014-10-25 13:36:17 +02:00
var itemFocusingMatrix : ItemFocusingMatrix = new ItemFocusingMatrix
2014-10-12 09:24:46 +02:00
2014-10-25 13:36:17 +02:00
var blockTesla : Block = new TileTesla
var blockBattery : Block = new TileBattery
var blockSolarPanel : Block = new TileSolarPanel
var blockMotor : Block = new TileMotor
var blockThermopile : Block = new TileThermopile
2014-10-12 09:24:46 +02:00
2014-10-25 14:31:19 +02:00
var blockLaserEmitter : Block = new TileLaserEmitter
var blockLaserReceiver : Block = new TileLaserReceiver
var blockMirror : Block = new TileMirror
var blockFocusCrystal : Block = new TileFocusCrystal
2014-10-12 09:24:46 +02:00
var tierOneBattery : ItemStack = null
var tierTwoBattery : ItemStack = null
var tierThreeBattery : ItemStack = null
2015-01-14 12:06:03 +01:00
manager . setTab ( EDXCreativeTab ) . setPrefix ( Reference . prefix )
2014-10-25 14:31:19 +02:00
2014-10-12 09:24:46 +02:00
override def preInit ( )
{
2014-10-25 13:36:17 +02:00
super . preInit ( )
2014-10-12 09:24:46 +02:00
2014-10-12 11:13:48 +02:00
tierOneBattery = ItemBlockBattery . setTier ( new ItemStack ( ElectricalContent . blockBattery , 1 , 0 ) , 0 )
tierTwoBattery = ItemBlockBattery . setTier ( new ItemStack ( ElectricalContent . blockBattery , 1 , 0 ) , 1 )
tierThreeBattery = ItemBlockBattery . setTier ( new ItemStack ( ElectricalContent . blockBattery , 1 , 0 ) , 2 )
2014-10-12 09:24:46 +02:00
/* * Register all parts */
ResonantPartFactory . register ( classOf [ PartFramedWire ] )
ResonantPartFactory . register ( classOf [ PartFlatWire ] )
ResonantPartFactory . register ( classOf [ PartMultimeter ] )
ResonantPartFactory . register ( classOf [ PartElectricTransformer ] )
ResonantPartFactory . register ( classOf [ PartQuantumGlyph ] )
MinecraftForge . EVENT_BUS . register ( this )
}
override def init ( )
{
2014-10-25 13:36:17 +02:00
super . init ( )
2014-10-12 09:24:46 +02:00
OreDictionary . registerOre ( "wire" , ElectricalContent . itemWire )
OreDictionary . registerOre ( "motor" , ElectricalContent . blockMotor )
OreDictionary . registerOre ( "battery" , ItemBlockBattery . setTier ( new ItemStack ( ElectricalContent . blockBattery , 1 , 0 ) , 0. asInstanceOf [ Byte ] ) )
OreDictionary . registerOre ( "batteryBox" , ItemBlockBattery . setTier ( new ItemStack ( ElectricalContent . blockBattery , 1 , 0 ) , 0. asInstanceOf [ Byte ] ) )
}
2014-12-10 15:26:58 +01:00
override def postInit ( )
2014-10-12 09:24:46 +02:00
{
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 ( tierOneBattery , "III" , "IRI" , "III" , 'R' , Blocks . redstone_block , 'I' , UniversalRecipe . PRIMARY_METAL . get )
recipes += shaped ( tierTwoBattery , "RRR" , "RIR" , "RRR" , 'R' , tierOneBattery , 'I' , UniversalRecipe . PRIMARY_PLATE . get )
recipes += shaped ( tierThreeBattery , "RRR" , "RIR" , "RRR" , 'R' , tierTwoBattery , 'I' , Blocks . diamond_block )
recipes += shaped ( getWire ( WireMaterial . COPPER , 3 ) , "MMM" , 'M' , "ingotCopper" )
recipes += shaped ( getWire ( WireMaterial . TIN , 3 ) , "MMM" , 'M' , "ingotTin" )
recipes += shaped ( getWire ( WireMaterial . IRON , 3 ) , "MMM" , 'M' , Items . iron_ingot )
recipes += shaped ( getWire ( WireMaterial . ALUMINUM , 3 ) , "MMM" , 'M' , "ingotAluminum" )
recipes += shaped ( getWire ( WireMaterial . SILVER , 3 ) , "MMM" , 'M' , "ingotSilver" )
recipes += shaped ( getWire ( WireMaterial . SUPERCONDUCTOR , 3 ) , "MMM" , 'M' , "ingotSuperconductor" )
recipes += shaped ( getWire ( WireMaterial . SUPERCONDUCTOR , 3 ) , "MMM" , "MEM" , "MMM" , 'M' , Items . gold_ingot , 'E' , Items . ender_eye )
//recipes += shaped(ElectricalContent.itemCharger, "WWW", "ICI", 'W', "wire", 'I', UniversalRecipe.PRIMARY_METAL.get, 'C', UniversalRecipe.CIRCUIT_T1.get)
recipes += shaped ( itemTransformer , "WWW" , "WWW" , "III" , 'W' , "wire" , 'I' , UniversalRecipe . PRIMARY_METAL . get )
//recipes += shaped(new ItemStack(ElectricalContent.itemQuantumGlyph, 1, 0), " CT", "LBL", "TCT", 'B', Blocks.diamond_block, 'L', ElectricalContent.itemLevitator, 'C', ElectricalContent.itemCharger, 'T', ElectricalContent.blockTesla)
//recipes += shaped(new ItemStack(ElectricalContent.itemQuantumGlyph, 1, 1), "TCT", "LBL", " CT", 'B', Blocks.diamond_block, 'L', ElectricalContent.itemLevitator, 'C', ElectricalContent.itemCharger, 'T', ElectricalContent.blockTesla)
//recipes += shaped(new ItemStack(ElectricalContent.itemQuantumGlyph, 1, 2), "TC ", "LBL", "TCT", 'B', Blocks.diamond_block, 'L', ElectricalContent.itemLevitator, 'C', ElectricalContent.itemCharger, 'T', ElectricalContent.blockTesla)
//recipes += shaped(new ItemStack(ElectricalContent.itemQuantumGlyph, 1, 3), "TCT", "LBL", "TC ", 'B', Blocks.diamond_block, 'L', ElectricalContent.itemLevitator, 'C', ElectricalContent.itemCharger, 'T', ElectricalContent.blockTesla)
recipes += shaped ( blockSolarPanel , "CCC" , "WWW" , "III" , 'W' , "wire" , 'C' , Items . coal , 'I' , UniversalRecipe . PRIMARY_METAL . get )
recipes += shaped ( blockMotor , "SRS" , "SMS" , "SWS" , 'W' , "wire" , 'R' , Items . redstone , 'M' , Blocks . iron_block , 'S' , UniversalRecipe . PRIMARY_METAL . get )
recipes += shaped ( blockThermopile , "ORO" , "OWO" , "OOO" , 'W' , "wire" , 'O' , Blocks . obsidian , 'R' , Items . redstone )
recipes += shaped ( blockLaserEmitter , "IGI" , "IDI" , "III" , 'G' , Blocks . glass , 'I' , Items . iron_ingot , 'D' , Items . diamond )
recipes += shaped ( blockLaserReceiver , "IGI" , "IRI" , "III" , 'G' , Blocks . glass , 'I' , Items . iron_ingot , 'R' , Blocks . redstone_block )
recipes += shaped ( blockMirror , "GGG" , "III" , "GGG" , 'G' , Blocks . glass , 'I' , Items . iron_ingot )
recipes += shaped ( blockFocusCrystal , "GGG" , "GDG" , "GGG" , 'G' , Blocks . glass , 'D' , Items . diamond )
recipes += shaped ( itemFocusingMatrix , "GGG" , "GNG" , "GGG" , 'G' , Items . redstone , 'N' , Items . quartz )
if ( Loader . isModLoaded ( "IC2" ) )
2014-08-11 09:47:13 +02:00
{
2014-10-12 09:24:46 +02:00
recipes += shapeless ( getWire ( WireMaterial . COPPER , 1 ) , IC2Items . getItem ( "copperCableItem" ) )
recipes += shapeless ( getWire ( WireMaterial . TIN , 1 ) , IC2Items . getItem ( "tinCableItem" ) )
recipes += shapeless ( getWire ( WireMaterial . IRON , 1 ) , IC2Items . getItem ( "ironCableItem" ) )
recipes += shapeless ( IC2Items . getItem ( "copperCableItem" ) , getWire ( WireMaterial . COPPER , 1 ) )
recipes += shapeless ( IC2Items . getItem ( "tinCableItem" ) , getWire ( WireMaterial . TIN , 1 ) )
recipes += shapeless ( IC2Items . getItem ( "ironCableItem" ) , getWire ( WireMaterial . IRON , 1 ) )
2014-08-11 09:47:13 +02:00
}
2014-10-12 09:24:46 +02:00
if ( Loader . isModLoaded ( "Mekanism" ) )
2014-08-11 09:47:13 +02:00
{
2014-10-12 09:24:46 +02:00
GameRegistry . addRecipe ( new ShapelessOreRecipe ( getWire ( WireMaterial . COPPER , 1 ) , "universalCable" ) )
2014-10-05 02:14:55 +02:00
}
2014-10-12 09:24:46 +02:00
}
2014-10-25 14:31:19 +02:00
def getWire ( t : WireMaterial , count : Int ) : ItemStack = new ItemStack ( itemWire , count , t . ordinal ( ) )
2014-10-12 09:24:46 +02:00
/* *
* Handle wire texture
*/
@SubscribeEvent
@SideOnly ( Side . CLIENT )
def preTextureHook ( event : TextureStitchEvent . Pre )
{
2014-12-10 15:26:58 +01:00
if ( event . map . getTextureType == 0 )
2014-10-05 02:14:55 +02:00
{
2014-10-12 09:24:46 +02:00
RenderFlatWire . wireIcon = event . map . registerIcon ( Reference . prefix + "models/flatWire" )
RenderFramedWire . wireIcon = event . map . registerIcon ( Reference . prefix + "models/wire" )
RenderFramedWire . insulationIcon = event . map . registerIcon ( Reference . prefix + "models/insulation" )
2014-10-05 02:14:55 +02:00
}
2014-10-12 09:24:46 +02:00
}
2014-08-11 07:44:06 +02:00
}