Fluid registry
This commit is contained in:
@@ -25,6 +25,7 @@ import { expand_items, list_matches } from "./tags.ts";
|
||||
import { GAME_VERSION } from "./constants.ts";
|
||||
import {
|
||||
by_kind,
|
||||
color,
|
||||
find_problems,
|
||||
id,
|
||||
id_or_tag,
|
||||
@@ -456,6 +457,18 @@ const effect_schema = z.object({
|
||||
|
||||
export type EffectJson = z.infer<typeof effect_schema>;
|
||||
|
||||
// a kind of fluid, like neoforge's FluidType: what it is apart from any block, container or amount. a block flows in
|
||||
// the world with its own "fluid" field, which is another thing
|
||||
const fluid_schema = z.object({
|
||||
id,
|
||||
// what players see, from the id when not set like an item's
|
||||
name: text.optional(),
|
||||
// for whatever shows it, like a container's tinted overlay
|
||||
color,
|
||||
});
|
||||
|
||||
export type FluidJson = z.infer<typeof fluid_schema>;
|
||||
|
||||
// a box from origin to origin + size, textured like minecraft's box uv: see the renderer's FACES
|
||||
const entity_cube = z.object({
|
||||
origin: vec3,
|
||||
@@ -869,6 +882,10 @@ export function validate_effect(json: unknown): Problems {
|
||||
return find_problems(effect_schema, json);
|
||||
}
|
||||
|
||||
export function validate_fluid(json: unknown): Problems {
|
||||
return find_problems(fluid_schema, json);
|
||||
}
|
||||
|
||||
export function validate_entity_model(json: unknown): Problems {
|
||||
return find_problems(entity_model_schema, json);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user