Fishing hook
This commit is contained in:
+9
-3
@@ -80,12 +80,15 @@ export interface ItemJson {
|
||||
components?: Record<string, unknown>;
|
||||
}
|
||||
|
||||
// a kind of mob, drawn with an entity model and one texture. it wanders around, panics when hurt and looks at players
|
||||
// a kind of entity, drawn with an entity model and one texture, or without a model as its texture facing the camera
|
||||
export interface EntityJson {
|
||||
id: string;
|
||||
// an entity model, see EntityModelJson
|
||||
model: string;
|
||||
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";
|
||||
// its collision box in blocks, width is for both x and z
|
||||
width: number;
|
||||
height: number;
|
||||
@@ -629,9 +632,12 @@ export function validate_entity(json: unknown): Problems {
|
||||
if (!is_object(json)) return ["entity must be an object"];
|
||||
const problems = [
|
||||
...validate_id(json.id, "id"),
|
||||
...validate_id(json.model, "model"),
|
||||
...(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"');
|
||||
}
|
||||
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`);
|
||||
|
||||
Reference in New Issue
Block a user