Undergarden mod !
This commit is contained in:
+9
-6
@@ -96,15 +96,18 @@ export interface EntityJson {
|
||||
// an entity model, see EntityModelJson
|
||||
model?: string;
|
||||
texture: string;
|
||||
// "animal" (the default) wanders around, panics when hurt and looks at players. "scripted" stays where scripts put
|
||||
// it: no gravity, ai or health, and it isn't saved with the world, like the fishing hook
|
||||
behavior?: "animal" | "scripted";
|
||||
// "animal" (the default) wanders around, panics when hurt and looks at players. "monster" goes after players it
|
||||
// sees and whoever hurts it, and despawns far from players, like minecraft's zombies. "scripted" stays where
|
||||
// scripts put it: no gravity, ai or health, and it isn't saved with the world, like the fishing hook
|
||||
behavior?: "animal" | "monster" | "scripted";
|
||||
// its collision box in blocks, width is for both x and z
|
||||
width: number;
|
||||
height: number;
|
||||
max_health?: number;
|
||||
// minecraft's per tick speed, 0.25 for most animals
|
||||
movement_speed?: number;
|
||||
// what its hits do, for monsters. 2 when not set, like minecraft's
|
||||
attack_damage?: number;
|
||||
// protection from physical and from arcane damage, not used yet
|
||||
physical_shielding?: number;
|
||||
arcane_shielding?: number;
|
||||
@@ -705,15 +708,15 @@ export function validate_entity(json: unknown): Problems {
|
||||
...(json.model === undefined ? [] : validate_id(json.model, "model")),
|
||||
...validate_id(json.texture, "texture"),
|
||||
];
|
||||
if (json.behavior !== undefined && json.behavior !== "animal" && json.behavior !== "scripted") {
|
||||
problems.push('behavior must be "animal" or "scripted"');
|
||||
if (json.behavior !== undefined && !["animal", "monster", "scripted"].includes(json.behavior as string)) {
|
||||
problems.push('behavior must be "animal", "monster" or "scripted"');
|
||||
}
|
||||
for (const key of ["width", "height"]) {
|
||||
if (typeof json[key] !== "number" || json[key] <= 0 || json[key] > 16) {
|
||||
problems.push(`${key} must be a number of blocks above 0, at most 16`);
|
||||
}
|
||||
}
|
||||
for (const key of ["max_health", "movement_speed", "physical_shielding", "arcane_shielding"]) {
|
||||
for (const key of ["max_health", "movement_speed", "attack_damage", "physical_shielding", "arcane_shielding"]) {
|
||||
if (json[key] !== undefined && (typeof json[key] !== "number" || json[key] < 0)) {
|
||||
problems.push(`${key} must be a number, 0 or more`);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user