Skip to content
Permalink
Browse files

Arcs now prioritize the closest target, whether it be ground or entity.

  • Loading branch information...
Ri5ux Ri5ux
Ri5ux authored and Ri5ux committed Jul 15, 2019
1 parent 9973423 commit 4a1c077f5e021d422964055aadcaef989c57301b
Showing with 8 additions and 4 deletions.
  1. +8 −4 src/main/java/org/avp/tile/TileEntityPowerline.java
@@ -80,18 +80,22 @@ public void update()
double z = this.pos.getZ() + 0.5;
Pos t = getNextGroundingPoint(new Pos(x, y + 1, z), this.world);
Entity target = Entities.getRandomEntityInCoordsRange(world, EntityLivingBase.class, new Pos(this), (int) Math.floor(maxArcDist));
double dist = y - t.y;
double distG = y - t.y;
double distE = 1000;
double dist = distG;
double arcWidth = MDXMath.map((double) this.voltage, 600D, 10000D, 0.05D, 0.5D);
float damageMult = (float) (arcWidth * 100F);

if (target != null)
{
t = new Pos(target.getPosition()).add(target.width / 2, 0, target.width / 2);
Pos p = new Pos(target.getPosition()).add(target.width / 2, 0, target.width / 2);
m = 8F;
dist = target.getDistance(x, y, z);
distE = target.getDistance(x, y, z);

if (dist <= maxArcDist)
if (distE <= distG && distE <= maxArcDist)
{
t = p;
dist = distE;
target.attackEntityFrom(DamageSources.electricity, damageMult);
target.setFire(3);
}

0 comments on commit 4a1c077

Please sign in to comment.
You can’t perform that action at this time.