优化NBT#CustomSoundRadius

This commit is contained in:
17146 2025-01-04 00:25:18 +08:00
parent e7971c812f
commit d35bcb3092
2 changed files with 2 additions and 2 deletions

View file

@ -129,7 +129,7 @@ public class GunEventHandler {
player.playSound(ModSounds.HENG.get(), 4f, 1f);
}
float soundRadius = (float) (stack.getOrCreateTag().getDouble("SoundRadius") * stack.getOrCreateTag().getDouble("CustomSoundRadius"));
float soundRadius = (float) (GunsTool.getGunDoubleTag(stack, "SoundRadius") * GunsTool.getGunDoubleTag(stack, "CustomSoundRadius", 1));
int barrelType = GunsTool.getAttachmentType(stack, GunsTool.AttachmentType.BARREL);

View file

@ -210,7 +210,7 @@ public abstract class GunItem extends Item {
double soundRadius = tag.getInt("Barrel") == 2 ? 0.6 : 1;
GunsTool.setGunDoubleTag(stack, "CustomWeight", scopeWeight + barrelWeight + magazineWeight + stockWeight + gripWeight);
stack.getOrCreateTag().putDouble("CustomSoundRadius", soundRadius);
GunsTool.setGunDoubleTag(stack, "CustomSoundRadius", soundRadius);
}
public boolean canApplyPerk(Perk perk) {