NMS Playerv1.0.0已發布

NMS 玩家 Profile 操作

NMS Player Profile

操作 GameProfile 進行 skin 注入,用於 NPC 外觀設定與假玩家實體(Paper NMS + Mojang mappings)。

nmsgameprofileskinnpctexturemojang-mapped
更新:2026年4月30日GitHub

NMS Player Profile

目的

透過 NMS GameProfile 操作玩家皮膚(texture)屬性,實現 NPC 外觀注入、假玩家實體皮膚設定,以及客製化頭顱 skull 顯示。


平台需求

  • Paper 1.21 – 1.21.3
  • Paperweight userdev 1.7.2+
  • Mojang mappings(Paper 1.20.5+ 原生支援)
  • Java 21

產生的代碼

ProfileBuilder.java

// 從現有玩家複製 profile
GameProfile profile = ProfileBuilder.copyFrom(player);

// 以 Base64 texture 建立自定義 profile
GameProfile custom = ProfileBuilder.withSkin("NpcName", textureValue, signature);

SkinFetcher.java(非同步抓取)

SkinFetcher.fetchByName(plugin, "Notch").thenAccept(profile -> {
    Bukkit.getScheduler().runTask(plugin, () -> spawnNpc(location, profile));
});

執行緒安全

  • ProfileBuilder 純資料操作,可在任意執行緒呼叫
  • skin 抓取後需切回主執行緒套用到 NPC 實體