Fluid containers

This commit is contained in:
2026-10-25 15:02:31 -03:00
parent fc27771a92
commit 26b59a1899
24 changed files with 486 additions and 82 deletions
+20
View File
@@ -247,6 +247,23 @@ export interface FoodProperties {
returns?: string;
}
// an item that holds one fluid, full or empty, like a bucket. a full one's stack data is { fluid: FluidVariant }, see
// docs/modding/resources/fluids.md. what it looks like full is a layer tinted "fluid"
export interface FluidContainerProperties {
// how much a full one holds, in mB
capacity: number;
// how many full ones fit in a slot, the item's max_stack when not set
full_max_stack?: number;
}
// a texture drawn over a flat item's own, like the fluid in a bucket, drawn in its tint's color: a block tint's color
// outside any biome, or "fluid" for the fluid a fluid container holds. a layer whose tint has no color for a stack, like
// "fluid" on an empty container, isn't drawn
export interface ItemLayer {
texture: string;
tint?: TintColor | "fluid";
}
export interface ItemRegistry<T = unknown | undefined> {
texture_id: string | ((item: ItemStack<T>) => string);
// shown in place of texture_id while the stack's data has that key set, like a cast fishing rod. the first wins
@@ -267,6 +284,9 @@ export interface ItemRegistry<T = unknown | undefined> {
// whether players holding it aim at fluids, like buckets and fishing rods. others look through them, so they can
// break and place blocks under water
targets_fluids?: boolean;
fluid_container?: FluidContainerProperties;
// drawn over its texture in order, see ItemLayer
layers?: ItemLayer[];
components?: Record<string, unknown>;
on_create?(item: ItemStack<T>): void;