diff --git a/src/main/scala/resonantinduction/atomic/machine/accelerator/EntityParticle.scala b/src/main/scala/resonantinduction/atomic/machine/accelerator/EntityParticle.scala index ade4a4186..a010b682b 100644 --- a/src/main/scala/resonantinduction/atomic/machine/accelerator/EntityParticle.scala +++ b/src/main/scala/resonantinduction/atomic/machine/accelerator/EntityParticle.scala @@ -24,6 +24,11 @@ import scala.collection.JavaConversions._ */ object EntityParticle { + /** + * User client side to determine the velocity of the particle. + */ + val clientParticleVelocity: Float = 0.9f + def canSpawnParticle(world: World, pos: Vector3): Boolean = { val block: Block = pos.getBlock(world) @@ -100,7 +105,7 @@ class EntityParticle(par1World: World) extends Entity(par1World) with IEntityAdd { if (this.ticksExisted % 10 == 0) { - this.worldObj.playSoundAtEntity(this, Reference.prefix + "accelerator", 1f, (0.6f + (0.4 * (this.getParticleVelocity / TileAccelerator.clientParticleVelocity))).asInstanceOf[Float]) + this.worldObj.playSoundAtEntity(this, Reference.prefix + "accelerator", 1f, (0.6f + (0.4 * (this.getParticleVelocity / EntityParticle.clientParticleVelocity))).asInstanceOf[Float]) } val t: TileEntity = this.worldObj.getTileEntity(this.movementVector.xi, this.movementVector.yi, this.movementVector.zi) if (!(t.isInstanceOf[TileAccelerator])) @@ -157,9 +162,9 @@ class EntityParticle(par1World: World) extends Entity(par1World) with IEntityAdd val dongLi: Vector3 = new Vector3 dongLi.add(this.movementDirection) dongLi.multiply(acceleration) - this.motionX = Math.min(dongLi.x + this.motionX, TileAccelerator.clientParticleVelocity) - this.motionY = Math.min(dongLi.y + this.motionY, TileAccelerator.clientParticleVelocity) - this.motionZ = Math.min(dongLi.z + this.motionZ, TileAccelerator.clientParticleVelocity) + this.motionX = Math.min(dongLi.x + this.motionX, EntityParticle.clientParticleVelocity) + this.motionY = Math.min(dongLi.y + this.motionY, EntityParticle.clientParticleVelocity) + this.motionZ = Math.min(dongLi.z + this.motionZ, EntityParticle.clientParticleVelocity) this.isAirBorne = true this.lastTickPosX = this.posX this.lastTickPosY = this.posY @@ -218,7 +223,7 @@ class EntityParticle(par1World: World) extends Entity(par1World) with IEntityAdd this.worldObj.playSoundAtEntity(this, Reference.prefix + "antimatter", 1.5f, 1f - this.worldObj.rand.nextFloat * 0.3f) if (!this.worldObj.isRemote) { - if (this.getParticleVelocity > TileAccelerator.clientParticleVelocity / 2) + if (this.getParticleVelocity > EntityParticle.clientParticleVelocity / 2) { val radius: Float = 1f val bounds: AxisAlignedBB = AxisAlignedBB.getBoundingBox(this.posX - radius, this.posY - radius, this.posZ - radius, this.posX + radius, this.posY + radius, this.posZ + radius) diff --git a/src/main/scala/resonantinduction/atomic/machine/accelerator/GuiAccelerator.scala b/src/main/scala/resonantinduction/atomic/machine/accelerator/GuiAccelerator.scala index 9d911dd13..e0e6e3e0c 100644 --- a/src/main/scala/resonantinduction/atomic/machine/accelerator/GuiAccelerator.scala +++ b/src/main/scala/resonantinduction/atomic/machine/accelerator/GuiAccelerator.scala @@ -2,6 +2,7 @@ package resonantinduction.atomic.machine.accelerator import net.minecraft.entity.player.EntityPlayer import resonant.lib.gui.GuiContainerBase +import resonantinduction.core.Settings import universalelectricity.api.UnitDisplay import universalelectricity.core.transform.vector.Vector3 @@ -29,10 +30,10 @@ class GuiAccelerator(player: EntityPlayer, tileEntity: TileAccelerator) extends { status = "\u00a72Idle" } - this.fontRendererObj.drawString("Velocity: " + Math.round((this.tileEntity.velocity / TileAccelerator.clientParticleVelocity) * 100) + "%", 8, 27, 4210752) + this.fontRendererObj.drawString("Velocity: " + Math.round((this.tileEntity.velocity / EntityParticle.clientParticleVelocity) * 100) + "%", 8, 27, 4210752) this.fontRendererObj.drawString("Energy Used:", 8, 38, 4210752) this.fontRendererObj.drawString(new UnitDisplay(UnitDisplay.Unit.JOULES, this.tileEntity.totalEnergyConsumed).toString, 8, 49, 4210752) - this.fontRendererObj.drawString(new UnitDisplay(UnitDisplay.Unit.WATT, TileAccelerator.energyPerTick * 20).toString, 8, 60, 4210752) + this.fontRendererObj.drawString(new UnitDisplay(UnitDisplay.Unit.WATT, Settings.ACCELERATOR_ENERGY_COST_PER_TICK * 20).toString, 8, 60, 4210752) this.fontRendererObj.drawString("N?A", 8, 70, 4210752) this.fontRendererObj.drawString("Antimatter: " + this.tileEntity.antimatter + " mg", 8, 80, 4210752) this.fontRendererObj.drawString("Status:", 8, 90, 4210752) diff --git a/src/main/scala/resonantinduction/atomic/machine/accelerator/TileAccelerator.scala b/src/main/scala/resonantinduction/atomic/machine/accelerator/TileAccelerator.scala index b7e5643f9..c9bac2af1 100644 --- a/src/main/scala/resonantinduction/atomic/machine/accelerator/TileAccelerator.scala +++ b/src/main/scala/resonantinduction/atomic/machine/accelerator/TileAccelerator.scala @@ -19,10 +19,6 @@ import resonantinduction.core.{Reference, Settings} import universalelectricity.core.transform.vector.Vector3 class TileAccelerator extends TileElectricInventory(Material.iron) with IElectromagnet with IRotatable { - /** - * User client side to determine the velocity of the particle. - */ - val clientParticleVelocity: Float = 0.9f /** * Multiplier that is used to give extra anti-matter based on density (hardness) of a given ore. */ @@ -118,7 +114,7 @@ class TileAccelerator extends TileElectricInventory(Material.iron) with IElectro } entityParticle = null } - else if (velocity > clientParticleVelocity) + else if (velocity > EntityParticle.clientParticleVelocity) { worldObj.playSoundEffect(xCoord, yCoord, zCoord, Reference.prefix + "antimatter", 2f, 1f - worldObj.rand.nextFloat * 0.3f) val generatedAntimatter: Int = 5 + worldObj.rand.nextInt(antiMatterDensityMultiplyer) @@ -129,7 +125,7 @@ class TileAccelerator extends TileElectricInventory(Material.iron) with IElectro } if (entityParticle != null) { - worldObj.playSoundEffect(xCoord, yCoord, zCoord, Reference.prefix + "accelerator", 1.5f, (0.6f + (0.4 * (entityParticle.getParticleVelocity) / clientParticleVelocity)).asInstanceOf[Float]) + worldObj.playSoundEffect(xCoord, yCoord, zCoord, Reference.prefix + "accelerator", 1.5f, (0.6f + (0.4 * (entityParticle.getParticleVelocity) / EntityParticle.clientParticleVelocity)).asInstanceOf[Float]) } } energy.extractEnergy @@ -158,7 +154,7 @@ class TileAccelerator extends TileElectricInventory(Material.iron) with IElectro } } - override def use(player: EntityPlayer, side: Int, hit: Vector3): Boolean = + override def activate(player: EntityPlayer, side: Int, hit: Vector3): Boolean = { if (!world.isRemote) {