Single module modding
This commit is contained in:
+10
-10
@@ -12,7 +12,7 @@ export type Season = "spring" | "summer" | "autumn" | "winter";
|
||||
export interface ItemStack {
|
||||
readonly id: Id;
|
||||
count: number;
|
||||
// any json value, set by server scripts
|
||||
// any json value, set by server phases
|
||||
data?: unknown;
|
||||
}
|
||||
|
||||
@@ -30,7 +30,7 @@ export interface FluidStack {
|
||||
amount: number;
|
||||
}
|
||||
|
||||
// ctx.fluids in server and client scripts: every fluid any mod defines, the same on the server and every client
|
||||
// ctx.fluids in server and client phases: 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[];
|
||||
@@ -44,7 +44,7 @@ export interface FluidApi {
|
||||
same(a: FluidVariant, b: FluidVariant): boolean;
|
||||
}
|
||||
|
||||
// what a fluid's data makes it, registered by a shared script, like neoforge's FluidType.getDescription and
|
||||
// what a fluid's data makes it, registered by a mod's shared phase, like neoforge's FluidType.getDescription and
|
||||
// FluidTintSource.colorAsStack without the amount. data is the variant's, undefined for none, and isn't to be changed.
|
||||
// returning undefined keeps what the fluid's json says
|
||||
export interface FluidRules {
|
||||
@@ -127,7 +127,7 @@ export interface EventSignal<T> {
|
||||
subscribe(handler: (event: T) => void): Unsubscribe;
|
||||
}
|
||||
|
||||
// shared scripts: block rules that run on the server and on every client, so a client places blocks the way the
|
||||
// shared phases: block rules that run on the server and on every client, so a client places blocks the way the
|
||||
// server will, like minecraft's Block code that both sides run. see docs/modding/gettingstarted/modfiles.md
|
||||
|
||||
export interface SharedContext {
|
||||
@@ -169,21 +169,21 @@ export interface SharedContext {
|
||||
readonly recipes: {
|
||||
// adds a recipe of type, like "shaped" or "bworld:cooking", as a file in the mod's recipes/ with that
|
||||
// json would, only during setup. for recipes made from other data, like one for every item with a component.
|
||||
// shared scripts run on the server and every client alike, so they all have it without it being sent. it's
|
||||
// there for server and client scripts, which set up after, and it throws when it's broken like a file would
|
||||
// shared phases run on the server and every client alike, so they all have it without it being sent. it's
|
||||
// there for server and client phases, which set up after, and it throws when it's broken like a file would
|
||||
// stop the mod loading
|
||||
register(type: string, json: Record<string, unknown>): void;
|
||||
// every recipe, or every one of type, as its json, copies, in load order: the mods' recipes/ files, and what the
|
||||
// shared scripts that set up before this one registered, which are the dependencies'. like the client's
|
||||
// shared phases that set up before this one registered, which are the dependencies'. like the client's
|
||||
// deno-lint-ignore no-explicit-any
|
||||
list(type?: string): any[];
|
||||
// a recipe type of the mod's own, in its namespace, only during setup: its recipes, from files and register,
|
||||
// are parsed by it then, and find and all read them from there on every side. a recipe of a type no mod
|
||||
// registers stops its mod loading once every shared script has set up. see RecipeType
|
||||
// registers stops its mod loading once every shared phase has set up. see RecipeType
|
||||
register_type<R, I>(type: Id, rules: RecipeType<R, I>): void;
|
||||
} & RecipeLookup;
|
||||
readonly components: {
|
||||
// the rules of a block component, the same id the server script registers the rest of it under
|
||||
// the rules of a block component, the same id the server phase registers the rest of it under
|
||||
// deno-lint-ignore no-explicit-any
|
||||
register_block<P = any>(id: Id, rules: BlockRules<P>): void;
|
||||
};
|
||||
@@ -246,6 +246,6 @@ export interface BlockRules<P = any> {
|
||||
on_neighbor_change?(block: SharedBlock, params: P, neighbor: SharedBlock): void;
|
||||
// a player right clicks it, like minecraft's useWithoutItem: changes only its states and its neighbors', which
|
||||
// the clicking client shows right away instead of waiting for the server. return true if it did something, then
|
||||
// nothing is placed. the server runs the server script's on_interact too
|
||||
// nothing is placed. the server runs the server phase's on_interact too
|
||||
on_interact?(block: SharedBlock, params: P, interaction: BlockInteraction): boolean | void;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user