Changes to position and packet usage due to RE update

This commit is contained in:
Robert S 2014-10-20 13:45:50 -04:00
parent 2f4be51317
commit f848a8e7b8
42 changed files with 157 additions and 192 deletions

View file

@ -26,7 +26,7 @@ import resonant.lib.network.handle.IPacketReceiver
import resonant.lib.render.RenderItemOverlayUtility import resonant.lib.render.RenderItemOverlayUtility
import resonant.lib.utility.inventory.InventoryUtility import resonant.lib.utility.inventory.InventoryUtility
import resonantinduction.core.Reference import resonantinduction.core.Reference
import universalelectricity.core.transform.vector.{Vector2, Vector3, VectorWorld} import universalelectricity.core.transform.vector.{Vector2, Vector3}
import scala.collection.JavaConversions._ import scala.collection.JavaConversions._
@ -371,12 +371,12 @@ class TileImprinter extends TileAdvanced(Material.circuits) with ISidedInventory
InventoryUtility.dropItemStack(world, new Vector3(player), checkStack, 0) InventoryUtility.dropItemStack(world, new Vector3(player), checkStack, 0)
inventory(slotID) = null inventory(slotID) = null
} }
world.markBlockForUpdate(x, y, z) world.markBlockForUpdate(xi, yi, zi)
return true return true
} }
} }
} }
world.markBlockForUpdate(x, y, z) world.markBlockForUpdate(xi, yi, zi)
} }
return true return true
} }
@ -399,8 +399,7 @@ class TileImprinter extends TileAdvanced(Material.circuits) with ISidedInventory
override def onNeighborChanged(block: Block) override def onNeighborChanged(block: Block)
{ {
val vec: VectorWorld = new VectorWorld(this) val b: Block = asVectorWorld.add(ForgeDirection.getOrientation(1)).getBlock
val b: Block = vec.add(ForgeDirection.getOrientation(1)).getBlock
if (Blocks.piston_head eq b) if (Blocks.piston_head eq b)
{ {
onInventoryChanged onInventoryChanged

View file

@ -36,7 +36,7 @@ class TileTurntable extends SpatialBlock(Material.piston) with TRotatable
override def update() override def update()
{ {
updateTurntableState(world, x, y, z) updateTurntableState(world, xi, yi, zi)
} }
private def updateTurntableState(world: World, x: Int, y: Int, z: Int) private def updateTurntableState(world: World, x: Int, y: Int, z: Int)

View file

@ -156,12 +156,10 @@ class TileCrate extends TileInventory(Material.rock) with TPacketReceiver with I
return TileCrate.getSlotCount(this.getBlockMetadata) return TileCrate.getSlotCount(this.getBlockMetadata)
} }
def read(data: ByteBuf, player: EntityPlayer, packet: PacketType) override def read(data: ByteBuf, player: EntityPlayer, packet: PacketType)
{ {
if (this.worldObj.isRemote) if (this.worldObj.isRemote)
{ {
try
{
if (data.readBoolean) if (data.readBoolean)
{ {
this.sampleStack = ItemStack.loadItemStackFromNBT(data.readTag()) this.sampleStack = ItemStack.loadItemStackFromNBT(data.readTag())
@ -171,14 +169,6 @@ class TileCrate extends TileInventory(Material.rock) with TPacketReceiver with I
{ {
this.sampleStack = null this.sampleStack = null
} }
}
catch
{
case e: Exception =>
{
e.printStackTrace
}
}
} }
} }

View file

@ -246,7 +246,7 @@ class TileEngineeringTable extends TileInventory(Material.wood) with IPacketRece
override def onRemove(block: Block, par6: Int) override def onRemove(block: Block, par6: Int)
{ {
val stack: ItemStack = ItemBlockSaved.getItemStackWithNBT(block, world, x, y, z) val stack: ItemStack = ItemBlockSaved.getItemStackWithNBT(block, world, xi, yi, zi)
InventoryUtility.dropItemStack(world, center, stack) InventoryUtility.dropItemStack(world, center, stack)
} }
@ -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 = new Vector3(this).add(dir).getTileEntity(worldObj) val tile: TileEntity = asVectorWorld.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 = new Vector3(this).add(dir).getTileEntity(worldObj) val tile: TileEntity = asVectorWorld.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 = new Vector3(this).add(dir).getTileEntity(worldObj) val tile: TileEntity = asVectorWorld.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, new Vector3(this).add(0, 1, 0), new FluidStack(FluidRegistry.WATER, volume), new FluidStack(FluidRegistry.getFluid("steam"), volume), 2, false)) 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))
boiledVolume += volume boiledVolume += volume
} }
if (boiledVolume >= FluidContainerRegistry.BUCKET_VOLUME) if (boiledVolume >= FluidContainerRegistry.BUCKET_VOLUME)
@ -269,7 +269,7 @@ class TileFirebox extends TileElectricInventory(Material.rock) with IPacketRecei
override def use(player: EntityPlayer, side: Int, hit: Vector3): Boolean = override def use(player: EntityPlayer, side: Int, hit: Vector3): Boolean =
{ {
if (FluidUtility.playerActivatedFluidItem(world, x, y, z, player, side)) if (FluidUtility.playerActivatedFluidItem(world, xi, yi, zi, player, side))
{ {
return true return true
} }

View file

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

View file

@ -81,7 +81,7 @@ class TileGutter extends TilePressureNode(Material.rock)
{ {
val dir: ForgeDirection = ForgeDirection.getOrientation(i) val dir: ForgeDirection = ForgeDirection.getOrientation(i)
val pressure: Int = getPressure(dir) val pressure: Int = getPressure(dir)
val _position: Vector3 = position.add(dir) val _position: Vector3 = asVector3.add(dir)
val checkTile: TileEntity = _position.getTileEntity(world) val checkTile: TileEntity = _position.getTileEntity(world)
if (checkTile.isInstanceOf[TileGutter]) if (checkTile.isInstanceOf[TileGutter])
{ {

View file

@ -107,7 +107,7 @@ class TileTank extends TileTankNode(Material.iron) with ISneakPickup
{ {
if (!world.isRemote) if (!world.isRemote)
{ {
return FluidUtility.playerActivatedFluidItem(world, x, y, z, player, side) return FluidUtility.playerActivatedFluidItem(world, xi, yi, zi, player, side)
} }
return true return true
} }
@ -140,10 +140,10 @@ class TileTank extends TileTankNode(Material.iron) with ISneakPickup
GL11.glScaled(0.99, 0.99, 0.99) GL11.glScaled(0.99, 0.99, 0.99)
val tank: IFluidTank = getTank val tank: IFluidTank = getTank
val percentageFilled: Double = tank.getFluidAmount.asInstanceOf[Double] / tank.getCapacity.asInstanceOf[Double] val percentageFilled: Double = tank.getFluidAmount.asInstanceOf[Double] / tank.getCapacity.asInstanceOf[Double]
val ySouthEast: Double = FluidUtility.getAveragePercentageFilledForSides(classOf[TileTank], percentageFilled, world, new Vector3(this), ForgeDirection.SOUTH, ForgeDirection.EAST) val ySouthEast: Double = FluidUtility.getAveragePercentageFilledForSides(classOf[TileTank], percentageFilled, world, asVector3, ForgeDirection.SOUTH, ForgeDirection.EAST)
val yNorthEast: Double = FluidUtility.getAveragePercentageFilledForSides(classOf[TileTank], percentageFilled, world, new Vector3(this), ForgeDirection.NORTH, 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, new Vector3(this), ForgeDirection.SOUTH, ForgeDirection.WEST) val ySouthWest: Double = FluidUtility.getAveragePercentageFilledForSides(classOf[TileTank], percentageFilled, world, asVector3, ForgeDirection.SOUTH, ForgeDirection.WEST)
val yNorthWest: Double = FluidUtility.getAveragePercentageFilledForSides(classOf[TileTank], percentageFilled, world, new Vector3(this), ForgeDirection.NORTH, ForgeDirection.WEST) val yNorthWest: Double = FluidUtility.getAveragePercentageFilledForSides(classOf[TileTank], percentageFilled, world, asVector3, 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 = new Vector3(this).add(0, 1, 0) val checkPos: Vector3 = asVector3.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

@ -145,7 +145,7 @@ class TileMillstone extends TileInventory(Material.rock) with IPacketReceiver
setInventorySlotContents(0, current) setInventorySlotContents(0, current)
player.inventory.setInventorySlotContents(player.inventory.currentItem, null) player.inventory.setInventorySlotContents(player.inventory.currentItem, null)
} }
world.markBlockForUpdate(x, y, z) world.markBlockForUpdate(xi, yi, zi)
return false return false
} }
} }

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 = new Vector3(tile) + dir val check = asVector3 + 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)
@ -123,7 +123,7 @@ class TileElectromagnet extends SpatialBlock(Material.iron) with IElectromagnet
} }
} }
RenderBlockUtility.tessellateBlockWithConnectedTextures(sideMap, world, x, y, z, tile.getBlockType, null, RenderUtility.getIcon(edgeTexture)) RenderBlockUtility.tessellateBlockWithConnectedTextures(sideMap, world, xi, yi, zi, tile.getBlockType, null, RenderUtility.getIcon(edgeTexture))
} }
} }

View file

@ -19,13 +19,13 @@ class TileSiren extends SpatialBlock(Material.wood)
val world: World = worldObj val world: World = worldObj
if (world != null) if (world != null)
{ {
val metadata: Int = world.getBlockMetadata(x, y, z) val metadata: Int = world.getBlockMetadata(xi, yi, zi)
if (world.getBlockPowerInput(x, y, z) > 0) if (world.getBlockPowerInput(xi, yi, zi) > 0)
{ {
var volume: Float = 0.5f var volume: Float = 0.5f
for (i <- 0 to 6) for (i <- 0 to 6)
{ {
val check: Vector3 = position.add(ForgeDirection.getOrientation(i)) val check: Vector3 = asVector3.add(ForgeDirection.getOrientation(i))
if (check.getBlock(world) eq getBlockType) if (check.getBlock(world) eq getBlockType)
{ {
volume *= 1.5f volume *= 1.5f
@ -38,7 +38,7 @@ class TileSiren extends SpatialBlock(Material.wood)
override def configure(player: EntityPlayer, side: Int, hit: Vector3): Boolean = override def configure(player: EntityPlayer, side: Int, hit: Vector3): Boolean =
{ {
var metadata: Int = world.getBlockMetadata(x, y, z) var metadata: Int = world.getBlockMetadata(xi, yi, zi)
if (player.isSneaking) if (player.isSneaking)
{ {
metadata -= 1 metadata -= 1
@ -48,7 +48,7 @@ class TileSiren extends SpatialBlock(Material.wood)
metadata += 1 metadata += 1
} }
metadata = Math.max(metadata % 16, 0) metadata = Math.max(metadata % 16, 0)
world.setBlockMetadataWithNotify(x, y, z, metadata, 2) world.setBlockMetadataWithNotify(xi, yi, zi, metadata, 2)
return true return true
} }
} }

View file

@ -15,7 +15,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 = new Vector3(this.tileEntity) val position: Vector3 = tileEntity.asVector3
position.add(this.tileEntity.getDirection.getOpposite) position.add(this.tileEntity.getDirection.getOpposite)
if (!EntityParticle.canSpawnParticle(this.tileEntity.world, position)) if (!EntityParticle.canSpawnParticle(this.tileEntity.world, position))
{ {

View file

@ -104,13 +104,13 @@ class TileAccelerator extends TileElectricInventory(Material.iron) with IElectro
{ {
if (getStackInSlot(0) != null && lastSpawnTick >= 40) if (getStackInSlot(0) != null && lastSpawnTick >= 40)
{ {
val spawn_vec: Vector3 = new Vector3(this) val spawn_vec: Vector3 = asVector3
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, new Vector3(this), getDirection.getOpposite) entityParticle = new EntityParticle(worldObj, spawn_vec, asVector3, getDirection.getOpposite)
worldObj.spawnEntityInWorld(entityParticle) worldObj.spawnEntityInWorld(entityParticle)
CalculateParticleDensity CalculateParticleDensity
decrStackSize(0, 1) decrStackSize(0, 1)
@ -175,7 +175,7 @@ class TileAccelerator extends TileElectricInventory(Material.iron) with IElectro
{ {
if (!world.isRemote) if (!world.isRemote)
{ {
player.openGui(AtomicContent, 0, world, x, y, z) player.openGui(AtomicContent, 0, world, xi, yi, zi)
} }
return true return true
} }

View file

@ -129,7 +129,7 @@ class TileNuclearBoiler extends TileElectricInventory(Material.iron) with IPacke
override def getDescPacket: PacketTile = override def getDescPacket: PacketTile =
{ {
return new PacketTile(x, y, z, Array(this.timer, AtomicContent.getFluidAmount(this.waterTank.getFluid), AtomicContent.getFluidAmount(this.gasTank.getFluid))) return new PacketTile(xi, yi, zi, Array(this.timer, AtomicContent.getFluidAmount(this.waterTank.getFluid), AtomicContent.getFluidAmount(this.gasTank.getFluid)))
} }
def sendDescPack def sendDescPack

View file

@ -54,7 +54,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 = new Vector3(this).add(direction).getTileEntity(world) val tileEntity: TileEntity = asVector3.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])
@ -127,7 +127,7 @@ class TileCentrifuge extends TileElectricInventory(Material.iron) with IPacketRe
override def getDescriptionPacket: Packet = override def getDescriptionPacket: Packet =
{ {
return ResonantEngine.instance.packetHandler.toMCPacket(new PacketTile(x, y, z, Array(this.timer, AtomicContent.getFluidAmount(this.gasTank.getFluid)))) return ResonantEngine.instance.packetHandler.toMCPacket(new PacketTile(xi, yi, zi, Array(this.timer, AtomicContent.getFluidAmount(this.gasTank.getFluid))))
} }
/** /**

View file

@ -46,7 +46,7 @@ class FulminationHandler
{ {
if (!tileEntity.isInvalid) if (!tileEntity.isInvalid)
{ {
val tileDiDian: Vector3 = new Vector3(tileEntity) val tileDiDian: Vector3 = tileEntity.asVector3
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 = new Vector3(tileEntity).distance(new Vector3(evt.x, evt.y, evt.z)) val juLi: Double = tileEntity.asVector3.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

@ -15,7 +15,7 @@ import resonant.api.event.PlasmaEvent
import resonant.content.prefab.java.TileAdvanced import resonant.content.prefab.java.TileAdvanced
import resonant.engine.grid.thermal.ThermalGrid import resonant.engine.grid.thermal.ThermalGrid
import resonant.lib.config.Config import resonant.lib.config.Config
import universalelectricity.core.transform.vector.{Vector3, VectorWorld} import universalelectricity.core.transform.vector.Vector3
object TilePlasma object TilePlasma
{ {
@ -58,7 +58,7 @@ class TilePlasma extends TileAdvanced(Material.lava)
override def update override def update
{ {
super.update super.update
ThermalGrid.addTemperature(new VectorWorld(this), ((temperature - ThermalGrid.getTemperature(new VectorWorld(this))) * 0.1f).asInstanceOf[Float]) ThermalGrid.addTemperature(asVectorWorld, ((temperature - ThermalGrid.getTemperature(asVectorWorld)) * 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 = new Vector3(this) val diDian: Vector3 = asVector3
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

@ -59,7 +59,7 @@ class TilePlasmaHeater extends TileElectric(Material.iron) with IPacketReceiver
} }
if (ticks % 80 == 0) if (ticks % 80 == 0)
{ {
world.markBlockForUpdate(x, y, z) world.markBlockForUpdate(xi, yi, zi)
} }
} }
@ -186,7 +186,7 @@ class TilePlasmaHeater extends TileElectric(Material.iron) with IPacketReceiver
override def use(player: EntityPlayer, side: Int, hit: Vector3): Boolean = override def use(player: EntityPlayer, side: Int, hit: Vector3): Boolean =
{ {
return FluidUtility.playerActivatedFluidItem(world, x, y, z, player, side) return FluidUtility.playerActivatedFluidItem(world, xi, yi, zi, player, side)
} }
} }

View file

@ -49,7 +49,7 @@ class TileQuantumAssembler extends TileElectricInventory(Material.iron) with IPa
{ {
if (!world.isRemote) if (!world.isRemote)
{ {
player.openGui(AtomicContent, 0, world, x, y, z) player.openGui(AtomicContent, 0, world, xi, yi, zi)
} }
return true return true
} }
@ -137,9 +137,9 @@ class TileQuantumAssembler extends TileElectricInventory(Material.iron) with IPa
{ {
if (this.getStackInSlot(6) != null) if (this.getStackInSlot(6) != null)
{ {
return new PacketTile(x, y, z, Array(time, getStackInSlot(6))) return new PacketTile(xi, yi, zi, Array(time, getStackInSlot(6)))
} }
return new PacketTile(x, y, z, Array(time, -1, -1, -1)) return new PacketTile(xi, yi, zi, Array(time, -1, -1, -1))
} }
/** /**

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 = new Vector3(this).add(new Vector3(0, 1, 0)).getTileEntity(worldObj).isInstanceOf[TileReactorCell] val top: Boolean = asVector3.add(new Vector3(0, 1, 0)).getTileEntity(worldObj).isInstanceOf[TileReactorCell]
val bottom: Boolean = new Vector3(this).add(new Vector3(0, -1, 0)).getTileEntity(worldObj).isInstanceOf[TileReactorCell] val bottom: Boolean = asVector3.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 = new Vector3(this) val checkPosition: Vector3 = asVector3
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 = new Vector3(this) + spawnDir + spawnDir val spawnPos: Vector3 = asVector3 + 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(new Vector3(this), entity) PoisonRadiation.INSTANCE.poisonEntity(asVector3, entity)
} }
} }
} }
} }
} }
temperature = ThermalGrid.getTemperature(new VectorWorld(this)) temperature = ThermalGrid.getTemperature(asVectorWorld)
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 = new Vector3(this).add(ForgeDirection.getOrientation(i)) val checkAdjacent: Vector3 = asVector3.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(new VectorWorld(this), deltaT) ThermalGrid.addTemperature(asVectorWorld, 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 = new VectorWorld(this).add(worldObj.rand.nextInt(20) - 10, worldObj.rand.nextInt(20) - 10, worldObj.rand.nextInt(20) - 10) val leakPos: VectorWorld = asVectorWorld.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)
{ {
@ -255,7 +255,7 @@ class TileReactorCell extends TileInventory(Material.iron) with IMultiBlockStruc
{ {
shouldUpdate = false shouldUpdate = false
notifyChange notifyChange
sendPacket(getDescPacket) //sendPacket(getDescPacket)
} }
} }
else else
@ -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 = new Vector3(this) val checkPosition: Vector3 = asVector3
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 = new Vector3(this) val checkPosition: Vector3 = asVector3
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 new Vector3(this) return asVector3
} }
/** 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 = new Vector3(this) val position: Vector3 = asVector3
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(new Vector3(this).add(ForgeDirection.getOrientation(this.getBlockMetadata).getOpposite)) }).init(asVector3.add(ForgeDirection.getOrientation(this.getBlockMetadata).getOpposite))
import scala.collection.JavaConversions._ import scala.collection.JavaConversions._
for (node <- finder.results) for (node <- finder.results)
{ {
@ -174,17 +174,17 @@ class TileReactorDrain extends TileAdvanced(Material.iron) with IFluidHandler
override def onPlaced(entityLiving: EntityLivingBase, itemStack: ItemStack) override def onPlaced(entityLiving: EntityLivingBase, itemStack: ItemStack)
{ {
if (MathHelper.abs(entityLiving.posX.asInstanceOf[Float] - x) < 2.0F && MathHelper.abs(entityLiving.posZ.asInstanceOf[Float] - z) < 2.0F) if (MathHelper.abs(entityLiving.posX.asInstanceOf[Float] - xi) < 2.0F && MathHelper.abs(entityLiving.posZ.asInstanceOf[Float] - zi) < 2.0F)
{ {
val d0: Double = entityLiving.posY + 1.82D - entityLiving.yOffset val d0: Double = entityLiving.posY + 1.82D - entityLiving.yOffset
if (d0 - y > 2.0D) if (d0 - y > 2.0D)
{ {
world.setBlockMetadataWithNotify(x, y, z, 1, 3) world.setBlockMetadataWithNotify(xi, yi, zi, 1, 3)
return return
} }
if (y - d0 > 0.0D) if (y - d0 > 0.0D)
{ {
world.setBlockMetadataWithNotify(x, y, z, 0, 3) world.setBlockMetadataWithNotify(xi, yi, zi, 0, 3)
return return
} }
} }

View file

@ -96,7 +96,7 @@ class TileThermometer extends TileAdvanced(Material.piston) with SimpleComponent
override def onRemove(block: Block, par6: Int) override def onRemove(block: Block, par6: Int)
{ {
val stack: ItemStack = ItemBlockSaved.getItemStackWithNBT(getBlockType, world, x, y, z) val stack: ItemStack = ItemBlockSaved.getItemStackWithNBT(getBlockType, world, xi, yi, zi)
InventoryUtility.dropItemStack(world, center, stack) InventoryUtility.dropItemStack(world, center, stack)
} }
@ -113,14 +113,14 @@ class TileThermometer extends TileAdvanced(Material.piston) with SimpleComponent
} }
else else
{ {
detectedTemperature = ThermalGrid.getTemperature(new VectorWorld(this)) detectedTemperature = ThermalGrid.getTemperature(asVectorWorld)
} }
if (detectedTemperature != previousDetectedTemperature || isProvidingPower != this.isOverThreshold) if (detectedTemperature != previousDetectedTemperature || isProvidingPower != this.isOverThreshold)
{ {
previousDetectedTemperature = detectedTemperature previousDetectedTemperature = detectedTemperature
isProvidingPower = isOverThreshold isProvidingPower = isOverThreshold
notifyChange notifyChange
sendPacket(getDescPacket) //sendPacket(getDescPacket)
} }
} }
} }

View file

@ -9,7 +9,7 @@ import net.minecraftforge.common.util.ForgeDirection
import net.minecraftforge.fluids._ import net.minecraftforge.fluids._
import resonant.content.prefab.java.TileAdvanced import resonant.content.prefab.java.TileAdvanced
import resonant.lib.network.discriminator.{PacketTile, PacketType} import resonant.lib.network.discriminator.{PacketTile, PacketType}
import resonant.lib.network.handle.IPacketIDReceiver import resonant.lib.network.handle.TPacketIDReceiver
import universalelectricity.api.core.grid.{INode, INodeProvider} import universalelectricity.api.core.grid.{INode, INodeProvider}
/** /**
@ -17,7 +17,7 @@ import universalelectricity.api.core.grid.{INode, INodeProvider}
* *
* @author DarkGuardsman * @author DarkGuardsman
*/ */
class TileTankNode(material: Material) extends TileAdvanced(material) with INodeProvider with IFluidHandler with IPacketIDReceiver class TileTankNode(material: Material) extends TileAdvanced(material) with INodeProvider with IFluidHandler with TPacketIDReceiver
{ {
val PACKET_DESCRIPTION = 0 val PACKET_DESCRIPTION = 0
val PACKET_RENDER = 1 val PACKET_RENDER = 1

View file

@ -111,7 +111,7 @@ class TileBattery extends TileElectric(Material.iron) with IPacketReceiver
{ {
energy.setCapacity(TileBattery.getEnergyForTier(ItemBlockBattery.getTier(itemStack))) energy.setCapacity(TileBattery.getEnergyForTier(ItemBlockBattery.getTier(itemStack)))
energy.setEnergy((itemStack.getItem.asInstanceOf[ItemBlockBattery]).getEnergy(itemStack)) energy.setEnergy((itemStack.getItem.asInstanceOf[ItemBlockBattery]).getEnergy(itemStack))
world.setBlockMetadataWithNotify(x, y, z, ItemBlockBattery.getTier(itemStack), 3) world.setBlockMetadataWithNotify(xi, yi, zi, ItemBlockBattery.getTier(itemStack), 3)
} }
} }
@ -120,7 +120,7 @@ class TileBattery extends TileElectric(Material.iron) with IPacketReceiver
val ret: ArrayList[ItemStack] = new ArrayList[ItemStack] val ret: ArrayList[ItemStack] = new ArrayList[ItemStack]
val itemStack: ItemStack = new ItemStack(getBlockType, 1) val itemStack: ItemStack = new ItemStack(getBlockType, 1)
val itemBlock: ItemBlockBattery = itemStack.getItem.asInstanceOf[ItemBlockBattery] val itemBlock: ItemBlockBattery = itemStack.getItem.asInstanceOf[ItemBlockBattery]
ItemBlockBattery.setTier(itemStack, world.getBlockMetadata(x, y, z).asInstanceOf[Byte]) ItemBlockBattery.setTier(itemStack, world.getBlockMetadata(xi, yi, zi).asInstanceOf[Byte])
itemBlock.setEnergy(itemStack, energy.getEnergy) itemBlock.setEnergy(itemStack, energy.getEnergy)
ret.add(itemStack) ret.add(itemStack)
return ret return ret

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 = new Vector3(this).add(dir) val checkPos: Vector3 = asVector3.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 = new Vector3(this).add(dir) val checkPos: Vector3 = asVector3.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

@ -19,12 +19,12 @@ class TileLaserEmitter extends TileAdvanced(Material.iron) with ILaserHandler
{ {
if (isIndirectlyPowered) if (isIndirectlyPowered)
{ {
energy += world.getStrongestIndirectPower(x, y, z) * (Laser.maxEnergy / 15) energy += world.getStrongestIndirectPower(xi, yi, zi) * (Laser.maxEnergy / 15)
} }
if (energy > 0) if (energy > 0)
{ {
Laser.spawn(worldObj, position + 0.5 + new Vector3(getDirection) * 0.51, position + new Vector3(getDirection) * 0.6 + 0.5, new Vector3(getDirection), energy) Laser.spawn(worldObj, asVector3 + 0.5 + new Vector3(getDirection) * 0.51, asVector3 + new Vector3(getDirection) * 0.6 + 0.5, new Vector3(getDirection), energy)
energy = 0; energy = 0;
} }
} }

View file

@ -30,7 +30,7 @@ class TileFocusCrystal extends TileBase with ILaserHandler with IFocus
{ {
val dir = ForgeDirection.getOrientation(a) val dir = ForgeDirection.getOrientation(a)
val axis = new Vector3(dir) val axis = new Vector3(dir)
val rotateAngle = world.getIndirectPowerLevelTo(x + axis.x.toInt, y + axis.y.toInt, z + axis.z.toInt, a) * 15 val rotateAngle = world.getIndirectPowerLevelTo(xi + axis.x.toInt, yi + axis.y.toInt, zi + axis.z.toInt, a) * 15
if (rotateAngle > 0) if (rotateAngle > 0)
{ {
@ -38,12 +38,12 @@ class TileFocusCrystal extends TileBase with ILaserHandler with IFocus
} }
} }
world.markBlockForUpdate(x, y, z) world.markBlockForUpdate(xi, yi, zi)
} }
if (energy > 0) if (energy > 0)
{ {
Laser.spawn(worldObj, position + 0.5 + normal * 0.9, position + 0.5, normal, color, energy) Laser.spawn(worldObj, asVector3 + 0.5 + normal * 0.9, asVector3 + 0.5, normal, color, energy)
color = new Vector3(1, 1, 1) color = new Vector3(1, 1, 1)
energy = 0; energy = 0;
} }
@ -51,8 +51,8 @@ class TileFocusCrystal extends TileBase with ILaserHandler with IFocus
override def focus(newPosition: Vector3) override def focus(newPosition: Vector3)
{ {
normal = ((newPosition - position) - 0.5).normalize normal = ((newPosition - asVector3) - 0.5).normalize
world.markBlockForUpdate(x, y, z) world.markBlockForUpdate(xi, yi, zi)
} }
def setFocus(focus: Vector3) def setFocus(focus: Vector3)
@ -66,7 +66,7 @@ class TileFocusCrystal extends TileBase with ILaserHandler with IFocus
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, position + 0.5, color, energy) ResonantInduction.proxy.renderLaser(worldObj, renderStart, asVector3 + 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
@ -76,7 +76,7 @@ class TileFocusCrystal extends TileBase with ILaserHandler with IFocus
{ {
val nbt = new NBTTagCompound() val nbt = new NBTTagCompound()
writeToNBT(nbt) writeToNBT(nbt)
return new S35PacketUpdateTileEntity(x, y, z, 0, nbt) return new S35PacketUpdateTileEntity(xi, yi, zi, 0, nbt)
} }
override def onDataPacket(net: NetworkManager, pkt: S35PacketUpdateTileEntity) override def onDataPacket(net: NetworkManager, pkt: S35PacketUpdateTileEntity)

View file

@ -30,7 +30,7 @@ class TileMirror extends TileBase with ILaserHandler with IFocus
{ {
val dir = ForgeDirection.getOrientation(a) val dir = ForgeDirection.getOrientation(a)
val axis = new Vector3(dir) val axis = new Vector3(dir)
val rotateAngle = world.getIndirectPowerLevelTo(x + axis.x.toInt, y + axis.y.toInt, z + axis.z.toInt, a) * 15 val rotateAngle = world.getIndirectPowerLevelTo(xi + axis.x.toInt, yi + axis.y.toInt, zi + axis.z.toInt, a) * 15
if (rotateAngle > 0) if (rotateAngle > 0)
{ {
@ -38,7 +38,7 @@ class TileMirror extends TileBase with ILaserHandler with IFocus
} }
} }
world.markBlockForUpdate(x, y, z) world.markBlockForUpdate(xi, yi, zi)
} }
if (world.getTotalWorldTime % 20 == 0) if (world.getTotalWorldTime % 20 == 0)
@ -47,8 +47,8 @@ class TileMirror extends TileBase with ILaserHandler with IFocus
override def focus(newPosition: Vector3) override def focus(newPosition: Vector3)
{ {
normal = ((newPosition - position) - 0.5).normalize normal = ((newPosition - asVector3) - 0.5).normalize
world.markBlockForUpdate(x, y, z) world.markBlockForUpdate(xi, yi, zi)
} }
def setFocus(focus: Vector3) def setFocus(focus: Vector3)
@ -70,7 +70,7 @@ class TileMirror extends TileBase with ILaserHandler with IFocus
/** /**
* Render incoming laser * Render incoming laser
*/ */
ResonantInduction.proxy.renderLaser(worldObj, renderStart, position + 0.5, color, energy) ResonantInduction.proxy.renderLaser(worldObj, renderStart, asVector3 + 0.5, color, energy)
/** /**
* Calculate Reflection * Calculate Reflection
@ -82,7 +82,7 @@ class TileMirror extends TileBase with ILaserHandler with IFocus
if (Math.toDegrees(rotateAngle) < 180) if (Math.toDegrees(rotateAngle) < 180)
{ {
val newDirection = (incidentDirection.clone.transform(new Quaternion(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) Laser.spawn(worldObj, asVector3 + 0.5 + newDirection * 0.9, asVector3 + 0.5, newDirection, color, energy / 1.2)
} }
return true return true
@ -92,7 +92,7 @@ class TileMirror extends TileBase with ILaserHandler with IFocus
{ {
val nbt = new NBTTagCompound() val nbt = new NBTTagCompound()
writeToNBT(nbt) writeToNBT(nbt)
return new S35PacketUpdateTileEntity(x, y, z, 0, nbt) return new S35PacketUpdateTileEntity(xi, yi, zi, 0, nbt)
} }
override def onDataPacket(net: NetworkManager, pkt: S35PacketUpdateTileEntity) override def onDataPacket(net: NetworkManager, pkt: S35PacketUpdateTileEntity)

View file

@ -23,8 +23,8 @@ class TileLaserReceiver extends TileBase with ILaserHandler
if (redstoneValue != prevRedstoneValue) if (redstoneValue != prevRedstoneValue)
{ {
world.notifyBlocksOfNeighborChange(x, y, z, getBlockType) world.notifyBlocksOfNeighborChange(xi, yi, zi, getBlockType)
ForgeDirection.VALID_DIRECTIONS.foreach(dir => world.notifyBlocksOfNeighborChange(x + dir.offsetX, y + dir.offsetY, z + dir.offsetZ, getBlockType)) ForgeDirection.VALID_DIRECTIONS.foreach(dir => world.notifyBlocksOfNeighborChange(xi + dir.offsetX, yi + dir.offsetY, zi + dir.offsetZ, getBlockType))
prevRedstoneValue = redstoneValue prevRedstoneValue = redstoneValue
} }
@ -36,8 +36,8 @@ class TileLaserReceiver extends TileBase with ILaserHandler
if (redstoneValue != prevRedstoneValue) if (redstoneValue != prevRedstoneValue)
{ {
world.notifyBlocksOfNeighborChange(x, y, z, getBlockType) world.notifyBlocksOfNeighborChange(xi, yi, zi, getBlockType)
ForgeDirection.VALID_DIRECTIONS.foreach(dir => world.notifyBlocksOfNeighborChange(x + dir.offsetX, y + dir.offsetY, z + dir.offsetZ, getBlockType)) ForgeDirection.VALID_DIRECTIONS.foreach(dir => world.notifyBlocksOfNeighborChange(xi + dir.offsetX, yi + dir.offsetY, zi + dir.offsetZ, getBlockType))
prevRedstoneValue = redstoneValue prevRedstoneValue = redstoneValue
} }
} }

View file

@ -21,12 +21,13 @@ import net.minecraftforge.common.util.ForgeDirection
import resonant.lib.content.prefab.java.TileElectric import resonant.lib.content.prefab.java.TileElectric
import resonant.lib.multiblock.reference.{IMultiBlockStructure, MultiBlockHandler} import resonant.lib.multiblock.reference.{IMultiBlockStructure, MultiBlockHandler}
import resonant.lib.network.discriminator.{PacketTile, PacketType} import resonant.lib.network.discriminator.{PacketTile, PacketType}
import resonant.lib.network.handle.IPacketReceiver import resonant.lib.network.handle.TPacketIDReceiver
import resonant.lib.render.EnumColor import resonant.lib.render.EnumColor
import resonant.lib.utility.{LanguageUtility, LinkUtility} import resonant.lib.utility.{LanguageUtility, LinkUtility}
import resonantinduction.core.util.ResonantUtil import resonantinduction.core.util.ResonantUtil
import resonantinduction.core.{ResonantInduction, Reference, Settings} import resonantinduction.core.{Reference, ResonantInduction, Settings}
import universalelectricity.core.transform.vector.{Vector3, VectorWorld} import universalelectricity.core.transform.vector.{Vector3, VectorWorld}
import scala.collection.JavaConversions._ import scala.collection.JavaConversions._
/** /**
@ -42,7 +43,7 @@ object TileTesla
final val DEFAULT_COLOR: Int = 12 final val DEFAULT_COLOR: Int = 12
} }
class TileTesla extends TileElectric(Material.iron) with IMultiBlockStructure[TileTesla] with ITesla with IPacketReceiver class TileTesla extends TileElectric(Material.iron) with IMultiBlockStructure[TileTesla] with ITesla with TPacketIDReceiver
{ {
final val TRANSFER_CAP: Double = 10000D final val TRANSFER_CAP: Double = 10000D
@ -92,7 +93,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 = new Vector3(topTesla) val topTeslaVector: Vector3 = asVector3
if (this.linked != null || this.isLinkedClient) if (this.linked != null || this.isLinkedClient)
{ {
if (!this.worldObj.isRemote) if (!this.worldObj.isRemote)
@ -122,8 +123,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 = new Vector3(topTesla).distance(new Vector3(o1.asInstanceOf[TileEntity])) val distance1: Double = asVector3.distance(new Vector3(o1.asInstanceOf[TileEntity]))
val distance2: Double = new Vector3(topTesla).distance(new Vector3(o2.asInstanceOf[TileEntity])) val distance2: Double = asVector3.distance(new Vector3(o2.asInstanceOf[TileEntity]))
if (distance1 < distance2) if (distance1 < distance2)
{ {
return 1 return 1
@ -139,7 +140,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(new Vector3(this)) < this.getRange && otherTesla != this) if (new Vector3(otherTesla.asInstanceOf[TileEntity]).distance(asVector3) < this.getRange && otherTesla != this)
{ {
if (otherTesla.isInstanceOf[TileTesla]) if (otherTesla.isInstanceOf[TileTesla])
{ {
@ -170,11 +171,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 = new Vector3((tesla.asInstanceOf[TileTesla]).getTopTelsa) targetVector = tesla.asInstanceOf[TileTesla].getTopTelsa.asVector3
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, new Vector3(topTesla).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.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)
this.transfer(tesla, Math.min(transferEnergy, TRANSFER_CAP)) this.transfer(tesla, Math.min(transferEnergy, TRANSFER_CAP))
if (!sentPacket && transferEnergy > 0) if (!sentPacket && transferEnergy > 0)
{ {
@ -219,9 +220,9 @@ class TileTesla extends TileElectric(Material.iron) with IMultiBlockStructure[Ti
return canReceive && tileEntity != getMultiBlock.get && !this.outputBlacklist.contains(tileEntity) return canReceive && tileEntity != getMultiBlock.get && !this.outputBlacklist.contains(tileEntity)
} }
def sendPacket(`type`: Int) def sendPacket(id: Int)
{ {
sendPacket(new PacketTile(this, this.getPacketData(`type`).toArray)) super.sendPacket(new PacketTile(xi, yi, zi, this.getPacketData(id).toArray))
} }
override def getDescPacket: PacketTile = override def getDescPacket: PacketTile =
@ -255,35 +256,28 @@ class TileTesla extends TileElectric(Material.iron) with IMultiBlockStructure[Ti
return data return data
} }
def read(data: ByteBuf, player: EntityPlayer, `type`: PacketType) override def read(data: ByteBuf, id: Int, player: EntityPlayer, `type`: PacketType) : Boolean =
{ {
try if (id == 1)
{ {
var id: Int = data.readByte this.dyeID = data.readInt
if (id == 1) this.canReceive = data.readBoolean
{ this.attackEntities = data.readBoolean
this.dyeID = data.readInt this.isLinkedClient = data.readBoolean
this.canReceive = data.readBoolean getMultiBlock.load(ByteBufUtils.readTag(data))
this.attackEntities = data.readBoolean return true
this.isLinkedClient = data.readBoolean }else
getMultiBlock.load(ByteBufUtils.readTag(data)) if (id == 2)
} {
if (id == 2) this.isTransfering = data.readBoolean
{ return true
this.isTransfering = data.readBoolean }else
} if (id == 3)
if (id == 3) {
{ this.doTransfer = true
this.doTransfer = true return true
}
} }
catch return false
{
case e: Exception =>
{
e.printStackTrace
}
}
} }
def teslaTransfer(e: Double, doTransfer: Boolean): Double = def teslaTransfer(e: Double, doTransfer: Boolean): Double =
@ -322,8 +316,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 = new Vector3(this).add(new Vector3(0, 1, 0)).getTileEntity(this.worldObj).isInstanceOf[TileTesla] val isTop: Boolean = asVector3.add(new Vector3(0, 1, 0)).getTileEntity(this.worldObj).isInstanceOf[TileTesla]
val isBottom: Boolean = new Vector3(this).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]
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)
@ -350,7 +344,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 = new Vector3(this) val checkPosition: Vector3 = asVector3
var returnTile: TileTesla = this var returnTile: TileTesla = this
var exit = false var exit = false
while (exit) while (exit)
@ -386,7 +380,7 @@ class TileTesla extends TileElectric(Material.iron) with IMultiBlockStructure[Ti
var exit = false var exit = false
while (!exit) while (!exit)
{ {
val t: TileEntity = new Vector3(this).add(new Vector3(0, y, 0)).getTileEntity(this.worldObj) val t: TileEntity = asVector3.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])
@ -484,7 +478,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(new Vector3(this), this.worldObj.provider.dimensionId, false) (tileEntity.asInstanceOf[TileTesla]).setLink(asVector3, this.worldObj.provider.dimensionId, false)
} }
} }
} }
@ -510,7 +504,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 = new Vector3(this) val checkPosition: Vector3 = asVector3
var exit = false var exit = false
while (!exit) while (!exit)
{ {
@ -531,7 +525,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 = new Vector3(this) val checkPosition: Vector3 = asVector3
var exit = false var exit = false
while (!exit) while (!exit)
{ {
@ -556,7 +550,7 @@ class TileTesla extends TileElectric(Material.iron) with IMultiBlockStructure[Ti
def getPosition: Vector3 = def getPosition: Vector3 =
{ {
return new Vector3(this) return asVector3
} }
def getMultiBlock: MultiBlockHandler[TileTesla] = def getMultiBlock: MultiBlockHandler[TileTesla] =
@ -639,7 +633,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, new VectorWorld(this)) LinkUtility.setLink(itemStack, asVectorWorld)
} }
return true return true
} }

View file

@ -7,7 +7,6 @@ import net.minecraftforge.fluids.{Fluid, FluidStack, FluidTankInfo, IFluidHandle
import resonant.api.IRotatable import resonant.api.IRotatable
import resonantinduction.mechanical.mech.TileMechanical import resonantinduction.mechanical.mech.TileMechanical
import universalelectricity.api.core.grid.INode import universalelectricity.api.core.grid.INode
import universalelectricity.core.transform.vector.Vector3
class TilePump extends TileMechanical(Material.iron) with IRotatable with IFluidHandler class TilePump extends TileMechanical(Material.iron) with IRotatable with IFluidHandler
{ {
@ -38,7 +37,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 = new Vector3(this).add(getDirection.getOpposite).getTileEntity(this.worldObj) val tileIn: TileEntity = asVector3.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)
@ -54,7 +53,7 @@ class TilePump extends TileMechanical(Material.iron) with IRotatable with IFluid
{ {
if (from eq getDirection.getOpposite) if (from eq getDirection.getOpposite)
{ {
val tileOut: TileEntity = new Vector3(this).add(from.getOpposite).getTileEntity(this.worldObj) val tileOut: TileEntity = asVector3.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

@ -84,7 +84,7 @@ class TileDetector extends TileFilterable with IPacketIDReceiver
this.worldObj.notifyBlocksOfNeighborChange(x, this.yCoord + 1, z, MechanicalContent.blockDetector) this.worldObj.notifyBlocksOfNeighborChange(x, this.yCoord + 1, z, MechanicalContent.blockDetector)
} }
} }
ResonantEngine.instance.packetHandler.sendToAllAround(new PacketTile(x, y, z, Array[Any](0, this.isInverted)), this) ResonantEngine.instance.packetHandler.sendToAllAround(new PacketTile(xi, yi, zi, Array[Any](0, this.isInverted)), this)
} }
} }
} }
@ -110,7 +110,7 @@ class TileDetector extends TileFilterable with IPacketIDReceiver
override def getDescriptionPacket: Packet = override def getDescriptionPacket: Packet =
{ {
return ResonantEngine.instance.packetHandler.toMCPacket(new PacketTile(x, y, z, Array[Any](0, this.isInverted))) return ResonantEngine.instance.packetHandler.toMCPacket(new PacketTile(xi, yi, zi, Array[Any](0, this.isInverted)))
} }
override def read(data: ByteBuf, id: Int, player: EntityPlayer, `type`: PacketType): Boolean = override def read(data: ByteBuf, id: Int, player: EntityPlayer, `type`: PacketType): Boolean =
@ -140,7 +140,7 @@ class TileDetector extends TileFilterable with IPacketIDReceiver
{ {
var isInverted: Boolean = false var isInverted: Boolean = false
var isFront: Boolean = false var isFront: Boolean = false
val tileEntity: TileEntity = iBlockAccess.getTileEntity(x, y, z) val tileEntity: TileEntity = iBlockAccess.getTileEntity(xi, yi, zi)
if (tileEntity.isInstanceOf[TileDetector]) if (tileEntity.isInstanceOf[TileDetector])
{ {
isFront = side == (tileEntity.asInstanceOf[TileDetector]).getDirection.ordinal isFront = side == (tileEntity.asInstanceOf[TileDetector]).getDirection.ordinal

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 = position.add(dir) val check: Vector3 = asVector3.add(dir)
val put: VectorWorld = position.add(dir.getOpposite).asInstanceOf[VectorWorld] val put: VectorWorld = asVector3.add(dir.getOpposite).asInstanceOf[VectorWorld]
val block: Block = check.getBlock(world) val block: Block = check.getBlock(world)
if (block != null) if (block != null)
{ {
@ -123,7 +123,7 @@ class TileBreaker extends TileAdvanced(Material.iron) with IRotatable with IPack
@SideOnly(Side.CLIENT) override def getIcon(access: IBlockAccess, side: Int): IIcon = @SideOnly(Side.CLIENT) override def getIcon(access: IBlockAccess, side: Int): IIcon =
{ {
val meta: Int = access.getBlockMetadata(x, y, z) val meta: Int = access.getBlockMetadata(xi, yi, zi)
if (side == meta) if (side == meta)
{ {
return TileBreaker.iconFront return TileBreaker.iconFront

View file

@ -2,9 +2,7 @@ package resonantinduction.mechanical.machine.edit
import java.util.EnumSet import java.util.EnumSet
import cpw.mods.fml.common.network.ByteBufUtils
import cpw.mods.fml.relauncher.{Side, SideOnly} import cpw.mods.fml.relauncher.{Side, SideOnly}
import io.netty.buffer.ByteBuf
import net.minecraft.block.Block import net.minecraft.block.Block
import net.minecraft.block.material.Material import net.minecraft.block.material.Material
import net.minecraft.client.renderer.texture.IIconRegister import net.minecraft.client.renderer.texture.IIconRegister
@ -17,8 +15,8 @@ import net.minecraftforge.common.util.ForgeDirection
import org.lwjgl.opengl.GL11 import org.lwjgl.opengl.GL11
import resonant.api.IRotatable import resonant.api.IRotatable
import resonant.lib.content.prefab.java.TileInventory import resonant.lib.content.prefab.java.TileInventory
import resonant.lib.network.discriminator.{PacketTile, PacketType} import resonant.lib.network.discriminator.PacketTile
import resonant.lib.network.handle.IPacketReceiver import resonant.lib.network.handle.TPacketReceiver
import resonant.lib.render.RenderItemOverlayUtility import resonant.lib.render.RenderItemOverlayUtility
import resonant.lib.utility.LanguageUtility import resonant.lib.utility.LanguageUtility
import resonant.lib.utility.inventory.{InternalInventoryHandler, InventoryUtility} import resonant.lib.utility.inventory.{InternalInventoryHandler, InventoryUtility}
@ -34,7 +32,7 @@ object TilePlacer
@SideOnly(Side.CLIENT) private var iconBack: IIcon = null @SideOnly(Side.CLIENT) private var iconBack: IIcon = null
} }
class TilePlacer extends TileInventory(Material.rock) with IRotatable with IPacketReceiver class TilePlacer extends TileInventory(Material.rock) with IRotatable with TPacketReceiver
{ {
private var _doWork: Boolean = false private var _doWork: Boolean = false
private var autoPullItems: Boolean = false private var autoPullItems: Boolean = false
@ -109,7 +107,7 @@ class TilePlacer extends TileInventory(Material.rock) with IRotatable with IPack
def doWork def doWork
{ {
val side: Int = 0 val side: Int = 0
val placePos: Vector3 = position.add(getDirection) val placePos: Vector3 = asVector3.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))
{ {
@ -151,21 +149,6 @@ class TilePlacer extends TileInventory(Material.rock) with IRotatable with IPack
sendPacket(getDescPacket) sendPacket(getDescPacket)
} }
def read(data: ByteBuf, player: EntityPlayer, `type`: PacketType)
{
try
{
readFromNBT(ByteBufUtils.readTag(data))
}
catch
{
case e: Exception =>
{
e.printStackTrace
}
}
}
override def readFromNBT(nbt: NBTTagCompound) override def readFromNBT(nbt: NBTTagCompound)
{ {
super.readFromNBT(nbt) super.readFromNBT(nbt)
@ -188,7 +171,7 @@ class TilePlacer extends TileInventory(Material.rock) with IRotatable with IPack
@SideOnly(Side.CLIENT) override def getIcon(access: IBlockAccess, side: Int): IIcon = @SideOnly(Side.CLIENT) override def getIcon(access: IBlockAccess, side: Int): IIcon =
{ {
val meta: Int = access.getBlockMetadata(x, y, z) val meta: Int = access.getBlockMetadata(xi, yi, zi)
if (side == meta) if (side == meta)
{ {
return TilePlacer.iconFront return TilePlacer.iconFront

View file

@ -93,13 +93,13 @@ abstract class TileMechanical(material: Material) extends TileNode(material) wit
{ {
val tag: NBTTagCompound = new NBTTagCompound val tag: NBTTagCompound = new NBTTagCompound
writeToNBT(tag) writeToNBT(tag)
return ResonantEngine.instance.packetHandler.toMCPacket(new PacketTile(x, y, z, Array(nbt_packet_id, tag))) return ResonantEngine.instance.packetHandler.toMCPacket(new PacketTile(xi, yi, zi, Array(nbt_packet_id, tag)))
} }
/** Sends the torque and angular velocity to the client */ /** Sends the torque and angular velocity to the client */
private def sendRotationPacket private def sendRotationPacket
{ {
ResonantEngine.instance.packetHandler.sendToAllAround(new PacketTile(x, y , z, Array(vel_packet_id, mechanicalNode.angularVelocity, mechanicalNode.torque)), this) ResonantEngine.instance.packetHandler.sendToAllAround(new PacketTile(xi, yi , zi, Array(vel_packet_id, mechanicalNode.angularVelocity, mechanicalNode.torque)), this)
} }
override def read(data: ByteBuf, id: Int, player: EntityPlayer, `type`: PacketType): Boolean = override def read(data: ByteBuf, id: Int, player: EntityPlayer, `type`: PacketType): Boolean =

View file

@ -46,7 +46,7 @@ import cpw.mods.fml.relauncher.SideOnly
if (tile.getWorldObj != null) if (tile.getWorldObj != null)
{ {
val dir: ForgeDirection = tile.getDirection val dir: ForgeDirection = tile.getDirection
if (tile.world.isAirBlock(tile.x + dir.offsetX, tile.y + dir.offsetY, tile.z + dir.offsetZ)) if (tile.world.isAirBlock(tile.xi + dir.offsetX, tile.yi + dir.offsetY, tile.zi + dir.offsetZ))
{ {
GL11.glTranslated(0, 0, (0.4 * Math.sin(angle)) - 0.5) GL11.glTranslated(0, 0, (0.4 * Math.sin(angle)) - 0.5)
} }

View file

@ -50,7 +50,7 @@ class TileMechanicalPiston extends TileMechanical(Material.piston)
super.update super.update
if (markRevolve) if (markRevolve)
{ {
val movePosition: Vector3 = new Vector3(TileMechanicalPiston.this).add(getDirection) val movePosition: Vector3 = asVector3.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 && new Vector3(this).add(0.5).distance(new Vector3(grindingItem)) < 1) if (TileGrindingWheel.TIMER_GRIND_ITEM.containsKey(grindingItem) && !grindingItem.isDead && asVector3.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

@ -70,7 +70,7 @@ class TileMixer extends TileMechanical(Material.iron)
{ {
if (x != 0 && z != 0) if (x != 0 && z != 0)
{ {
val block: Block = position.add(x, 0, z).getBlock(world) val block: Block = asVector3.add(x, 0, z).getBlock(world)
if (block != null && !(block.isInstanceOf[IFluidBlock])) if (block != null && !(block.isInstanceOf[IFluidBlock]))
{ {
return true return true
@ -101,9 +101,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(new Vector3(this).add(0.5)) val relativePosition: Vector3 = originalPosition.clone.subtract(asVector3.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 = new Vector3(this).add(0.5).add(relativePosition) val newPosition: Vector3 = asVector3.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
@ -122,7 +122,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 && new Vector3(this).add(0.5).distance(new Vector3(processingItem)) < 2) if (!processingItem.isDead && asVector3.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 new Vector3(this) return asVector3
} }
def getMultiBlock: TurbineMBlockHandler = def getMultiBlock: TurbineMBlockHandler =

View file

@ -91,7 +91,7 @@ class TileWaterTurbine extends TileTurbine
{ {
if (dir != currentDir && dir != currentDir.getOpposite) if (dir != currentDir && dir != currentDir.getOpposite)
{ {
val check: Vector3 = new Vector3(this).add(dir) val check: Vector3 = asVector3.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)