More fluid apis
This commit is contained in:
@@ -47,6 +47,7 @@ export class FluidRules {
|
||||
// ctx.fluids for server and client scripts
|
||||
api(): FluidApi {
|
||||
return {
|
||||
ids: () => EverythingRegistry.entries("fluids").map(([id]) => id),
|
||||
exists: (id) => EverythingRegistry.get("fluids", id) !== undefined,
|
||||
name: (fluid) => this.name(fluid),
|
||||
color: (fluid) => this.color(fluid),
|
||||
|
||||
@@ -71,7 +71,10 @@ export interface ClientContext {
|
||||
solid(id: Id): boolean;
|
||||
};
|
||||
// every fluid, named and colored by its rules, see docs/modding/resources/fluids.md
|
||||
fluids: FluidApi;
|
||||
fluids: FluidApi & {
|
||||
// the mod that registered it, like ctx.items.mod
|
||||
mod(id: Id): string;
|
||||
};
|
||||
// the mods' loot table files (see docs/modding/resources/loot_tables.md), to show what they give. tables server
|
||||
// scripts make with ctx.loot.register_table aren't here
|
||||
loot: {
|
||||
|
||||
@@ -26,6 +26,8 @@ export interface FluidVariant {
|
||||
|
||||
// ctx.fluids in server and client scripts: every fluid any mod defines, the same on the server and every client
|
||||
export interface FluidApi {
|
||||
// every fluid's id, in load order, like ctx.items.ids. each without data, which a fluid like juice has many of
|
||||
ids(): Id[];
|
||||
exists(id: Id): boolean;
|
||||
// what players see, from the fluid's rules for its data, or else its json
|
||||
name(fluid: FluidVariant): string;
|
||||
|
||||
Reference in New Issue
Block a user