Skip to main content
Version: 2.0

Creating NPC-s

First, "alive", person

susu



Sample
fun npc(
pos: Vec3,
name: String = "NPC",
model: String = "hollowengine:models/entity/player_model.gltf",
rotation: Vec2 = rotation(0, 0),
world: String = "minecraft:overworld",
size: Pair<Float, Float> = 0.6f to 1.8f,
attributes: Map<String, Float> = emptyMap(),
textures: Map<String, String> = emptyMap(),
animations: Map<AnimationType, String> = emptyMap(),
tranfsorm: Transform = Transform(),
showName: Boolean = true,
inverseHeadRotation: Boolean = false
): NPCEntity

Example
val npcID = npc(
pos = pos(29, 85, 23), // Coordinates what NPC will spawns.
name = "НИП", // The NPC name, for chat and nametag (nametag can be turned off)
model = "my_mo_id:path/to/my_top_model.gltf", // Resource path to model.
rotation = rotation(180, 0), // Witch position will look npc with `pitch` and `yaw`.
world = "my_mod_id:my_dimension_id", // Dimension, what npc will spawn in.
size = 1f to 1.2f, // Scale of HitBox by width and height.
attributes = mapOf( // NPC Attributes.
"my_mod_id:my.best.attrubute_one" to 10f,
"my_mod_id:my.best.attribute_two" to 0.5f,
...
),
textures = mapOf( // Textures for NPC model.
"model/texture_id_one" to "my_mod_id:path/to/my_best_texture.png",
"model/texture_id_two" to "my_mod_id:path/to/my_another_texture.png",
...
),
animations = mapOf( // Parenting custom NPC animations.
AnimationType.IDLE to "bestIdleAnimation",
AnimationType.WALK to "walkAnimLoop",
...
),
transform = Transform( // Transformation of NPC model
tX = 1.1f, tY = 0.4f, tZ = 3f, // Position model with X, Y и Z
rX = 90f, rY = 2.4f, rZ = 194f, // Rotation with X, y и Z
sX = 0.1f, sY = 1.001f, sZ = 9.2f // Scale with X, Y и Z
),
showName = false, // Turn NPC-s nametag off
inverseHeadRotation = true // If NPC-s head rotate wrongly
)