Aidan, go merge again :)
This commit is contained in:
parent
23393d83be
commit
fcbd4cad43
3 changed files with 13 additions and 5 deletions
|
@ -36,4 +36,8 @@ public class CommonProxy implements IGuiHandler
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void renderElectricShock(World world, Vector3 start, Vector3 target)
|
||||||
|
{
|
||||||
|
renderElectricShock(world, start, target, 0.55f, 0.7f, 1f);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -4,6 +4,7 @@
|
||||||
package resonantinduction.fx;
|
package resonantinduction.fx;
|
||||||
|
|
||||||
import java.util.HashSet;
|
import java.util.HashSet;
|
||||||
|
import java.util.Random;
|
||||||
import java.util.Set;
|
import java.util.Set;
|
||||||
|
|
||||||
import net.minecraft.client.Minecraft;
|
import net.minecraft.client.Minecraft;
|
||||||
|
@ -40,6 +41,8 @@ public class FXElectricBolt extends EntityFX
|
||||||
private double boltLength;
|
private double boltLength;
|
||||||
private int segmentCount;
|
private int segmentCount;
|
||||||
|
|
||||||
|
private Random random;
|
||||||
|
|
||||||
private Set<BoltSegment> segments = new HashSet<BoltSegment>();
|
private Set<BoltSegment> segments = new HashSet<BoltSegment>();
|
||||||
|
|
||||||
public FXElectricBolt(World world, Vector3 start, Vector3 target)
|
public FXElectricBolt(World world, Vector3 start, Vector3 target)
|
||||||
|
@ -47,9 +50,9 @@ public class FXElectricBolt extends EntityFX
|
||||||
super(world, start.x, start.y, start.z);
|
super(world, start.x, start.y, start.z);
|
||||||
this.start = new BoltPoint(target);
|
this.start = new BoltPoint(target);
|
||||||
this.target = new BoltPoint(target);
|
this.target = new BoltPoint(target);
|
||||||
|
this.particleAge = (3 + this.rand.nextInt(3) - 1);
|
||||||
|
this.random = new Random();
|
||||||
this.boltLength = start.distance(target);
|
this.boltLength = start.distance(target);
|
||||||
|
|
||||||
this.setUp();
|
this.setUp();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -85,7 +88,7 @@ public class FXElectricBolt extends EntityFX
|
||||||
|
|
||||||
for (int i = 1; i < splitAmount; i++)
|
for (int i = 1; i < splitAmount; i++)
|
||||||
{
|
{
|
||||||
Vector3 newOffset = segment.getDifference().getPerpendicular();
|
Vector3 newOffset = segment.getDifference().getPerpendicular().rotate(random.nextFloat() * 360, segment.getDifference()).scale((this.random.nextFloat() / 2) * offset);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -119,7 +122,7 @@ public class FXElectricBolt extends EntityFX
|
||||||
GL11.glEnable(3042);
|
GL11.glEnable(3042);
|
||||||
|
|
||||||
Vector3 playerVector = new Vector3(sinYaw * -cosPitch, -cosSinPitch / cosYaw, cosYaw * cosPitch);
|
Vector3 playerVector = new Vector3(sinYaw * -cosPitch, -cosSinPitch / cosYaw, cosYaw * cosPitch);
|
||||||
int renderLength = (int) (this.particleAge + partialFrame + this.boltLength * 3) / (int) (this.boltLength * 3) * this.segmentCount;
|
int renderLength = (int) ((this.particleAge + partialFrame + this.boltLength * 3) / (this.boltLength * 3 * this.segmentCount));
|
||||||
|
|
||||||
for (BoltSegment segment : this.segments)
|
for (BoltSegment segment : this.segments)
|
||||||
{
|
{
|
||||||
|
|
|
@ -40,7 +40,7 @@ public class TileEntityTesla extends TileEntityBase implements ITesla
|
||||||
|
|
||||||
for (ITesla tesla : TeslaGrid.instance().get())
|
for (ITesla tesla : TeslaGrid.instance().get())
|
||||||
{
|
{
|
||||||
if (new Vector3((TileEntity) tesla).distance(new Vector3(this)) < this.getRange())
|
if (tesla != this && new Vector3((TileEntity) tesla).distance(new Vector3(this)) < this.getRange())
|
||||||
{
|
{
|
||||||
transferTeslaCoils.add(tesla);
|
transferTeslaCoils.add(tesla);
|
||||||
}
|
}
|
||||||
|
@ -53,6 +53,7 @@ public class TileEntityTesla extends TileEntityBase implements ITesla
|
||||||
for (ITesla tesla : transferTeslaCoils)
|
for (ITesla tesla : transferTeslaCoils)
|
||||||
{
|
{
|
||||||
tesla.transfer(transferEnergy * (1 - (this.worldObj.rand.nextFloat() * 0.1f)));
|
tesla.transfer(transferEnergy * (1 - (this.worldObj.rand.nextFloat() * 0.1f)));
|
||||||
|
ResonantInduction.proxy.renderElectricShock(this.worldObj, new Vector3(this), new Vector3((TileEntity) tesla));
|
||||||
this.transfer(-transferEnergy);
|
this.transfer(-transferEnergy);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue