调整遥控器物品描述
This commit is contained in:
parent
076255440d
commit
c35f5aa2b1
1 changed files with 5 additions and 1 deletions
|
@ -117,11 +117,15 @@ public class Monitor extends Item {
|
||||||
@OnlyIn(Dist.CLIENT)
|
@OnlyIn(Dist.CLIENT)
|
||||||
@Override
|
@Override
|
||||||
public void appendHoverText(ItemStack stack, Level world, List<Component> list, TooltipFlag flag) {
|
public void appendHoverText(ItemStack stack, Level world, List<Component> list, TooltipFlag flag) {
|
||||||
if (stack.getOrCreateTag().getString(LINKED_DRONE).equals("none")) return;
|
if (!stack.getOrCreateTag().contains(LINKED_DRONE) || stack.getOrCreateTag().getString(LINKED_DRONE).equals("none"))
|
||||||
|
return;
|
||||||
|
|
||||||
Player player = Minecraft.getInstance().player;
|
Player player = Minecraft.getInstance().player;
|
||||||
if (player == null) return;
|
if (player == null) return;
|
||||||
|
|
||||||
|
if (!stack.getOrCreateTag().contains("PosX") || !stack.getOrCreateTag().contains("PosY") || !stack.getOrCreateTag().contains("PosZ"))
|
||||||
|
return;
|
||||||
|
|
||||||
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("##.#").format(player.position().distanceTo(droneVec)) + "m").withStyle(ChatFormatting.GRAY));
|
||||||
|
|
Loading…
Add table
Reference in a new issue