修复狗牌名称显示配置处理问题
This commit is contained in:
parent
60a7dbc11c
commit
db692df419
1 changed files with 9 additions and 5 deletions
|
@ -37,7 +37,6 @@ import org.jetbrains.annotations.Nullable;
|
|||
import top.theillusivec4.curios.api.CuriosApi;
|
||||
|
||||
import javax.annotation.ParametersAreNonnullByDefault;
|
||||
import java.util.concurrent.atomic.AtomicReference;
|
||||
|
||||
import static com.atsuishio.superbwarfare.client.RenderHelper.preciseBlit;
|
||||
|
||||
|
@ -368,13 +367,18 @@ public class KillMessageOverlay implements LayeredDraw.Layer {
|
|||
}
|
||||
|
||||
public static String getEntityName(Entity entity) {
|
||||
AtomicReference<String> targetName = new AtomicReference<>(entity.getDisplayName().getString());
|
||||
if (entity.getDisplayName() == null) return "";
|
||||
|
||||
var name = entity.getDisplayName().getString();
|
||||
if (!DisplayConfig.DOG_TAG_NAME_VISIBLE.get()) return name;
|
||||
|
||||
if (entity instanceof Player targetPlayer) {
|
||||
CuriosApi.getCuriosInventory(targetPlayer)
|
||||
return CuriosApi.getCuriosInventory(targetPlayer)
|
||||
.flatMap(c -> c.findFirstCurio(ModItems.DOG_TAG.get()))
|
||||
.ifPresent(s -> targetName.set(s.stack().getHoverName().getString()));
|
||||
.map(s -> s.stack().getHoverName().getString())
|
||||
.orElse(name);
|
||||
}
|
||||
return targetName.get();
|
||||
return name;
|
||||
}
|
||||
|
||||
@Nullable
|
||||
|
|
Loading…
Add table
Reference in a new issue