@jsprismarine/engine-systems 0.0.0 → 0.16.0-unstable-20261029141316

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (48) hide show
  1. package/CHANGELOG.md +146 -0
  2. package/LICENSE +373 -0
  3. package/README.md +72 -0
  4. package/dist/blockRules.cjs.cjs +78 -0
  5. package/dist/blockRules.d.ts +44 -0
  6. package/dist/blockRules.d.ts.map +1 -0
  7. package/dist/blockRules.es.js +72 -0
  8. package/dist/engine.cjs.cjs +44 -0
  9. package/dist/engine.d.ts +58 -0
  10. package/dist/engine.d.ts.map +1 -0
  11. package/dist/engine.es.js +42 -0
  12. package/dist/explosions.cjs.cjs +354 -0
  13. package/dist/explosions.d.ts +214 -0
  14. package/dist/explosions.d.ts.map +1 -0
  15. package/dist/explosions.es.js +339 -0
  16. package/dist/index.cjs.cjs +83 -0
  17. package/dist/index.d.ts +11 -0
  18. package/dist/index.d.ts.map +1 -0
  19. package/dist/index.es.js +11 -0
  20. package/dist/neighborUpdates.cjs.cjs +86 -0
  21. package/dist/neighborUpdates.d.ts +43 -0
  22. package/dist/neighborUpdates.d.ts.map +1 -0
  23. package/dist/neighborUpdates.es.js +83 -0
  24. package/dist/randomTick.cjs.cjs +104 -0
  25. package/dist/randomTick.d.ts +78 -0
  26. package/dist/randomTick.d.ts.map +1 -0
  27. package/dist/randomTick.es.js +98 -0
  28. package/dist/scheduler.cjs.cjs +188 -0
  29. package/dist/scheduler.d.ts +132 -0
  30. package/dist/scheduler.d.ts.map +1 -0
  31. package/dist/scheduler.es.js +183 -0
  32. package/dist/signal.cjs.cjs +190 -0
  33. package/dist/signal.d.ts +40 -0
  34. package/dist/signal.d.ts.map +1 -0
  35. package/dist/signal.es.js +176 -0
  36. package/dist/testWorld.cjs.cjs +58 -0
  37. package/dist/testWorld.d.ts +42 -0
  38. package/dist/testWorld.d.ts.map +1 -0
  39. package/dist/testWorld.es.js +56 -0
  40. package/dist/weather.cjs.cjs +168 -0
  41. package/dist/weather.d.ts +126 -0
  42. package/dist/weather.d.ts.map +1 -0
  43. package/dist/weather.es.js +156 -0
  44. package/dist/world.cjs.cjs +142 -0
  45. package/dist/world.d.ts +115 -0
  46. package/dist/world.d.ts.map +1 -0
  47. package/dist/world.es.js +126 -0
  48. package/package.json +66 -5
package/CHANGELOG.md ADDED
@@ -0,0 +1,146 @@
1
+ # @jsprismarine/engine-systems
2
+
3
+ ## 0.16.0-unstable-20261029141316
4
+
5
+ ### Minor Changes
6
+
7
+ - [#2628](https://github.com/JSPrismarine/JSPrismarine/pull/2628) [`3ce20e2`](https://github.com/JSPrismarine/JSPrismarine/commit/3ce20e248ddf68967062a79a0b5766bf8ac4fa8c) Thanks [@filiphsps](https://github.com/filiphsps)! - Run every destroyed block through one path.
8
+
9
+ A blast, a stream of water, a piston, fire and a falling block each took blocks out with a rule
10
+ of their own, and none of them raised the block's `onBreak`. A chest the TNT caught kept its
11
+ contents, a double chest left its other half paired to air, and what fell was a hardcoded copy
12
+ of the block rather than Java's loot table.
13
+
14
+ `WorldAccess` gains `destroyBlock`, which the host answers by running the same path a player's
15
+ break takes: the hook before the write, then the roll with whatever the caller knows, the blast
16
+ radius for an explosion and nothing at all for a plank the fire burned. It also gains
17
+ `moveBlock`, so a pushed block carries its block entity instead of being written twice and
18
+ arriving empty. `WorldAccess.spawnItem` is gone with them.
19
+
20
+ `World` now raises `onNeighborChanged` for every block write rather than only for the content
21
+ adapter's own, so a torch whose support a command or a generator removed finally hears about it.
22
+
23
+ - [#2628](https://github.com/JSPrismarine/JSPrismarine/pull/2628) [`fd43ade`](https://github.com/JSPrismarine/JSPrismarine/commit/fd43ade59e80f19e3e7ef994ca80adb15e1f7907) Thanks [@filiphsps](https://github.com/filiphsps)! - Make fire tick on a running server, and gate it on the 1.21.11 game rule.
24
+
25
+ `Engine.setBlockAndUpdate` raised the six neighbor updates and the extra ones a signal source
26
+ reaches with, and stopped. Nothing ran the work a block's own `onPlace` does, which is the work
27
+ that reads the world the new block landed in rather than telling the world about it. Three
28
+ systems were dead because of it: fire never got the first of the ticks that spread it and burn it
29
+ out, so placed fire sat where it was lit; dust placed beside a live lever stayed dark; and a
30
+ piston placed into a position something already powered never extended. `runPlacementUpdates` now
31
+ runs `FireBlock.onPlace`, `RedstoneWireBlock.onPlace` and `PistonBaseBlock.onPlace` alongside the
32
+ fluid's, and `createTestEngine` wires a notifying write back through `setBlockAndUpdate` so the
33
+ package's own harness behaves like the server.
34
+
35
+ `fireTick` takes an options record in place of its `increasedBurnout` flag, and its new `spreads`
36
+ is Java's `ServerLevel.canSpreadFireAround`: false stops the tick after it has booked the next
37
+ one, so the fire keeps its place in the tick list and does not even go out. `EngineOptions`
38
+ gains `canSpreadFireAround` for the host to answer it.
39
+
40
+ The host's answer is `minecraft:fire_spread_radius_around_player`, which 1.21.11 folded
41
+ `doFireTick` and `allowFireTicksAwayFromPlayer` into. It is an integer with a default of 128 and
42
+ a minimum of -1, read out of `GameRules.class` in the pinned 26.3 jar: -1 lifts the limit, and
43
+ anything else is a euclidean distance from the block to the nearest non-spectating player. Mojang's
44
+ own `GameRuleRegistryFix` converts the two booleans a Bedrock world still spells, so `doFireTick`
45
+ off is 0, which no player is ever inside. `gameRuleValue` is the registry-resolved read the content
46
+ adapter already did inline, now shared with the world code that reads a rule outside it.
47
+
48
+ - [#2628](https://github.com/JSPrismarine/JSPrismarine/pull/2628) [`abd3869`](https://github.com/JSPrismarine/JSPrismarine/commit/abd38698ac421ed89eda5afc3e6aac1ab03981ae) Thanks [@filiphsps](https://github.com/filiphsps)! - Remove Engine-owned redstone and piston handlers, and route block behavior through resolved content families.
49
+
50
+ - [#2628](https://github.com/JSPrismarine/JSPrismarine/pull/2628) [`5e47439`](https://github.com/JSPrismarine/JSPrismarine/commit/5e474396321b54f696760962ceb9d24b85917640) Thanks [@filiphsps](https://github.com/filiphsps)! - Resolve redstone conductor overrides from `minecraft:redstone_conductivity` block components.
51
+
52
+ - [#2628](https://github.com/JSPrismarine/JSPrismarine/pull/2628) [`d0b36e7`](https://github.com/JSPrismarine/JSPrismarine/commit/d0b36e7d517f9f057cadbc261c6a77d3cb58329a) Thanks [@filiphsps](https://github.com/filiphsps)! - Route server fluid ticks through data-driven block families, expose liquid state reading from block behaviors, and remove fluid handling from `Engine`.
53
+
54
+ - [#2628](https://github.com/JSPrismarine/JSPrismarine/pull/2628) [`3093e34`](https://github.com/JSPrismarine/JSPrismarine/commit/3093e340fc9a98a5a408f3c175e844b576289940) Thanks [@filiphsps](https://github.com/filiphsps)! - Remove legacy fire handlers from the engine and dispatch fire ticks through block behavior families.
55
+
56
+ ### Patch Changes
57
+
58
+ - [#2628](https://github.com/JSPrismarine/JSPrismarine/pull/2628) [`b6eccf4`](https://github.com/JSPrismarine/JSPrismarine/commit/b6eccf49493ed702c5c13eb831ad9fa54258a47d) Thanks [@filiphsps](https://github.com/filiphsps)! - Route block power changes through data-driven redstone hooks.
59
+
60
+ - [#2628](https://github.com/JSPrismarine/JSPrismarine/pull/2628) [`bd32c08`](https://github.com/JSPrismarine/JSPrismarine/commit/bd32c08eac967ec9e0068cd56cf1788053539a6b) Thanks [@filiphsps](https://github.com/filiphsps)! - Move slope-directed fluid flow, falling levels, and source conversion into the data-driven liquid family.
61
+
62
+ - [#2628](https://github.com/JSPrismarine/JSPrismarine/pull/2628) [`d231208`](https://github.com/JSPrismarine/JSPrismarine/commit/d231208b7ed03ea5f62f14a2f72741881b57f128) Thanks [@filiphsps](https://github.com/filiphsps)! - Route observer pulses through block family hooks
63
+
64
+ - [#2628](https://github.com/JSPrismarine/JSPrismarine/pull/2628) [`3cde97f`](https://github.com/JSPrismarine/JSPrismarine/commit/3cde97f56f87dbf9ce3636a6ccf142950fa23cf8) Thanks [@filiphsps](https://github.com/filiphsps)! - Add the weather cycle, which is Java's `ServerLevel.advanceWeatherCycle` over `WeatherData`: three counters, two flags, and the jar's own durations. `advanceWeatherCycle` is a function from one state to the next rather than something that owns a world, so a host steps it, saves the five numbers that come back, and tells its clients when `weatherOf` changed. `weatherCommandState` is the part of `WeatherCommand` that belongs here, which is which counters each of the three forms sets and the duration it uses when the command names none.
65
+
66
+ - [#2628](https://github.com/JSPrismarine/JSPrismarine/pull/2628) [`7b155cd`](https://github.com/JSPrismarine/JSPrismarine/commit/7b155cdeb90769ec011f29706cb65a95832196f5) Thanks [@filiphsps](https://github.com/filiphsps)! - Add `@jsprismarine/engine-systems`, the four engine systems neither edition publishes as data: the
67
+ tick scheduler, redstone, flowing fluids, and fire spread with the random tick driver. Every
68
+ constant and ordering rule is read out of the pinned Java 26.3 server jar, which carries original
69
+ names since Mojang removed obfuscation in 26.1, rather than from a wiki page.
70
+
71
+ All four read and write the world through one `WorldAccess` interface covering block state, block
72
+ entity data, tick scheduling and its two queries, item drops, sounds, difficulty, weather, rain,
73
+ dimension, game time, the world random and the height bounds. `createTestWorld` implements it over
74
+ a map of positions and `createTestEngine` returns a world and an engine wired to each other, so a
75
+ test builds a real circuit rather than a mock.
76
+
77
+ The scheduler is `LevelTicks`, `LevelChunkTicks` and `ScheduledTick`: Java's drain order, the seven
78
+ `TickPriority` values of -3 through 3, the rule that a second tick for the same position and type is
79
+ ignored, and the budget of 65536 ticks per list per game tick. `createNeighborUpdates` is
80
+ `CollectingNeighborUpdater`, which is what keeps an immediate neighbor update apart from a scheduled
81
+ tick.
82
+
83
+ Redstone implements Java Edition's rules, because redstone is server-decided and invisible to the
84
+ Bedrock client. Power runs 0 to 15 through `SignalGetter` and the per-block signal overrides, dust
85
+ uses `DefaultRedstoneWireEvaluator` rather than the experiment Mojang ships behind a feature flag,
86
+ repeaters take their delay state times 2 game ticks and lock from a diode on either side,
87
+ comparators run compare and subtract and read a container's fill, observers pulse 15 for two game
88
+ ticks on a shape change from the block they face, and pistons use `PistonStructureResolver`
89
+ unchanged, including the 12-block limit and the slime and honey rules. Quasi-connectivity is
90
+ implemented; Bedrock's produce and consume tick split, soft inversion, its dust refresh rule and its
91
+ observer-as-update-detector are not, and the README lists them.
92
+
93
+ Fluids run `FlowingFluid` over Bedrock's two blocks per fluid, encoding the level into Bedrock's own
94
+ `liquid_depth` by Java's `getLegacyLevel` rule. Water drops 1 level per block, searches 4 for a hole
95
+ and ticks every 5; lava drops 2, searches 2 and ticks every 30 outside the nether, and drops 1,
96
+ searches 4 and ticks every 10 inside it. Obsidian, cobblestone, stone and basalt all come out of
97
+ `LiquidBlock`.
98
+
99
+ Fire is `FireBlock` with the ignite and burn odds read from `@jsprismarine/mapping` rather than
100
+ restated, running on scheduled ticks 30 to 40 game ticks apart as Java does. The random tick driver
101
+ is `ServerLevel.tickChunk` with `Level.getBlockRandomPos` transcribed exactly, drawing Java's
102
+ absolute three positions per section where Bedrock's rule is documented as relative with no
103
+ published mapping.
104
+
105
+ - [#2628](https://github.com/JSPrismarine/JSPrismarine/pull/2628) [`3d89810`](https://github.com/JSPrismarine/JSPrismarine/commit/3d89810e3456d9c9108e1b33535197d2bab4786e) Thanks [@filiphsps](https://github.com/filiphsps)! - Cast Java's explosion rays instead of clearing a sphere.
106
+
107
+ `@jsprismarine/engine-systems` gains `explode`, a transcription of `ServerExplosion` from the
108
+ pinned 26.3 jar: 1352 rays off the surface of a 16 by 16 by 16 grid, each starting at
109
+ `radius * (0.7 + random * 0.6)` and losing `(blastResistance + 0.3) * 0.3` per block it crosses and
110
+ 0.22500001 per 0.3-block step. The blocks behind a wall now survive, a one-block moat tames TNT,
111
+ and the crater is the irregular shape vanilla's is. Entity damage comes off
112
+ `getSeenPercent`, which grades cover by sampling a grid of rays over the entity's box, and
113
+ knockback reads `EXPLOSION_KNOCKBACK_RESISTANCE`.
114
+
115
+ The server no longer holds its own model. `entity/Explosion.ts` and the data-driven runtime's
116
+ `explode` both call the package, so a creeper destroys terrain where it used to leave the hole for
117
+ later, and every block a blast takes out is rolled through its Java loot table with the
118
+ `explosion_radius` parameter that `survives_explosion` and `explosion_decay` turn into a `1 / radius`
119
+ chance.
120
+
121
+ - [#2628](https://github.com/JSPrismarine/JSPrismarine/pull/2628) [`276ebd1`](https://github.com/JSPrismarine/JSPrismarine/commit/276ebd1a17e2876e128b41321145a816df6e8918) Thanks [@filiphsps](https://github.com/filiphsps)! - Move redstone placement updates and piston movement into data-driven block families
122
+
123
+ - [#2628](https://github.com/JSPrismarine/JSPrismarine/pull/2628) [`c8ed1c5`](https://github.com/JSPrismarine/JSPrismarine/commit/c8ed1c5b88953b3f5f1e3ccec99e8de623faeeb2) Thanks [@filiphsps](https://github.com/filiphsps)! - Route redstone torch ticks through block family hooks
124
+
125
+ - [#2628](https://github.com/JSPrismarine/JSPrismarine/pull/2628) [`1fa9eda`](https://github.com/JSPrismarine/JSPrismarine/commit/1fa9edaec739e3f7b11648b5662d9860cf569c45) Thanks [@filiphsps](https://github.com/filiphsps)! - Stop a piston and a copper bulb conducting redstone. Java's `Blocks` refuses both through `isRedstoneConductor(Blocks::never)`, but it does so from shared property factories rather than from an inline registration, so the ten blocks they cover were missing from `NON_CONDUCTING_FULL_CUBES` while being opaque enough for `isFullCube` to read them as conductors. `powered_repeater` and `unpowered_repeater` leave the set: Java's `REPEATER` registration calls `isRedstoneConductor` not at all, and the default already refuses them.
126
+
127
+ The surrounding documentation said "26 blocks override it". 26 is the number of call sites in `Blocks`; they cover 65 blocks and 2.
128
+
129
+ - [#2628](https://github.com/JSPrismarine/JSPrismarine/pull/2628) [`b3360c0`](https://github.com/JSPrismarine/JSPrismarine/commit/b3360c05087155a4aa71299a2042646fa91d6f14) Thanks [@filiphsps](https://github.com/filiphsps)! - Route repeater and comparator updates and scheduled transitions through their data-driven block behavior hooks.
130
+
131
+ - [#2628](https://github.com/JSPrismarine/JSPrismarine/pull/2628) [`59f8ec6`](https://github.com/JSPrismarine/JSPrismarine/commit/59f8ec6fcd56487b167a9641cf74d60601d8af7e) Thanks [@filiphsps](https://github.com/filiphsps)! - Run fire spread, burnout, and scheduled ticks through data-driven block behavior hooks.
132
+
133
+ - [#2628](https://github.com/JSPrismarine/JSPrismarine/pull/2628) [`21887ca`](https://github.com/JSPrismarine/JSPrismarine/commit/21887ca1f152fa69516fb80543e32a5ce047ec39) Thanks [@filiphsps](https://github.com/filiphsps)! - Draw random ticks only where Java draws them, which is also what makes an idle world free.
134
+ `ServerLevel.tickChunks` visits a chunk when a player ticket holds it and draws in a section when
135
+ that section's palette holds something that ticks; this server drew in all 24 sections of all 441
136
+ loaded chunks with nobody online. `WorldSystemsView.randomTickChunks` is the world's answer to both
137
+ halves, and `World` gives it from the players' simulation distance and the chunk's occupied sub
138
+ chunks. Measured over the real loop on a flat world: 29.5 ms per tick to 3.5 with the section half,
139
+ and to nothing at all with no players online, against a 50 ms tick budget.
140
+
141
+ `EngineOptions.randomTickHandlers` now receives the block with the position. The engine has just
142
+ read it to find the handler, so reading it again cost a chunk lookup and a block-state construction
143
+ in the hottest loop the world has.
144
+ - Updated dependencies [[`232a1ce`](https://github.com/JSPrismarine/JSPrismarine/commit/232a1ce20b5ade2e33b703300fb671f0c3f62076), [`ea083fb`](https://github.com/JSPrismarine/JSPrismarine/commit/ea083fb8d67d0c285724b73bf94b41947afc4013), [`f33a57c`](https://github.com/JSPrismarine/JSPrismarine/commit/f33a57c3750488f1ed77a441ab26b7c1086eff68), [`cde1039`](https://github.com/JSPrismarine/JSPrismarine/commit/cde1039d276df8d3787b361e072fafdb32a6da9a), [`f3fa1c6`](https://github.com/JSPrismarine/JSPrismarine/commit/f3fa1c6bf9096223ac9d2b0396bcc71cd04e244e), [`57f252b`](https://github.com/JSPrismarine/JSPrismarine/commit/57f252b2781508290fac2e842cf37fb652467d66), [`f8a43ce`](https://github.com/JSPrismarine/JSPrismarine/commit/f8a43ce910da3d8e1c88091c8886a7c1d09ab0c0), [`d4afedd`](https://github.com/JSPrismarine/JSPrismarine/commit/d4afeddfc1a6016173261b800813e9f248208db8), [`89a02c8`](https://github.com/JSPrismarine/JSPrismarine/commit/89a02c81dd66293ab2b303851aad61c891535081), [`bfb9a31`](https://github.com/JSPrismarine/JSPrismarine/commit/bfb9a31a40c8173f1b811ee63b2308f357c47fd0), [`b6eccf4`](https://github.com/JSPrismarine/JSPrismarine/commit/b6eccf49493ed702c5c13eb831ad9fa54258a47d), [`e17199e`](https://github.com/JSPrismarine/JSPrismarine/commit/e17199e28be25659495b398dc05d6a48baa2b593), [`18f0d0c`](https://github.com/JSPrismarine/JSPrismarine/commit/18f0d0ca7bfb691c75d2d2453eb21b0126e4a4e3), [`9f58b70`](https://github.com/JSPrismarine/JSPrismarine/commit/9f58b7012e39f08ef869149252312f3617c5d057), [`440e164`](https://github.com/JSPrismarine/JSPrismarine/commit/440e164b88f43548c9c4fe8ae896387157f21701), [`e678a6a`](https://github.com/JSPrismarine/JSPrismarine/commit/e678a6a48dd00568f1186f37f2d460b1c898f059), [`a540a4c`](https://github.com/JSPrismarine/JSPrismarine/commit/a540a4cc5879f62d5d3b39d59100200af8e3d313), [`a4abb61`](https://github.com/JSPrismarine/JSPrismarine/commit/a4abb61b7a03101b4f22ebab35da281066530430), [`f370405`](https://github.com/JSPrismarine/JSPrismarine/commit/f37040563ed0cac590fe971ef3a448cb2e01a581), [`c1591b1`](https://github.com/JSPrismarine/JSPrismarine/commit/c1591b1e567a51dc80ecbbdfdbdc8e7c7f4f6c42), [`c9cafc8`](https://github.com/JSPrismarine/JSPrismarine/commit/c9cafc8529e05fe90ea2812920feb76cbcaf4a1b), [`8518afc`](https://github.com/JSPrismarine/JSPrismarine/commit/8518afc7b9ee684ebe4255ce26e7b56d612a145a), [`5e47439`](https://github.com/JSPrismarine/JSPrismarine/commit/5e474396321b54f696760962ceb9d24b85917640), [`03d0f89`](https://github.com/JSPrismarine/JSPrismarine/commit/03d0f89125f6101873fbee9df425f33497b0cc7a), [`4ab02e5`](https://github.com/JSPrismarine/JSPrismarine/commit/4ab02e5cf76b88f09ba19106e971337c1da2d1b9), [`a3db50e`](https://github.com/JSPrismarine/JSPrismarine/commit/a3db50eef709e1d2e3848d71383d6801d5f69773), [`cc8b110`](https://github.com/JSPrismarine/JSPrismarine/commit/cc8b1109b9c174940cdd4549615a05affb459b9a), [`32ce6f2`](https://github.com/JSPrismarine/JSPrismarine/commit/32ce6f2f752e7e89c4445d1936e13a6e243a3a30), [`35e7df5`](https://github.com/JSPrismarine/JSPrismarine/commit/35e7df54b5bba03f65c9e3a972bac32b01ba4fe4), [`13792da`](https://github.com/JSPrismarine/JSPrismarine/commit/13792daea4f024f559c9392e93328694db22e164), [`9e53c61`](https://github.com/JSPrismarine/JSPrismarine/commit/9e53c61399266bf9e26dd87160c45ccd251a21f8)]:
145
+ - @jsprismarine/mapping@0.16.0-unstable-20261029141316
146
+ - @jsprismarine/blocks@0.16.0-unstable-20261029141316
package/LICENSE ADDED
@@ -0,0 +1,373 @@
1
+ Mozilla Public License Version 2.0
2
+ ==================================
3
+
4
+ 1. Definitions
5
+ --------------
6
+
7
+ 1.1. "Contributor"
8
+ means each individual or legal entity that creates, contributes to
9
+ the creation of, or owns Covered Software.
10
+
11
+ 1.2. "Contributor Version"
12
+ means the combination of the Contributions of others (if any) used
13
+ by a Contributor and that particular Contributor's Contribution.
14
+
15
+ 1.3. "Contribution"
16
+ means Covered Software of a particular Contributor.
17
+
18
+ 1.4. "Covered Software"
19
+ means Source Code Form to which the initial Contributor has attached
20
+ the notice in Exhibit A, the Executable Form of such Source Code
21
+ Form, and Modifications of such Source Code Form, in each case
22
+ including portions thereof.
23
+
24
+ 1.5. "Incompatible With Secondary Licenses"
25
+ means
26
+
27
+ (a) that the initial Contributor has attached the notice described
28
+ in Exhibit B to the Covered Software; or
29
+
30
+ (b) that the Covered Software was made available under the terms of
31
+ version 1.1 or earlier of the License, but not also under the
32
+ terms of a Secondary License.
33
+
34
+ 1.6. "Executable Form"
35
+ means any form of the work other than Source Code Form.
36
+
37
+ 1.7. "Larger Work"
38
+ means a work that combines Covered Software with other material, in
39
+ a separate file or files, that is not Covered Software.
40
+
41
+ 1.8. "License"
42
+ means this document.
43
+
44
+ 1.9. "Licensable"
45
+ means having the right to grant, to the maximum extent possible,
46
+ whether at the time of the initial grant or subsequently, any and
47
+ all of the rights conveyed by this License.
48
+
49
+ 1.10. "Modifications"
50
+ means any of the following:
51
+
52
+ (a) any file in Source Code Form that results from an addition to,
53
+ deletion from, or modification of the contents of Covered
54
+ Software; or
55
+
56
+ (b) any new file in Source Code Form that contains any Covered
57
+ Software.
58
+
59
+ 1.11. "Patent Claims" of a Contributor
60
+ means any patent claim(s), including without limitation, method,
61
+ process, and apparatus claims, in any patent Licensable by such
62
+ Contributor that would be infringed, but for the grant of the
63
+ License, by the making, using, selling, offering for sale, having
64
+ made, import, or transfer of either its Contributions or its
65
+ Contributor Version.
66
+
67
+ 1.12. "Secondary License"
68
+ means either the GNU General Public License, Version 2.0, the GNU
69
+ Lesser General Public License, Version 2.1, the GNU Affero General
70
+ Public License, Version 3.0, or any later versions of those
71
+ licenses.
72
+
73
+ 1.13. "Source Code Form"
74
+ means the form of the work preferred for making modifications.
75
+
76
+ 1.14. "You" (or "Your")
77
+ means an individual or a legal entity exercising rights under this
78
+ License. For legal entities, "You" includes any entity that
79
+ controls, is controlled by, or is under common control with You. For
80
+ purposes of this definition, "control" means (a) the power, direct
81
+ or indirect, to cause the direction or management of such entity,
82
+ whether by contract or otherwise, or (b) ownership of more than
83
+ fifty percent (50%) of the outstanding shares or beneficial
84
+ ownership of such entity.
85
+
86
+ 2. License Grants and Conditions
87
+ --------------------------------
88
+
89
+ 2.1. Grants
90
+
91
+ Each Contributor hereby grants You a world-wide, royalty-free,
92
+ non-exclusive license:
93
+
94
+ (a) under intellectual property rights (other than patent or trademark)
95
+ Licensable by such Contributor to use, reproduce, make available,
96
+ modify, display, perform, distribute, and otherwise exploit its
97
+ Contributions, either on an unmodified basis, with Modifications, or
98
+ as part of a Larger Work; and
99
+
100
+ (b) under Patent Claims of such Contributor to make, use, sell, offer
101
+ for sale, have made, import, and otherwise transfer either its
102
+ Contributions or its Contributor Version.
103
+
104
+ 2.2. Effective Date
105
+
106
+ The licenses granted in Section 2.1 with respect to any Contribution
107
+ become effective for each Contribution on the date the Contributor first
108
+ distributes such Contribution.
109
+
110
+ 2.3. Limitations on Grant Scope
111
+
112
+ The licenses granted in this Section 2 are the only rights granted under
113
+ this License. No additional rights or licenses will be implied from the
114
+ distribution or licensing of Covered Software under this License.
115
+ Notwithstanding Section 2.1(b) above, no patent license is granted by a
116
+ Contributor:
117
+
118
+ (a) for any code that a Contributor has removed from Covered Software;
119
+ or
120
+
121
+ (b) for infringements caused by: (i) Your and any other third party's
122
+ modifications of Covered Software, or (ii) the combination of its
123
+ Contributions with other software (except as part of its Contributor
124
+ Version); or
125
+
126
+ (c) under Patent Claims infringed by Covered Software in the absence of
127
+ its Contributions.
128
+
129
+ This License does not grant any rights in the trademarks, service marks,
130
+ or logos of any Contributor (except as may be necessary to comply with
131
+ the notice requirements in Section 3.4).
132
+
133
+ 2.4. Subsequent Licenses
134
+
135
+ No Contributor makes additional grants as a result of Your choice to
136
+ distribute the Covered Software under a subsequent version of this
137
+ License (see Section 10.2) or under the terms of a Secondary License (if
138
+ permitted under the terms of Section 3.3).
139
+
140
+ 2.5. Representation
141
+
142
+ Each Contributor represents that the Contributor believes its
143
+ Contributions are its original creation(s) or it has sufficient rights
144
+ to grant the rights to its Contributions conveyed by this License.
145
+
146
+ 2.6. Fair Use
147
+
148
+ This License is not intended to limit any rights You have under
149
+ applicable copyright doctrines of fair use, fair dealing, or other
150
+ equivalents.
151
+
152
+ 2.7. Conditions
153
+
154
+ Sections 3.1, 3.2, 3.3, and 3.4 are conditions of the licenses granted
155
+ in Section 2.1.
156
+
157
+ 3. Responsibilities
158
+ -------------------
159
+
160
+ 3.1. Distribution of Source Form
161
+
162
+ All distribution of Covered Software in Source Code Form, including any
163
+ Modifications that You create or to which You contribute, must be under
164
+ the terms of this License. You must inform recipients that the Source
165
+ Code Form of the Covered Software is governed by the terms of this
166
+ License, and how they can obtain a copy of this License. You may not
167
+ attempt to alter or restrict the recipients' rights in the Source Code
168
+ Form.
169
+
170
+ 3.2. Distribution of Executable Form
171
+
172
+ If You distribute Covered Software in Executable Form then:
173
+
174
+ (a) such Covered Software must also be made available in Source Code
175
+ Form, as described in Section 3.1, and You must inform recipients of
176
+ the Executable Form how they can obtain a copy of such Source Code
177
+ Form by reasonable means in a timely manner, at a charge no more
178
+ than the cost of distribution to the recipient; and
179
+
180
+ (b) You may distribute such Executable Form under the terms of this
181
+ License, or sublicense it under different terms, provided that the
182
+ license for the Executable Form does not attempt to limit or alter
183
+ the recipients' rights in the Source Code Form under this License.
184
+
185
+ 3.3. Distribution of a Larger Work
186
+
187
+ You may create and distribute a Larger Work under terms of Your choice,
188
+ provided that You also comply with the requirements of this License for
189
+ the Covered Software. If the Larger Work is a combination of Covered
190
+ Software with a work governed by one or more Secondary Licenses, and the
191
+ Covered Software is not Incompatible With Secondary Licenses, this
192
+ License permits You to additionally distribute such Covered Software
193
+ under the terms of such Secondary License(s), so that the recipient of
194
+ the Larger Work may, at their option, further distribute the Covered
195
+ Software under the terms of either this License or such Secondary
196
+ License(s).
197
+
198
+ 3.4. Notices
199
+
200
+ You may not remove or alter the substance of any license notices
201
+ (including copyright notices, patent notices, disclaimers of warranty,
202
+ or limitations of liability) contained within the Source Code Form of
203
+ the Covered Software, except that You may alter any license notices to
204
+ the extent required to remedy known factual inaccuracies.
205
+
206
+ 3.5. Application of Additional Terms
207
+
208
+ You may choose to offer, and to charge a fee for, warranty, support,
209
+ indemnity or liability obligations to one or more recipients of Covered
210
+ Software. However, You may do so only on Your own behalf, and not on
211
+ behalf of any Contributor. You must make it absolutely clear that any
212
+ such warranty, support, indemnity, or liability obligation is offered by
213
+ You alone, and You hereby agree to indemnify every Contributor for any
214
+ liability incurred by such Contributor as a result of warranty, support,
215
+ indemnity or liability terms You offer. You may include additional
216
+ disclaimers of warranty and limitations of liability specific to any
217
+ jurisdiction.
218
+
219
+ 4. Inability to Comply Due to Statute or Regulation
220
+ ---------------------------------------------------
221
+
222
+ If it is impossible for You to comply with any of the terms of this
223
+ License with respect to some or all of the Covered Software due to
224
+ statute, judicial order, or regulation then You must: (a) comply with
225
+ the terms of this License to the maximum extent possible; and (b)
226
+ describe the limitations and the code they affect. Such description must
227
+ be placed in a text file included with all distributions of the Covered
228
+ Software under this License. Except to the extent prohibited by statute
229
+ or regulation, such description must be sufficiently detailed for a
230
+ recipient of ordinary skill to be able to understand it.
231
+
232
+ 5. Termination
233
+ --------------
234
+
235
+ 5.1. The rights granted under this License will terminate automatically
236
+ if You fail to comply with any of its terms. However, if You become
237
+ compliant, then the rights granted under this License from a particular
238
+ Contributor are reinstated (a) provisionally, unless and until such
239
+ Contributor explicitly and finally terminates Your grants, and (b) on an
240
+ ongoing basis, if such Contributor fails to notify You of the
241
+ non-compliance by some reasonable means prior to 60 days after You have
242
+ come back into compliance. Moreover, Your grants from a particular
243
+ Contributor are reinstated on an ongoing basis if such Contributor
244
+ notifies You of the non-compliance by some reasonable means, this is the
245
+ first time You have received notice of non-compliance with this License
246
+ from such Contributor, and You become compliant prior to 30 days after
247
+ Your receipt of the notice.
248
+
249
+ 5.2. If You initiate litigation against any entity by asserting a patent
250
+ infringement claim (excluding declaratory judgment actions,
251
+ counter-claims, and cross-claims) alleging that a Contributor Version
252
+ directly or indirectly infringes any patent, then the rights granted to
253
+ You by any and all Contributors for the Covered Software under Section
254
+ 2.1 of this License shall terminate.
255
+
256
+ 5.3. In the event of termination under Sections 5.1 or 5.2 above, all
257
+ end user license agreements (excluding distributors and resellers) which
258
+ have been validly granted by You or Your distributors under this License
259
+ prior to termination shall survive termination.
260
+
261
+ ************************************************************************
262
+ * *
263
+ * 6. Disclaimer of Warranty *
264
+ * ------------------------- *
265
+ * *
266
+ * Covered Software is provided under this License on an "as is" *
267
+ * basis, without warranty of any kind, either expressed, implied, or *
268
+ * statutory, including, without limitation, warranties that the *
269
+ * Covered Software is free of defects, merchantable, fit for a *
270
+ * particular purpose or non-infringing. The entire risk as to the *
271
+ * quality and performance of the Covered Software is with You. *
272
+ * Should any Covered Software prove defective in any respect, You *
273
+ * (not any Contributor) assume the cost of any necessary servicing, *
274
+ * repair, or correction. This disclaimer of warranty constitutes an *
275
+ * essential part of this License. No use of any Covered Software is *
276
+ * authorized under this License except under this disclaimer. *
277
+ * *
278
+ ************************************************************************
279
+
280
+ ************************************************************************
281
+ * *
282
+ * 7. Limitation of Liability *
283
+ * -------------------------- *
284
+ * *
285
+ * Under no circumstances and under no legal theory, whether tort *
286
+ * (including negligence), contract, or otherwise, shall any *
287
+ * Contributor, or anyone who distributes Covered Software as *
288
+ * permitted above, be liable to You for any direct, indirect, *
289
+ * special, incidental, or consequential damages of any character *
290
+ * including, without limitation, damages for lost profits, loss of *
291
+ * goodwill, work stoppage, computer failure or malfunction, or any *
292
+ * and all other commercial damages or losses, even if such party *
293
+ * shall have been informed of the possibility of such damages. This *
294
+ * limitation of liability shall not apply to liability for death or *
295
+ * personal injury resulting from such party's negligence to the *
296
+ * extent applicable law prohibits such limitation. Some *
297
+ * jurisdictions do not allow the exclusion or limitation of *
298
+ * incidental or consequential damages, so this exclusion and *
299
+ * limitation may not apply to You. *
300
+ * *
301
+ ************************************************************************
302
+
303
+ 8. Litigation
304
+ -------------
305
+
306
+ Any litigation relating to this License may be brought only in the
307
+ courts of a jurisdiction where the defendant maintains its principal
308
+ place of business and such litigation shall be governed by laws of that
309
+ jurisdiction, without reference to its conflict-of-law provisions.
310
+ Nothing in this Section shall prevent a party's ability to bring
311
+ cross-claims or counter-claims.
312
+
313
+ 9. Miscellaneous
314
+ ----------------
315
+
316
+ This License represents the complete agreement concerning the subject
317
+ matter hereof. If any provision of this License is held to be
318
+ unenforceable, such provision shall be reformed only to the extent
319
+ necessary to make it enforceable. Any law or regulation which provides
320
+ that the language of a contract shall be construed against the drafter
321
+ shall not be used to construe this License against a Contributor.
322
+
323
+ 10. Versions of the License
324
+ ---------------------------
325
+
326
+ 10.1. New Versions
327
+
328
+ Mozilla Foundation is the license steward. Except as provided in Section
329
+ 10.3, no one other than the license steward has the right to modify or
330
+ publish new versions of this License. Each version will be given a
331
+ distinguishing version number.
332
+
333
+ 10.2. Effect of New Versions
334
+
335
+ You may distribute the Covered Software under the terms of the version
336
+ of the License under which You originally received the Covered Software,
337
+ or under the terms of any subsequent version published by the license
338
+ steward.
339
+
340
+ 10.3. Modified Versions
341
+
342
+ If you create software not governed by this License, and you want to
343
+ create a new license for such software, you may create and use a
344
+ modified version of this License if you rename the license and remove
345
+ any references to the name of the license steward (except to note that
346
+ such modified license differs from this License).
347
+
348
+ 10.4. Distributing Source Code Form that is Incompatible With Secondary
349
+ Licenses
350
+
351
+ If You choose to distribute Source Code Form that is Incompatible With
352
+ Secondary Licenses under the terms of this version of the License, the
353
+ notice described in Exhibit B of this License must be attached.
354
+
355
+ Exhibit A - Source Code Form License Notice
356
+ -------------------------------------------
357
+
358
+ This Source Code Form is subject to the terms of the Mozilla Public
359
+ License, v. 2.0. If a copy of the MPL was not distributed with this
360
+ file, You can obtain one at http://mozilla.org/MPL/2.0/.
361
+
362
+ If it is not possible or desirable to put the notice in a particular
363
+ file, then You may include the notice in a location (such as a LICENSE
364
+ file in a relevant directory) where a recipient would be likely to look
365
+ for such a notice.
366
+
367
+ You may add additional accurate notices of copyright ownership.
368
+
369
+ Exhibit B - "Incompatible With Secondary Licenses" Notice
370
+ ---------------------------------------------------------
371
+
372
+ This Source Code Form is "Incompatible With Secondary Licenses", as
373
+ defined by the Mozilla Public License, v. 2.0.
package/README.md ADDED
@@ -0,0 +1,72 @@
1
+ # @jsprismarine/engine-systems
2
+
3
+ Shared world-system primitives that do not come from Bedrock data: tick scheduling, neighbor
4
+ update ordering, redstone signal calculations, random tick selection, explosions, and the weather
5
+ cycle. Resolved block families own block behavior, including fluid flow, fire, redstone state
6
+ changes, and piston movement.
7
+
8
+ The Java-derived rules in this package are based on the pinned 26.3 server jar in
9
+ `node_modules/.cache/jsprismarine/java-server/`. Source comments name the Java classes behind the
10
+ transcribed behavior.
11
+
12
+ ## World access
13
+
14
+ The engine reads and writes blocks through a small `WorldAccess` interface. Block tick scheduling
15
+ lives in `TickScheduler`, and explosions use a separate `ExplosionWorld` interface.
16
+
17
+ ```typescript
18
+ import { block, createEngine, createTestWorld } from '@jsprismarine/engine-systems';
19
+
20
+ const world = createTestWorld();
21
+ const engine = createEngine(world);
22
+ engine.setBlockAndUpdate({ x: 0, y: 0, z: 0 }, block('minecraft:stone'));
23
+ ```
24
+
25
+ `setBlockAndUpdate` writes the block, runs the six neighbor updates in Java's
26
+ `CollectingNeighborUpdater` order, and reports resulting signal power to the content bridge. It
27
+ does not implement individual block behavior. The active block family's hooks handle placement,
28
+ neighbor changes, scheduled ticks, and state transitions.
29
+
30
+ ## Tick scheduling
31
+
32
+ `TickScheduler` owns the block and fluid tick lists. A scheduled tick carries a trigger tick, a
33
+ priority, and insertion order. Ticks drain by trigger tick, then priority, then insertion order;
34
+ the per tick budget defaults to Java's 65536 for each list. The host drains the scheduler and
35
+ dispatches each tick to the active block family's `onTick` hook.
36
+
37
+ `TickList` uses one queue for the whole world. Java shards each list by chunk and merges those
38
+ shards while draining, so a backlog can produce a different order. This queue runs the oldest due
39
+ ticks first.
40
+
41
+ ## Redstone signals
42
+
43
+ This package calculates weak and strong signal, conductor re-emission, and wire connections for
44
+ the Bedrock block identifiers the content families use. `WorldSystems` reports the resulting
45
+ power to `onRedstoneUpdate`; `@jsprismarine/block-behaviors` owns the redstone components' state
46
+ changes and scheduled behavior. The engine no longer owns their scheduled ticks or state
47
+ transitions; it keeps the signal output rules needed to calculate the shared network.
48
+
49
+ Resolved `minecraft:redstone_conductivity` values override the Java full-cube conductor default.
50
+ The vanilla overlay supplies the 28 exceptions extracted from Java's block registrations, and
51
+ data-driven packs can declare the same component for their blocks. Collision shapes are not
52
+ published, so the full-cube fallback remains an approximation for partial blocks.
53
+
54
+ ## Random ticking
55
+
56
+ The driver draws `random_tick_speed` positions from each selected section using Java's
57
+ `Level.getBlockRandomPos` step, `state * 3 + 1013904223`. Positions are drawn with replacement;
58
+ a position whose block does not take random ticks still consumes its draw. Block behavior comes
59
+ from the active family's random tick hook.
60
+
61
+ ## Explosions
62
+
63
+ `explode` traces Java's 1352 rays from the surface of a 16 by 16 by 16 grid. It returns affected
64
+ positions and entity hits; the host applies damage, knockback, drops, and entity callbacks.
65
+ Blast resistance is read from the mapping table. Exposure treats full cubes as the only
66
+ occluders because neither edition publishes collision shapes.
67
+
68
+ ## Weather
69
+
70
+ `advanceWeatherCycle`, `resetWeatherCycle`, and `weatherCommandState` model Java's saved rain and
71
+ thunder counters. They are pure functions: the host stores the returned state, applies game-rule
72
+ and dimension checks, and sends any client updates.