Skip to content
Permalink
Browse files

Support ghasts better, fixes #50

  • Loading branch information...
mcmonkey4eva committed Jul 15, 2016
1 parent d525e1b commit 7d095057e8e709a8c4b6bc4b9e0ba330ddf4f91b
Showing with 14 additions and 3 deletions.
  1. +1 −0 README.md
  2. +13 −3 src/main/java/org/mcmonkey/sentinel/SentinelTrait.java
@@ -102,6 +102,7 @@ These are all valid targets and ignores:
- (To make a target glow ++ damage it, equip a bow + arm it with spectral arrows!)
- Respawning can be set to "-1" to cause the NPC to delete itself on death, or "0" to prevent respawn.
- Sentinels will guard a point or path if either is set using the command "`/npc path`"
- To make a ghast or blaze fire fireballs, give them a blazerod!

### Need help using Sentinel? Try one of these places:

@@ -360,11 +360,19 @@ public void swingWeapon() {
}
}

public double firingMinimumRange() {
EntityType type = getLivingEntity().getType();
if (type == EntityType.WITHER || type == EntityType.WITHER) {
return 8; // Yikes!
}
return 2;
}

public HashMap.SimpleEntry<Location, Vector> getLaunchDetail(Location target, Vector lead) {
double speeda;
npc.faceLocation(target);
double angt = Double.POSITIVE_INFINITY;
Location start = getLivingEntity().getEyeLocation().clone().add(getLivingEntity().getEyeLocation().getDirection());
Location start = getLivingEntity().getEyeLocation().clone().add(getLivingEntity().getEyeLocation().getDirection().multiply(firingMinimumRange()));
double sbase = SentinelPlugin.instance.getConfig().getDouble("random.shoot speed minimum", 20);
for (speeda = sbase; speeda <= sbase + 15; speeda += 5) {
angt = SentinelUtilities.getArrowAngle(start, target, speeda, 20);
@@ -434,8 +442,9 @@ public void fireSnowball(Location target) {
stats_snowballsThrown++;
npc.faceLocation(target);
Vector forward = getLivingEntity().getEyeLocation().getDirection();
Location spawnAt = getLivingEntity().getEyeLocation().clone().add(forward.clone().multiply(2));
Location spawnAt = getLivingEntity().getEyeLocation().clone().add(forward.clone().multiply(firingMinimumRange()));
Entity ent = spawnAt.getWorld().spawnEntity(spawnAt, EntityType.SNOWBALL);
((Projectile) ent).setShooter(getLivingEntity());
ent.setVelocity(target.clone().subtract(spawnAt).toVector().normalize().multiply(2.5)); // TODO: Fiddle with '2.5'.
}

@@ -444,8 +453,9 @@ public void fireFireball(Location target) {
stats_fireballsFired++;
npc.faceLocation(target);
Vector forward = getLivingEntity().getEyeLocation().getDirection();
Location spawnAt = getLivingEntity().getEyeLocation().clone().add(forward.clone().multiply(2));
Location spawnAt = getLivingEntity().getEyeLocation().clone().add(forward.clone().multiply(firingMinimumRange()));
Entity ent = spawnAt.getWorld().spawnEntity(spawnAt, EntityType.SMALL_FIREBALL);
((Projectile) ent).setShooter(getLivingEntity());
ent.setVelocity(target.clone().subtract(spawnAt).toVector().normalize().multiply(4)); // TODO: Fiddle with '4'.
}

0 comments on commit 7d09505

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