调整迫击炮调节精度

This commit is contained in:
Atsuihsio 2024-07-07 23:26:09 +08:00
parent 954862d710
commit c6cb9b75e1

View file

@ -43,13 +43,13 @@ public class AdjustMortarAngleMessage {
double angle = 0; double angle = 0;
if (looking instanceof LivingEntity living){ if (looking instanceof LivingEntity living){
living.getAttribute(TargetModAttributes.MORTAR_PITCH.get()).setBaseValue(Mth.clamp(living.getAttribute(TargetModAttributes.MORTAR_PITCH.get()).getBaseValue() + message.scroll,20,89)); living.getAttribute(TargetModAttributes.MORTAR_PITCH.get()).setBaseValue(Mth.clamp(living.getAttribute(TargetModAttributes.MORTAR_PITCH.get()).getBaseValue() + 0.5 * message.scroll,20,89));
angle = living.getAttribute(TargetModAttributes.MORTAR_PITCH.get()).getBaseValue(); angle = living.getAttribute(TargetModAttributes.MORTAR_PITCH.get()).getBaseValue();
} }
var range = -looking.getXRot(); var range = -looking.getXRot();
player.displayClientMessage(Component.literal("Angle:" + new java.text.DecimalFormat("##.#").format(angle) + " Range:" + new java.text.DecimalFormat("##.#").format((int) RangeHelper.getRange(range)) + "M"), true); player.displayClientMessage(Component.literal("Angle:" + new java.text.DecimalFormat("##.##").format(angle) + " Range:" + new java.text.DecimalFormat("##.#").format((int) RangeHelper.getRange(range)) + "M"), true);
SoundTool.playLocalSound(player, TargetModSounds.ADJUST_FOV.get(), 1f, 0.7f); SoundTool.playLocalSound(player, TargetModSounds.ADJUST_FOV.get(), 1f, 0.7f);
}); });
context.get().setPacketHandled(true); context.get().setPacketHandled(true);