This repository has been archived by the owner on Nov 24, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
The final couple updates... The end is nigh...
- Loading branch information
1 parent
bdcd473
commit 24e0be9
Showing
6 changed files
with
423 additions
and
24 deletions.
There are no files selected for viewing
79 changes: 79 additions & 0 deletions
79
src/main/java/net/underplayer97/ResonantEnemies/entity/ai/AmalgamateAttackGoal.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,79 @@ | ||
package net.underplayer97.ResonantEnemies.entity.ai; | ||
|
||
import net.minecraft.entity.LivingEntity; | ||
import net.minecraft.entity.ai.goal.Goal; | ||
import net.underplayer97.ResonantEnemies.entity.boss.AmalgamateEntity; | ||
import net.underplayer97.ResonantEnemies.entity.boss.GrimsleyEntity; | ||
|
||
import java.util.EnumSet; | ||
|
||
public class AmalgamateAttackGoal extends Goal { | ||
private final AmalgamateEntity entity; | ||
private LivingEntity target; | ||
private final double maxSearchDistance; | ||
|
||
public AmalgamateAttackGoal(AmalgamateEntity entity, double maxSearchDistance) { | ||
this.entity = entity; | ||
this.maxSearchDistance = maxSearchDistance; | ||
setControls(EnumSet.of(Control.MOVE, Control.LOOK)); | ||
} | ||
|
||
@Override | ||
public void start() { | ||
entity.setPrimaryAttackCooldown(Math.max(entity.getPrimaryAttackCooldown(), 20)); | ||
target = entity.getTarget(); | ||
} | ||
|
||
@Override | ||
public boolean canStart() { | ||
if (!entity.canTarget(entity.getTarget())){ | ||
entity.setTarget(null); | ||
return false; | ||
} | ||
|
||
target = entity.getTarget(); | ||
return target != null && (entity.squaredDistanceTo(target) < maxSearchDistance); | ||
} | ||
|
||
@Override | ||
public boolean shouldContinue() { | ||
if (target == null) return false; | ||
if (!target.isAlive()) return false; | ||
return !entity.getNavigation().isIdle() || canStart(); | ||
} | ||
|
||
@Override | ||
public void stop() { | ||
target = null; | ||
entity.setTarget(null); | ||
entity.getNavigation().stop(); | ||
} | ||
|
||
@Override | ||
public boolean shouldRunEveryTick() { | ||
return false; | ||
} | ||
|
||
@Override | ||
public void tick() { | ||
if (target.isRemoved()) { | ||
stop(); | ||
return; | ||
} | ||
|
||
entity.setSprinting(true); | ||
entity.getLookControl().lookAt(target); | ||
double attackDistance = entity.getWidth() * 2.0f * (entity.getWidth() * 2.0f); | ||
double distance = entity.squaredDistanceTo(target); | ||
entity.getNavigation().startMovingTo(target, 1); | ||
boolean doesCollide = entity.doesCollide(entity.getBoundingBox(), target.getBoundingBox()); | ||
|
||
//if(entity.getSpecialAttackCooldown() == 0 && (distance > attackDistance * 4 || distance < attackDistance)) { | ||
// entity.getLookControl().lookAt(target); | ||
// //entity.shoot(); | ||
//} | ||
|
||
if (doesCollide) entity.meleeAttack(target); | ||
|
||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
79 changes: 79 additions & 0 deletions
79
src/main/java/net/underplayer97/ResonantEnemies/entity/ai/GrimsleyAttackGoal.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,79 @@ | ||
package net.underplayer97.ResonantEnemies.entity.ai; | ||
|
||
import net.minecraft.entity.LivingEntity; | ||
import net.minecraft.entity.ai.goal.Goal; | ||
import net.underplayer97.ResonantEnemies.entity.boss.ErebusEntity; | ||
import net.underplayer97.ResonantEnemies.entity.boss.GrimsleyEntity; | ||
|
||
import java.util.EnumSet; | ||
|
||
public class GrimsleyAttackGoal extends Goal { | ||
private final GrimsleyEntity entity; | ||
private LivingEntity target; | ||
private final double maxSearchDistance; | ||
|
||
public GrimsleyAttackGoal(GrimsleyEntity entity, double maxSearchDistance) { | ||
this.entity = entity; | ||
this.maxSearchDistance = maxSearchDistance; | ||
setControls(EnumSet.of(Control.MOVE, Control.LOOK)); | ||
} | ||
|
||
@Override | ||
public void start() { | ||
entity.setPrimaryAttackCooldown(Math.max(entity.getPrimaryAttackCooldown(), 20)); | ||
target = entity.getTarget(); | ||
} | ||
|
||
@Override | ||
public boolean canStart() { | ||
if (!entity.canTarget(entity.getTarget())){ | ||
entity.setTarget(null); | ||
return false; | ||
} | ||
|
||
target = entity.getTarget(); | ||
return target != null && (entity.squaredDistanceTo(target) < maxSearchDistance); | ||
} | ||
|
||
@Override | ||
public boolean shouldContinue() { | ||
if (target == null) return false; | ||
if (!target.isAlive()) return false; | ||
return !entity.getNavigation().isIdle() || canStart(); | ||
} | ||
|
||
@Override | ||
public void stop() { | ||
target = null; | ||
entity.setTarget(null); | ||
entity.getNavigation().stop(); | ||
} | ||
|
||
@Override | ||
public boolean shouldRunEveryTick() { | ||
return false; | ||
} | ||
|
||
@Override | ||
public void tick() { | ||
if (target.isRemoved()) { | ||
stop(); | ||
return; | ||
} | ||
|
||
entity.setSprinting(true); | ||
entity.getLookControl().lookAt(target); | ||
double attackDistance = entity.getWidth() * 2.0f * (entity.getWidth() * 2.0f); | ||
double distance = entity.squaredDistanceTo(target); | ||
entity.getNavigation().startMovingTo(target, 1); | ||
boolean doesCollide = entity.doesCollide(entity.getBoundingBox(), target.getBoundingBox()); | ||
|
||
//if(entity.getSpecialAttackCooldown() == 0 && (distance > attackDistance * 4 || distance < attackDistance)) { | ||
// entity.getLookControl().lookAt(target); | ||
// //entity.shoot(); | ||
//} | ||
|
||
if (doesCollide) entity.meleeAttack(target); | ||
|
||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.