superb-warfare/src/main/java/com/atsuishio/superbwarfare/client/tooltip/ClientLauncherImageTooltip.java
2025-01-06 23:52:00 +08:00

28 lines
1.3 KiB
Java

package com.atsuishio.superbwarfare.client.tooltip;
import com.atsuishio.superbwarfare.client.tooltip.component.GunImageComponent;
import com.atsuishio.superbwarfare.tools.GunsTool;
import com.atsuishio.superbwarfare.tools.TooltipTool;
import net.minecraft.ChatFormatting;
import net.minecraft.network.chat.Component;
import java.text.DecimalFormat;
public class ClientLauncherImageTooltip extends ClientGunImageTooltip {
public ClientLauncherImageTooltip(GunImageComponent tooltip) {
super(tooltip);
}
@Override
protected Component getDamageComponent() {
double damage = GunsTool.getGunDoubleTag(stack, "Damage", 0) * TooltipTool.perkDamage(stack);
double explosionDamage = GunsTool.getGunDoubleTag(stack, "ExplosionDamage", 0);
return Component.translatable("des.superbwarfare.guns.damage").withStyle(ChatFormatting.GRAY)
.append(Component.literal("").withStyle(ChatFormatting.RESET))
.append(Component.literal(new DecimalFormat("##.#").format(damage)).withStyle(ChatFormatting.GREEN)
.append(Component.literal("").withStyle(ChatFormatting.RESET))
.append(Component.literal(" + " + new DecimalFormat("##.#").format(explosionDamage)).withStyle(ChatFormatting.GOLD)));
}
}