Push golem block shot as per request
This commit is contained in:
parent
ba41118da7
commit
102fcd8e73
@ -354,7 +354,7 @@ public class UtilAlg
|
|||||||
return bestLoc;
|
return bestLoc;
|
||||||
}
|
}
|
||||||
|
|
||||||
public static Vector calculateVelocity(Vector from, Vector to, int heightGain)
|
public static Vector calculateVelocity(Vector from, Vector to, double heightGain)
|
||||||
{
|
{
|
||||||
// Gravity of a potion
|
// Gravity of a potion
|
||||||
double gravity = 0.115;
|
double gravity = 0.115;
|
||||||
@ -366,8 +366,7 @@ public class UtilAlg
|
|||||||
|
|
||||||
double horizDist = Math.sqrt(dx1 * dx1 + dz1 * dz1);
|
double horizDist = Math.sqrt(dx1 * dx1 + dz1 * dz1);
|
||||||
// Height gain
|
// Height gain
|
||||||
int gain = heightGain;
|
double maxGain = heightGain > (endGain + heightGain) ? heightGain : (endGain + heightGain);
|
||||||
double maxGain = gain > (endGain + gain) ? gain : (endGain + gain);
|
|
||||||
// Solve quadratic equation for velocity
|
// Solve quadratic equation for velocity
|
||||||
double a = -horizDist * horizDist / (4 * maxGain);
|
double a = -horizDist * horizDist / (4 * maxGain);
|
||||||
double b = horizDist;
|
double b = horizDist;
|
||||||
|
@ -173,8 +173,8 @@ public class GolemBlockShot extends GolemAbility
|
|||||||
|
|
||||||
net.minecraft.server.v1_7_R4.Entity nmsEntity = ((CraftEntity) cur).getHandle();
|
net.minecraft.server.v1_7_R4.Entity nmsEntity = ((CraftEntity) cur).getHandle();
|
||||||
Vec3D vec3d = Vec3D.a(nmsEntity.locX, nmsEntity.locY, nmsEntity.locZ);
|
Vec3D vec3d = Vec3D.a(nmsEntity.locX, nmsEntity.locY, nmsEntity.locZ);
|
||||||
Vec3D vec3d1 = Vec3D.a(nmsEntity.locX + nmsEntity.motX, nmsEntity.locY + nmsEntity.motY, nmsEntity.locZ
|
Vec3D vec3d1 = Vec3D.a(nmsEntity.locX + nmsEntity.motX, nmsEntity.locY + nmsEntity.motY,
|
||||||
+ nmsEntity.motZ);
|
nmsEntity.locZ + nmsEntity.motZ);
|
||||||
|
|
||||||
MovingObjectPosition finalObjectPosition = nmsEntity.world.rayTrace(vec3d, vec3d1, false, true, false);
|
MovingObjectPosition finalObjectPosition = nmsEntity.world.rayTrace(vec3d, vec3d1, false, true, false);
|
||||||
vec3d = Vec3D.a(nmsEntity.locX, nmsEntity.locY, nmsEntity.locZ);
|
vec3d = Vec3D.a(nmsEntity.locX, nmsEntity.locY, nmsEntity.locZ);
|
||||||
@ -185,8 +185,7 @@ public class GolemBlockShot extends GolemAbility
|
|||||||
vec3d1 = Vec3D.a(finalObjectPosition.pos.a, finalObjectPosition.pos.b, finalObjectPosition.pos.c);
|
vec3d1 = Vec3D.a(finalObjectPosition.pos.a, finalObjectPosition.pos.b, finalObjectPosition.pos.c);
|
||||||
}
|
}
|
||||||
|
|
||||||
for (Object entity : ((CraftWorld) cur.getWorld()).getHandle().getEntities(
|
for (Object entity : ((CraftWorld) cur.getWorld()).getHandle().getEntities(((CraftEntity) cur).getHandle(),
|
||||||
((CraftEntity) cur).getHandle(),
|
|
||||||
((CraftEntity) cur).getHandle().boundingBox.a(((CraftEntity) cur).getHandle().motX,
|
((CraftEntity) cur).getHandle().boundingBox.a(((CraftEntity) cur).getHandle().motX,
|
||||||
((CraftEntity) cur).getHandle().motY, ((CraftEntity) cur).getHandle().motZ).grow(2, 2, 2)))
|
((CraftEntity) cur).getHandle().motY, ((CraftEntity) cur).getHandle().motZ).grow(2, 2, 2)))
|
||||||
{
|
{
|
||||||
@ -225,11 +224,9 @@ public class GolemBlockShot extends GolemAbility
|
|||||||
{
|
{
|
||||||
cur.getWorld().playEffect(victim.getEyeLocation().subtract(0, 0.5, 0), Effect.STEP_SOUND, cur.getBlockId());
|
cur.getWorld().playEffect(victim.getEyeLocation().subtract(0, 0.5, 0), Effect.STEP_SOUND, cur.getBlockId());
|
||||||
|
|
||||||
getGolem()
|
getGolem().getEvent().getDamageManager().NewDamageEvent((LivingEntity) victim, getEntity(), null,
|
||||||
.getEvent()
|
DamageCause.CONTACT, 6 * getGolem().getDifficulty(), true, true, false, "Iron Wizard Block Shot",
|
||||||
.getDamageManager()
|
"Iron Wizard Block Shot");
|
||||||
.NewDamageEvent((LivingEntity) victim, getEntity(), null, DamageCause.CONTACT, 6, true, true, false,
|
|
||||||
"Iron Wizard Block Shot", "Iron Wizard Block Shot");
|
|
||||||
|
|
||||||
cur.remove();
|
cur.remove();
|
||||||
fallingIterator.remove();
|
fallingIterator.remove();
|
||||||
@ -255,8 +252,8 @@ public class GolemBlockShot extends GolemAbility
|
|||||||
nmsEntity.motX = ((float) (finalObjectPosition.pos.a - nmsEntity.locX));
|
nmsEntity.motX = ((float) (finalObjectPosition.pos.a - nmsEntity.locX));
|
||||||
nmsEntity.motY = ((float) (finalObjectPosition.pos.b - nmsEntity.locY));
|
nmsEntity.motY = ((float) (finalObjectPosition.pos.b - nmsEntity.locY));
|
||||||
nmsEntity.motZ = ((float) (finalObjectPosition.pos.c - nmsEntity.locZ));
|
nmsEntity.motZ = ((float) (finalObjectPosition.pos.c - nmsEntity.locZ));
|
||||||
float f2 = MathHelper.sqrt(nmsEntity.motX * nmsEntity.motX + nmsEntity.motY * nmsEntity.motY + nmsEntity.motZ
|
float f2 = MathHelper.sqrt(
|
||||||
* nmsEntity.motZ);
|
nmsEntity.motX * nmsEntity.motX + nmsEntity.motY * nmsEntity.motY + nmsEntity.motZ * nmsEntity.motZ);
|
||||||
nmsEntity.locX -= nmsEntity.motX / f2 * 0.0500000007450581D;
|
nmsEntity.locX -= nmsEntity.motX / f2 * 0.0500000007450581D;
|
||||||
nmsEntity.locY -= nmsEntity.motY / f2 * 0.0500000007450581D;
|
nmsEntity.locY -= nmsEntity.motY / f2 * 0.0500000007450581D;
|
||||||
nmsEntity.locZ -= nmsEntity.motZ / f2 * 0.0500000007450581D;
|
nmsEntity.locZ -= nmsEntity.motZ / f2 * 0.0500000007450581D;
|
||||||
@ -268,8 +265,9 @@ public class GolemBlockShot extends GolemAbility
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
UtilParticle.PlayParticle(ParticleType.BLOCK_DUST.getParticle(Material.STONE, 0), cur.getLocation()
|
UtilParticle.PlayParticle(ParticleType.BLOCK_DUST.getParticle(Material.STONE, 0),
|
||||||
.add(0, 0.5, 0), 0.3F, 0.3F, 0.3F, 0, 2, UtilParticle.ViewDist.NORMAL, UtilServer.getPlayers());
|
cur.getLocation().add(0, 0.5, 0), 0.3F, 0.3F, 0.3F, 0, 2, UtilParticle.ViewDist.NORMAL,
|
||||||
|
UtilServer.getPlayers());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -361,8 +359,8 @@ public class GolemBlockShot extends GolemAbility
|
|||||||
UtilPlayer.sendPacket(player, packet, packet2);
|
UtilPlayer.sendPacket(player, packet, packet2);
|
||||||
}
|
}
|
||||||
|
|
||||||
_shotAt.put(_target.getUniqueId(), (_shotAt.containsKey(_target.getUniqueId()) ? _shotAt.get(_target.getUniqueId())
|
_shotAt.put(_target.getUniqueId(),
|
||||||
: 0) + 1);
|
(_shotAt.containsKey(_target.getUniqueId()) ? _shotAt.get(_target.getUniqueId()) : 0) + 1);
|
||||||
|
|
||||||
_target = getTarget();
|
_target = getTarget();
|
||||||
}
|
}
|
||||||
@ -382,7 +380,7 @@ public class GolemBlockShot extends GolemAbility
|
|||||||
|
|
||||||
PacketPlayOutEntityDestroy packet = new PacketPlayOutEntityDestroy(new int[]
|
PacketPlayOutEntityDestroy packet = new PacketPlayOutEntityDestroy(new int[]
|
||||||
{
|
{
|
||||||
id
|
id
|
||||||
});
|
});
|
||||||
|
|
||||||
for (Player player : Bukkit.getOnlinePlayers())
|
for (Player player : Bukkit.getOnlinePlayers())
|
||||||
@ -416,16 +414,18 @@ public class GolemBlockShot extends GolemAbility
|
|||||||
loc1.setY(l.getY() + 1);
|
loc1.setY(l.getY() + 1);
|
||||||
}
|
}
|
||||||
|
|
||||||
Vector vector = UtilAlg.getTrajectory(l, loc1);
|
int dist = (int) Math.ceil(loc1.toVector().setY(0).distance(l.toVector().setY(0)));
|
||||||
|
|
||||||
vector.multiply(13).add(new Vector(UtilMath.r(3) - 1, 0, UtilMath.r(3) - 1)).normalize();
|
Vector vector = UtilAlg.calculateVelocity(l.toVector(), loc1.toVector(), dist / 13);
|
||||||
|
|
||||||
falling.setVelocity(vector.multiply(0.5 + (l.distance(target.getEyeLocation()) / 10)));
|
falling.setVelocity(vector);// .multiply(0.5 + (l.distance(target.getEyeLocation()) / 10)).multiply(0.7));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (_thrown >= 3 && !UtilPlayer.getNearby(getLocation(), 10, true).isEmpty())
|
if (_thrown >= 3 && !UtilPlayer.getNearby(
|
||||||
|
|
||||||
|
getLocation(), 10, true).isEmpty())
|
||||||
{
|
{
|
||||||
_thrown = 99;
|
_thrown = 99;
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user