修复perk信息显示问题
This commit is contained in:
parent
7736e8264f
commit
4e2119d4b7
2 changed files with 3 additions and 7 deletions
|
@ -255,10 +255,8 @@ public class ClientGunImageTooltip implements ClientTooltipComponent {
|
||||||
var ammoItem = perkInstance.perk().getItem().get();
|
var ammoItem = perkInstance.perk().getItem().get();
|
||||||
guiGraphics.renderItem(ammoItem.getDefaultInstance(), x, y + 4 + yOffset);
|
guiGraphics.renderItem(ammoItem.getDefaultInstance(), x, y + 4 + yOffset);
|
||||||
|
|
||||||
var ids = perkInstance.perk().descriptionId.split(":");
|
var id = perkInstance.perk().descriptionId;
|
||||||
if (ids.length <= 1) continue;
|
|
||||||
|
|
||||||
String id = ids[1];
|
|
||||||
var component = Component.translatable("item.superbwarfare." + id).withStyle(type.getColor())
|
var component = Component.translatable("item.superbwarfare." + id).withStyle(type.getColor())
|
||||||
.append(Component.literal(" ").withStyle(ChatFormatting.RESET))
|
.append(Component.literal(" ").withStyle(ChatFormatting.RESET))
|
||||||
.append(Component.literal(" Lvl. " + perkInstance.level()).withStyle(ChatFormatting.WHITE));
|
.append(Component.literal(" Lvl. " + perkInstance.level()).withStyle(ChatFormatting.WHITE));
|
||||||
|
@ -294,10 +292,8 @@ public class ClientGunImageTooltip implements ClientTooltipComponent {
|
||||||
var perkInstance = data.perk.getInstance(type);
|
var perkInstance = data.perk.getInstance(type);
|
||||||
if (perkInstance == null) continue;
|
if (perkInstance == null) continue;
|
||||||
|
|
||||||
var ids = perkInstance.perk().descriptionId.split(":");
|
var id = perkInstance.perk().descriptionId;
|
||||||
if (ids.length <= 1) continue;
|
|
||||||
|
|
||||||
String id = ids[1];
|
|
||||||
var ammoDesComponent = Component.translatable("des.superbwarfare." + id).withStyle(ChatFormatting.GRAY);
|
var ammoDesComponent = Component.translatable("des.superbwarfare." + id).withStyle(ChatFormatting.GRAY);
|
||||||
width = Math.max(width, font.width(ammoDesComponent));
|
width = Math.max(width, font.width(ammoDesComponent));
|
||||||
}
|
}
|
||||||
|
|
|
@ -24,7 +24,7 @@ public final class Perks {
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean has(Perk.Type type) {
|
public boolean has(Perk.Type type) {
|
||||||
return perks.contains(type.getName());
|
return perks.contains(type.getName()) && !perks.getCompound(type.getName()).getString("Name").isEmpty();
|
||||||
}
|
}
|
||||||
|
|
||||||
public void set(PerkInstance instance) {
|
public void set(PerkInstance instance) {
|
||||||
|
|
Loading…
Add table
Reference in a new issue