All around error correction, slowly starting to compile

This commit is contained in:
Robert S 2014-08-11 03:47:13 -04:00
parent b1a148ee97
commit 6db933cc7d
28 changed files with 111 additions and 176 deletions

View file

@ -53,8 +53,8 @@ class TileCrate extends TileInventory(Material.rock) with TPacketReceiver with I
override def getSizeInventory: Int = TileCrate.getSlotCount(getBlockMetadata)
override def updateEntity {
super.updateEntity
override def update {
super.update
if (!worldObj.isRemote) {
this.writeToNBT(new NBTTagCompound)
if (ticks % updateTick == 0) {

View file

@ -1,9 +1,8 @@
package resonantinduction.archaic.fluid.grate
import java.util.Collections
import java.util.Comparator
import java.util.HashMap
import java.util.PriorityQueue
import java.util.{Collections, Comparator, HashMap, PriorityQueue}
import cpw.mods.fml.relauncher.{Side, SideOnly}
import net.minecraft.block.material.Material
import net.minecraft.client.renderer.texture.IIconRegister
import net.minecraft.entity.player.EntityPlayer
@ -11,23 +10,14 @@ import net.minecraft.nbt.NBTTagCompound
import net.minecraft.util.{ChatComponentText, IIcon}
import net.minecraft.world.IBlockAccess
import net.minecraftforge.common.util.ForgeDirection
import net.minecraftforge.fluids.Fluid
import net.minecraftforge.fluids.FluidContainerRegistry
import net.minecraftforge.fluids.FluidRegistry
import net.minecraftforge.fluids.FluidStack
import net.minecraftforge.fluids.FluidTankInfo
import net.minecraftforge.fluids.{Fluid, FluidContainerRegistry, FluidRegistry, FluidStack, FluidTankInfo}
import resonant.api.IRotatable
import resonant.lib.config.Config
import resonant.lib.utility.FluidUtility
import resonantinduction.archaic.fluid.grate.TileGrate._
import resonantinduction.core.Reference
import resonantinduction.core.grid.fluid.pressure.FluidPressureNode
import resonantinduction.core.grid.fluid.pressure.TilePressureNode
import resonantinduction.core.grid.fluid.pressure.{FluidPressureNode, TilePressureNode}
import universalelectricity.core.transform.vector.Vector3
import cpw.mods.fml.relauncher.Side
import cpw.mods.fml.relauncher.SideOnly
import TileGrate._
//remove if not needed
import scala.collection.JavaConversions._
object TileGrate {
@ -65,11 +55,11 @@ class TileGrate extends TilePressureNode( Material.rock ) with IRotatable {
normalRender = true
rotationMask = java.lang.Byte.parseByte( "111111", 2 )
//rotationMask = java.lang.Byte.parseByte( "111111", 2 )
tankNode = new FluidPressureNode( this )
node.maxFlowRate = getPressureTank.getCapacity
tankNode.maxFlowRate = getPressureTank.getCapacity
override def getIcon( world : IBlockAccess, side : Int ) : IIcon = {
if ( side == getDirection.ordinal() ) iconFront else iconSide
@ -112,11 +102,11 @@ class TileGrate extends TilePressureNode( Material.rock ) with IRotatable {
override def canDrain( from : ForgeDirection, fluid : Fluid ) : Boolean = getDirection != from
override def updateEntity() {
super.updateEntity()
override def update() {
super.update()
if ( !world.isRemote ) {
if ( ticks % 10 == 0 ) {
val pressure = node.getPressure( getDirection )
val pressure = tankNode.getPressure( getDirection )
val blockEffect = Math.abs( pressure * grateEffectMultiplier ).toInt
getPressureTank.setCapacity( Math.max( blockEffect * FluidContainerRegistry.BUCKET_VOLUME * grateDrainSpeedMultiplier,
FluidContainerRegistry.BUCKET_VOLUME ).toInt )
@ -174,11 +164,11 @@ class TileGrate extends TilePressureNode( Material.rock ) with IRotatable {
var navigationMap : HashMap[ Vector3, Vector3 ] = new HashMap[ Vector3, Vector3 ]()
var workingNodes : PriorityQueue[ ComparableVector ] = if ( checkVertical ) new PriorityQueue[ ComparableVector ]() else new PriorityQueue[ ComparableVector ]( 1024,
new Comparator() {
new Comparator[ComparableVector]() {
override def compare( a : AnyRef, b : AnyRef ) : Int = {
var wa = a.asInstanceOf[ TileGrate.ComparableVector ]
var wb = b.asInstanceOf[ TileGrate.ComparableVector ]
override def compare( a : ComparableVector, b : ComparableVector ) : Int = {
val wa = a.asInstanceOf[ TileGrate.ComparableVector ]
val wb = b.asInstanceOf[ TileGrate.ComparableVector ]
wa.iterations - wb.iterations
}
} )

View file

@ -34,7 +34,7 @@ import resonantinduction.mechanical.turbine.{TileElectricTurbine, RenderElectric
class ClientProxy extends CommonProxy {
override def preInit {
RenderingRegistry.registerBlockHandler(new BlockRenderingHandler.type)
RenderingRegistry.registerBlockHandler(BlockRenderingHandler)
}
override def getArmorIndex(armor: String): Int = {

View file

@ -14,8 +14,9 @@ import net.minecraft.tileentity.TileEntity
import net.minecraft.util.{ChatComponentText, MovingObjectPosition}
import resonant.api.blocks.IBlockFrequency
import resonant.api.mffs.fortron.FrequencyGridRegistry
import resonantinduction.electrical.Electrical
import resonantinduction.electrical.ElectricalContent
import universalelectricity.core.transform.vector.VectorWorld
import scala.collection.JavaConversions._
object PartQuantumGlyph {
@ -117,7 +118,7 @@ class PartQuantumGlyph extends JCuboidPart with TSlottedPart with JNormalOcclusi
return new Cuboid6(0, 0, 0, 0.5, 0.5, 0.5)
}
def getOcclusionBoxes: Iterable[Cuboid6] = {
override def getOcclusionBoxes: Iterable[codechicken.lib.vec.Cuboid6] = {
return Array[Cuboid6](getBounds)
}
@ -126,10 +127,11 @@ class PartQuantumGlyph extends JCuboidPart with TSlottedPart with JNormalOcclusi
}
protected def getItem: ItemStack = {
return new ItemStack(Electrical.itemQuantumGlyph, 1, number)
return new ItemStack(ElectricalContent.itemQuantumGlyph, 1, number)
}
override def getDrops: Iterable[ItemStack] = {
override def getDrops: Iterable[net.minecraft.item.ItemStack] = {
super.getDrops
val drops: Array[ItemStack] = new Array[ItemStack](1)
drops(0) = getItem
return drops

View file

@ -62,11 +62,11 @@ class TileReactorCell extends TileInventory(Material.iron) with IMultiBlockStruc
normalRender = false
customItemRender = true
override protected def onWorldJoin {
override def onWorldJoin {
updatePositionStatus
}
override protected def onNeighborChanged(block : Block) {
override def onNeighborChanged(block : Block) {
updatePositionStatus
}
@ -305,7 +305,7 @@ class TileReactorCell extends TileInventory(Material.iron) with IMultiBlockStruc
return height
}
override def getDescriptionPacket: Any = {
override def getDescPacket: PacketAnnotation = {
return new PacketAnnotation(this)
}

View file

@ -7,7 +7,7 @@ import net.minecraft.nbt.NBTTagCompound
import net.minecraft.network.Packet
import net.minecraftforge.common.util.ForgeDirection
import net.minecraftforge.fluids._
import resonant.content.spatial.block.SpatialTile
import resonant.content.prefab.java.TileAdvanced
import resonant.lib.network.ByteBufWrapper.ByteBufWrapper
import resonant.lib.network.discriminator.PacketType
import resonant.lib.network.handle.{IPacketIDReceiver, TPacketIDSender}
@ -28,7 +28,7 @@ object TileTankNode extends Enumeration
final val PACKET_DESCRIPTION, PACKET_RENDER, PACKET_TANK = Value
}
class TileTankNode(material: Material) extends SpatialTile(material) with INodeProvider with IFluidHandler with IPacketIDReceiver with TPacketIDSender
class TileTankNode(material: Material) extends TileAdvanced(material) with INodeProvider with IFluidHandler with IPacketIDReceiver with TPacketIDSender
{
protected var tank: FluidTank = new FluidTank(1000);
protected var pressure = 0
@ -173,9 +173,9 @@ class TileTankNode(material: Material) extends SpatialTile(material) with INodeP
tankNode.onChange = () => sendRenderUpdate
override def start()
override def initiate()
{
super.start()
super.initiate()
tankNode.reconstruct()
}

View file

@ -1,23 +1,18 @@
package resonantinduction.core.grid.fluid.pressure
import net.minecraft.nbt.NBTTagCompound
import net.minecraftforge.common.util.ForgeDirection
import net.minecraftforge.fluids.{FluidStack, FluidTank, IFluidHandler}
import resonantinduction.core.grid.MultipartNode
import resonantinduction.core.grid.fluid.TileTankNode
import resonantinduction.core.grid.fluid.distribution.TankNode
import universalelectricity.api.core.grid.INodeProvider
import scala.collection.convert.wrapAll._
class FluidPressureNode(parent: TileTankNode) extends MultipartNode[AnyRef](parent)
class FluidPressureNode(parent: TileTankNode) extends TankNode(parent)
{
var maxFlowRate: Int = 20
var maxPressure: Int = 100
protected var connectionMap: Byte = java.lang.Byte.parseByte("111111", 2)
private var pressure = 0
def genericParent = parent.asInstanceOf[TileTankNode]
def setConnection(connectionMap: Byte): FluidPressureNode =
{
this.connectionMap = connectionMap
@ -153,28 +148,6 @@ class FluidPressureNode(parent: TileTankNode) extends MultipartNode[AnyRef](pare
}
}
def getMaxFlowRate: Int =
{
return maxFlowRate
}
def setPressure(newPressure: Int)
{
if (newPressure > 0)
{
pressure = Math.min(maxPressure, newPressure)
}
else
{
pressure = Math.max(-maxPressure, newPressure)
}
}
def getPressure(dir: ForgeDirection): Int =
{
return pressure
}
/**
* Recache the connections. This is the default connection implementation.
*/
@ -201,16 +174,4 @@ class FluidPressureNode(parent: TileTankNode) extends MultipartNode[AnyRef](pare
{
return (source.isInstanceOf[FluidPressureNode]) && (connectionMap & (1 << from.ordinal)) != 0
}
override def load(nbt: NBTTagCompound)
{
super.load(nbt)
pressure = nbt.getInteger("pressure")
}
override def save(nbt: NBTTagCompound)
{
super.save(nbt)
nbt.setInteger("pressure", pressure)
}
}

View file

@ -4,7 +4,6 @@ import net.minecraft.block.material.Material
import net.minecraftforge.common.util.ForgeDirection
import net.minecraftforge.fluids.{FluidStack, FluidTank, FluidTankInfo}
import resonantinduction.core.grid.fluid.TileTankNode
import universalelectricity.api.core.grid.INode
/**
* A prefab class for tiles that use the fluid network.
@ -13,19 +12,6 @@ import universalelectricity.api.core.grid.INode
*/
abstract class TilePressureNode(material: Material) extends TileTankNode(material)
{
protected val pressureNode: FluidPressureNode
override def start
{
super.start
pressureNode.reconstruct
}
override def invalidate
{
pressureNode.deconstruct
super.invalidate
}
override def fill(from: ForgeDirection, resource: FluidStack, doFill: Boolean): Int =
{
@ -65,12 +51,4 @@ abstract class TilePressureNode(material: Material) extends TileTankNode(materia
{
return tank
}
override def getNode(nodeType: Class[_ <: INode], from: ForgeDirection): INode =
{
if (nodeType.isAssignableFrom(pressureNode.getClass))
return pressureNode
return null
}
}

View file

@ -44,6 +44,7 @@ abstract class PartFramedNode[M](insulationType: Item) extends PartColorableMate
}
override def getSubParts: Iterable[IndexedCuboid6] = {
super.getSubParts
val currentSides: Array[IndexedCuboid6] = if (isInsulated) PartFramedNode.insulatedSides.clone() else PartFramedNode.sides.clone()
if (tile != null) {
for (side <- ForgeDirection.VALID_DIRECTIONS) {

View file

@ -3,15 +3,11 @@ package resonantinduction.electrical
import cpw.mods.fml.common.Mod.{EventHandler, Instance}
import cpw.mods.fml.common.event.{FMLInitializationEvent, FMLPostInitializationEvent, FMLPreInitializationEvent}
import cpw.mods.fml.common.network.NetworkRegistry
import cpw.mods.fml.common.registry.GameRegistry
import cpw.mods.fml.common.{Loader, Mod, ModMetadata, SidedProxy}
import ic2.api.item.IC2Items
import net.minecraft.init.{Blocks, Items}
import cpw.mods.fml.common.{Mod, ModMetadata, SidedProxy}
import net.minecraft.item.ItemStack
import net.minecraftforge.oredict.{OreDictionary, ShapedOreRecipe, ShapelessOreRecipe}
import net.minecraftforge.oredict.OreDictionary
import resonant.content.loader.ModManager
import resonant.lib.loadable.LoadableHandler
import resonant.lib.recipe.UniversalRecipe
import resonantinduction.atomic.gate.ItemQuantumGlyph
import resonantinduction.core.resource.ItemResourcePart
import resonantinduction.core.{Reference, ResonantTab, Settings}
@ -73,42 +69,6 @@ object Electrical {
}
@EventHandler def postInit(evt: FMLPostInitializationEvent) {
GameRegistry.addRecipe(new ShapedOreRecipe(ElectricalContent.blockTesla, "WEW", " C ", "DID", 'W', "wire", 'E', Items.ender_eye, 'C', UniversalRecipe.BATTERY.get, 'D', Items.diamond, 'I', UniversalRecipe.PRIMARY_PLATE.get))
GameRegistry.addRecipe(new ShapedOreRecipe(ElectricalContent.itemMultimeter, "WWW", "ICI", 'W', "wire", 'C', UniversalRecipe.BATTERY.get, 'I', UniversalRecipe.PRIMARY_METAL.get))
val tierOneBattery: ItemStack = ItemBlockBattery.setTier(new ItemStack(ElectricalContent.blockBattery, 1, 0), 0.asInstanceOf[Byte])
val tierTwoBattery: ItemStack = ItemBlockBattery.setTier(new ItemStack(ElectricalContent.blockBattery, 1, 0), 1.asInstanceOf[Byte])
val tierThreeBattery: ItemStack = ItemBlockBattery.setTier(new ItemStack(ElectricalContent.blockBattery, 1, 0), 2.asInstanceOf[Byte])
GameRegistry.addRecipe(new ShapedOreRecipe(tierOneBattery, "III", "IRI", "III", 'R', Blocks.redstone_block, 'I', UniversalRecipe.PRIMARY_METAL.get))
GameRegistry.addRecipe(new ShapedOreRecipe(tierTwoBattery, "RRR", "RIR", "RRR", 'R', tierOneBattery, 'I', UniversalRecipe.PRIMARY_PLATE.get))
GameRegistry.addRecipe(new ShapedOreRecipe(tierThreeBattery, "RRR", "RIR", "RRR", 'R', tierTwoBattery, 'I', Blocks.diamond_block))
GameRegistry.addRecipe(new ShapedOreRecipe(EnumWireMaterial.COPPER.getWire(3), "MMM", 'M', "ingotCopper"))
GameRegistry.addRecipe(new ShapedOreRecipe(EnumWireMaterial.TIN.getWire(3), "MMM", 'M', "ingotTin"))
GameRegistry.addRecipe(new ShapedOreRecipe(EnumWireMaterial.IRON.getWire(3), "MMM", 'M', Items.iron_ingot))
GameRegistry.addRecipe(new ShapedOreRecipe(EnumWireMaterial.ALUMINUM.getWire(3), "MMM", 'M', "ingotAluminum"))
GameRegistry.addRecipe(new ShapedOreRecipe(EnumWireMaterial.SILVER.getWire, "MMM", 'M', "ingotSilver"))
GameRegistry.addRecipe(new ShapedOreRecipe(EnumWireMaterial.SUPERCONDUCTOR.getWire(3), "MMM", 'M', "ingotSuperconductor"))
GameRegistry.addRecipe(new ShapedOreRecipe(EnumWireMaterial.SUPERCONDUCTOR.getWire(3), "MMM", "MEM", "MMM", 'M', Items.gold_ingot, 'E', Items.ender_eye))
GameRegistry.addRecipe(new ShapedOreRecipe(ElectricalContent.itemCharger, "WWW", "ICI", 'W', "wire", 'I', UniversalRecipe.PRIMARY_METAL.get, 'C', UniversalRecipe.CIRCUIT_T1.get))
GameRegistry.addRecipe(new ShapedOreRecipe(ElectricalContent.itemTransformer, "WWW", "WWW", "III", 'W', "wire", 'I', UniversalRecipe.PRIMARY_METAL.get))
GameRegistry.addRecipe(new ShapedOreRecipe(new ItemStack(ElectricalContent.itemQuantumGlyph, 1, 0), " CT", "LBL", "TCT", 'B', Blocks.diamond_block, 'L', ElectricalContent.itemLevitator, 'C', ElectricalContent.itemCharger, 'T', ElectricalContent.blockTesla))
GameRegistry.addRecipe(new ShapedOreRecipe(new ItemStack(ElectricalContent.itemQuantumGlyph, 1, 1), "TCT", "LBL", " CT", 'B', Blocks.diamond_block, 'L', ElectricalContent.itemLevitator, 'C', ElectricalContent.itemCharger, 'T', ElectricalContent.blockTesla))
GameRegistry.addRecipe(new ShapedOreRecipe(new ItemStack(ElectricalContent.itemQuantumGlyph, 1, 2), "TC ", "LBL", "TCT", 'B', Blocks.diamond_block, 'L', ElectricalContent.itemLevitator, 'C', ElectricalContent.itemCharger, 'T', ElectricalContent.blockTesla))
GameRegistry.addRecipe(new ShapedOreRecipe(new ItemStack(ElectricalContent.itemQuantumGlyph, 1, 3), "TCT", "LBL", "TC ", 'B', Blocks.diamond_block, 'L', ElectricalContent.itemLevitator, 'C', ElectricalContent.itemCharger, 'T', ElectricalContent.blockTesla))
GameRegistry.addRecipe(new ShapedOreRecipe(ElectricalContent.blockSolarPanel, "CCC", "WWW", "III", 'W', "wire", 'C', Items.coal, 'I', UniversalRecipe.PRIMARY_METAL.get))
GameRegistry.addRecipe(new ShapedOreRecipe(ElectricalContent.blockMotor, "SRS", "SMS", "SWS", 'W', "wire", 'R', Items.redstone, 'M', Blocks.iron_block, 'S', UniversalRecipe.PRIMARY_METAL.get))
GameRegistry.addRecipe(new ShapedOreRecipe(ElectricalContent.blockThermopile, "ORO", "OWO", "OOO", 'W', "wire", 'O', Blocks.obsidian, 'R', Items.redstone))
//GameRegistry.addRecipe(new ShapedOreRecipe(ElectricalContent.itemLaserGun, "RDR", "RDR", "ICB", 'R', Items.redstone, 'D', Items.diamond, 'I', Items.gold_ingot, 'C', UniversalRecipe.CIRCUIT_T2.get, 'B', ItemBlockBattery.setTier(new ItemStack(Electrical.blockBattery, 1, 0), 0.asInstanceOf[Byte])))
if (Loader.isModLoaded("IC2")) {
GameRegistry.addRecipe(new ShapelessOreRecipe(EnumWireMaterial.COPPER.getWire, IC2Items.getItem("copperCableItem")))
GameRegistry.addRecipe(new ShapelessOreRecipe(EnumWireMaterial.TIN.getWire, IC2Items.getItem("tinCableItem")))
GameRegistry.addRecipe(new ShapelessOreRecipe(EnumWireMaterial.IRON.getWire, IC2Items.getItem("ironCableItem")))
GameRegistry.addRecipe(new ShapelessOreRecipe(IC2Items.getItem("copperCableItem"), EnumWireMaterial.COPPER.getWire))
GameRegistry.addRecipe(new ShapelessOreRecipe(IC2Items.getItem("tinCableItem"), EnumWireMaterial.TIN.getWire))
GameRegistry.addRecipe(new ShapelessOreRecipe(IC2Items.getItem("ironCableItem"), EnumWireMaterial.IRON.getWire))
}
if (Loader.isModLoaded("Mekanism")) {
GameRegistry.addRecipe(new ShapelessOreRecipe(EnumWireMaterial.COPPER.getWire, "universalCable"))
}
Electrical.proxy.postInit
modproxies.postInit
}

View file

@ -1,14 +1,26 @@
package resonantinduction.electrical
import cpw.mods.fml.common.Loader
import cpw.mods.fml.common.registry.GameRegistry
import ic2.api.item.IC2Items
import net.minecraft.block.Block
import net.minecraft.item.Item
import net.minecraft.init.{Blocks, Items}
import net.minecraft.item.{Item, ItemStack}
import net.minecraftforge.oredict.ShapelessOreRecipe
import resonant.content.loader.ContentHolder
import resonant.lib.recipe.UniversalRecipe
import resonantinduction.electrical.battery.ItemBlockBattery
import resonantinduction.electrical.wire.EnumWireMaterial
/**
* Created by robert on 8/11/2014.
*/
object ElectricalContent extends ContentHolder {
val tierOneBattery: ItemStack = ItemBlockBattery.setTier(new ItemStack(ElectricalContent.blockBattery, 1, 0), 0.asInstanceOf[Byte])
val tierTwoBattery: ItemStack = ItemBlockBattery.setTier(new ItemStack(ElectricalContent.blockBattery, 1, 0), 1.asInstanceOf[Byte])
val tierThreeBattery: ItemStack = ItemBlockBattery.setTier(new ItemStack(ElectricalContent.blockBattery, 1, 0), 2.asInstanceOf[Byte])
var itemWire: Item = null
var itemMultimeter: Item = null
var itemTransformer: Item = null
@ -21,16 +33,48 @@ object ElectricalContent extends ContentHolder {
var blockMotor: Block = null
var blockThermopile: Block = null
var itemLevitator: Item = null
var blockArmbot: Block = null
var itemDisk: Item = null
var itemInsulation: Item = null
var blockQuantumGate: Block = null
var itemQuantumGlyph: Item = null
var itemLaserGun: Item = null
override def postInit
{
recipes += shaped(ElectricalContent.blockTesla, "WEW", " C ", "DID", 'W', "wire", 'E', Items.ender_eye, 'C', UniversalRecipe.BATTERY.get, 'D', Items.diamond, 'I', UniversalRecipe.PRIMARY_PLATE.get)
recipes += shaped(ElectricalContent.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(EnumWireMaterial.COPPER.getWire(3), "MMM", 'M', "ingotCopper")
recipes += shaped(EnumWireMaterial.TIN.getWire(3), "MMM", 'M', "ingotTin")
recipes += shaped(EnumWireMaterial.IRON.getWire(3), "MMM", 'M', Items.iron_ingot)
recipes += shaped(EnumWireMaterial.ALUMINUM.getWire(3), "MMM", 'M', "ingotAluminum")
recipes += shaped(EnumWireMaterial.SILVER.getWire, "MMM", 'M', "ingotSilver")
recipes += shaped(EnumWireMaterial.SUPERCONDUCTOR.getWire(3), "MMM", 'M', "ingotSuperconductor")
recipes += shaped(EnumWireMaterial.SUPERCONDUCTOR.getWire(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(ElectricalContent.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(ElectricalContent.blockSolarPanel, "CCC", "WWW", "III", 'W', "wire", 'C', Items.coal, 'I', UniversalRecipe.PRIMARY_METAL.get)
recipes += shaped(ElectricalContent.blockMotor, "SRS", "SMS", "SWS", 'W', "wire", 'R', Items.redstone, 'M', Blocks.iron_block, 'S', UniversalRecipe.PRIMARY_METAL.get)
recipes += shaped(ElectricalContent.blockThermopile, "ORO", "OWO", "OOO", 'W', "wire", 'O', Blocks.obsidian, 'R', Items.redstone)
if (Loader.isModLoaded("IC2"))
{
recipes += shapeless(EnumWireMaterial.COPPER.getWire, IC2Items.getItem("copperCableItem"))
recipes += shapeless(EnumWireMaterial.TIN.getWire, IC2Items.getItem("tinCableItem"))
recipes += shapeless(EnumWireMaterial.IRON.getWire, IC2Items.getItem("ironCableItem"))
recipes += shapeless(IC2Items.getItem("copperCableItem"), EnumWireMaterial.COPPER.getWire)
recipes += shapeless(IC2Items.getItem("tinCableItem"), EnumWireMaterial.TIN.getWire)
recipes += shapeless(IC2Items.getItem("ironCableItem"), EnumWireMaterial.IRON.getWire)
}
if (Loader.isModLoaded("Mekanism"))
{
GameRegistry.addRecipe(new ShapelessOreRecipe(EnumWireMaterial.COPPER.getWire, "universalCable"))
}
}

View file

@ -10,6 +10,7 @@ import resonantinduction.electrical.em.laser.emitter.{RenderLaserEmitter, TileLa
import resonantinduction.electrical.em.laser.focus.crystal.{RenderFocusCrystal, TileFocusCrystal}
import resonantinduction.electrical.em.laser.focus.mirror.{RenderMirror, TileMirror}
import resonantinduction.electrical.em.laser.fx.{EntityBlockParticleFX, EntityLaserFX, EntityScorchFX}
import universalelectricity.core.transform.vector.Vector3
/**
* @author Calclavia

View file

@ -3,6 +3,7 @@ package resonantinduction.electrical.em
import net.minecraft.block.Block
import net.minecraft.world.World
import resonant.lib.prefab.AbstractProxy
import universalelectricity.core.transform.vector.Vector3
/**
* @author Calclavia

View file

@ -1,7 +1,7 @@
package resonantinduction.electrical.em.laser;
import net.minecraft.util.MovingObjectPosition;
import resonantinduction.electrical.em.Vector3;
import universalelectricity.core.transform.vector.Vector3;
/**
* @author Calclavia

View file

@ -2,6 +2,7 @@ package resonantinduction.electrical.em.laser
import net.minecraft.tileentity.TileEntity
import net.minecraftforge.common.util.ForgeDirection
import universalelectricity.core.transform.vector.Vector3
/**
* @author Calclavia

View file

@ -17,7 +17,6 @@ class BlockLaserEmitter extends BlockContainer(Material.rock)
{
setBlockName(ElectromagneticCoherence.PREFIX + "laserEmitter")
setBlockTextureName("stone")
setCreativeTab(TabEC)
/**
* Called when the block is placed in the world.

View file

@ -1,6 +1,7 @@
package resonantinduction.electrical.em.laser.emitter
import net.minecraft.util.MovingObjectPosition
import universalelectricity.core.transform.vector.Vector3
import resonantinduction.electrical.em.laser.{ILaserHandler, Laser, TileBase}
/**

View file

@ -8,6 +8,7 @@ import net.minecraft.util.{ChatComponentText, EnumChatFormatting}
import net.minecraft.world.World
import resonantinduction.core.ResonantTab
import resonantinduction.electrical.em.ElectromagneticCoherence
import universalelectricity.core.transform.rotation.Quaternion
import universalelectricity.core.transform.vector.Vector3
import scala.collection.convert.wrapAsScala._
@ -83,13 +84,13 @@ class ItemFocusingMatrix extends Item
val random_index = rand.nextInt(cachedHits.size)
val incident = cachedHits(random_index).normalize
val targetDirection = (new Vector3(x, y, z) - controlVec).normalize
val targetDirection : Vector3 = (new Vector3(x, y, z) - controlVec).normalize
if (targetDirection.magnitude > 0)
{
val angle = Math.acos(incident $ targetDirection)
val axis = incident x targetDirection
var focusDirection = incident.clone.rotate(-90 - Math.toDegrees(angle / 2), axis).normalize
val axis : Vector3 = incident.cross(targetDirection)
var focusDirection = incident.clone.transform(new Quaternion(-90 - Math.toDegrees(angle / 2), axis)).normalize
if (focusDirection.magnitude == 0 || focusDirection.magnitude.equals(Double.NaN))
{

View file

@ -15,7 +15,6 @@ class BlockFocusCrystal extends BlockFocusBase(Material.rock)
{
setBlockName(ElectromagneticCoherence.PREFIX + "focusCrystal")
setBlockTextureName("glass")
setCreativeTab(TabEC)
override def createNewTileEntity(world: World, metadata: Int): TileEntity =
{

View file

@ -30,9 +30,9 @@ object RenderFocusCrystal extends TileEntitySpecialRenderer
val focusCrystal = tileEntity.asInstanceOf[TileFocusCrystal]
val angle = focusCrystal.normal.eulerAngles
glRotated(angle.x, 0, 1, 0)
glRotated(angle.y, 1, 0, 0)
val angle = focusCrystal.normal.toEulerAngle
glRotated(angle.yaw, 0, 1, 0)
glRotated(angle.pitch, 1, 0, 0)
glRotated(180, 0, 1, 0)

View file

@ -8,6 +8,8 @@ import net.minecraftforge.common.util.ForgeDirection
import resonantinduction.electrical.em.ElectromagneticCoherence
import resonantinduction.electrical.em.laser.focus.IFocus
import resonantinduction.electrical.em.laser.{ILaserHandler, Laser, TileBase}
import universalelectricity.core.transform.rotation.Quaternion
import universalelectricity.core.transform.vector.Vector3
/**
* Redirects lasers to one point
@ -32,7 +34,7 @@ class TileFocusCrystal extends TileBase with ILaserHandler with IFocus
if (rotateAngle > 0)
{
normal = normal.rotate(Math.toRadians(rotateAngle), axis).normalize
normal = normal.transform(new Quaternion(Math.toRadians(rotateAngle), axis)).normalize
}
}
@ -93,7 +95,7 @@ class TileFocusCrystal extends TileBase with ILaserHandler with IFocus
{
super.writeToNBT(nbt)
val normalNBT = new NBTTagCompound()
normal.writeToNBT(normalNBT)
normal.writeNBT(normalNBT)
nbt.setTag("normal", normalNBT)
}
}

View file

@ -28,9 +28,9 @@ object RenderMirror extends TileEntitySpecialRenderer
val tile = tileEntity.asInstanceOf[TileMirror]
val angle = tile.normal.eulerAngles
glRotated(angle.x, 0, 1, 0)
glRotated(angle.y, 1, 0, 0)
val angle = tile.normal.toEulerAngle
glRotated(angle.yaw, 0, 1, 0)
glRotated(angle.pitch, 1, 0, 0)
glRotated(90, 1, 0, 0)
model.renderOnly("mirror", "mirrorBacking", "standConnector")

View file

@ -8,6 +8,7 @@ import net.minecraftforge.common.util.ForgeDirection
import resonantinduction.electrical.em.ElectromagneticCoherence
import resonantinduction.electrical.em.laser.focus.IFocus
import resonantinduction.electrical.em.laser.{ILaserHandler, Laser, TileBase}
import universalelectricity.core.transform.rotation.Quaternion
import universalelectricity.core.transform.vector.Vector3
import scala.collection.convert.wrapAsJava._
@ -33,7 +34,7 @@ class TileMirror extends TileBase with ILaserHandler with IFocus
if (rotateAngle > 0)
{
normal = normal.rotate(Math.toRadians(rotateAngle), axis).normalize
normal = normal.transform(new Quaternion(Math.toRadians(rotateAngle), axis)).normalize
}
}
@ -75,12 +76,12 @@ class TileMirror extends TileBase with ILaserHandler with IFocus
* Calculate Reflection
*/
val angle = Math.acos(incidentDirection $ normal)
val axisOfReflection = incidentDirection x normal
val axisOfReflection = incidentDirection.cross(normal)
val rotateAngle = 180 - Math.toDegrees(2 * angle)
if (Math.toDegrees(rotateAngle) < 180)
{
val newDirection = (incidentDirection.clone.rotate(rotateAngle, axisOfReflection)).normalize
val newDirection = (incidentDirection.clone.transform(new Quaternion(rotateAngle, axisOfReflection))).normalize
Laser.spawn(worldObj, position + 0.5 + newDirection * 0.9, position + 0.5, newDirection, color, energy / 1.2)
}

View file

@ -51,7 +51,7 @@ class EntityLaserFX(par1World: World, start: Vector3, end: Vector3, color: Vecto
val length = start.distance(end)
val difference = end - start
val angles = difference.eulerAngles
val angles = difference.toEulerAngle
val modifierTranslation = (length / 2) + endSize;
@ -91,8 +91,8 @@ class EntityLaserFX(par1World: World, start: Vector3, end: Vector3, color: Vecto
/**
* Rotate the beam
*/
glRotated(angles.x(), 0, 1, 0)
glRotated(angles.y(), 1, 0, 0)
glRotated(angles.yaw, 0, 1, 0)
glRotated(angles.pitch, 1, 0, 0)
glRotated(90, 1, 0, 0)

View file

@ -9,6 +9,7 @@ import net.minecraft.world.World
import net.minecraftforge.common.util.ForgeDirection
import org.lwjgl.opengl.GL11._
import resonantinduction.electrical.em.ElectromagneticCoherence
import universalelectricity.core.transform.vector.Vector3
/**
* @author Calclavia

View file

@ -17,7 +17,6 @@ class BlockLaserReceiver extends BlockContainer(Material.rock)
{
setBlockName(ElectromagneticCoherence.PREFIX + "laserReceiver")
setBlockTextureName("stone")
setCreativeTab(TabEC)
/**
* Called when the block is placed in the world.

View file

@ -3,6 +3,7 @@ package resonantinduction.electrical.em.laser.receiver
import net.minecraft.util.MovingObjectPosition
import net.minecraftforge.common.util.ForgeDirection
import resonantinduction.electrical.em.laser.{ILaserHandler, Laser, TileBase}
import universalelectricity.core.transform.vector.Vector3
/**
* @author Calclavia

View file

@ -89,14 +89,6 @@ class TileMotor extends TileElectric(Material.iron) with IRotatable {
return dirs
}
def getDirection: ForgeDirection = {
return ForgeDirection.getOrientation(this.getBlockMetadata)
}
def setDirection(dir: ForgeDirection) {
this.worldObj.setBlockMetadataWithNotify(xCoord, yCoord, zCoord, dir.ordinal, 3)
}
override def readFromNBT(nbt: NBTTagCompound) {
super.readFromNBT(nbt)
isInversed = nbt.getBoolean("isInversed")