Fix centered weapons erroneously gaining the ADS accuracy boost

This commit is contained in:
George Paton 2024-02-19 10:54:44 +11:00
parent cc5371a761
commit d4203f0334

View File

@ -111,12 +111,20 @@ public class EntityBulletBaseNT extends EntityThrowableInterp implements IBullet
ItemStack gun = entity.getHeldItem();
boolean offsetShot = true;
boolean accuracyBoost = false;
if(gun != null && gun.getItem() instanceof ItemGunBase) {
GunConfiguration cfg = ((ItemGunBase) gun.getItem()).mainConfig;
if(cfg != null && (cfg.hasSights && entity.isSneaking()) || cfg.isCentered) {
offsetShot = false;
if(cfg != null) {
if(cfg.hasSights && entity.isSneaking()) {
offsetShot = false;
accuracyBoost = true;
}
if(cfg.isCentered){
offsetShot = false;
}
}
}
@ -140,7 +148,7 @@ public class EntityBulletBaseNT extends EntityThrowableInterp implements IBullet
this.renderDistanceWeight = 10.0D;
this.setSize(0.5F, 0.5F);
this.setThrowableHeading(this.motionX, this.motionY, this.motionZ, 1.0F, this.config.spread * (offsetShot ? 1F : 0.25F));
this.setThrowableHeading(this.motionX, this.motionY, this.motionZ, 1.0F, this.config.spread * (accuracyBoost ? 0.25F : 1F));
}
public EntityBulletBaseNT(World world, int config, EntityLivingBase entity, EntityLivingBase target, float motion, float deviation) {