mirror of
https://github.com/HbmMods/Hbm-s-Nuclear-Tech-GIT.git
synced 2026-01-25 10:32:49 +00:00
Improved chloro rounds logic
This commit is contained in:
parent
a7d393e663
commit
e0d13496cd
@ -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;
|
||||
|
||||
@ -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);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user