Skip to content

Commit

Permalink
正式修复
Browse files Browse the repository at this point in the history
  • Loading branch information
Koud-Wind committed Jun 23, 2023
1 parent 533e3e2 commit 1cac260
Show file tree
Hide file tree
Showing 4 changed files with 7 additions and 9 deletions.
4 changes: 2 additions & 2 deletions src/main/java/com/paneedah/weaponlib/Weapon.java
Original file line number Diff line number Diff line change
Expand Up @@ -1535,7 +1535,7 @@ public ItemAttachment.ApplyHandler2<Weapon> getEquivalentHandler(AttachmentCateg
break;
case GRIP:
handler = (a, i) -> {
i.setRecoil(builder.recoil);
i.setRecoil(BalancePackManager.shouldChangeWeaponRecoil(i.getWeapon()) ? (float) BalancePackManager.getNewWeaponRecoil(i.getWeapon()) : builder.recoil);
};
break;
default:
Expand All @@ -1549,7 +1549,7 @@ public String getTextureName() {
}

public float getRecoil() {
return builder.recoil;
return BalancePackManager.shouldChangeWeaponRecoil(this) ? (float) BalancePackManager.getNewWeaponRecoil(this) : builder.recoil;
}

public ModContext getModContext() {
Expand Down
2 changes: 0 additions & 2 deletions src/main/java/com/paneedah/weaponlib/WeaponFireAspect.java
Original file line number Diff line number Diff line change
Expand Up @@ -312,8 +312,6 @@ private void fire(PlayerWeaponInstance weaponInstance) {
weaponInstance.setSlideLock(true);

float recoilAmount = weaponInstance.getRecoil();

if(BalancePackManager.shouldChangeWeaponRecoil(weapon)) recoilAmount = (float) BalancePackManager.getNewWeaponRecoil(weapon);
recoilAmount *= BalancePackManager.getGlobalRecoilMultiplier();
recoilAmount *= BalancePackManager.getGroupRecoilMultiplier(weapon.getConfigurationGroup());

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -831,7 +831,7 @@ public static boolean balancePackAddressesGroup(GunConfigurationGroup group) {

public static double getNewWeaponDamage(Weapon weapon) {
if (!hasActiveBalancePack() || !balancePackAddressesWeapon(weapon))
return -1;
return weapon.getSpawnEntityDamage();
return getActiveBalancePack().getWeaponBalancing(weapon.getName()).getDamage();
}

Expand Down Expand Up @@ -884,7 +884,7 @@ public static boolean shouldChangeWeaponRecoil(Weapon weapon) {

public static double getNewWeaponRecoil(Weapon weapon) {
if (!hasActiveBalancePack() || !balancePackAddressesWeapon(weapon))
return -1;
return weapon.getRecoil();
return getActiveBalancePack().getWeaponBalancing(weapon.getName()).getRecoil();
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -633,14 +633,14 @@ public void render(ModContext modContext) {
TextFormatting.GOLD + translate(weapon.getTranslationKey()),
30, 30, 1.0, ColorPalette.WHITE);
GUIRenderHelper.drawScaledString(
"Damage :: " + TextFormatting.GOLD + BalancePackManager.getNetGunDamage(weapon),
"Damage :: " + TextFormatting.GOLD + String.format("%.2f" , (BalancePackManager.getNetGunDamage(weapon))),
30, 60, 1, ColorPalette.WHITE);
GUIRenderHelper.drawScaledString("Recoil :: " + TextFormatting.GOLD + (float) BalancePackManager.getNewWeaponRecoil(weapon),
GUIRenderHelper.drawScaledString("Recoil :: " + TextFormatting.GOLD + String.format("%.2f" , (weaponInstance.getRecoil())),
30, 75, 1, ColorPalette.WHITE);
GUIRenderHelper.drawScaledString("Firerate :: " + TextFormatting.GOLD + weaponInstance.getFireRate(), 30, 90, 1,
ColorPalette.WHITE);
GUIRenderHelper.drawScaledString(
"Inaccuracy :: " + TextFormatting.GOLD + weaponInstance.getInaccuracy(), 30,
"Inaccuracy :: " + TextFormatting.GOLD + String.format("%.1f" , (weaponInstance.getInaccuracy())), 30,
105, 1, ColorPalette.WHITE);

GlStateManager.popMatrix();
Expand Down

0 comments on commit 1cac260

Please sign in to comment.