Fixed electrical part registry registering too late

This commit is contained in:
Calclavia 2014-10-12 15:24:46 +08:00
parent 1e38614b9f
commit 9fd2b3eac0
4 changed files with 244 additions and 245 deletions

View file

@ -13,6 +13,7 @@ import resonant.lib.wrapper.WrapList._
import resonantinduction.core.{Reference, ResonantTab} import resonantinduction.core.{Reference, ResonantTab}
import scala.collection.JavaConversions._ import scala.collection.JavaConversions._
object ItemImprint object ItemImprint
{ {
/** /**
@ -66,6 +67,7 @@ object ItemImprint
val var4: NBTTagCompound = tagList.getCompoundTagAt(i) val var4: NBTTagCompound = tagList.getCompoundTagAt(i)
filterStacks.add(ItemStack.loadItemStackFromNBT(var4)) filterStacks.add(ItemStack.loadItemStackFromNBT(var4))
} }
return filterStacks return filterStacks
} }
@ -88,11 +90,11 @@ object ItemImprint
class ItemImprint extends Item class ItemImprint extends Item
{ {
//Constructor //Constructor
this.setUnlocalizedName(Reference.prefix + "imprint") setUnlocalizedName(Reference.prefix + "imprint")
this.setTextureName(Reference.prefix + "imprint") setTextureName(Reference.prefix + "imprint")
this.setCreativeTab(ResonantTab.tab) setCreativeTab(ResonantTab.tab)
this.setHasSubtypes(true) setHasSubtypes(true)
this.setMaxStackSize(1) setMaxStackSize(1)
override def onLeftClickEntity(stack: ItemStack, player: EntityPlayer, entity: Entity): Boolean = override def onLeftClickEntity(stack: ItemStack, player: EntityPlayer, entity: Entity): Boolean =
{ {
@ -117,6 +119,7 @@ class ItemImprint extends Item
{ {
for (filterItem <- filterItems) for (filterItem <- filterItems)
{ {
if(filterItem != null)
list.add(filterItem.getDisplayName) list.add(filterItem.getDisplayName)
} }
} }

View file

@ -26,64 +26,63 @@ import scala.collection.convert.wrapAll._
@ModstatInfo(prefix = "resonantin") @ModstatInfo(prefix = "resonantin")
final object ResonantInduction final object ResonantInduction
{ {
/** Packets */ /** Packets */
val packetHandler = ResonantEngine.instance.packetHandler val packetHandler = ResonantEngine.instance.packetHandler
val loadables = new LoadableHandler val loadables = new LoadableHandler
@SidedProxy(clientSide = "resonantinduction.core.ClientProxy", serverSide = "resonantinduction.core.CommonProxy") @SidedProxy(clientSide = "resonantinduction.core.ClientProxy", serverSide = "resonantinduction.core.CommonProxy")
var proxy: CommonProxy = _ var proxy: CommonProxy = _
@Mod.Metadata(References.ID) @Mod.Metadata(References.ID)
var metadata: ModMetadata = null var metadata: ModMetadata = null
@EventHandler @EventHandler
def preInit(evt: FMLPreInitializationEvent) def preInit(evt: FMLPreInitializationEvent)
{
NetworkRegistry.INSTANCE.registerGuiHandler(this, proxy)
Modstats.instance.getReporter.registerMod(this)
Settings.config = new Configuration(evt.getSuggestedConfigurationFile)
ConfigHandler.sync(Settings, Settings.config)
MinecraftForge.EVENT_BUS.register(new TextureHookHandler)
loadables.applyModule(proxy)
loadables.applyModule(packetHandler)
loadables.applyModule(AtomicContent)
loadables.applyModule(ArchaicContent)
loadables.applyModule(CoreContent)
loadables.applyModule(ElectricalContent)
loadables.applyModule(MechContent)
loadables.preInit()
ResonantTab.itemStack = new ItemStack(CoreContent.decoration)
}
@EventHandler
def init(evt: FMLInitializationEvent)
{
//TODO: Why is there an if statement check here?
if (ResonantInduction.metadata != null)
{ {
NetworkRegistry.INSTANCE.registerGuiHandler(this, proxy) ResonantInduction.metadata.modId = Reference.name
Modstats.instance.getReporter.registerMod(this) ResonantInduction.metadata.name = Reference.name
ResonantInduction.metadata.description = Reference.name + " is a mod... TODO add description"
Settings.config = new Configuration(evt.getSuggestedConfigurationFile) ResonantInduction.metadata.url = "http://calclavia.com/resonant-induction/"
ConfigHandler.sync(Settings, Settings.config) ResonantInduction.metadata.version = Reference.version + Reference.build
ResonantInduction.metadata.authorList = List[String]("Calclavia", "DarkCow", "tgame14", "Maxwolf")
MinecraftForge.EVENT_BUS.register(new TextureHookHandler) ResonantInduction.metadata.autogenerated = false
loadables.applyModule(proxy)
loadables.applyModule(packetHandler)
loadables.applyModule(AtomicContent)
loadables.applyModule(ArchaicContent)
loadables.applyModule(CoreContent)
loadables.applyModule(ElectricalContent)
loadables.applyModule(MechContent)
loadables.preInit()
ResonantTab.itemStack = new ItemStack(CoreContent.decoration)
} }
@EventHandler ResonantPartFactory.init()
def init(evt: FMLInitializationEvent) ResonantEngine.resourceFactory.generateAll()
{ loadables.init()
//TODO: Why is there an if statement check here? }
if (ResonantInduction.metadata != null)
{
ResonantInduction.metadata.modId = Reference.name
ResonantInduction.metadata.name = Reference.name
ResonantInduction.metadata.description = Reference.name + " is a mod... TODO add description"
ResonantInduction.metadata.url = "http://calclavia.com/resonant-induction/"
ResonantInduction.metadata.version = Reference.version + Reference.build
ResonantInduction.metadata.authorList = List[String]("Calclavia", "DarkCow", "tgame14", "Maxwolf")
ResonantInduction.metadata.autogenerated = false
}
ResonantPartFactory.init() @EventHandler
ResonantEngine.resourceFactory.generateAll(); def postInit(evt: FMLPostInitializationEvent)
{
loadables.init() loadables.postInit()
} }
@EventHandler
def postInit(evt: FMLPostInitializationEvent)
{
loadables.postInit()
}
} }

View file

@ -10,29 +10,29 @@ import scala.collection.mutable
*/ */
object ResonantPartFactory extends IPartFactory object ResonantPartFactory extends IPartFactory
{ {
val prefix = Reference.prefix val prefix = Reference.prefix
private val partMap = mutable.Map.empty[String, Class[_ <: TMultiPart]] private val partMap = mutable.Map.empty[String, Class[_ <: TMultiPart]]
def register(part: Class[_ <: TMultiPart]) def register(part: Class[_ <: TMultiPart])
{ {
partMap += (prefix + part.getSimpleName -> part) partMap += (prefix + part.getSimpleName -> part)
} }
def create[C <: TMultiPart](part: Class[C]): C = MultiPartRegistry.createPart((partMap map (_.swap)).get(part).get, false).asInstanceOf[C] def create[C <: TMultiPart](part: Class[C]): C = MultiPartRegistry.createPart((partMap map (_.swap)).get(part).get, false).asInstanceOf[C]
def init() def init()
{ {
MultiPartRegistry.registerParts(this, partMap.keys.toArray) MultiPartRegistry.registerParts(this, partMap.keys.toArray)
MultipartGenerator.registerTrait("universalelectricity.api.core.grid.INodeProvider", "resonantinduction.core.prefab.pass.TNodeProvider") MultipartGenerator.registerTrait("universalelectricity.api.core.grid.INodeProvider", "resonantinduction.core.prefab.pass.TNodeProvider")
MultipartGenerator.registerPassThroughInterface("net.minecraftforge.fluids.IFluidHandler") MultipartGenerator.registerPassThroughInterface("net.minecraftforge.fluids.IFluidHandler")
} }
def createPart(name: String, client: Boolean): TMultiPart = def createPart(name: String, client: Boolean): TMultiPart =
{ {
if (partMap.contains(name)) if (partMap.contains(name))
return partMap(name).newInstance() return partMap(name).newInstance()
else else
return null return null
} }
} }

View file

@ -37,179 +37,176 @@ import resonantinduction.electrical.wire.framed.{PartFramedWire, RenderFramedWir
*/ */
object ElectricalContent extends ContentHolder 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 itemMultimeter: Item = null
var itemTransformer: Item = null
var itemInsulation: Item = null
var itemQuantumGlyph: Item = null
var blockTesla: Block = null
var blockBattery: Block = null
var blockSolarPanel: Block = null
var blockMotor: Block = null
var blockThermopile: Block = null
var blockLaserEmitter: BlockLaserEmitter = null
var blockLaserReceiver: BlockLaserReceiver = null
var blockMirror: BlockMirror = null
var blockFocusCrystal: BlockFocusCrystal = null
var itemFocusingMatrix: ItemFocusingMatrix = null
var tierOneBattery: ItemStack = null
var tierTwoBattery: ItemStack = null
var tierThreeBattery: ItemStack = null
var guideBook: ItemStack = createGuide
override def 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.asInstanceOf[Byte])
tierTwoBattery = ItemBlockBattery.setTier(new ItemStack(ElectricalContent.blockBattery, 1, 0), 1.asInstanceOf[Byte])
tierThreeBattery = ItemBlockBattery.setTier(new ItemStack(ElectricalContent.blockBattery, 1, 0), 2.asInstanceOf[Byte])
/** 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()
{
super.init
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("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]))
}
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(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)
var itemWire: Item = null if (Loader.isModLoaded("IC2"))
var itemMultimeter: Item = null
var itemTransformer: Item = null
var itemInsulation: Item = null
var itemQuantumGlyph: Item = null
var blockTesla: Block = null
var blockBattery: Block = null
var blockSolarPanel: Block = null
var blockMotor: Block = null
var blockThermopile: Block = null
var blockLaserEmitter: BlockLaserEmitter = null
var blockLaserReceiver: BlockLaserReceiver = null
var blockMirror: BlockMirror = null
var blockFocusCrystal: BlockFocusCrystal = null
var itemFocusingMatrix: ItemFocusingMatrix = null
var tierOneBattery: ItemStack = null
var tierTwoBattery: ItemStack = null
var tierThreeBattery: ItemStack = null
var guideBook: ItemStack = createGuide
override def preInit()
{ {
super.preInit recipes += shapeless(getWire(WireMaterial.COPPER, 1), IC2Items.getItem("copperCableItem"))
itemWire = manager.newItem(classOf[ItemWire]) recipes += shapeless(getWire(WireMaterial.TIN, 1), IC2Items.getItem("tinCableItem"))
itemMultimeter = manager.newItem(classOf[ItemMultimeter]) recipes += shapeless(getWire(WireMaterial.IRON, 1), IC2Items.getItem("ironCableItem"))
itemTransformer = manager.newItem(classOf[ItemElectricTransformer]) recipes += shapeless(IC2Items.getItem("copperCableItem"), getWire(WireMaterial.COPPER, 1))
itemInsulation = manager.newItem("insulation", classOf[Item]) recipes += shapeless(IC2Items.getItem("tinCableItem"), getWire(WireMaterial.TIN, 1))
itemQuantumGlyph = manager.newItem(classOf[ItemQuantumGlyph]) recipes += shapeless(IC2Items.getItem("ironCableItem"), getWire(WireMaterial.IRON, 1))
}
blockTesla = manager.newBlock(classOf[TileTesla]) if (Loader.isModLoaded("Mekanism"))
blockBattery = manager.newBlock(classOf[TileBattery]) {
blockSolarPanel = manager.newBlock(classOf[TileSolarPanel]) GameRegistry.addRecipe(new ShapelessOreRecipe(getWire(WireMaterial.COPPER, 1), "universalCable"))
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.asInstanceOf[Byte])
tierTwoBattery = ItemBlockBattery.setTier(new ItemStack(ElectricalContent.blockBattery, 1, 0), 1.asInstanceOf[Byte])
tierThreeBattery = ItemBlockBattery.setTier(new ItemStack(ElectricalContent.blockBattery, 1, 0), 2.asInstanceOf[Byte])
MinecraftForge.EVENT_BUS.register(this)
} }
override def init() }
def getWire(t: WireMaterial, count: Int): ItemStack =
{
return new ItemStack(itemWire, count, t.ordinal())
}
def createGuide: ItemStack =
{
val guideBook = new ItemStack(Items.written_book)
val bookNBT = new NBTTagCompound()
bookNBT.setString("title", "Electromagnetic Coherence Guide")
bookNBT.setString("author", "Calclavia")
val pages = new NBTTagList()
pages.appendTag(new NBTTagString(EnumChatFormatting.RED + "Guidebook:\n\n" + EnumChatFormatting.BLACK + "Electromagnetic Coherence is a mod all about lasers.\n\nYou can find all the blocks in the mod's creative tab."))
pages.appendTag(new NBTTagString("A laser can be focused through a " + EnumChatFormatting.RED + "laser emitter" + EnumChatFormatting.BLACK + ". By default, the color of the laser is white. The color can be changed by placing stained glass in front of it. Different combinations of glass would result in mixed colors."))
pages.appendTag(new NBTTagString("To create a laser beam, provide a redstone pulse to the laser emitter. The intensity of the redstone would determine the intensity of the laser. Lasers with high intensities can burn and melt through blocks, hurting entities."))
pages.appendTag(new NBTTagString("A laser beam can also be reflected using a " + EnumChatFormatting.RED + "mirror" + EnumChatFormatting.BLACK + " with reduced intensity. Mirrors can be rotated by right clicking on it. Shift-right clicking a mirror focuses it to a side. Mirrors can also be auto-rotated with a redstone signal based on the direction of the signal propagation."))
pages.appendTag(new NBTTagString("A " + EnumChatFormatting.RED + "laser receiver" + EnumChatFormatting.BLACK + " outputs a redstone signal with a strength based on the laser incident on its front. Using this, laser trip-wires can be made as entities walking through a laser will block its path."))
pages.appendTag(new NBTTagString("The " + EnumChatFormatting.RED + "focusing matrix" + EnumChatFormatting.BLACK + " allows the player to focus mirrors and focus crystals. First, right click on a mirror/crystal to select it. Then, right click on a point to focus. Clicking the point twice will aim the laser at that point instead of making the device look at the point."))
pages.appendTag(new NBTTagString("The " + EnumChatFormatting.RED + "Focus Crystal" + EnumChatFormatting.BLACK + " allows you to focus multiple laser beams into a single one, adding their strength together. All beams aiming at the crystal will be sent in the direction the crystal is facing. Focus Crystals can be rotated the same way as mirrors can."))
pages.appendTag(new NBTTagString(EnumChatFormatting.RED + "Usages\n\n" + EnumChatFormatting.BLACK + "- Light Shows\n- Mining\n- Killing\n- Burning\n- Redstone Detection\n- Smelting (Aim strong laser at furnace)\n\nComing Soon:\n- Energy Transfer\n- Crafting"))
bookNBT.setTag("pages", pages)
guideBook.setTagCompound(bookNBT)
return guideBook
}
/**
* Handle wire texture
*/
@SubscribeEvent
@SideOnly(Side.CLIENT)
def preTextureHook(event: TextureStitchEvent.Pre)
{
if (event.map.getTextureType() == 0)
{ {
super.init RenderFlatWire.wireIcon = event.map.registerIcon(Reference.prefix + "models/flatWire")
RenderFramedWire.wireIcon = event.map.registerIcon(Reference.prefix + "models/wire")
ResonantTab.itemStack(new ItemStack(ElectricalContent.itemTransformer)) RenderFramedWire.insulationIcon = event.map.registerIcon(Reference.prefix + "models/insulation")
GameRegistry.registerTileEntity(classOf[TileLaserEmitter], "EMLaserEmitter");
GameRegistry.registerTileEntity(classOf[TileLaserReceiver], "EMLaserReceiver");
GameRegistry.registerTileEntity(classOf[TileMirror], "EMLaserMirror");
GameRegistry.registerTileEntity(classOf[TileFocusCrystal], "EMFocusCrystal");
/** Register all parts */
ResonantPartFactory.register(classOf[PartFramedWire])
ResonantPartFactory.register(classOf[PartFlatWire])
ResonantPartFactory.register(classOf[PartMultimeter])
ResonantPartFactory.register(classOf[PartElectricTransformer])
ResonantPartFactory.register(classOf[PartQuantumGlyph])
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]))
}
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(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"))
{
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))
}
if (Loader.isModLoaded("Mekanism"))
{
GameRegistry.addRecipe(new ShapelessOreRecipe(getWire(WireMaterial.COPPER, 1), "universalCable"))
}
}
def getWire(t: WireMaterial, count: Int): ItemStack =
{
return new ItemStack(itemWire, count, t.ordinal())
}
def createGuide: ItemStack =
{
val guideBook = new ItemStack(Items.written_book)
val bookNBT = new NBTTagCompound()
bookNBT.setString("title", "Electromagnetic Coherence Guide")
bookNBT.setString("author", "Calclavia")
val pages = new NBTTagList()
pages.appendTag(new NBTTagString(EnumChatFormatting.RED + "Guidebook:\n\n" + EnumChatFormatting.BLACK + "Electromagnetic Coherence is a mod all about lasers.\n\nYou can find all the blocks in the mod's creative tab."))
pages.appendTag(new NBTTagString("A laser can be focused through a " + EnumChatFormatting.RED + "laser emitter" + EnumChatFormatting.BLACK + ". By default, the color of the laser is white. The color can be changed by placing stained glass in front of it. Different combinations of glass would result in mixed colors."))
pages.appendTag(new NBTTagString("To create a laser beam, provide a redstone pulse to the laser emitter. The intensity of the redstone would determine the intensity of the laser. Lasers with high intensities can burn and melt through blocks, hurting entities."))
pages.appendTag(new NBTTagString("A laser beam can also be reflected using a " + EnumChatFormatting.RED + "mirror" + EnumChatFormatting.BLACK + " with reduced intensity. Mirrors can be rotated by right clicking on it. Shift-right clicking a mirror focuses it to a side. Mirrors can also be auto-rotated with a redstone signal based on the direction of the signal propagation."))
pages.appendTag(new NBTTagString("A " + EnumChatFormatting.RED + "laser receiver" + EnumChatFormatting.BLACK + " outputs a redstone signal with a strength based on the laser incident on its front. Using this, laser trip-wires can be made as entities walking through a laser will block its path."))
pages.appendTag(new NBTTagString("The " + EnumChatFormatting.RED + "focusing matrix" + EnumChatFormatting.BLACK + " allows the player to focus mirrors and focus crystals. First, right click on a mirror/crystal to select it. Then, right click on a point to focus. Clicking the point twice will aim the laser at that point instead of making the device look at the point."))
pages.appendTag(new NBTTagString("The " + EnumChatFormatting.RED + "Focus Crystal" + EnumChatFormatting.BLACK + " allows you to focus multiple laser beams into a single one, adding their strength together. All beams aiming at the crystal will be sent in the direction the crystal is facing. Focus Crystals can be rotated the same way as mirrors can."))
pages.appendTag(new NBTTagString(EnumChatFormatting.RED + "Usages\n\n" + EnumChatFormatting.BLACK + "- Light Shows\n- Mining\n- Killing\n- Burning\n- Redstone Detection\n- Smelting (Aim strong laser at furnace)\n\nComing Soon:\n- Energy Transfer\n- Crafting"))
bookNBT.setTag("pages", pages)
guideBook.setTagCompound(bookNBT)
return guideBook
}
/**
* Handle wire texture
*/
@SubscribeEvent
@SideOnly(Side.CLIENT)
def preTextureHook(event: TextureStitchEvent.Pre)
{
if (event.map.getTextureType() == 0)
{
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")
}
} }
}
} }