Fixed PipeNode crash

This commit is contained in:
Calclavia 2014-11-08 20:58:31 +08:00
parent d28c5a93cb
commit 5a7af55b39
34 changed files with 85 additions and 169 deletions

View file

@ -399,7 +399,7 @@ class TileImprinter extends TileAdvanced(Material.circuits) with ISidedInventory
override def onNeighborChanged(block: Block)
{
val b: Block = asVectorWorld.add(ForgeDirection.getOrientation(1)).getBlock
val b: Block = toVectorWorld.add(ForgeDirection.getOrientation(1)).getBlock
if (Blocks.piston_head eq b)
{
onInventoryChanged

View file

@ -341,7 +341,7 @@ class TileEngineeringTable extends TileInventory(Material.wood) with IPacketRece
var idDisplacement: Int = TileEngineeringTable.PLAYER_OUTPUT_END
for (dir <- ForgeDirection.VALID_DIRECTIONS)
{
val tile: TileEntity = asVectorWorld.add(dir).getTileEntity
val tile: TileEntity = toVectorWorld.add(dir).getTileEntity
if (tile.isInstanceOf[IInventory])
{
val inventory: IInventory = tile.asInstanceOf[IInventory]
@ -408,7 +408,7 @@ class TileEngineeringTable extends TileInventory(Material.wood) with IPacketRece
var idDisplacement: Int = TileEngineeringTable.PLAYER_OUTPUT_END
for (dir <- ForgeDirection.VALID_DIRECTIONS)
{
val tile: TileEntity = asVectorWorld.add(dir).getTileEntity
val tile: TileEntity = toVectorWorld.add(dir).getTileEntity
if (tile.isInstanceOf[IInventory])
{
val inventory: IInventory = tile.asInstanceOf[IInventory]
@ -646,7 +646,7 @@ class TileEngineeringTable extends TileInventory(Material.wood) with IPacketRece
var temporaryInvID: Int = TileEngineeringTable.PLAYER_OUTPUT_END
for (dir <- ForgeDirection.VALID_DIRECTIONS)
{
val tile: TileEntity = asVectorWorld.add(dir).getTileEntity(worldObj)
val tile: TileEntity = toVectorWorld.add(dir).getTileEntity(worldObj)
if (tile.isInstanceOf[IInventory])
{
val inventory: IInventory = tile.asInstanceOf[IInventory]

View file

@ -106,7 +106,7 @@ class TileFirebox extends TileElectricInventory(Material.rock) with IPacketRecei
{
if (FluidRegistry.getFluid("steam") != null)
{
MinecraftForge.EVENT_BUS.post(new BoilEvent(worldObj, asVectorWorld.add(0, 1, 0), new FluidStack(FluidRegistry.WATER, volume), new FluidStack(FluidRegistry.getFluid("steam"), volume), 2, false))
MinecraftForge.EVENT_BUS.post(new BoilEvent(worldObj, toVectorWorld.add(0, 1, 0), new FluidStack(FluidRegistry.WATER, volume), new FluidStack(FluidRegistry.getFluid("steam"), volume), 2, false))
boiledVolume += volume
}
if (boiledVolume >= FluidContainerRegistry.BUCKET_VOLUME)

View file

@ -106,7 +106,7 @@ class TileGrate extends TileFluidProvider(Material.rock) with IRotatable
if (gratePath == null)
{
gratePath = new GratePathfinder(true)
gratePath.startFill(asVectorWorld, fluidNode.getFluid.getFluid.getID)
gratePath.startFill(toVectorWorld, fluidNode.getFluid.getFluid.getID)
}
val filledInWorld = gratePath.tryFill(fluidNode.getFluidAmount, blockEffect)
fluidNode.drain(filledInWorld, true)
@ -120,7 +120,7 @@ class TileGrate extends TileFluidProvider(Material.rock) with IRotatable
if (gratePath == null)
{
gratePath = new GratePathfinder(false)
if (!gratePath.startDrain(asVector3))
if (!gratePath.startDrain(toVector3))
{
resetPath()
}

View file

@ -83,7 +83,7 @@ class TileGutter extends TileFluidProvider(Material.rock)
{
val dir: ForgeDirection = ForgeDirection.getOrientation(i)
val pressure: Int = fluidNode.asInstanceOf[NodePressure].pressure(dir)
val pos: Vector3 = asVector3.add(dir)
val pos: Vector3 = toVector3.add(dir)
val checkTile: TileEntity = pos.getTileEntity(world)
if (checkTile.isInstanceOf[TileGutter])

View file

@ -93,10 +93,10 @@ class TileTank extends TileFluidProvider(Material.iron) with ISneakPickup with R
GL11.glScaled(0.99, 0.99, 0.99)
val tank: IFluidTank = fluidNode.getPrimaryTank
val percentageFilled: Double = tank.getFluidAmount.toDouble / tank.getCapacity.toDouble
val ySouthEast: Double = FluidUtility.getAveragePercentageFilledForSides(classOf[TileTank], percentageFilled, world, asVector3, ForgeDirection.SOUTH, ForgeDirection.EAST)
val yNorthEast: Double = FluidUtility.getAveragePercentageFilledForSides(classOf[TileTank], percentageFilled, world, asVector3, ForgeDirection.NORTH, ForgeDirection.EAST)
val ySouthWest: Double = FluidUtility.getAveragePercentageFilledForSides(classOf[TileTank], percentageFilled, world, asVector3, ForgeDirection.SOUTH, ForgeDirection.WEST)
val yNorthWest: Double = FluidUtility.getAveragePercentageFilledForSides(classOf[TileTank], percentageFilled, world, asVector3, ForgeDirection.NORTH, ForgeDirection.WEST)
val ySouthEast: Double = FluidUtility.getAveragePercentageFilledForSides(classOf[TileTank], percentageFilled, world, toVector3, ForgeDirection.SOUTH, ForgeDirection.EAST)
val yNorthEast: Double = FluidUtility.getAveragePercentageFilledForSides(classOf[TileTank], percentageFilled, world, toVector3, ForgeDirection.NORTH, ForgeDirection.EAST)
val ySouthWest: Double = FluidUtility.getAveragePercentageFilledForSides(classOf[TileTank], percentageFilled, world, toVector3, ForgeDirection.SOUTH, ForgeDirection.WEST)
val yNorthWest: Double = FluidUtility.getAveragePercentageFilledForSides(classOf[TileTank], percentageFilled, world, toVector3, ForgeDirection.NORTH, ForgeDirection.WEST)
FluidRenderUtility.renderFluidTesselation(tank, ySouthEast, yNorthEast, ySouthWest, yNorthWest)
}
GL11.glPopMatrix()

View file

@ -75,7 +75,7 @@ class TileCastingMold extends TileInventory(Material.rock) with IFluidHandler wi
override def update
{
val checkPos: Vector3 = asVector3.add(0, 1, 0)
val checkPos: Vector3 = toVector3.add(0, 1, 0)
val drainStack: FluidStack = FluidUtility.drainBlock(worldObj, checkPos, false)
if (MachineRecipes.INSTANCE.getOutput(RecipeType.SMELTER.name, drainStack).length > 0)
{

View file

@ -114,7 +114,7 @@ class TileElectromagnet extends SpatialBlock(Material.iron) with IElectromagnet
for (dir <- ForgeDirection.VALID_DIRECTIONS)
{
val check = asVector3 + dir
val check = toVector3 + dir
val checkTile = check.getTileEntity(world)
if (checkTile != null && checkTile.getClass == tile.getClass && check.getBlockMetadata(world) == tile.getBlockMetadata)

View file

@ -25,7 +25,7 @@ class TileSiren extends SpatialBlock(Material.wood)
var volume: Float = 0.5f
for (i <- 0 to 6)
{
val check: Vector3 = asVector3.add(ForgeDirection.getOrientation(i))
val check: Vector3 = toVector3.add(ForgeDirection.getOrientation(i))
if (check.getBlock(world) eq getBlockType)
{
volume *= 1.5f

View file

@ -16,7 +16,7 @@ class GuiAccelerator(player: EntityPlayer, tileEntity: TileAccelerator) extends
{
this.fontRendererObj.drawString("Accelerator", 40, 10, 4210752)
var status: String = ""
val position: Vector3 = tileEntity.asVector3 + tileEntity.getDirection.getOpposite
val position: Vector3 = tileEntity.toVector3 + tileEntity.getDirection.getOpposite
if (!EntityParticle.canSpawnParticle(this.tileEntity.world, position))
{
status = "\u00a74Fail to emit; try rotating."

View file

@ -68,13 +68,13 @@ class TileAccelerator extends TileElectricInventory(Material.iron) with IElectro
//Create new particle if we have materials to spawn it with
if (getStackInSlot(0) != null && lastSpawnTick >= 40)
{
val spawn_vec: Vector3 = asVector3
val spawn_vec: Vector3 = toVector3
spawn_vec.add(getDirection.getOpposite)
spawn_vec.add(0.5f)
if (EntityParticle.canSpawnParticle(worldObj, spawn_vec))
{
totalEnergyConsumed = 0
entityParticle = new EntityParticle(worldObj, spawn_vec, asVector3, getDirection.getOpposite)
entityParticle = new EntityParticle(worldObj, spawn_vec, toVector3, getDirection.getOpposite)
worldObj.spawnEntityInWorld(entityParticle)
CalculateParticleDensity
decrStackSize(0, 1)

View file

@ -55,7 +55,7 @@ class TileCentrifuge extends TileElectricInventory(Material.iron) with IPacketRe
for (i <- 0 to 6)
{
val direction: ForgeDirection = ForgeDirection.getOrientation(i)
val tileEntity: TileEntity = asVector3.add(direction).getTileEntity(world)
val tileEntity: TileEntity = toVector3.add(direction).getTileEntity(world)
if (tileEntity.isInstanceOf[IFluidHandler] && tileEntity.getClass != this.getClass)
{
val fluidHandler: IFluidHandler = (tileEntity.asInstanceOf[IFluidHandler])

View file

@ -46,7 +46,7 @@ class FulminationHandler
{
if (!tileEntity.isInvalid)
{
val tileDiDian: Vector3 = tileEntity.asVector3
val tileDiDian: Vector3 = tileEntity.toVector3
tileDiDian.add(0.5f)
val juLi: Double = tileDiDian.distance(new Vector3(evt.x, evt.y, evt.z))
if (juLi <= evt.iExplosion.getRadius && juLi > 0)
@ -66,7 +66,7 @@ class FulminationHandler
for (tileEntity <- avaliableGenerators)
{
val density: Float = evt.world.getBlockDensity(Vec3.createVectorHelper(evt.x, evt.y, evt.z), AtomicContent.blockFulmination.getCollisionBoundingBoxFromPool(evt.world, tileEntity.xCoord, tileEntity.yCoord, tileEntity.zCoord))
val juLi: Double = tileEntity.asVector3.distance(new Vector3(evt.x, evt.y, evt.z))
val juLi: Double = tileEntity.toVector3.distance(new Vector3(evt.x, evt.y, evt.z))
var energy: Long = Math.min(maxEnergyPerGenerator, maxEnergyPerGenerator / (juLi / evt.iExplosion.getRadius)).asInstanceOf[Long]
energy = Math.max((1 - density) * energy, 0).asInstanceOf[Long]
tileEntity.energy.receiveEnergy(energy, true)

View file

@ -58,7 +58,7 @@ class TilePlasma extends TileAdvanced(Material.lava)
override def update
{
super.update
ThermalGrid.addTemperature(asVectorWorld, ((temperature - ThermalGrid.getTemperature(asVectorWorld)) * 0.1f).asInstanceOf[Float])
ThermalGrid.addTemperature(toVectorWorld, ((temperature - ThermalGrid.getTemperature(toVectorWorld)) * 0.1f).asInstanceOf[Float])
if (ticks % 20 == 0)
{
temperature /= 1.5
@ -71,7 +71,7 @@ class TilePlasma extends TileAdvanced(Material.lava)
{
if (worldObj.rand.nextFloat < 0.4)
{
val diDian: Vector3 = asVector3
val diDian: Vector3 = toVector3
diDian.add(ForgeDirection.getOrientation(i))
val tileEntity: TileEntity = diDian.getTileEntity(worldObj)
if (!(tileEntity.isInstanceOf[TilePlasma]))

View file

@ -79,8 +79,8 @@ class TileReactorCell extends TileInventory(Material.iron) with IMultiBlockStruc
val mainTile: TileReactorCell = getLowest
mainTile.getMultiBlock.deconstruct
mainTile.getMultiBlock.construct
val top: Boolean = asVector3.add(new Vector3(0, 1, 0)).getTileEntity(worldObj).isInstanceOf[TileReactorCell]
val bottom: Boolean = asVector3.add(new Vector3(0, -1, 0)).getTileEntity(worldObj).isInstanceOf[TileReactorCell]
val top: Boolean = toVector3.add(new Vector3(0, 1, 0)).getTileEntity(worldObj).isInstanceOf[TileReactorCell]
val bottom: Boolean = toVector3.add(new Vector3(0, -1, 0)).getTileEntity(worldObj).isInstanceOf[TileReactorCell]
if (top && bottom)
{
worldObj.setBlockMetadataWithNotify(xCoord, yCoord, zCoord, 1, 3)
@ -98,7 +98,7 @@ class TileReactorCell extends TileInventory(Material.iron) with IMultiBlockStruc
def getLowest: TileReactorCell =
{
var lowest: TileReactorCell = this
val checkPosition: Vector3 = asVector3
val checkPosition: Vector3 = toVector3
while (true)
{
val t: TileEntity = checkPosition.getTileEntity(this.worldObj)
@ -141,7 +141,7 @@ class TileReactorCell extends TileInventory(Material.iron) with IMultiBlockStruc
if (drain != null && drain.amount >= FluidContainerRegistry.BUCKET_VOLUME)
{
val spawnDir: ForgeDirection = ForgeDirection.getOrientation(worldObj.rand.nextInt(3) + 2)
val spawnPos: Vector3 = asVector3 + spawnDir + spawnDir
val spawnPos: Vector3 = toVector3 + spawnDir + spawnDir
spawnPos.add(0, Math.max(worldObj.rand.nextInt(getHeight) - 1, 0), 0)
if (worldObj.isAirBlock(spawnPos.xi, spawnPos.yi, spawnPos.zi))
{
@ -173,13 +173,13 @@ class TileReactorCell extends TileInventory(Material.iron) with IMultiBlockStruc
val entities: List[EntityLiving] = worldObj.getEntitiesWithinAABB(classOf[EntityLiving], AxisAlignedBB.getBoundingBox(xCoord - TileReactorCell.RADIUS * 2, yCoord - TileReactorCell.RADIUS * 2, zCoord - TileReactorCell.RADIUS * 2, xCoord + TileReactorCell.RADIUS * 2, yCoord + TileReactorCell.RADIUS * 2, zCoord + TileReactorCell.RADIUS * 2)).asInstanceOf[List[EntityLiving]]
for (entity <- entities)
{
PoisonRadiation.INSTANCE.poisonEntity(asVector3, entity)
PoisonRadiation.INSTANCE.poisonEntity(toVector3, entity)
}
}
}
}
}
temperature = ThermalGrid.getTemperature(asVectorWorld)
temperature = ThermalGrid.getTemperature(toVectorWorld)
if (internalEnergy - prevInternalEnergy > 0)
{
var deltaT: Float = ThermalPhysics.getTemperatureForEnergy(mass, specificHeatCapacity, ((internalEnergy - prevInternalEnergy) * 0.15).asInstanceOf[Long])
@ -188,7 +188,7 @@ class TileReactorCell extends TileInventory(Material.iron) with IMultiBlockStruc
for (i <- 0 to 5)
{
{
val checkAdjacent: Vector3 = asVector3.add(ForgeDirection.getOrientation(i))
val checkAdjacent: Vector3 = toVector3.add(ForgeDirection.getOrientation(i))
if (checkAdjacent.getBlock(worldObj) == AtomicContent.blockControlRod)
{
deltaT /= 1.1f
@ -196,7 +196,7 @@ class TileReactorCell extends TileInventory(Material.iron) with IMultiBlockStruc
}
}
}
ThermalGrid.addTemperature(asVectorWorld, deltaT)
ThermalGrid.addTemperature(toVectorWorld, deltaT)
if (worldObj.rand.nextInt(80) == 0 && this.getTemperature >= 373)
{
worldObj.playSoundEffect(this.xCoord + 0.5F, this.yCoord + 0.5F, this.zCoord + 0.5F, "Fluid.lava", 0.5F, 2.1F + (worldObj.rand.nextFloat - worldObj.rand.nextFloat) * 0.85F)
@ -234,7 +234,7 @@ class TileReactorCell extends TileInventory(Material.iron) with IMultiBlockStruc
internalEnergy = 0
if (isOverToxic)
{
val leakPos: VectorWorld = asVectorWorld.add(worldObj.rand.nextInt(20) - 10, worldObj.rand.nextInt(20) - 10, worldObj.rand.nextInt(20) - 10)
val leakPos: VectorWorld = toVectorWorld.add(worldObj.rand.nextInt(20) - 10, worldObj.rand.nextInt(20) - 10, worldObj.rand.nextInt(20) - 10)
val block: Block = leakPos.getBlock
if (block == Blocks.grass)
{
@ -281,7 +281,7 @@ class TileReactorCell extends TileInventory(Material.iron) with IMultiBlockStruc
def getHeight: Int =
{
var height: Int = 0
val checkPosition: Vector3 = asVector3
val checkPosition: Vector3 = toVector3
var tile: TileEntity = this
while (tile.isInstanceOf[TileReactorCell])
{
@ -320,7 +320,7 @@ class TileReactorCell extends TileInventory(Material.iron) with IMultiBlockStruc
override def getMultiBlockVectors: java.lang.Iterable[Vector3] =
{
val vectors: List[Vector3] = new ArrayList[Vector3]
val checkPosition: Vector3 = asVector3
val checkPosition: Vector3 = toVector3
while (true)
{
val t: TileEntity = checkPosition.getTileEntity(this.worldObj)
@ -339,7 +339,7 @@ class TileReactorCell extends TileInventory(Material.iron) with IMultiBlockStruc
def getPosition: Vector3 =
{
return asVector3
return toVector3
}
/** Reads a tile entity from NBT. */

View file

@ -32,7 +32,7 @@ class TileReactorDrain extends TileAdvanced(Material.iron) with IFluidHandler
{
this.tanks.clear
val world: World = this.worldObj
val position: Vector3 = asVector3
val position: Vector3 = toVector3
val finder: Pathfinder = new Pathfinder(new IPathCallBack
{
def getConnectedNodes(finder: Pathfinder, currentNode: Vector3): Set[Vector3] =
@ -64,7 +64,7 @@ class TileReactorDrain extends TileAdvanced(Material.iron) with IFluidHandler
}
return false
}
}).init(asVector3.add(ForgeDirection.getOrientation(this.getBlockMetadata).getOpposite))
}).init(toVector3.add(ForgeDirection.getOrientation(this.getBlockMetadata).getOpposite))
import scala.collection.JavaConversions._
for (node <- finder.results)
{

View file

@ -114,7 +114,7 @@ class TileThermometer extends TileAdvanced(Material.piston) with SimpleComponent
}
else
{
detectedTemperature = ThermalGrid.getTemperature(asVectorWorld)
detectedTemperature = ThermalGrid.getTemperature(toVectorWorld)
}
if (detectedTemperature != previousDetectedTemperature || isProvidingPower != this.isOverThreshold)
{

View file

@ -20,7 +20,7 @@ import scala.collection.mutable
abstract class PartFramedNode extends PartAbstract with TPartNodeProvider with TSlottedPart with TNormalOcclusion with TIconHitEffects
{
/** Bitmask connections */
var connectionMask = 0x00
protected var clientRenderMask = 0x00
@SideOnly(Side.CLIENT)
protected var breakIcon: IIcon = null
@ -50,7 +50,7 @@ abstract class PartFramedNode extends PartAbstract with TPartNodeProvider with T
val list = mutable.Set.empty[IndexedCuboid6]
list += CuboidShapes.WIRE_CENTER
list ++= ForgeDirection.VALID_DIRECTIONS.filter(s => connectionMapContainsSide(connectionMask, s) || s == testingSide).map(s => currentSides(s.ordinal()))
list ++= ForgeDirection.VALID_DIRECTIONS.filter(s => connectionMapContainsSide(clientRenderMask, s) || s == testingSide).map(s => currentSides(s.ordinal()))
return list
}
@ -65,25 +65,25 @@ abstract class PartFramedNode extends PartAbstract with TPartNodeProvider with T
return !expandable
}
def isCurrentlyConnected(side: ForgeDirection): Boolean = connectionMapContainsSide(connectionMask, side)
def isCurrentlyConnected(side: ForgeDirection): Boolean = connectionMapContainsSide(clientRenderMask, side)
/** Packet Methods */
def sendConnectionUpdate()
{
if (!world.isRemote)
tile.getWriteStream(this).writeByte(0).writeByte(connectionMask)
tile.getWriteStream(this).writeByte(0).writeByte(node)
}
override def readDesc(packet: MCDataInput)
{
super.readDesc(packet)
connectionMask = packet.readByte
clientRenderMask = packet.readByte
}
override def writeDesc(packet: MCDataOutput)
{
super.writeDesc(packet)
packet.writeByte(connectionMask)
packet.writeByte(clientRenderMask)
}
override def read(packet: MCDataInput, packetID: Int)
@ -92,7 +92,7 @@ abstract class PartFramedNode extends PartAbstract with TPartNodeProvider with T
if (packetID == 0)
{
connectionMask = packet.readByte
clientRenderMask = packet.readByte
tile.markRender()
}
}

View file

@ -23,7 +23,7 @@ class TileThermopile extends TileElectric(Material.rock) {
var heatSources: Int = 0
var coolingSources: Int = 0
for (dir <- ForgeDirection.VALID_DIRECTIONS) {
val checkPos: Vector3 = asVector3.add(dir)
val checkPos: Vector3 = toVector3.add(dir)
val block: Block = checkPos.getBlock(worldObj)
if (block eq Blocks.water) {
coolingSources += 1
@ -48,7 +48,7 @@ class TileThermopile extends TileElectric(Material.rock) {
usingTicks += 1; usingTicks
}) >= MAX_USE_TICKS) {
for (dir <- ForgeDirection.VALID_DIRECTIONS) {
val checkPos: Vector3 = asVector3.add(dir)
val checkPos: Vector3 = toVector3.add(dir)
val blockID: Block = checkPos.getBlock(worldObj)
if (blockID eq Blocks.water) {
checkPos.setBlockToAir(worldObj)

View file

@ -63,7 +63,7 @@ class TileLaserEmitter extends TileAdvanced(Material.iron) with ILaserHandler
if (energy > 0)
{
Laser.spawn(worldObj, asVector3 + 0.5 + new Vector3(getDirection) * 0.51, asVector3 + new Vector3(getDirection) * 0.6 + 0.5, new Vector3(getDirection), energy)
Laser.spawn(worldObj, toVector3 + 0.5 + new Vector3(getDirection) * 0.51, toVector3 + new Vector3(getDirection) * 0.6 + 0.5, new Vector3(getDirection), energy)
energy = 0
}
}

View file

@ -59,7 +59,7 @@ class TileFocusCrystal extends TileFocus(Material.rock) with ILaserHandler with
if (energy > 0)
{
Laser.spawn(worldObj, asVector3 + 0.5 + normal * 0.9, asVector3 + 0.5, normal, color, energy)
Laser.spawn(worldObj, toVector3 + 0.5 + normal * 0.9, toVector3 + 0.5, normal, color, energy)
color = new Vector3(1, 1, 1)
energy = 0
}
@ -67,7 +67,7 @@ class TileFocusCrystal extends TileFocus(Material.rock) with ILaserHandler with
override def focus(newPosition: Vector3)
{
normal = ((newPosition - asVector3) - 0.5).normalize
normal = ((newPosition - toVector3) - 0.5).normalize
world.markBlockForUpdate(xi, yi, zi)
}
@ -82,7 +82,7 @@ class TileFocusCrystal extends TileFocus(Material.rock) with ILaserHandler with
override def onLaserHit(renderStart: Vector3, incidentDirection: Vector3, hit: MovingObjectPosition, color: Vector3, energy: Double): Boolean =
{
ResonantInduction.proxy.renderLaser(worldObj, renderStart, asVector3 + 0.5, color, energy)
ResonantInduction.proxy.renderLaser(worldObj, renderStart, toVector3 + 0.5, color, energy)
this.energy += energy
this.color = (this.color + color) / 2
return true

View file

@ -66,7 +66,7 @@ class TileMirror extends TileFocus(Material.glass) with ILaserHandler with IFocu
override def focus(newPosition: Vector3)
{
normal = ((newPosition - asVector3) - 0.5).normalize
normal = ((newPosition - toVector3) - 0.5).normalize
world.markBlockForUpdate(xi, yi, zi)
}
@ -89,7 +89,7 @@ class TileMirror extends TileFocus(Material.glass) with ILaserHandler with IFocu
/**
* Render incoming laser
*/
ResonantInduction.proxy.renderLaser(worldObj, renderStart, asVector3 + 0.5, color, energy)
ResonantInduction.proxy.renderLaser(worldObj, renderStart, toVector3 + 0.5, color, energy)
/**
* Calculate Reflection
@ -102,7 +102,7 @@ class TileMirror extends TileFocus(Material.glass) with ILaserHandler with IFocu
if (rotateAngle < Math.PI)
{
val newDirection = (incidentDirection.clone.transform(new Quaternion(rotateAngle, axisOfReflection))).normalize
Laser.spawn(worldObj, asVector3 + 0.5 + newDirection * 0.9, asVector3 + 0.5, newDirection, color, energy / 1.2)
Laser.spawn(worldObj, toVector3 + 0.5 + newDirection * 0.9, toVector3 + 0.5, newDirection, color, energy / 1.2)
}
return true

View file

@ -97,7 +97,7 @@ class TileTesla extends TileElectric(Material.iron) with IMultiBlockStructure[Ti
if (this.ticks % (4 + this.worldObj.rand.nextInt(2)) == 0 && ((this.worldObj.isRemote && isTransfering) || (!this.energy.isEmpty && !this.worldObj.isBlockIndirectlyGettingPowered(this.xCoord, this.yCoord, this.zCoord))))
{
val topTesla: TileTesla = this.getTopTelsa
val topTeslaVector: Vector3 = asVector3
val topTeslaVector: Vector3 = toVector3
if (this.linked != null || this.isLinkedClient)
{
if (!this.worldObj.isRemote)
@ -127,8 +127,8 @@ class TileTesla extends TileElectric(Material.iron) with IMultiBlockStructure[Ti
{
def compare(o1: ITesla, o2: ITesla): Int =
{
val distance1: Double = asVector3.distance(new Vector3(o1.asInstanceOf[TileEntity]))
val distance2: Double = asVector3.distance(new Vector3(o2.asInstanceOf[TileEntity]))
val distance1: Double = toVector3.distance(new Vector3(o1.asInstanceOf[TileEntity]))
val distance2: Double = toVector3.distance(new Vector3(o2.asInstanceOf[TileEntity]))
if (distance1 < distance2)
{
return 1
@ -144,7 +144,7 @@ class TileTesla extends TileElectric(Material.iron) with IMultiBlockStructure[Ti
for (o <- TeslaGrid.instance.get)
{
var otherTesla = o
if (new Vector3(otherTesla.asInstanceOf[TileEntity]).distance(asVector3) < this.getRange && otherTesla != this)
if (new Vector3(otherTesla.asInstanceOf[TileEntity]).distance(toVector3) < this.getRange && otherTesla != this)
{
if (otherTesla.isInstanceOf[TileTesla])
{
@ -175,11 +175,11 @@ class TileTesla extends TileElectric(Material.iron) with IMultiBlockStructure[Ti
if (tesla.isInstanceOf[TileTesla])
{
getMultiBlock.get.outputBlacklist.add(this)
targetVector = tesla.asInstanceOf[TileTesla].getTopTelsa.asVector3
targetVector = tesla.asInstanceOf[TileTesla].getTopTelsa.toVector3
heightRange = (tesla.asInstanceOf[TileTesla]).getHeight
}
val distance: Double = topTeslaVector.distance(targetVector)
ResonantInduction.proxy.renderElectricShock(this.worldObj, topTesla.asVector3.add(new Vector3(0.5)), targetVector.add(new Vector3(0.5, Math.random * heightRange / 3 - heightRange / 3, 0.5)), EnumColor.DYES(this.dyeID).toColor)
ResonantInduction.proxy.renderElectricShock(this.worldObj, topTesla.toVector3.add(new Vector3(0.5)), targetVector.add(new Vector3(0.5, Math.random * heightRange / 3 - heightRange / 3, 0.5)), EnumColor.DYES(this.dyeID).toColor)
this.transfer(tesla, Math.min(transferEnergy, TRANSFER_CAP))
if (!sentPacket && transferEnergy > 0)
{
@ -317,8 +317,8 @@ class TileTesla extends TileElectric(Material.iron) with IMultiBlockStructure[Ti
val mainTile: TileTesla = getLowestTesla
mainTile.getMultiBlock.deconstruct
mainTile.getMultiBlock.construct
val isTop: Boolean = asVector3.add(new Vector3(0, 1, 0)).getTileEntity(this.worldObj).isInstanceOf[TileTesla]
val isBottom: Boolean = asVector3.add(new Vector3(0, -1, 0)).getTileEntity(this.worldObj).isInstanceOf[TileTesla]
val isTop: Boolean = toVector3.add(new Vector3(0, 1, 0)).getTileEntity(this.worldObj).isInstanceOf[TileTesla]
val isBottom: Boolean = toVector3.add(new Vector3(0, -1, 0)).getTileEntity(this.worldObj).isInstanceOf[TileTesla]
if (isTop && isBottom)
{
this.worldObj.setBlockMetadataWithNotify(this.xCoord, this.yCoord, this.zCoord, 1, 3)
@ -345,7 +345,7 @@ class TileTesla extends TileElectric(Material.iron) with IMultiBlockStructure[Ti
return this.topCache
}
this.connectedTeslas.clear
val checkPosition: Vector3 = asVector3
val checkPosition: Vector3 = toVector3
var returnTile: TileTesla = this
var exit = false
while (exit)
@ -381,7 +381,7 @@ class TileTesla extends TileElectric(Material.iron) with IMultiBlockStructure[Ti
var exit = false
while (!exit)
{
val t: TileEntity = asVector3.add(new Vector3(0, y, 0)).getTileEntity(this.worldObj)
val t: TileEntity = toVector3.add(new Vector3(0, y, 0)).getTileEntity(this.worldObj)
if (t.isInstanceOf[TileTesla])
{
this.connectedTeslas.add(t.asInstanceOf[TileTesla])
@ -479,7 +479,7 @@ class TileTesla extends TileElectric(Material.iron) with IMultiBlockStructure[Ti
val tileEntity: TileEntity = this.linked.getTileEntity(newOtherWorld)
if (tileEntity.isInstanceOf[TileTesla])
{
(tileEntity.asInstanceOf[TileTesla]).setLink(asVector3, this.worldObj.provider.dimensionId, false)
(tileEntity.asInstanceOf[TileTesla]).setLink(toVector3, this.worldObj.provider.dimensionId, false)
}
}
}
@ -505,7 +505,7 @@ class TileTesla extends TileElectric(Material.iron) with IMultiBlockStructure[Ti
def getMultiBlockVectors: java.lang.Iterable[Vector3] =
{
val vectors: List[Vector3] = new ArrayList[Vector3]
val checkPosition: Vector3 = asVector3
val checkPosition: Vector3 = toVector3
var exit = false
while (!exit)
{
@ -526,7 +526,7 @@ class TileTesla extends TileElectric(Material.iron) with IMultiBlockStructure[Ti
def getLowestTesla: TileTesla =
{
var lowest: TileTesla = this
val checkPosition: Vector3 = asVector3
val checkPosition: Vector3 = toVector3
var exit = false
while (!exit)
{
@ -551,7 +551,7 @@ class TileTesla extends TileElectric(Material.iron) with IMultiBlockStructure[Ti
def getPosition: Vector3 =
{
return asVector3
return toVector3
}
def getMultiBlock: MultiBlockHandler[TileTesla] =
@ -634,7 +634,7 @@ class TileTesla extends TileElectric(Material.iron) with IMultiBlockStructure[Ti
else
{
if (world.isRemote) player.addChatMessage(new ChatComponentText("Marked link for device."))
LinkUtility.setLink(itemStack, asVectorWorld)
LinkUtility.setLink(itemStack, toVectorWorld)
}
return true
}

View file

@ -43,7 +43,7 @@ object RenderFramedWire
CCRenderState.setBrightness(wire.world, wire.x, wire.y, wire.z)
renderSide(ForgeDirection.UNKNOWN, wire)
ForgeDirection.VALID_DIRECTIONS.filter(s => wire.connectionMask.mask(s)).foreach(renderSide(_, wire))
ForgeDirection.VALID_DIRECTIONS.filter(s => wire.clientRenderMask.mask(s)).foreach(renderSide(_, wire))
}
def renderSide(side: ForgeDirection, wire: PartFramedWire)

View file

@ -1,84 +0,0 @@
package resonantinduction.mechanical.fluid.pipe
import net.minecraftforge.common.util.ForgeDirection
import net.minecraftforge.fluids.IFluidHandler
import resonant.api.grid.INodeProvider
import resonant.lib.wrapper.BitmaskWrapper._
import resonantinduction.core.prefab.node.{NodePressure, TMultipartNode}
import resonantinduction.core.prefab.part.connector.TColorable
/**
* Pressure node for the pipe
*
* @author Calclavia, Darkguardsman
*/
class PipePressureNode(parent: PartPipe) extends NodePressure(parent) with TMultipartNode[IFluidHandler]
{
def pipe: PartPipe = getParent.asInstanceOf[PartPipe]
override def reconstruct()
{
connections.clear()
if (world != null)
{
val previousConnections = pipe.connectionMask
pipe.connectionMask = 0
for (dir <- ForgeDirection.VALID_DIRECTIONS)
{
val tile = position.add(dir).getTileEntity(world)
if (tile.isInstanceOf[IFluidHandler])
{
if (tile.isInstanceOf[INodeProvider])
{
val check = tile.asInstanceOf[INodeProvider].getNode(classOf[NodePressure], dir.getOpposite)
if (check.isInstanceOf[NodePressure] && canConnect(check, dir) && check.asInstanceOf[NodePressure].canConnect(this, dir.getOpposite))
{
pipe.connectionMask = pipe.connectionMask.openMask(dir)
connect(check, dir)
}
}
else if (tile.isInstanceOf[IFluidHandler] && canConnect(tile.asInstanceOf[IFluidHandler], dir))
{
pipe.connectionMask = pipe.connectionMask.openMask(dir)
connect(tile.asInstanceOf[IFluidHandler], dir)
}
}
}
if (!world.isRemote && previousConnections != pipe.connectionMask)
{
pipe.sendConnectionUpdate
}
}
}
override def canConnect[B <: IFluidHandler](source: B, from: ForgeDirection): Boolean =
{
if (!pipe.isBlockedOnSide(from))
{
if (source.isInstanceOf[PipePressureNode])
{
val otherNode = source.asInstanceOf[PipePressureNode]
val otherPipe = otherNode.pipe
if (!otherPipe.isBlockedOnSide(from.getOpposite) && pipe.material == otherPipe.material)
{
return pipe.getColor == otherPipe.getColor || (pipe.getColor == TColorable.defaultColor || otherPipe.getColor == TColorable.defaultColor)
}
return false
}
return super.canConnect(source, from) || source.isInstanceOf[IFluidHandler]
}
return false
}
override def toString: String = getClass.getSimpleName + hashCode
}

View file

@ -80,11 +80,11 @@ object RenderPipe extends ISimpleItemRenderer
{
GL11.glPushMatrix()
GL11.glTranslated(x + 0.5, y + 0.5, z + 0.5)
render(part.getMaterialID, if (part.getColor > 0) ItemDye.field_150922_c(part.getColor) else -1, part.connectionMask)
render(part.getMaterialID, if (part.getColor > 0) ItemDye.field_150922_c(part.getColor) else -1, part.clientRenderMask)
GL11.glPopMatrix()
GL11.glPushMatrix()
val fluid = part.tank.getFluid
val renderSides = part.connectionMask
val renderSides = part.clientRenderMask
if (fluid != null && fluid.amount > 0)
{

View file

@ -36,7 +36,7 @@ class TilePump extends TileMechanical(Material.iron) with IRotatable with IFluid
super.update
if (!worldObj.isRemote && mechanicalNode.getPower > 0)
{
val tileIn: TileEntity = asVector3.add(getDirection.getOpposite).getTileEntity(this.worldObj)
val tileIn: TileEntity = toVector3.add(getDirection.getOpposite).getTileEntity(this.worldObj)
if (tileIn.isInstanceOf[IFluidHandler])
{
val drain: FluidStack = (tileIn.asInstanceOf[IFluidHandler]).drain(getDirection, pressureNode.getCapacity, false)
@ -52,7 +52,7 @@ class TilePump extends TileMechanical(Material.iron) with IRotatable with IFluid
{
if (from eq getDirection.getOpposite)
{
val tileOut: TileEntity = asVector3.add(from.getOpposite).getTileEntity(this.worldObj)
val tileOut: TileEntity = toVector3.add(from.getOpposite).getTileEntity(this.worldObj)
if (tileOut.isInstanceOf[IFluidHandler]) return (tileOut.asInstanceOf[IFluidHandler]).fill(from, resource, doFill)
}
return 0

View file

@ -89,8 +89,8 @@ class TileBreaker extends TileAdvanced(Material.iron) with IRotatable with IPack
if (isIndirectlyPowered)
{
val dir: ForgeDirection = getDirection
val check: Vector3 = asVector3.add(dir)
val put: VectorWorld = asVector3.add(dir.getOpposite).asInstanceOf[VectorWorld]
val check: Vector3 = toVector3.add(dir)
val put: VectorWorld = toVector3.add(dir.getOpposite).asInstanceOf[VectorWorld]
val block: Block = check.getBlock(world)
if (block != null)
{

View file

@ -107,7 +107,7 @@ class TilePlacer extends TileInventory(Material.rock) with IRotatable with TPack
def doWork
{
val side: Int = 0
val placePos: Vector3 = asVector3.add(getDirection)
val placePos: Vector3 = toVector3.add(getDirection)
val placeStack: ItemStack = getStackInSlot(0)
if (InventoryUtility.placeItemBlock(world, placePos.xi, placePos.yi, placePos.zi, placeStack, side))
{

View file

@ -50,7 +50,7 @@ class TileMechanicalPiston extends TileMechanical(Material.piston)
super.update
if (markRevolve)
{
val movePosition: Vector3 = asVector3.add(getDirection)
val movePosition: Vector3 = toVector3.add(getDirection)
if (!hitOreBlock(movePosition))
{
if (!worldObj.isRemote)

View file

@ -120,7 +120,7 @@ class TileGrindingWheel extends TileMechanical(Material.rock) with IRotatable
var didWork: Boolean = false
if (grindingItem != null)
{
if (TileGrindingWheel.TIMER_GRIND_ITEM.containsKey(grindingItem) && !grindingItem.isDead && asVector3.add(0.5).distance(new Vector3(grindingItem)) < 1)
if (TileGrindingWheel.TIMER_GRIND_ITEM.containsKey(grindingItem) && !grindingItem.isDead && toVector3.add(0.5).distance(new Vector3(grindingItem)) < 1)
{
val timeLeft: Int = TileGrindingWheel.TIMER_GRIND_ITEM.decrease(grindingItem)
if (timeLeft <= 0)

View file

@ -81,7 +81,7 @@ class TileMixer extends TileMechanical(Material.iron)
{
if (x != 0 && z != 0)
{
val block: Block = asVector3.add(x, 0, z).getBlock(world)
val block: Block = toVector3.add(x, 0, z).getBlock(world)
if (block != null && !(block.isInstanceOf[IFluidBlock]))
{
return true
@ -112,9 +112,9 @@ class TileMixer extends TileMechanical(Material.iron)
{
val entity: Entity = obj.asInstanceOf[Entity]
val originalPosition: Vector3 = new Vector3(entity)
val relativePosition: Vector3 = originalPosition.clone.subtract(asVector3.add(0.5))
val relativePosition: Vector3 = originalPosition.clone.subtract(toVector3.add(0.5))
relativePosition.transform(new Quaternion(-mechanicalNode.getAngularSpeed(ForgeDirection.UNKNOWN), new Vector3(1, 0, 0)))
val newPosition: Vector3 = asVector3.add(0.5).add(relativePosition)
val newPosition: Vector3 = toVector3.add(0.5).add(relativePosition)
val difference: Vector3 = newPosition.subtract(originalPosition).multiply(0.5)
entity.addVelocity(difference.x, difference.y, difference.z)
entity.onGround = false
@ -133,7 +133,7 @@ class TileMixer extends TileMechanical(Material.iron)
{
TileMixer.MIXER_ITEM_TIMER.put(processingItem, TileMixer.PROCESS_TIME)
}
if (!processingItem.isDead && asVector3.add(0.5).distance(new Vector3(processingItem)) < 2)
if (!processingItem.isDead && toVector3.add(0.5).distance(new Vector3(processingItem)) < 2)
{
val timeLeft: Int = TileMixer.MIXER_ITEM_TIMER.decrease(processingItem)
if (timeLeft <= 0)

View file

@ -131,7 +131,7 @@ class TileTurbine extends TileMechanical(Material.wood) with IMultiBlockStructur
def getPosition: Vector3 =
{
return asVector3
return toVector3
}
def getMultiBlock: TurbineMBlockHandler =

View file

@ -90,7 +90,7 @@ class TileWaterTurbine extends TileTurbine
{
if (dir != currentDir && dir != currentDir.getOpposite)
{
val check: Vector3 = asVector3.add(dir)
val check: Vector3 = toVector3.add(dir)
val blockID: Block = worldObj.getBlock(check.xi, check.yi, check.zi)
val metadata: Int = worldObj.getBlockMetadata(check.xi, check.yi, check.zi)
if (blockID == Blocks.water || blockID == Blocks.flowing_water)