Hand crank and shafts

This commit is contained in:
2026-10-15 11:45:12 -03:00
parent cedc7725b5
commit a0596ed0ef
27 changed files with 1008 additions and 36 deletions
+1 -1
View File
@@ -110,7 +110,7 @@ export class MultiPlayerGameMode {
// with the states the server will give it, see BlockRules.placement_value, and holding the liquid it goes into
const place_value = place_block &&
waterlog_placement(
block_rules.placement_value(place_block, this.client.player.yaw, {
block_rules.placement_value(place_block, this.client.player.yaw, this.client.player.pitch, {
...target,
face: hit.face,
hit: hit.hit,
+14 -8
View File
@@ -196,12 +196,25 @@ function script_url(code: string) {
return code_url(new TextEncoder().encode(code));
}
// ctx.blocks, the same in shared and client scripts
function blocks_api(mod: string): SharedContext["blocks"] {
return {
exists: (id) => EverythingRegistry.get("blocks", id) !== undefined,
components(id) {
const block = EverythingRegistry.get<BlockRegistry>("blocks", id);
if (!block) throw new Error(`[${mod}] unknown block ${id}`);
return structuredClone(block.components ?? {});
},
};
}
function shared_context(listing: ModListing): SharedContext {
const mod = listing.id;
return {
mod: { id: mod, version: listing.version },
side: "client",
tags: tag_api(),
blocks: blocks_api(mod),
world: rules_world,
components: {
register_block(id, rules) {
@@ -323,14 +336,7 @@ function client_context(listing: ModListing): ClientContext {
EverythingRegistry.get<ItemRegistry>("items", id)?.components ?? {},
)),
},
blocks: {
exists: (id) => EverythingRegistry.get("blocks", id) !== undefined,
components(id) {
const block = EverythingRegistry.get<BlockRegistry>("blocks", id);
if (!block) throw new Error(`[${mod}] unknown block ${id}`);
return structuredClone(block.components ?? {});
},
},
blocks: blocks_api(mod),
loot: {
table: (id) => structuredClone(EverythingRegistry.get<LootTableJson>("loot_tables", id)),
},