Skip to content
Permalink
Browse files

fix close range angling

  • Loading branch information...
mcmonkey4eva committed Jun 29, 2017
1 parent ba9149e commit a357ab8f70a6ac49c60c7dddec8a55bcfd00c1d0
@@ -470,7 +470,7 @@ public double firingMinimumRange() {

public HashMap.SimpleEntry<Location, Vector> getLaunchDetail(Location target, Vector lead) {
double speeda;
npc.faceLocation(target);
faceLocation(target);
double angt = Double.POSITIVE_INFINITY;
Location start = getLivingEntity().getEyeLocation().clone().add(getLivingEntity().getEyeLocation().getDirection().multiply(firingMinimumRange()));
double sbase = SentinelPlugin.instance.getConfig().getDouble("random.shoot speed minimum", 20);
@@ -566,7 +566,7 @@ public void fireArrow(ItemStack type, Location target, Vector lead) {
public void fireSnowball(Location target) {
swingWeapon();
stats_snowballsThrown++;
npc.faceLocation(target);
faceLocation(target);
Vector forward = getLivingEntity().getEyeLocation().getDirection();
Location spawnAt = getLivingEntity().getEyeLocation().clone().add(forward.clone().multiply(firingMinimumRange()));
Entity ent = spawnAt.getWorld().spawnEntity(spawnAt, EntityType.SNOWBALL);
@@ -577,7 +577,7 @@ public void fireSnowball(Location target) {
public void fireEgg(Location target) {
swingWeapon();
stats_eggsThrown++;
npc.faceLocation(target);
faceLocation(target);
Vector forward = getLivingEntity().getEyeLocation().getDirection();
Location spawnAt = getLivingEntity().getEyeLocation().clone().add(forward.clone().multiply(firingMinimumRange()));
Entity ent = spawnAt.getWorld().spawnEntity(spawnAt, EntityType.EGG);
@@ -587,16 +587,20 @@ public void fireEgg(Location target) {

public void firePearl(LivingEntity target) {
swingWeapon();
npc.faceLocation(target.getEyeLocation());
faceLocation(target.getEyeLocation());
// TODO: Maybe require entity is-on-ground?
stats_pearlsUsed++;
target.setVelocity(target.getVelocity().add(new Vector(0, getDamage(), 0)));
}

public void faceLocation(Location l) {
npc.faceLocation(l.clone().subtract(0, getLivingEntity().getEyeHeight(), 0));
}

public void fireFireball(Location target) {
swingWeapon();
stats_fireballsFired++;
npc.faceLocation(target);
faceLocation(target);
Vector forward = getLivingEntity().getEyeLocation().getDirection();
Location spawnAt = getLivingEntity().getEyeLocation().clone().add(forward.clone().multiply(firingMinimumRange()));
Entity ent = spawnAt.getWorld().spawnEntity(spawnAt, EntityType.SMALL_FIREBALL);
@@ -607,7 +611,7 @@ public void fireFireball(Location target) {
public void fireSkull(Location target) {
swingWeapon();
stats_skullsThrown++;
npc.faceLocation(target);
faceLocation(target);
Vector forward = getLivingEntity().getEyeLocation().getDirection();
Location spawnAt = getLivingEntity().getEyeLocation().clone().add(forward.clone().multiply(firingMinimumRange()));
Entity ent = spawnAt.getWorld().spawnEntity(spawnAt, EntityType.WITHER_SKULL);
@@ -737,7 +741,7 @@ public double getArmor(LivingEntity ent) {
}

public void punch(LivingEntity entity) {
npc.faceLocation(entity.getLocation());
faceLocation(entity.getLocation());
swingWeapon();
stats_punches++;
if (SentinelPlugin.instance.getConfig().getBoolean("random.workaround damage", false)) {
@@ -24,7 +24,7 @@ public boolean tryAttack(SentinelTrait st, LivingEntity ent) {
if (node == null) {
return false;
}
st.getNPC().faceLocation(ent.getEyeLocation());
st.faceLocation(ent.getEyeLocation());
direc.csminion.weaponInteraction((Player) st.getLivingEntity(), node, false);
return true;
}

0 comments on commit a357ab8

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