DECI-lib

DECI-lib

数据实体组合界面 - 使用数据包创建复杂生物!

数据驱动实体组合接口

Deci-Lib 是一个模块化框架,用于通过数据而非代码来定义完全自定义的生物。您可以创建行为、时机和表现形式的组合,从而完全通过 JSON 实现复杂的生物遭遇,同时保持确定性和可调试性。

生物由特性构建而成:这些是离散的行为单元,例如近战攻击、横扫、冲锋、伏击机制和移动控制器。这些特性在共享的生命周期(蓄力 → 释放 → 恢复)内运作,该生命周期直接在数据中暴露。

动画在生命周期层面集成,而非与特定逻辑绑定。Deci-Lib 可以使用 GeckoLib 或 AzureLib 等后端,但生物行为与这些后端解耦。无论您使用完整的动画系统、自定义模型还是替代渲染方式,生物定义都保持完全相同。循环状态和动作动画与行为一同定义。

特性通过优先级系统进行竞争,并受冷却时间和最短冷却时间阈值的限制,防止无控制的连锁反应,同时保持结果的可预测性。移动模式、目标锁定逻辑和位置约束均由数据定义,使您能够创建根据环境而非看似随机地行动的生物。

免责声明

Deci-Lib 最好被理解为实体行为上的抽象层:它标准化了生物的构建方式、能力的执行方式以及动画的同步方式,而将实际的设计决策完全交予作者手中。它并非用于作为低成本的游戏内容生成器。这个模组能产生的最佳内容,是那些背后有设计意图、并且在实现上有所克制而非无节制扩张的内容。

此模组默认注册并生成了示例生物。如果需要,请在配置中将其禁用。

包含的生物有:顶级掠食者、暗影拳、凶狼、巨鼠、鳞甲弓箭手、鳞甲毒蛇、鳞甲突击者


示例生物(默认包含并会生成):

{
  "id": "apex_predator",
  "archetype": "bruiser",
  "theme": "beast",
  "form": "azurelib",

  "render": {
    "backend": "azurelib",
    "assets": {
      "geo":       "deci-lib:geo/bear.geo.json",
      "animation": "deci-lib:animations/bear.animations.json",
      "texture":   "deci-lib:textures/entity/bear.png"
    },
    "loops": {
      "idle": "bear.anim.idle",
      "idle_hostile": "bear.anim.idle",
      "moving": "bear.anim.moving",
      "moving_hostile": "bear.anim.moving",
      "running": "bear.anim.moving2"
    }
  },
  "scale": {
    "width": 1.2,
    "height": 2.8
  },
  "tuning": {
    "health": "HIGH",
    "damage": "HIGH",
    "speed": "MEDIUM",
    "detection": "HIGH"
  },

  "attributes": {
    "max_health": 40.0,
    "attack_damage": 10.0,
    "melee_range": 3.0,
    "knockback_resistance": 0.5
  },

  "features": [
    {
      "type": "idle",
      "mode": "wander",
      "wander_range": 6.0,
      "pause_ticks": 40,
      "scan_interval_ticks": 30
    },

    {
      "type": "charge",
      "ability_id": "ground_slam",
      "cooldown_ticks": 120,
      "min_cooldown_ticks": 80,
      "charge_speed":          0,
      "upwards_speed":         0,
      "windup_ticks": 12,
      "release_delay": 20,

      "release_type": "radial",
      "range": 4.5,
      "coeff": 2.5,

      "priority": 120,

      "on_start_particles": "smoke_burst",
      "on_complete_particles": "smoke_ring",

      "animations": {
        "on_windup": "bear.anim.slam"
      }
    },

    {
      "type": "charge",
      "ability_id": "swipe",
      "cooldown_ticks": 120,
      "min_cooldown_ticks": 80,
      "charge_speed":          0,
      "upwards_speed":         0,
      "windup_ticks": 10,
      "release_delay": 6,

      "release_type": "arc",
      "range": 4.5,
      "coeff": 1.5,

      "priority": 100,

      "on_start_particles": "smoke_burst",
      "on_complete_particles": "sweep_arc",

      "animations": {
        "on_windup": "bear.anim.swipe1"
      }
    },

    {
      "type": "melee",
      "cooldown_ticks": 15,
      "priority": 60,

      "animations": {
        "on_action": "bear.anim.swipe2"
      }
    }
  ]
}
{
  "id": "shadow_fist",
  "archetype": "skirmisher",
  "theme": "sand",
  "form": "azurelib",
  "render": {
    "backend": "azurelib",
    "assets": {
      "geo":       "deci-lib:geo/shadow_fist.geo.json",
      "animation": "deci-lib:animations/rogue.animations.json",
      "texture":   "deci-lib:textures/entity/shadow_fist.png"
    },
    "loops": {
      "idle":   "animation.mob.idle_calm",
      "idle_hostile":   "animation.mob.idle",
      "moving": "animation.mob.walk_calm",
      "moving_hostile": "animation.mob.walk",
      "running": "animation.mob.running"

    }
  },
  "tuning": {
    "health":    "MEDIUM",
    "damage":    "LOW",
    "speed":     "HIGH",
    "detection": "MEDIUM"
  },
  "attributes": {
    "max_health": 40.0,
    "attack_damage": 5.0,
    "melee_range":   2.0
  },
  "features": [
    {
      "type":         "idle",
      "mode":         "wander",
      "wander_range": 5.0,
      "pause_ticks":  20
    },
    {
      "type":           "melee",
      "cooldown_ticks": 20,
      "animations": {
        "on_action": "animation.mob.swing1"
      }
    },
    {
      "type":                  "ambush_attack",
      "ability_id":            "sand_vanish",
      "cooldown_ticks":        200,
      "min_cooldown_ticks":    60,
      "hidden_duration_ticks": 40,
      "movement_mode":         "strafe",
      "surface_mode":          "behind",
      "strafe_radius":         4.5,
      "burrow_mode":           true,
      "priority":              18,
      "on_tick_particles":     "dust_trail",
      "on_interrupt_particles":"smoke_burst",
      "animations": {
        "on_complete": "animation.mob.swing1"
      }
    },
    {
      "type":                  "charge",
      "ability_id":            "sand_dash",
      "cooldown_ticks":        80,
      "windup_ticks":          4,
      "release_delay":         10,
      "release_type":          "arc",
      "half_angle_deg":        50.0,
      "range":                 3.0,
      "coeff":                 0.9,
      "charge_speed":          2.2,
      "upwards_speed":         0.1,
      "on_start_particles":    "poof_burst",
      "on_complete_particles": "sweep_arc",
      "animations": {
        "on_windup":  "animation.mob.trickster.roll",
        "on_release": "animation.mob.slashtwo"
      }
    },
    {
      "type":           "sweep",
      "ability_id":     "sand_swipe",
      "cooldown_ticks": 28,
      "min_cooldown":   8,
      "half_angle_deg": 55.0,
      "range":          2.5,
      "coeff":          0.75,
      "animations": {
        "on_action": "animation.mob.slashtwo"
      }
    }
  ]
}

生成数据:

{
  "mob_id": "shadow_fist",
  "category": "monster",
  "spawns": [
    {
      "weight": 5,
      "group_size": [1, 1],
      "biomes": ["#minecraft:is_forest", "#minecraft:is_jungle"],
      "dimension": "minecraft:overworld",
      "light_level": { "min": 0, "max": 7 },
      "conditions": ["on_ground", "natural_only"]
    },
    {
      "weight": 5,
      "group_size": [2, 3],
      "biomes": ["minecraft:dark_forest"],
      "dimension": "minecraft:overworld",
      "light_level": { "min": 0, "max": 11 },
      "conditions": ["on_ground", "natural_only"]
    }
  ]
}
{
  "mob_id": "apex_predator",
  "category": "monster",
  "spawns": [
    {
      "weight": 5,
      "group_size": [1, 1],
      "biomes": ["#minecraft:is_forest", "#minecraft:is_jungle"],
      "dimension": "minecraft:overworld",
      "light_level": { "min": 0, "max": 7 },
      "conditions": ["on_ground", "natural_only"]
    }
  ]
}

数据包结构:

deci-lib_datapack/
├── pack.mcmeta
└── data/
    └── deci-lib/
        ├── mob_spawns/
        │   ├── apex_predator.json
        │   └── shadow_fist.json
        └── mobs/
            ├── apex_predator.json
            └── shadow_fist.json