mirror of
https://github.com/KAMKEEL/CustomNPC-Plus.git
synced 2026-11-27 23:45:38 +00:00
Add a new Aim While Shooting Type
This commit is contained in:
1 parent
0877aee3e6
commit
cac5a53997
9 files changed
+52
-13
No files matched your search
@@ -31,6 +31,7 @@ public class EntityAIRangedAttack extends EntityAIBase {
|
||||
private int attackTick = 0;
|
||||
private boolean hasFired = false;
|
||||
private boolean navOverride = false;
|
||||
private boolean isShooting = false;
|
||||
|
||||
public EntityAIRangedAttack(IRangedAttackMob par1IRangedAttackMob) {
|
||||
if (!(par1IRangedAttackMob instanceof EntityLivingBase)) {
|
||||
@@ -113,10 +114,12 @@ public class EntityAIRangedAttack extends EntityAIBase {
|
||||
if (var1 <= (double) field_82642_h && (this.entityHost.getEntitySenses().canSee(this.attackTarget) || this.entityHost.ais.canFireIndirect == 2)) {
|
||||
if (this.field_70846_g++ <= this.entityHost.stats.burstCount) {
|
||||
this.rangedAttackTime = this.entityHost.stats.fireRate;
|
||||
this.isShooting = true;
|
||||
} else {
|
||||
this.field_70846_g = 0;
|
||||
this.hasFired = true;
|
||||
this.rangedAttackTime = (this.entityHost.stats.maxDelay - MathHelper.floor_float(this.entityHost.getRNG().nextFloat() * (this.entityHost.stats.maxDelay - this.entityHost.stats.minDelay)));
|
||||
this.isShooting = false;
|
||||
}
|
||||
|
||||
if (this.field_70846_g > 1) {
|
||||
@@ -143,6 +146,10 @@ public class EntityAIRangedAttack extends EntityAIBase {
|
||||
return this.hasFired;
|
||||
}
|
||||
|
||||
public boolean isShooting() {
|
||||
return this.isShooting;
|
||||
}
|
||||
|
||||
public void navOverride(boolean nav) {
|
||||
this.navOverride = nav;
|
||||
this.setMutexBits(this.navOverride ? AiMutex.PATHING : AiMutex.LOOK + AiMutex.PASSIVE);
|
||||
|
||||
Reference in new issue
Block a user