Proper season and time conditions for fishing

This commit is contained in:
2026-10-08 15:49:46 -03:00
parent 9c5a15542a
commit aa0d2f73d0
11 changed files with 86 additions and 76 deletions
+5
View File
@@ -6,6 +6,7 @@ import { block_states, get_state_value, is_waterlogged, liquid_block, set_state_
import { LootTables } from "./loot.ts";
import { collision_shape_at, covers_face, raycast_blocks, type Shape } from "$/common/block_shapes.ts";
import { AIR, ID_MASK } from "$/common/constants.ts";
import { clock } from "$/common/time.ts";
import { BlockRules } from "$/common/block_rules.ts";
import type { SharedContext } from "$/common/mod_api/shared.ts";
import { tag_api } from "$/common/tags.ts";
@@ -723,6 +724,10 @@ export class ModRuntime {
get day() {
return game().world.day;
},
get hour() {
const { hour, minute } = clock(game().world.time);
return hour + minute / 60;
},
set_time: (time) => {
if (!Number.isInteger(time) || time < 0) {
throw new Error(`time must be a whole number of ticks, not ${time}`);