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) 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) if (Blocks.piston_head eq b)
{ {
onInventoryChanged onInventoryChanged

View file

@ -341,7 +341,7 @@ class TileEngineeringTable extends TileInventory(Material.wood) with IPacketRece
var idDisplacement: Int = TileEngineeringTable.PLAYER_OUTPUT_END var idDisplacement: Int = TileEngineeringTable.PLAYER_OUTPUT_END
for (dir <- ForgeDirection.VALID_DIRECTIONS) for (dir <- ForgeDirection.VALID_DIRECTIONS)
{ {
val tile: TileEntity = asVectorWorld.add(dir).getTileEntity val tile: TileEntity = toVectorWorld.add(dir).getTileEntity
if (tile.isInstanceOf[IInventory]) if (tile.isInstanceOf[IInventory])
{ {
val inventory: IInventory = tile.asInstanceOf[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 var idDisplacement: Int = TileEngineeringTable.PLAYER_OUTPUT_END
for (dir <- ForgeDirection.VALID_DIRECTIONS) for (dir <- ForgeDirection.VALID_DIRECTIONS)
{ {
val tile: TileEntity = asVectorWorld.add(dir).getTileEntity val tile: TileEntity = toVectorWorld.add(dir).getTileEntity
if (tile.isInstanceOf[IInventory]) if (tile.isInstanceOf[IInventory])
{ {
val inventory: IInventory = tile.asInstanceOf[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 var temporaryInvID: Int = TileEngineeringTable.PLAYER_OUTPUT_END
for (dir <- ForgeDirection.VALID_DIRECTIONS) 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]) if (tile.isInstanceOf[IInventory])
{ {
val inventory: IInventory = tile.asInstanceOf[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) 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 boiledVolume += volume
} }
if (boiledVolume >= FluidContainerRegistry.BUCKET_VOLUME) if (boiledVolume >= FluidContainerRegistry.BUCKET_VOLUME)

View file

@ -106,7 +106,7 @@ class TileGrate extends TileFluidProvider(Material.rock) with IRotatable
if (gratePath == null) if (gratePath == null)
{ {
gratePath = new GratePathfinder(true) 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) val filledInWorld = gratePath.tryFill(fluidNode.getFluidAmount, blockEffect)
fluidNode.drain(filledInWorld, true) fluidNode.drain(filledInWorld, true)
@ -120,7 +120,7 @@ class TileGrate extends TileFluidProvider(Material.rock) with IRotatable
if (gratePath == null) if (gratePath == null)
{ {
gratePath = new GratePathfinder(false) gratePath = new GratePathfinder(false)
if (!gratePath.startDrain(asVector3)) if (!gratePath.startDrain(toVector3))
{ {
resetPath() resetPath()
} }

View file

@ -83,7 +83,7 @@ class TileGutter extends TileFluidProvider(Material.rock)
{ {
val dir: ForgeDirection = ForgeDirection.getOrientation(i) val dir: ForgeDirection = ForgeDirection.getOrientation(i)
val pressure: Int = fluidNode.asInstanceOf[NodePressure].pressure(dir) 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) val checkTile: TileEntity = pos.getTileEntity(world)
if (checkTile.isInstanceOf[TileGutter]) 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) GL11.glScaled(0.99, 0.99, 0.99)
val tank: IFluidTank = fluidNode.getPrimaryTank val tank: IFluidTank = fluidNode.getPrimaryTank
val percentageFilled: Double = tank.getFluidAmount.toDouble / tank.getCapacity.toDouble val percentageFilled: Double = tank.getFluidAmount.toDouble / tank.getCapacity.toDouble
val ySouthEast: Double = FluidUtility.getAveragePercentageFilledForSides(classOf[TileTank], percentageFilled, world, asVector3, ForgeDirection.SOUTH, ForgeDirection.EAST) val ySouthEast: Double = FluidUtility.getAveragePercentageFilledForSides(classOf[TileTank], percentageFilled, world, toVector3, ForgeDirection.SOUTH, ForgeDirection.EAST)
val yNorthEast: Double = FluidUtility.getAveragePercentageFilledForSides(classOf[TileTank], percentageFilled, world, asVector3, ForgeDirection.NORTH, 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, asVector3, ForgeDirection.SOUTH, ForgeDirection.WEST) val ySouthWest: Double = FluidUtility.getAveragePercentageFilledForSides(classOf[TileTank], percentageFilled, world, toVector3, ForgeDirection.SOUTH, ForgeDirection.WEST)
val yNorthWest: Double = FluidUtility.getAveragePercentageFilledForSides(classOf[TileTank], percentageFilled, world, asVector3, ForgeDirection.NORTH, ForgeDirection.WEST) val yNorthWest: Double = FluidUtility.getAveragePercentageFilledForSides(classOf[TileTank], percentageFilled, world, toVector3, ForgeDirection.NORTH, ForgeDirection.WEST)
FluidRenderUtility.renderFluidTesselation(tank, ySouthEast, yNorthEast, ySouthWest, yNorthWest) FluidRenderUtility.renderFluidTesselation(tank, ySouthEast, yNorthEast, ySouthWest, yNorthWest)
} }
GL11.glPopMatrix() GL11.glPopMatrix()

View file

@ -75,7 +75,7 @@ class TileCastingMold extends TileInventory(Material.rock) with IFluidHandler wi
override def update 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) val drainStack: FluidStack = FluidUtility.drainBlock(worldObj, checkPos, false)
if (MachineRecipes.INSTANCE.getOutput(RecipeType.SMELTER.name, drainStack).length > 0) 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) for (dir <- ForgeDirection.VALID_DIRECTIONS)
{ {
val check = asVector3 + dir val check = toVector3 + dir
val checkTile = check.getTileEntity(world) val checkTile = check.getTileEntity(world)
if (checkTile != null && checkTile.getClass == tile.getClass && check.getBlockMetadata(world) == tile.getBlockMetadata) 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 var volume: Float = 0.5f
for (i <- 0 to 6) 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) if (check.getBlock(world) eq getBlockType)
{ {
volume *= 1.5f volume *= 1.5f

View file

@ -16,7 +16,7 @@ class GuiAccelerator(player: EntityPlayer, tileEntity: TileAccelerator) extends
{ {
this.fontRendererObj.drawString("Accelerator", 40, 10, 4210752) this.fontRendererObj.drawString("Accelerator", 40, 10, 4210752)
var status: String = "" 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)) if (!EntityParticle.canSpawnParticle(this.tileEntity.world, position))
{ {
status = "\u00a74Fail to emit; try rotating." 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 //Create new particle if we have materials to spawn it with
if (getStackInSlot(0) != null && lastSpawnTick >= 40) if (getStackInSlot(0) != null && lastSpawnTick >= 40)
{ {
val spawn_vec: Vector3 = asVector3 val spawn_vec: Vector3 = toVector3
spawn_vec.add(getDirection.getOpposite) spawn_vec.add(getDirection.getOpposite)
spawn_vec.add(0.5f) spawn_vec.add(0.5f)
if (EntityParticle.canSpawnParticle(worldObj, spawn_vec)) if (EntityParticle.canSpawnParticle(worldObj, spawn_vec))
{ {
totalEnergyConsumed = 0 totalEnergyConsumed = 0
entityParticle = new EntityParticle(worldObj, spawn_vec, asVector3, getDirection.getOpposite) entityParticle = new EntityParticle(worldObj, spawn_vec, toVector3, getDirection.getOpposite)
worldObj.spawnEntityInWorld(entityParticle) worldObj.spawnEntityInWorld(entityParticle)
CalculateParticleDensity CalculateParticleDensity
decrStackSize(0, 1) decrStackSize(0, 1)

View file

@ -55,7 +55,7 @@ class TileCentrifuge extends TileElectricInventory(Material.iron) with IPacketRe
for (i <- 0 to 6) for (i <- 0 to 6)
{ {
val direction: ForgeDirection = ForgeDirection.getOrientation(i) 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) if (tileEntity.isInstanceOf[IFluidHandler] && tileEntity.getClass != this.getClass)
{ {
val fluidHandler: IFluidHandler = (tileEntity.asInstanceOf[IFluidHandler]) val fluidHandler: IFluidHandler = (tileEntity.asInstanceOf[IFluidHandler])

View file

@ -46,7 +46,7 @@ class FulminationHandler
{ {
if (!tileEntity.isInvalid) if (!tileEntity.isInvalid)
{ {
val tileDiDian: Vector3 = tileEntity.asVector3 val tileDiDian: Vector3 = tileEntity.toVector3
tileDiDian.add(0.5f) tileDiDian.add(0.5f)
val juLi: Double = tileDiDian.distance(new Vector3(evt.x, evt.y, evt.z)) val juLi: Double = tileDiDian.distance(new Vector3(evt.x, evt.y, evt.z))
if (juLi <= evt.iExplosion.getRadius && juLi > 0) if (juLi <= evt.iExplosion.getRadius && juLi > 0)
@ -66,7 +66,7 @@ class FulminationHandler
for (tileEntity <- avaliableGenerators) 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 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] var energy: Long = Math.min(maxEnergyPerGenerator, maxEnergyPerGenerator / (juLi / evt.iExplosion.getRadius)).asInstanceOf[Long]
energy = Math.max((1 - density) * energy, 0).asInstanceOf[Long] energy = Math.max((1 - density) * energy, 0).asInstanceOf[Long]
tileEntity.energy.receiveEnergy(energy, true) tileEntity.energy.receiveEnergy(energy, true)

View file

@ -58,7 +58,7 @@ class TilePlasma extends TileAdvanced(Material.lava)
override def update override def update
{ {
super.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) if (ticks % 20 == 0)
{ {
temperature /= 1.5 temperature /= 1.5
@ -71,7 +71,7 @@ class TilePlasma extends TileAdvanced(Material.lava)
{ {
if (worldObj.rand.nextFloat < 0.4) if (worldObj.rand.nextFloat < 0.4)
{ {
val diDian: Vector3 = asVector3 val diDian: Vector3 = toVector3
diDian.add(ForgeDirection.getOrientation(i)) diDian.add(ForgeDirection.getOrientation(i))
val tileEntity: TileEntity = diDian.getTileEntity(worldObj) val tileEntity: TileEntity = diDian.getTileEntity(worldObj)
if (!(tileEntity.isInstanceOf[TilePlasma])) if (!(tileEntity.isInstanceOf[TilePlasma]))

View file

@ -79,8 +79,8 @@ class TileReactorCell extends TileInventory(Material.iron) with IMultiBlockStruc
val mainTile: TileReactorCell = getLowest val mainTile: TileReactorCell = getLowest
mainTile.getMultiBlock.deconstruct mainTile.getMultiBlock.deconstruct
mainTile.getMultiBlock.construct mainTile.getMultiBlock.construct
val top: 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 = asVector3.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) if (top && bottom)
{ {
worldObj.setBlockMetadataWithNotify(xCoord, yCoord, zCoord, 1, 3) worldObj.setBlockMetadataWithNotify(xCoord, yCoord, zCoord, 1, 3)
@ -98,7 +98,7 @@ class TileReactorCell extends TileInventory(Material.iron) with IMultiBlockStruc
def getLowest: TileReactorCell = def getLowest: TileReactorCell =
{ {
var lowest: TileReactorCell = this var lowest: TileReactorCell = this
val checkPosition: Vector3 = asVector3 val checkPosition: Vector3 = toVector3
while (true) while (true)
{ {
val t: TileEntity = checkPosition.getTileEntity(this.worldObj) 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) if (drain != null && drain.amount >= FluidContainerRegistry.BUCKET_VOLUME)
{ {
val spawnDir: ForgeDirection = ForgeDirection.getOrientation(worldObj.rand.nextInt(3) + 2) 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) spawnPos.add(0, Math.max(worldObj.rand.nextInt(getHeight) - 1, 0), 0)
if (worldObj.isAirBlock(spawnPos.xi, spawnPos.yi, spawnPos.zi)) 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]] 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) 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) if (internalEnergy - prevInternalEnergy > 0)
{ {
var deltaT: Float = ThermalPhysics.getTemperatureForEnergy(mass, specificHeatCapacity, ((internalEnergy - prevInternalEnergy) * 0.15).asInstanceOf[Long]) 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) 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) if (checkAdjacent.getBlock(worldObj) == AtomicContent.blockControlRod)
{ {
deltaT /= 1.1f 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) 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) 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 internalEnergy = 0
if (isOverToxic) 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 val block: Block = leakPos.getBlock
if (block == Blocks.grass) if (block == Blocks.grass)
{ {
@ -281,7 +281,7 @@ class TileReactorCell extends TileInventory(Material.iron) with IMultiBlockStruc
def getHeight: Int = def getHeight: Int =
{ {
var height: Int = 0 var height: Int = 0
val checkPosition: Vector3 = asVector3 val checkPosition: Vector3 = toVector3
var tile: TileEntity = this var tile: TileEntity = this
while (tile.isInstanceOf[TileReactorCell]) while (tile.isInstanceOf[TileReactorCell])
{ {
@ -320,7 +320,7 @@ class TileReactorCell extends TileInventory(Material.iron) with IMultiBlockStruc
override def getMultiBlockVectors: java.lang.Iterable[Vector3] = override def getMultiBlockVectors: java.lang.Iterable[Vector3] =
{ {
val vectors: List[Vector3] = new ArrayList[Vector3] val vectors: List[Vector3] = new ArrayList[Vector3]
val checkPosition: Vector3 = asVector3 val checkPosition: Vector3 = toVector3
while (true) while (true)
{ {
val t: TileEntity = checkPosition.getTileEntity(this.worldObj) val t: TileEntity = checkPosition.getTileEntity(this.worldObj)
@ -339,7 +339,7 @@ class TileReactorCell extends TileInventory(Material.iron) with IMultiBlockStruc
def getPosition: Vector3 = def getPosition: Vector3 =
{ {
return asVector3 return toVector3
} }
/** Reads a tile entity from NBT. */ /** Reads a tile entity from NBT. */

View file

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

View file

@ -114,7 +114,7 @@ class TileThermometer extends TileAdvanced(Material.piston) with SimpleComponent
} }
else else
{ {
detectedTemperature = ThermalGrid.getTemperature(asVectorWorld) detectedTemperature = ThermalGrid.getTemperature(toVectorWorld)
} }
if (detectedTemperature != previousDetectedTemperature || isProvidingPower != this.isOverThreshold) 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 abstract class PartFramedNode extends PartAbstract with TPartNodeProvider with TSlottedPart with TNormalOcclusion with TIconHitEffects
{ {
/** Bitmask connections */ /** Bitmask connections */
var connectionMask = 0x00 protected var clientRenderMask = 0x00
@SideOnly(Side.CLIENT) @SideOnly(Side.CLIENT)
protected var breakIcon: IIcon = null protected var breakIcon: IIcon = null
@ -50,7 +50,7 @@ abstract class PartFramedNode extends PartAbstract with TPartNodeProvider with T
val list = mutable.Set.empty[IndexedCuboid6] val list = mutable.Set.empty[IndexedCuboid6]
list += CuboidShapes.WIRE_CENTER 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 return list
} }
@ -65,25 +65,25 @@ abstract class PartFramedNode extends PartAbstract with TPartNodeProvider with T
return !expandable return !expandable
} }
def isCurrentlyConnected(side: ForgeDirection): Boolean = connectionMapContainsSide(connectionMask, side) def isCurrentlyConnected(side: ForgeDirection): Boolean = connectionMapContainsSide(clientRenderMask, side)
/** Packet Methods */ /** Packet Methods */
def sendConnectionUpdate() def sendConnectionUpdate()
{ {
if (!world.isRemote) if (!world.isRemote)
tile.getWriteStream(this).writeByte(0).writeByte(connectionMask) tile.getWriteStream(this).writeByte(0).writeByte(node)
} }
override def readDesc(packet: MCDataInput) override def readDesc(packet: MCDataInput)
{ {
super.readDesc(packet) super.readDesc(packet)
connectionMask = packet.readByte clientRenderMask = packet.readByte
} }
override def writeDesc(packet: MCDataOutput) override def writeDesc(packet: MCDataOutput)
{ {
super.writeDesc(packet) super.writeDesc(packet)
packet.writeByte(connectionMask) packet.writeByte(clientRenderMask)
} }
override def read(packet: MCDataInput, packetID: Int) override def read(packet: MCDataInput, packetID: Int)
@ -92,7 +92,7 @@ abstract class PartFramedNode extends PartAbstract with TPartNodeProvider with T
if (packetID == 0) if (packetID == 0)
{ {
connectionMask = packet.readByte clientRenderMask = packet.readByte
tile.markRender() tile.markRender()
} }
} }

View file

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

View file

@ -63,7 +63,7 @@ class TileLaserEmitter extends TileAdvanced(Material.iron) with ILaserHandler
if (energy > 0) 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 energy = 0
} }
} }

View file

@ -59,7 +59,7 @@ class TileFocusCrystal extends TileFocus(Material.rock) with ILaserHandler with
if (energy > 0) 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) color = new Vector3(1, 1, 1)
energy = 0 energy = 0
} }
@ -67,7 +67,7 @@ class TileFocusCrystal extends TileFocus(Material.rock) with ILaserHandler with
override def focus(newPosition: Vector3) override def focus(newPosition: Vector3)
{ {
normal = ((newPosition - asVector3) - 0.5).normalize normal = ((newPosition - toVector3) - 0.5).normalize
world.markBlockForUpdate(xi, yi, zi) 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 = 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.energy += energy
this.color = (this.color + color) / 2 this.color = (this.color + color) / 2
return true return true

View file

@ -66,7 +66,7 @@ class TileMirror extends TileFocus(Material.glass) with ILaserHandler with IFocu
override def focus(newPosition: Vector3) override def focus(newPosition: Vector3)
{ {
normal = ((newPosition - asVector3) - 0.5).normalize normal = ((newPosition - toVector3) - 0.5).normalize
world.markBlockForUpdate(xi, yi, zi) world.markBlockForUpdate(xi, yi, zi)
} }
@ -89,7 +89,7 @@ class TileMirror extends TileFocus(Material.glass) with ILaserHandler with IFocu
/** /**
* Render incoming laser * 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 * Calculate Reflection
@ -102,7 +102,7 @@ class TileMirror extends TileFocus(Material.glass) with ILaserHandler with IFocu
if (rotateAngle < Math.PI) if (rotateAngle < Math.PI)
{ {
val newDirection = (incidentDirection.clone.transform(new Quaternion(rotateAngle, axisOfReflection))).normalize 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 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)))) 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 topTesla: TileTesla = this.getTopTelsa
val topTeslaVector: Vector3 = asVector3 val topTeslaVector: Vector3 = toVector3
if (this.linked != null || this.isLinkedClient) if (this.linked != null || this.isLinkedClient)
{ {
if (!this.worldObj.isRemote) if (!this.worldObj.isRemote)
@ -127,8 +127,8 @@ class TileTesla extends TileElectric(Material.iron) with IMultiBlockStructure[Ti
{ {
def compare(o1: ITesla, o2: ITesla): Int = def compare(o1: ITesla, o2: ITesla): Int =
{ {
val distance1: Double = asVector3.distance(new Vector3(o1.asInstanceOf[TileEntity])) val distance1: Double = toVector3.distance(new Vector3(o1.asInstanceOf[TileEntity]))
val distance2: Double = asVector3.distance(new Vector3(o2.asInstanceOf[TileEntity])) val distance2: Double = toVector3.distance(new Vector3(o2.asInstanceOf[TileEntity]))
if (distance1 < distance2) if (distance1 < distance2)
{ {
return 1 return 1
@ -144,7 +144,7 @@ class TileTesla extends TileElectric(Material.iron) with IMultiBlockStructure[Ti
for (o <- TeslaGrid.instance.get) for (o <- TeslaGrid.instance.get)
{ {
var otherTesla = o 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]) if (otherTesla.isInstanceOf[TileTesla])
{ {
@ -175,11 +175,11 @@ class TileTesla extends TileElectric(Material.iron) with IMultiBlockStructure[Ti
if (tesla.isInstanceOf[TileTesla]) if (tesla.isInstanceOf[TileTesla])
{ {
getMultiBlock.get.outputBlacklist.add(this) getMultiBlock.get.outputBlacklist.add(this)
targetVector = tesla.asInstanceOf[TileTesla].getTopTelsa.asVector3 targetVector = tesla.asInstanceOf[TileTesla].getTopTelsa.toVector3
heightRange = (tesla.asInstanceOf[TileTesla]).getHeight heightRange = (tesla.asInstanceOf[TileTesla]).getHeight
} }
val distance: Double = topTeslaVector.distance(targetVector) 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)) this.transfer(tesla, Math.min(transferEnergy, TRANSFER_CAP))
if (!sentPacket && transferEnergy > 0) if (!sentPacket && transferEnergy > 0)
{ {
@ -317,8 +317,8 @@ class TileTesla extends TileElectric(Material.iron) with IMultiBlockStructure[Ti
val mainTile: TileTesla = getLowestTesla val mainTile: TileTesla = getLowestTesla
mainTile.getMultiBlock.deconstruct mainTile.getMultiBlock.deconstruct
mainTile.getMultiBlock.construct mainTile.getMultiBlock.construct
val isTop: 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 = asVector3.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) if (isTop && isBottom)
{ {
this.worldObj.setBlockMetadataWithNotify(this.xCoord, this.yCoord, this.zCoord, 1, 3) 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 return this.topCache
} }
this.connectedTeslas.clear this.connectedTeslas.clear
val checkPosition: Vector3 = asVector3 val checkPosition: Vector3 = toVector3
var returnTile: TileTesla = this var returnTile: TileTesla = this
var exit = false var exit = false
while (exit) while (exit)
@ -381,7 +381,7 @@ class TileTesla extends TileElectric(Material.iron) with IMultiBlockStructure[Ti
var exit = false var exit = false
while (!exit) 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]) if (t.isInstanceOf[TileTesla])
{ {
this.connectedTeslas.add(t.asInstanceOf[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) val tileEntity: TileEntity = this.linked.getTileEntity(newOtherWorld)
if (tileEntity.isInstanceOf[TileTesla]) 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] = def getMultiBlockVectors: java.lang.Iterable[Vector3] =
{ {
val vectors: List[Vector3] = new ArrayList[Vector3] val vectors: List[Vector3] = new ArrayList[Vector3]
val checkPosition: Vector3 = asVector3 val checkPosition: Vector3 = toVector3
var exit = false var exit = false
while (!exit) while (!exit)
{ {
@ -526,7 +526,7 @@ class TileTesla extends TileElectric(Material.iron) with IMultiBlockStructure[Ti
def getLowestTesla: TileTesla = def getLowestTesla: TileTesla =
{ {
var lowest: TileTesla = this var lowest: TileTesla = this
val checkPosition: Vector3 = asVector3 val checkPosition: Vector3 = toVector3
var exit = false var exit = false
while (!exit) while (!exit)
{ {
@ -551,7 +551,7 @@ class TileTesla extends TileElectric(Material.iron) with IMultiBlockStructure[Ti
def getPosition: Vector3 = def getPosition: Vector3 =
{ {
return asVector3 return toVector3
} }
def getMultiBlock: MultiBlockHandler[TileTesla] = def getMultiBlock: MultiBlockHandler[TileTesla] =
@ -634,7 +634,7 @@ class TileTesla extends TileElectric(Material.iron) with IMultiBlockStructure[Ti
else else
{ {
if (world.isRemote) player.addChatMessage(new ChatComponentText("Marked link for device.")) if (world.isRemote) player.addChatMessage(new ChatComponentText("Marked link for device."))
LinkUtility.setLink(itemStack, asVectorWorld) LinkUtility.setLink(itemStack, toVectorWorld)
} }
return true return true
} }

View file

@ -43,7 +43,7 @@ object RenderFramedWire
CCRenderState.setBrightness(wire.world, wire.x, wire.y, wire.z) CCRenderState.setBrightness(wire.world, wire.x, wire.y, wire.z)
renderSide(ForgeDirection.UNKNOWN, wire) 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) 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.glPushMatrix()
GL11.glTranslated(x + 0.5, y + 0.5, z + 0.5) 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.glPopMatrix()
GL11.glPushMatrix() GL11.glPushMatrix()
val fluid = part.tank.getFluid val fluid = part.tank.getFluid
val renderSides = part.connectionMask val renderSides = part.clientRenderMask
if (fluid != null && fluid.amount > 0) if (fluid != null && fluid.amount > 0)
{ {

View file

@ -36,7 +36,7 @@ class TilePump extends TileMechanical(Material.iron) with IRotatable with IFluid
super.update super.update
if (!worldObj.isRemote && mechanicalNode.getPower > 0) 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]) if (tileIn.isInstanceOf[IFluidHandler])
{ {
val drain: FluidStack = (tileIn.asInstanceOf[IFluidHandler]).drain(getDirection, pressureNode.getCapacity, false) 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) 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) if (tileOut.isInstanceOf[IFluidHandler]) return (tileOut.asInstanceOf[IFluidHandler]).fill(from, resource, doFill)
} }
return 0 return 0

View file

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

View file

@ -107,7 +107,7 @@ class TilePlacer extends TileInventory(Material.rock) with IRotatable with TPack
def doWork def doWork
{ {
val side: Int = 0 val side: Int = 0
val placePos: Vector3 = asVector3.add(getDirection) val placePos: Vector3 = toVector3.add(getDirection)
val placeStack: ItemStack = getStackInSlot(0) val placeStack: ItemStack = getStackInSlot(0)
if (InventoryUtility.placeItemBlock(world, placePos.xi, placePos.yi, placePos.zi, placeStack, side)) 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 super.update
if (markRevolve) if (markRevolve)
{ {
val movePosition: Vector3 = asVector3.add(getDirection) val movePosition: Vector3 = toVector3.add(getDirection)
if (!hitOreBlock(movePosition)) if (!hitOreBlock(movePosition))
{ {
if (!worldObj.isRemote) if (!worldObj.isRemote)

View file

@ -120,7 +120,7 @@ class TileGrindingWheel extends TileMechanical(Material.rock) with IRotatable
var didWork: Boolean = false var didWork: Boolean = false
if (grindingItem != null) 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) val timeLeft: Int = TileGrindingWheel.TIMER_GRIND_ITEM.decrease(grindingItem)
if (timeLeft <= 0) if (timeLeft <= 0)

View file

@ -81,7 +81,7 @@ class TileMixer extends TileMechanical(Material.iron)
{ {
if (x != 0 && z != 0) 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])) if (block != null && !(block.isInstanceOf[IFluidBlock]))
{ {
return true return true
@ -112,9 +112,9 @@ class TileMixer extends TileMechanical(Material.iron)
{ {
val entity: Entity = obj.asInstanceOf[Entity] val entity: Entity = obj.asInstanceOf[Entity]
val originalPosition: Vector3 = new Vector3(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))) 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) val difference: Vector3 = newPosition.subtract(originalPosition).multiply(0.5)
entity.addVelocity(difference.x, difference.y, difference.z) entity.addVelocity(difference.x, difference.y, difference.z)
entity.onGround = false entity.onGround = false
@ -133,7 +133,7 @@ class TileMixer extends TileMechanical(Material.iron)
{ {
TileMixer.MIXER_ITEM_TIMER.put(processingItem, TileMixer.PROCESS_TIME) 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) val timeLeft: Int = TileMixer.MIXER_ITEM_TIMER.decrease(processingItem)
if (timeLeft <= 0) if (timeLeft <= 0)

View file

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

View file

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