From e0d13496cd59127af20d7094f3fb17da1f52cad8 Mon Sep 17 00:00:00 2001 From: 70000hp <105080577+70000hp@users.noreply.github.com> Date: Wed, 30 Aug 2023 12:28:26 -0400 Subject: [PATCH] Improved chloro rounds logic --- .../java/com/hbm/handler/BulletConfiguration.java | 3 ++- .../com/hbm/handler/guncfg/BulletConfigFactory.java | 12 ++++++++++-- 2 files changed, 12 insertions(+), 3 deletions(-) diff --git a/src/main/java/com/hbm/handler/BulletConfiguration.java b/src/main/java/com/hbm/handler/BulletConfiguration.java index 87163cdec..aa1d73ca5 100644 --- a/src/main/java/com/hbm/handler/BulletConfiguration.java +++ b/src/main/java/com/hbm/handler/BulletConfiguration.java @@ -182,7 +182,8 @@ public class BulletConfiguration implements Cloneable { } 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; diff --git a/src/main/java/com/hbm/handler/guncfg/BulletConfigFactory.java b/src/main/java/com/hbm/handler/guncfg/BulletConfigFactory.java index c4672568d..9e1e8bc13 100644 --- a/src/main/java/com/hbm/handler/guncfg/BulletConfigFactory.java +++ b/src/main/java/com/hbm/handler/guncfg/BulletConfigFactory.java @@ -446,7 +446,7 @@ public class BulletConfigFactory { } public static IBulletUpdateBehaviorNT getHomingBehavior(final double range, final double angle) { - + IBulletUpdateBehaviorNT onUpdate = new IBulletUpdateBehaviorNT() { @Override @@ -465,7 +465,6 @@ public class BulletConfigFactory { 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; @@ -500,6 +499,10 @@ public class BulletConfigFactory { 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; } @@ -514,4 +517,9 @@ public class BulletConfigFactory { return onUpdate; } + /** Resets the bullet's target **/ + public static IBulletHurtBehaviorNT getPenHomingBehavior(){ + return (bullet, hit) -> bullet.getEntityData().setInteger("homingTarget", 0); + } + }