添加哨兵描述方法
This commit is contained in:
parent
049c34edd5
commit
571d1f1e48
2 changed files with 41 additions and 2 deletions
|
@ -10,6 +10,7 @@ import net.mcreator.target.procedures.SentinelWuPinZaiBeiBaoZhongShiMeiKeFaSheng
|
||||||
import net.mcreator.target.tools.GunsTool;
|
import net.mcreator.target.tools.GunsTool;
|
||||||
import net.mcreator.target.tools.ItemNBTTool;
|
import net.mcreator.target.tools.ItemNBTTool;
|
||||||
import net.mcreator.target.tools.RarityTool;
|
import net.mcreator.target.tools.RarityTool;
|
||||||
|
import net.mcreator.target.tools.TooltipTool;
|
||||||
import net.minecraft.client.Minecraft;
|
import net.minecraft.client.Minecraft;
|
||||||
import net.minecraft.client.model.HumanoidModel;
|
import net.minecraft.client.model.HumanoidModel;
|
||||||
import net.minecraft.client.player.LocalPlayer;
|
import net.minecraft.client.player.LocalPlayer;
|
||||||
|
@ -164,8 +165,8 @@ public class SentinelItem extends GunItem implements GeoItem, AnimatedItem {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void appendHoverText(ItemStack itemstack, Level world, List<Component> list, TooltipFlag flag) {
|
public void appendHoverText(ItemStack stack, Level world, List<Component> list, TooltipFlag flag) {
|
||||||
super.appendHoverText(itemstack, world, list, flag);
|
TooltipTool.addSentinelTips(list, stack);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|
|
@ -66,4 +66,42 @@ public class TooltipTool {
|
||||||
.append(Component.literal(level + " " + new DecimalFormat("##.##").format(rate) + "%").withStyle(formatting).withStyle(ChatFormatting.BOLD)));
|
.append(Component.literal(level + " " + new DecimalFormat("##.##").format(rate) + "%").withStyle(formatting).withStyle(ChatFormatting.BOLD)));
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static void addBocekTips(List<Component> tooltip, ItemStack stack) {
|
||||||
|
// tooltip.add(Component.literal(""));
|
||||||
|
//
|
||||||
|
// double damage = (ItemNBTTool.getDouble(stack, "damage", 0) +
|
||||||
|
// ItemNBTTool.getDouble(stack, "adddamage", 0))
|
||||||
|
// * ItemNBTTool.getDouble(stack, "damageadd", 1);
|
||||||
|
//
|
||||||
|
// tooltip.add(Component.translatable("des.target.tips.damage").withStyle(ChatFormatting.GRAY)
|
||||||
|
// .append(Component.literal("").withStyle(ChatFormatting.RESET))
|
||||||
|
// .append(Component.literal(new DecimalFormat("##.#").format(damage)).withStyle(ChatFormatting.GREEN)));
|
||||||
|
//
|
||||||
|
// addLevelTips(tooltip, stack);
|
||||||
|
}
|
||||||
|
|
||||||
|
public static void addSentinelTips(List<Component> tooltip, ItemStack stack) {
|
||||||
|
tooltip.add(Component.literal(""));
|
||||||
|
|
||||||
|
boolean flag = ItemNBTTool.getDouble(stack, "chargingtime", 0) > 0;
|
||||||
|
|
||||||
|
if (flag) {
|
||||||
|
double damage = (ItemNBTTool.getDouble(stack, "damage", 0) +
|
||||||
|
ItemNBTTool.getDouble(stack, "adddamage", 0))
|
||||||
|
* ItemNBTTool.getDouble(stack, "damageadd", 1);
|
||||||
|
|
||||||
|
tooltip.add(Component.translatable("des.target.tips.damage").withStyle(ChatFormatting.GRAY)
|
||||||
|
.append(Component.literal("").withStyle(ChatFormatting.RESET))
|
||||||
|
.append(Component.literal(new DecimalFormat("##.#").format(damage)).withStyle(ChatFormatting.AQUA).withStyle(ChatFormatting.BOLD)));
|
||||||
|
} else {
|
||||||
|
double damage = ItemNBTTool.getDouble(stack, "damage", 0) * ItemNBTTool.getDouble(stack, "damageadd", 1);
|
||||||
|
|
||||||
|
tooltip.add(Component.translatable("des.target.tips.damage").withStyle(ChatFormatting.GRAY)
|
||||||
|
.append(Component.literal("").withStyle(ChatFormatting.RESET))
|
||||||
|
.append(Component.literal(new DecimalFormat("##.#").format(damage)).withStyle(ChatFormatting.GREEN)));
|
||||||
|
}
|
||||||
|
|
||||||
|
addLevelTips(tooltip, stack);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Reference in a new issue