← ClaudeAtlas

nms-custom-entitylisted

建立自定義 NMS 實體:繼承現有 Mob 類別、自訂 PathfinderGoal、替換 vanilla 實體行為 / Create custom NMS entities with custom PathfinderGoal AI
MrPippi/MJP-Claude-Skills · ★ 1 · AI & Automation · score 70
Install: claude install-skill MrPippi/MJP-Claude-Skills
# NMS Custom Entity / NMS 自定義實體 ## 技能名稱 / Skill Name `nms-custom-entity` ## 目的 / Purpose 透過繼承 NMS Mob 類別並覆寫 `registerGoals()` 加入自訂 `PathfinderGoal`,實現自定義 AI 行為。適用於客製化 Boss、NPC、守衛等場景。 ## NMS 版本需求 / NMS Version Requirements - Paper 1.21 – 1.21.3 - Paperweight userdev 1.7.2+ - 須使用 `paper-plugin.yml`(確保早於 Bukkit plugin 載入) ## 觸發條件 / Triggers - 「自定��實體」「custom entity」「NMS AI」 - 「PathfinderGoal」「自訂 mob」「custom mob」 - 「entity goal」「custom zombie」「replace entity」 ## 輸入參數 / Inputs | 參數 | 範例 | 說明 | |------|------|------| | `package_name` | `com.example.entities` | 產出類別所在 package | | `entity_class_name` | `CustomZombie` | 自定義實體類名 | | `base_entity` | `Zombie` | 繼承的 NMS 基類 | | `entity_id` | `my_custom_zombie` | 註冊用 ID(namespaced) | | `goal_class_name` | `FollowClosestPlayerGoal` | 自訂 goal 類名 | ## 輸出產物 / Outputs - `CustomZombie.java` — 繼承 `net.minecraft.world.entity.monster.Zombie` 的自定義實體 - `FollowClosestPlayerGoal.java` — 自訂 `PathfinderGoal` 範本 - `EntitySpawner.java` — 生成工具類 - `EntityListener.java`(選)— 攔截 vanilla spawn 替換為自定義實體 ## Paperweight 建置設定 / Build Setup 參見 `Skills/paper-nms/PLATFORM.md`。 ## 代碼範本 / Code Template ### `CustomZombie.java` ```java package com.example.entities; import net.minecraft.world.entity.EntityType; import net.minecraft.world.entity.ai.goal.FloatGoal; import net.minecraft.world.entity.ai.goal.LookAtPlayerGoal; import net.minecraft.world.entity.ai.goal.MeleeAttackGoal; import net.minecraft.world.entity.ai.goal.RandomLookAroundGoal; import net.min