优化数字格式化写法
This commit is contained in:
parent
cba1cf967c
commit
4e525cb506
16 changed files with 36 additions and 36 deletions
|
@ -98,7 +98,7 @@ public class CannonHudOverlay {
|
||||||
}
|
}
|
||||||
if (lookAtEntity) {
|
if (lookAtEntity) {
|
||||||
event.getGuiGraphics().drawString(Minecraft.getInstance().font, Component.translatable("tips.superbwarfare.drone.range")
|
event.getGuiGraphics().drawString(Minecraft.getInstance().font, Component.translatable("tips.superbwarfare.drone.range")
|
||||||
.append(Component.literal(new DecimalFormat("##.#").format(entityRange) + "M " + lookingEntity.getDisplayName().getString())),
|
.append(Component.literal(new DecimalFormat("##.#M ").format(entityRange) + lookingEntity.getDisplayName().getString())),
|
||||||
w / 2 + 14, h / 2 - 20, -1, false);
|
w / 2 + 14, h / 2 - 20, -1, false);
|
||||||
} else {
|
} else {
|
||||||
if (blockRange > 511) {
|
if (blockRange > 511) {
|
||||||
|
@ -106,7 +106,7 @@ public class CannonHudOverlay {
|
||||||
.append(Component.literal("---M")), w / 2 + 14, h / 2 - 20, -1, false);
|
.append(Component.literal("---M")), w / 2 + 14, h / 2 - 20, -1, false);
|
||||||
} else {
|
} else {
|
||||||
event.getGuiGraphics().drawString(Minecraft.getInstance().font, Component.translatable("tips.superbwarfare.drone.range")
|
event.getGuiGraphics().drawString(Minecraft.getInstance().font, Component.translatable("tips.superbwarfare.drone.range")
|
||||||
.append(Component.literal(new DecimalFormat("##.#").format(blockRange) + "M")),
|
.append(Component.literal(new DecimalFormat("##.#M").format(blockRange))),
|
||||||
w / 2 + 14, h / 2 - 20, -1, false);
|
w / 2 + 14, h / 2 - 20, -1, false);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -70,7 +70,7 @@ public class DroneUIOverlay {
|
||||||
guiGraphics.blit(ModUtils.loc("textures/screens/drone_fov.png"), w / 2 + 100, h / 2 - 64, 0, 0, 64, 129, 64, 129);
|
guiGraphics.blit(ModUtils.loc("textures/screens/drone_fov.png"), w / 2 + 100, h / 2 - 64, 0, 0, 64, 129, 64, 129);
|
||||||
|
|
||||||
preciseBlit(guiGraphics, ModUtils.loc("textures/screens/drone_fov_move.png"), (float) w / 2 + 100, (float) (h / 2 - 64 - ((ClientEventHandler.droneFovLerp - 1) * 23.8)), 0, 0, 64, 129, 64, 129);
|
preciseBlit(guiGraphics, ModUtils.loc("textures/screens/drone_fov_move.png"), (float) w / 2 + 100, (float) (h / 2 - 64 - ((ClientEventHandler.droneFovLerp - 1) * 23.8)), 0, 0, 64, 129, 64, 129);
|
||||||
guiGraphics.drawString(mc.font, Component.literal(new DecimalFormat("##.#").format(ClientEventHandler.droneFovLerp) + "x"),
|
guiGraphics.drawString(mc.font, Component.literal(new DecimalFormat("##.#x").format(ClientEventHandler.droneFovLerp)),
|
||||||
w / 2 + 144, h / 2 + 56 - (int) ((ClientEventHandler.droneFovLerp - 1) * 23.8), -1, false);
|
w / 2 + 144, h / 2 + 56 - (int) ((ClientEventHandler.droneFovLerp - 1) * 23.8), -1, false);
|
||||||
|
|
||||||
DroneEntity entity = EntityFindUtil.findDrone(player.level(), stack.getOrCreateTag().getString("LinkedDrone"));
|
DroneEntity entity = EntityFindUtil.findDrone(player.level(), stack.getOrCreateTag().getString("LinkedDrone"));
|
||||||
|
@ -101,7 +101,7 @@ public class DroneUIOverlay {
|
||||||
|
|
||||||
// 距离
|
// 距离
|
||||||
guiGraphics.drawString(mc.font, Component.translatable("tips.superbwarfare.drone.distance")
|
guiGraphics.drawString(mc.font, Component.translatable("tips.superbwarfare.drone.distance")
|
||||||
.append(Component.literal(new DecimalFormat("##.#").format(distance) + "M")),
|
.append(Component.literal(new DecimalFormat("##.#M").format(distance))),
|
||||||
w / 2 + 10, h / 2 + 33, color, false);
|
w / 2 + 10, h / 2 + 33, color, false);
|
||||||
|
|
||||||
// 血量
|
// 血量
|
||||||
|
@ -111,7 +111,7 @@ public class DroneUIOverlay {
|
||||||
if (entity.getEntityData().get(KAMIKAZE_MODE) == 0) {
|
if (entity.getEntityData().get(KAMIKAZE_MODE) == 0) {
|
||||||
// 弹药
|
// 弹药
|
||||||
guiGraphics.drawString(mc.font, Component.translatable("tips.superbwarfare.drone.ammo")
|
guiGraphics.drawString(mc.font, Component.translatable("tips.superbwarfare.drone.ammo")
|
||||||
.append(Component.literal(new DecimalFormat("##.#").format(entity.getEntityData().get(AMMO)) + " / 6")),
|
.append(Component.literal(new DecimalFormat("##.# / 6").format(entity.getEntityData().get(AMMO)))),
|
||||||
w / 2 + 12, h / 2 - 37, -1, false);
|
w / 2 + 12, h / 2 - 37, -1, false);
|
||||||
} else {
|
} else {
|
||||||
// 神风
|
// 神风
|
||||||
|
@ -122,7 +122,7 @@ public class DroneUIOverlay {
|
||||||
if (lookAtEntity) {
|
if (lookAtEntity) {
|
||||||
// 实体距离
|
// 实体距离
|
||||||
guiGraphics.drawString(mc.font, Component.translatable("tips.superbwarfare.drone.range")
|
guiGraphics.drawString(mc.font, Component.translatable("tips.superbwarfare.drone.range")
|
||||||
.append(Component.literal(new DecimalFormat("##.#").format(entityRange) + "M " + lookingEntity.getDisplayName().getString())),
|
.append(Component.literal(new DecimalFormat("##.#M ").format(entityRange) + lookingEntity.getDisplayName().getString())),
|
||||||
w / 2 + 12, h / 2 - 28, color, false);
|
w / 2 + 12, h / 2 - 28, color, false);
|
||||||
} else {
|
} else {
|
||||||
// 方块距离
|
// 方块距离
|
||||||
|
@ -131,7 +131,7 @@ public class DroneUIOverlay {
|
||||||
.append(Component.literal("---M")), w / 2 + 12, h / 2 - 28, color, false);
|
.append(Component.literal("---M")), w / 2 + 12, h / 2 - 28, color, false);
|
||||||
} else {
|
} else {
|
||||||
guiGraphics.drawString(mc.font, Component.translatable("tips.superbwarfare.drone.range")
|
guiGraphics.drawString(mc.font, Component.translatable("tips.superbwarfare.drone.range")
|
||||||
.append(Component.literal(new DecimalFormat("##.#").format(blockRange) + "M")),
|
.append(Component.literal(new DecimalFormat("##.#M").format(blockRange))),
|
||||||
w / 2 + 12, h / 2 - 28, color, false);
|
w / 2 + 12, h / 2 - 28, color, false);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -107,12 +107,12 @@ public class HelicopterHudOverlay {
|
||||||
preciseBlit(guiGraphics, ModUtils.loc("textures/screens/helicopter/heli_power.png"), (float) w / 2 + 130f, ((float) h / 2 - 64 + 124 - power * 980), 0, 0, 4, power * 980, 4, power * 980);
|
preciseBlit(guiGraphics, ModUtils.loc("textures/screens/helicopter/heli_power.png"), (float) w / 2 + 130f, ((float) h / 2 - 64 + 124 - power * 980), 0, 0, 4, power * 980, 4, power * 980);
|
||||||
lerpVy = (float) Mth.lerp(0.021f * event.getPartialTick(), lerpVy, mobileVehicle.getDeltaMovement().y());
|
lerpVy = (float) Mth.lerp(0.021f * event.getPartialTick(), lerpVy, mobileVehicle.getDeltaMovement().y());
|
||||||
preciseBlit(guiGraphics, ModUtils.loc("textures/screens/helicopter/heli_vy_move.png"), (float) w / 2 + 138, ((float) h / 2 - 3 - Math.max(lerpVy * 20, -24) * 2.5f), 0, 0, 8, 8, 8, 8);
|
preciseBlit(guiGraphics, ModUtils.loc("textures/screens/helicopter/heli_vy_move.png"), (float) w / 2 + 138, ((float) h / 2 - 3 - Math.max(lerpVy * 20, -24) * 2.5f), 0, 0, 8, 8, 8, 8);
|
||||||
guiGraphics.drawString(Minecraft.getInstance().font, Component.literal(new DecimalFormat("##").format(lerpVy * 20) + "m/s"),
|
guiGraphics.drawString(Minecraft.getInstance().font, Component.literal(new DecimalFormat("##m/s").format(lerpVy * 20) ),
|
||||||
w / 2 + 146, (int) (h / 2 - 3 - Math.max(lerpVy * 20, -24) * 2.5), (lerpVy * 20 < -24 || ((lerpVy * 20 < -10 || (lerpVy * 20 < -1 && length(mobileVehicle.getDeltaMovement().x, mobileVehicle.getDeltaMovement().y, mobileVehicle.getDeltaMovement().z) * 72 > 100)) && height < 36) || (length(mobileVehicle.getDeltaMovement().x, mobileVehicle.getDeltaMovement().y, mobileVehicle.getDeltaMovement().z) * 72 > 40 && blockInWay < 72) ? -65536 : 0x66FF00), false);
|
w / 2 + 146, (int) (h / 2 - 3 - Math.max(lerpVy * 20, -24) * 2.5), (lerpVy * 20 < -24 || ((lerpVy * 20 < -10 || (lerpVy * 20 < -1 && length(mobileVehicle.getDeltaMovement().x, mobileVehicle.getDeltaMovement().y, mobileVehicle.getDeltaMovement().z) * 72 > 100)) && height < 36) || (length(mobileVehicle.getDeltaMovement().x, mobileVehicle.getDeltaMovement().y, mobileVehicle.getDeltaMovement().z) * 72 > 40 && blockInWay < 72) ? -65536 : 0x66FF00), false);
|
||||||
guiGraphics.drawString(Minecraft.getInstance().font, Component.literal(new DecimalFormat("##").format(mobileVehicle.getY())),
|
guiGraphics.drawString(Minecraft.getInstance().font, Component.literal(new DecimalFormat("##").format(mobileVehicle.getY())),
|
||||||
w / 2 + 104, h / 2, 0x66FF00, false);
|
w / 2 + 104, h / 2, 0x66FF00, false);
|
||||||
preciseBlit(guiGraphics, ModUtils.loc("textures/screens/helicopter/speed_frame.png"), (float) w / 2 - 144, (float) h / 2 - 6, 0, 0, 50, 18, 50, 18);
|
preciseBlit(guiGraphics, ModUtils.loc("textures/screens/helicopter/speed_frame.png"), (float) w / 2 - 144, (float) h / 2 - 6, 0, 0, 50, 18, 50, 18);
|
||||||
guiGraphics.drawString(Minecraft.getInstance().font, Component.literal(new DecimalFormat("##").format(length(mobileVehicle.getDeltaMovement().x, mobileVehicle.getDeltaMovement().y, mobileVehicle.getDeltaMovement().z) * 72) + "KM/H"),
|
guiGraphics.drawString(Minecraft.getInstance().font, Component.literal(new DecimalFormat("##KM/H").format(length(mobileVehicle.getDeltaMovement().x, mobileVehicle.getDeltaMovement().y, mobileVehicle.getDeltaMovement().z) * 72)),
|
||||||
w / 2 - 140, h / 2, 0x66FF00, false);
|
w / 2 - 140, h / 2, 0x66FF00, false);
|
||||||
|
|
||||||
if (mobileVehicle instanceof Ah6Entity ah6Entity) {
|
if (mobileVehicle instanceof Ah6Entity ah6Entity) {
|
||||||
|
|
|
@ -28,10 +28,10 @@ public class MortarInfoOverlay {
|
||||||
}
|
}
|
||||||
if (lookingEntity instanceof MortarEntity mortar) {
|
if (lookingEntity instanceof MortarEntity mortar) {
|
||||||
event.getGuiGraphics().drawString(Minecraft.getInstance().font, Component.translatable("tips.superbwarfare.mortar.yaw")
|
event.getGuiGraphics().drawString(Minecraft.getInstance().font, Component.translatable("tips.superbwarfare.mortar.yaw")
|
||||||
.append(Component.literal(new DecimalFormat("##.#").format(mortar.getEntityData().get(MortarEntity.Y_ROT)) + "°")),
|
.append(Component.literal(new DecimalFormat("##.#°").format(mortar.getEntityData().get(MortarEntity.Y_ROT)))),
|
||||||
w / 2 + 12, h / 2 - 36, -1, false);
|
w / 2 + 12, h / 2 - 36, -1, false);
|
||||||
event.getGuiGraphics().drawString(Minecraft.getInstance().font, Component.translatable("tips.superbwarfare.mortar.pitch")
|
event.getGuiGraphics().drawString(Minecraft.getInstance().font, Component.translatable("tips.superbwarfare.mortar.pitch")
|
||||||
.append(Component.literal(new DecimalFormat("##.#").format(mortar.getEntityData().get(MortarEntity.PITCH)) + "°")),
|
.append(Component.literal(new DecimalFormat("##.#°").format(mortar.getEntityData().get(MortarEntity.PITCH)))),
|
||||||
w / 2 + 12, h / 2 - 28, -1, false);
|
w / 2 + 12, h / 2 - 28, -1, false);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -40,7 +40,7 @@ public class SpyglassRangeOverlay {
|
||||||
|
|
||||||
if (lookAtEntity) {
|
if (lookAtEntity) {
|
||||||
event.getGuiGraphics().drawString(Minecraft.getInstance().font, Component.translatable("tips.superbwarfare.drone.range")
|
event.getGuiGraphics().drawString(Minecraft.getInstance().font, Component.translatable("tips.superbwarfare.drone.range")
|
||||||
.append(Component.literal(new DecimalFormat("##.#").format(entityRange) + "M " + lookingEntity.getDisplayName().getString())),
|
.append(Component.literal(new DecimalFormat("##.#M ").format(entityRange) + lookingEntity.getDisplayName().getString())),
|
||||||
w / 2 + 12, h / 2 - 28, -1, false);
|
w / 2 + 12, h / 2 - 28, -1, false);
|
||||||
} else {
|
} else {
|
||||||
if (blockRange > 512) {
|
if (blockRange > 512) {
|
||||||
|
@ -48,7 +48,7 @@ public class SpyglassRangeOverlay {
|
||||||
.append(Component.literal("---M")), w / 2 + 12, h / 2 - 28, -1, false);
|
.append(Component.literal("---M")), w / 2 + 12, h / 2 - 28, -1, false);
|
||||||
} else {
|
} else {
|
||||||
event.getGuiGraphics().drawString(Minecraft.getInstance().font, Component.translatable("tips.superbwarfare.drone.range")
|
event.getGuiGraphics().drawString(Minecraft.getInstance().font, Component.translatable("tips.superbwarfare.drone.range")
|
||||||
.append(Component.literal(new DecimalFormat("##.#").format(blockRange) + "M")),
|
.append(Component.literal(new DecimalFormat("##.#M").format(blockRange))),
|
||||||
w / 2 + 12, h / 2 - 28, -1, false);
|
w / 2 + 12, h / 2 - 28, -1, false);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -236,7 +236,7 @@ public class VehicleHudOverlay {
|
||||||
|
|
||||||
//时速
|
//时速
|
||||||
|
|
||||||
guiGraphics.drawString(mc.font, Component.literal(new DecimalFormat("##").format(mobileVehicle.getDeltaMovement().length() * 72) + " KM/H"),
|
guiGraphics.drawString(mc.font, Component.literal(new DecimalFormat("## KM/H").format(mobileVehicle.getDeltaMovement().length() * 72)),
|
||||||
w / 2 + 160, h / 2 - 48, 0x66FF00, false);
|
w / 2 + 160, h / 2 - 48, 0x66FF00, false);
|
||||||
|
|
||||||
//低电量警告
|
//低电量警告
|
||||||
|
@ -265,13 +265,13 @@ public class VehicleHudOverlay {
|
||||||
}
|
}
|
||||||
|
|
||||||
if (lookAtEntity) {
|
if (lookAtEntity) {
|
||||||
guiGraphics.drawString(mc.font, Component.literal(new DecimalFormat("##").format(entityRange)),
|
guiGraphics.drawString(mc.font, Component.literal(new DecimalFormat("##.#M").format(entityRange)),
|
||||||
w / 2 - 6, h - 53, 0x66FF00, false);
|
w / 2 - 6, h - 53, 0x66FF00, false);
|
||||||
} else {
|
} else {
|
||||||
if (blockRange > 512) {
|
if (blockRange > 512) {
|
||||||
guiGraphics.drawString(mc.font, Component.literal("---"), w / 2 - 6, h - 53, 0x66FF00, false);
|
guiGraphics.drawString(mc.font, Component.literal("---"), w / 2 - 6, h - 53, 0x66FF00, false);
|
||||||
} else {
|
} else {
|
||||||
guiGraphics.drawString(mc.font, Component.literal(new DecimalFormat("##").format(blockRange)),
|
guiGraphics.drawString(mc.font, Component.literal(new DecimalFormat("##.#M").format(blockRange)),
|
||||||
w / 2 - 6, h - 53, 0x66FF00, false);
|
w / 2 - 6, h - 53, 0x66FF00, false);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -49,11 +49,11 @@ public class VehicleTeamOverlay {
|
||||||
Component.literal(player1.getDisplayName().getString() + (player1.getTeam() == null ? "" : " <" + (player1.getTeam().getName()) + ">")),
|
Component.literal(player1.getDisplayName().getString() + (player1.getTeam() == null ? "" : " <" + (player1.getTeam().getName()) + ">")),
|
||||||
w / 2 + 90, h / 2 - 4, player1.getTeamColor(), false);
|
w / 2 + 90, h / 2 - 4, player1.getTeamColor(), false);
|
||||||
event.getGuiGraphics().drawString(Minecraft.getInstance().font,
|
event.getGuiGraphics().drawString(Minecraft.getInstance().font,
|
||||||
Component.literal(lookingEntity.getDisplayName().getString() + " " + new DecimalFormat("##.#").format(entityRange) + "M"),
|
Component.literal(lookingEntity.getDisplayName().getString() + new DecimalFormat(" ##.#M").format(entityRange)),
|
||||||
w / 2 + 90, h / 2 + 5, player1.getTeamColor(), false);
|
w / 2 + 90, h / 2 + 5, player1.getTeamColor(), false);
|
||||||
} else {
|
} else {
|
||||||
event.getGuiGraphics().drawString(Minecraft.getInstance().font,
|
event.getGuiGraphics().drawString(Minecraft.getInstance().font,
|
||||||
Component.literal(lookingEntity.getDisplayName().getString() + " " + new DecimalFormat("##.#").format(entityRange) + "M"),
|
Component.literal(lookingEntity.getDisplayName().getString() + new DecimalFormat(" ##.#M").format(entityRange)),
|
||||||
w / 2 + 90, h / 2 + 5, -1, false);
|
w / 2 + 90, h / 2 + 5, -1, false);
|
||||||
}
|
}
|
||||||
poseStack.popPose();
|
poseStack.popPose();
|
||||||
|
|
|
@ -180,7 +180,7 @@ public class ClientGunImageTooltip implements ClientTooltipComponent {
|
||||||
|
|
||||||
return Component.translatable("des.superbwarfare.guns.bypass").withStyle(ChatFormatting.GRAY)
|
return Component.translatable("des.superbwarfare.guns.bypass").withStyle(ChatFormatting.GRAY)
|
||||||
.append(Component.literal("").withStyle(ChatFormatting.RESET))
|
.append(Component.literal("").withStyle(ChatFormatting.RESET))
|
||||||
.append(Component.literal(new DecimalFormat("##.##").format(bypassRate * 100) + "%").withStyle(ChatFormatting.GOLD));
|
.append(Component.literal(new DecimalFormat("##.##%").format(bypassRate * 100)).withStyle(ChatFormatting.GOLD));
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -190,7 +190,7 @@ public class ClientGunImageTooltip implements ClientTooltipComponent {
|
||||||
double headshot = GunsTool.getGunDoubleTag(stack, "Headshot", 0);
|
double headshot = GunsTool.getGunDoubleTag(stack, "Headshot", 0);
|
||||||
return Component.translatable("des.superbwarfare.guns.headshot").withStyle(ChatFormatting.GRAY)
|
return Component.translatable("des.superbwarfare.guns.headshot").withStyle(ChatFormatting.GRAY)
|
||||||
.append(Component.literal("").withStyle(ChatFormatting.RESET))
|
.append(Component.literal("").withStyle(ChatFormatting.RESET))
|
||||||
.append(Component.literal(new DecimalFormat("##.#").format(headshot) + "x").withStyle(ChatFormatting.AQUA));
|
.append(Component.literal(new DecimalFormat("##.#x").format(headshot)).withStyle(ChatFormatting.AQUA));
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
@ -129,7 +129,7 @@ public class TargetEntity extends LivingEntity implements GeoEntity, AnimatedEnt
|
||||||
|
|
||||||
if (sourceEntity instanceof Player player) {
|
if (sourceEntity instanceof Player player) {
|
||||||
player.displayClientMessage(Component.translatable("tips.superbwarfare.target.down",
|
player.displayClientMessage(Component.translatable("tips.superbwarfare.target.down",
|
||||||
new java.text.DecimalFormat("##.#").format((entity.position()).distanceTo((sourceEntity.position()))) + "M"), true);
|
new java.text.DecimalFormat("##.#M").format((entity.position()).distanceTo((sourceEntity.position())))), true);
|
||||||
SoundTool.playLocalSound(player, ModSounds.TARGET_DOWN.get(), 1, 1);
|
SoundTool.playLocalSound(player, ModSounds.TARGET_DOWN.get(), 1, 1);
|
||||||
targetEntity.entityData.set(DOWN_TIME, 40);
|
targetEntity.entityData.set(DOWN_TIME, 40);
|
||||||
}
|
}
|
||||||
|
|
|
@ -411,7 +411,7 @@ public class ProjectileEntity extends Entity implements IEntityAdditionalSpawnDa
|
||||||
|
|
||||||
player.displayClientMessage(Component.literal(String.valueOf(score))
|
player.displayClientMessage(Component.literal(String.valueOf(score))
|
||||||
.append(Component.translatable("tips.superbwarfare.shoot.rings"))
|
.append(Component.translatable("tips.superbwarfare.shoot.rings"))
|
||||||
.append(Component.literal(" " + new DecimalFormat("##.#").format(distance) + "m")), false);
|
.append(Component.literal(" " + new DecimalFormat("##.#m").format(distance) )), false);
|
||||||
|
|
||||||
if (!this.shooter.level().isClientSide() && this.shooter instanceof ServerPlayer serverPlayer) {
|
if (!this.shooter.level().isClientSide() && this.shooter instanceof ServerPlayer serverPlayer) {
|
||||||
var holder = score == 10 ? Holder.direct(ModSounds.HEADSHOT.get()) : Holder.direct(ModSounds.INDICATION.get());
|
var holder = score == 10 ? Holder.direct(ModSounds.HEADSHOT.get()) : Holder.direct(ModSounds.INDICATION.get());
|
||||||
|
|
|
@ -237,7 +237,7 @@ public class Lav150Entity extends ContainerMobileEntity implements GeoEntity, IC
|
||||||
}
|
}
|
||||||
|
|
||||||
if (this.level() instanceof ServerLevel) {
|
if (this.level() instanceof ServerLevel) {
|
||||||
if (this.getFirstPassenger() instanceof Player player) {
|
if (this.getFirstPassenger() instanceof Player) {
|
||||||
if ((this.getItemStacks().stream().filter(stack -> stack.is(ModItems.RIFLE_AMMO_BOX.get())).mapToInt(ItemStack::getCount).sum() > 0 && this.getEntityData().get(LOADED_COAX_AMMO) < 500)) {
|
if ((this.getItemStacks().stream().filter(stack -> stack.is(ModItems.RIFLE_AMMO_BOX.get())).mapToInt(ItemStack::getCount).sum() > 0 && this.getEntityData().get(LOADED_COAX_AMMO) < 500)) {
|
||||||
this.entityData.set(LOADED_COAX_AMMO, this.getEntityData().get(LOADED_COAX_AMMO) + 30);
|
this.entityData.set(LOADED_COAX_AMMO, this.getEntityData().get(LOADED_COAX_AMMO) + 30);
|
||||||
this.getItemStacks().stream().filter(stack -> stack.is(ModItems.RIFLE_AMMO_BOX.get())).findFirst().ifPresent(stack -> stack.shrink(1));
|
this.getItemStacks().stream().filter(stack -> stack.is(ModItems.RIFLE_AMMO_BOX.get())).findFirst().ifPresent(stack -> stack.shrink(1));
|
||||||
|
|
|
@ -190,7 +190,7 @@ public class LivingEventHandler {
|
||||||
if (entity instanceof TargetEntity && sourceEntity instanceof Player player) {
|
if (entity instanceof TargetEntity && sourceEntity instanceof Player player) {
|
||||||
player.displayClientMessage(Component.translatable("tips.superbwarfare.target.damage",
|
player.displayClientMessage(Component.translatable("tips.superbwarfare.target.damage",
|
||||||
new DecimalFormat("##.##").format(damage),
|
new DecimalFormat("##.##").format(damage),
|
||||||
new DecimalFormat("##.#").format(entity.position().distanceTo(sourceEntity.position())) + "m"), false);
|
new DecimalFormat("##.#m").format(entity.position().distanceTo(sourceEntity.position()))), false);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -128,7 +128,7 @@ public class Monitor extends Item {
|
||||||
|
|
||||||
Vec3 droneVec = new Vec3(stack.getOrCreateTag().getDouble("PosX"), stack.getOrCreateTag().getDouble("PosY"), stack.getOrCreateTag().getDouble("PosZ"));
|
Vec3 droneVec = new Vec3(stack.getOrCreateTag().getDouble("PosX"), stack.getOrCreateTag().getDouble("PosY"), stack.getOrCreateTag().getDouble("PosZ"));
|
||||||
|
|
||||||
list.add(Component.translatable("des.superbwarfare.monitor", new DecimalFormat("##.#").format(player.position().distanceTo(droneVec)) + "m").withStyle(ChatFormatting.GRAY));
|
list.add(Component.translatable("des.superbwarfare.monitor", new DecimalFormat("##.#m").format(player.position().distanceTo(droneVec))).withStyle(ChatFormatting.GRAY));
|
||||||
list.add(Component.literal("X: " + new DecimalFormat("##.#").format(droneVec.x) +
|
list.add(Component.literal("X: " + new DecimalFormat("##.#").format(droneVec.x) +
|
||||||
" Y: " + new DecimalFormat("##.#").format(droneVec.y) +
|
" Y: " + new DecimalFormat("##.#").format(droneVec.y) +
|
||||||
" Z: " + new DecimalFormat("##.#").format(droneVec.z)
|
" Z: " + new DecimalFormat("##.#").format(droneVec.z)
|
||||||
|
|
|
@ -42,7 +42,7 @@ public class Transcript extends Item {
|
||||||
tooltip.add(Component.translatable("des.superbwarfare.transcript.score").withStyle(ChatFormatting.GRAY)
|
tooltip.add(Component.translatable("des.superbwarfare.transcript.score").withStyle(ChatFormatting.GRAY)
|
||||||
.append(Component.literal(score + " ").withStyle(score == 10 ? ChatFormatting.GOLD : ChatFormatting.WHITE))
|
.append(Component.literal(score + " ").withStyle(score == 10 ? ChatFormatting.GOLD : ChatFormatting.WHITE))
|
||||||
.append(Component.translatable("des.superbwarfare.transcript.distance").withStyle(ChatFormatting.GRAY))
|
.append(Component.translatable("des.superbwarfare.transcript.distance").withStyle(ChatFormatting.GRAY))
|
||||||
.append(Component.literal(new DecimalFormat("##.#").format(tag.getDouble("Distance")) + "m").withStyle(ChatFormatting.WHITE)));
|
.append(Component.literal(new DecimalFormat("##.#m").format(tag.getDouble("Distance"))).withStyle(ChatFormatting.WHITE)));
|
||||||
}
|
}
|
||||||
|
|
||||||
tooltip.add(Component.translatable("des.superbwarfare.transcript.total").withStyle(ChatFormatting.YELLOW)
|
tooltip.add(Component.translatable("des.superbwarfare.transcript.total").withStyle(ChatFormatting.YELLOW)
|
||||||
|
|
|
@ -51,8 +51,8 @@ public class AdjustMortarAngleMessage {
|
||||||
}
|
}
|
||||||
|
|
||||||
player.displayClientMessage(Component.translatable("tips.superbwarfare.mortar.angle",
|
player.displayClientMessage(Component.translatable("tips.superbwarfare.mortar.angle",
|
||||||
new DecimalFormat("##.##").format(angle) + "°",
|
new DecimalFormat("##.##°").format(angle),
|
||||||
new DecimalFormat("##.#").format((int) RangeHelper.getRange(angle)) + "m"), true);
|
new DecimalFormat("##.#m").format((int) RangeHelper.getRange(angle))), true);
|
||||||
SoundTool.playLocalSound(player, ModSounds.ADJUST_FOV.get(), 1f, 0.7f);
|
SoundTool.playLocalSound(player, ModSounds.ADJUST_FOV.get(), 1f, 0.7f);
|
||||||
});
|
});
|
||||||
context.get().setPacketHandled(true);
|
context.get().setPacketHandled(true);
|
||||||
|
|
|
@ -59,7 +59,7 @@ public class AdjustZoomFovMessage {
|
||||||
if (GunsTool.getGunIntTag(stack, "RPM", 0) == 1095) {
|
if (GunsTool.getGunIntTag(stack, "RPM", 0) == 1095) {
|
||||||
GunsTool.setGunIntTag(stack, "RPM", 1100);
|
GunsTool.setGunIntTag(stack, "RPM", 1100);
|
||||||
}
|
}
|
||||||
player.displayClientMessage(Component.literal("RPM: " + new DecimalFormat("##").format(GunsTool.getGunIntTag(stack, "RPM", 0))), true);
|
player.displayClientMessage(Component.literal(new DecimalFormat("RPM: ##").format(GunsTool.getGunIntTag(stack, "RPM", 0))), true);
|
||||||
int rpm = GunsTool.getGunIntTag(stack, "RPM", 0);
|
int rpm = GunsTool.getGunIntTag(stack, "RPM", 0);
|
||||||
if (rpm > minRpm && rpm < maxRpm) {
|
if (rpm > minRpm && rpm < maxRpm) {
|
||||||
SoundTool.playLocalSound(player, ModSounds.ADJUST_FOV.get(), 1f, 0.7f);
|
SoundTool.playLocalSound(player, ModSounds.ADJUST_FOV.get(), 1f, 0.7f);
|
||||||
|
|
Loading…
Add table
Reference in a new issue