Skip to content

Commit

Permalink
Improved chloro rounds logic
Browse files Browse the repository at this point in the history
  • Loading branch information
70000hp committed Aug 30, 2023
1 parent 99f9bc7 commit fb2d80d
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 3 deletions.
3 changes: 2 additions & 1 deletion src/main/java/com/hbm/handler/BulletConfiguration.java
Original file line number Diff line number Diff line change
Expand Up @@ -182,7 +182,8 @@ public BulletConfiguration setToGuided() {
}

public BulletConfiguration getChlorophyte() {
this.bntUpdate = BulletConfigFactory.getHomingBehavior(20, 360);
this.bntUpdate = BulletConfigFactory.getHomingBehavior(30, 180);
this.bntHurt = BulletConfigFactory.getPenHomingBehavior();
this.dmgMin *= 2F;
this.dmgMax *= 2F;
this.wear *= 0.5;
Expand Down
12 changes: 10 additions & 2 deletions src/main/java/com/hbm/handler/guncfg/BulletConfigFactory.java
Original file line number Diff line number Diff line change
Expand Up @@ -483,7 +483,7 @@ public void behaveUpdate(EntityBulletBaseNT bullet) {
}

public static IBulletUpdateBehaviorNT getHomingBehavior(final double range, final double angle) {

IBulletUpdateBehaviorNT onUpdate = new IBulletUpdateBehaviorNT() {

@Override
Expand All @@ -502,7 +502,6 @@ public void behaveUpdate(EntityBulletBaseNT bullet) {

Vec3 delta = Vec3.createVectorHelper(target.posX - bullet.posX, target.posY + target.height / 2 - bullet.posY, target.posZ - bullet.posZ);
delta = delta.normalize();

double vel = Vec3.createVectorHelper(bullet.motionX, bullet.motionY, bullet.motionZ).lengthVector();

bullet.motionX = delta.xCoord * vel;
Expand Down Expand Up @@ -537,6 +536,10 @@ private void chooseTarget(EntityBulletBaseNT bullet) {
double deltaAngle = BobMathUtil.getCrossAngle(mot, delta);

if(deltaAngle < targetAngle) {
//Checks if the bullet is not already inside the entity's bounding box, so it doesn't pick the same target
if(bullet.getConfig().doesPenetrate && bullet.worldObj.getEntitiesWithinAABB(EntityLivingBase.class, bullet.boundingBox.expand(2, 2, 2)) == null) {
continue;
}
target = e;
targetAngle = deltaAngle;
}
Expand All @@ -551,4 +554,9 @@ private void chooseTarget(EntityBulletBaseNT bullet) {

return onUpdate;
}
/** Resets the bullet's target **/
public static IBulletHurtBehaviorNT getPenHomingBehavior(){
return (bullet, hit) -> bullet.getEntityData().setInteger("homingTarget", 0);
}

}

0 comments on commit fb2d80d

Please sign in to comment.