redscript-mc 3.0.1 → 3.0.2

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 (225) hide show
  1. package/.github/workflows/ci.yml +1 -0
  2. package/README.md +119 -313
  3. package/README.zh.md +118 -314
  4. package/ROADMAP.md +5 -5
  5. package/dist/data/impl_test/function/counter/get.mcfunction +5 -0
  6. package/dist/data/impl_test/function/counter/inc.mcfunction +7 -0
  7. package/dist/data/impl_test/function/counter/new.mcfunction +4 -0
  8. package/dist/data/impl_test/function/load.mcfunction +1 -0
  9. package/dist/data/impl_test/function/test_impl.mcfunction +10 -0
  10. package/dist/data/minecraft/tags/function/load.json +5 -0
  11. package/dist/data/playground/function/load.mcfunction +1 -0
  12. package/dist/data/playground/function/start.mcfunction +4 -0
  13. package/dist/data/playground/function/start__say_macro_t1.mcfunction +1 -0
  14. package/dist/data/playground/function/stop.mcfunction +5 -0
  15. package/dist/data/playground/function/stop__say_macro_t0.mcfunction +1 -0
  16. package/dist/data/stdlib_queue8_test/function/__queue_append_apply.mcfunction +4 -0
  17. package/dist/data/stdlib_queue8_test/function/__queue_peek_apply.mcfunction +4 -0
  18. package/dist/data/stdlib_queue8_test/function/__queue_size_raw_apply.mcfunction +4 -0
  19. package/dist/data/stdlib_queue8_test/function/load.mcfunction +1 -0
  20. package/dist/data/stdlib_queue8_test/function/queue_clear.mcfunction +6 -0
  21. package/dist/data/stdlib_queue8_test/function/queue_empty__merge_1.mcfunction +5 -0
  22. package/dist/data/stdlib_queue8_test/function/queue_empty__then_0.mcfunction +5 -0
  23. package/dist/data/stdlib_queue8_test/function/queue_peek__merge_1.mcfunction +13 -0
  24. package/dist/data/stdlib_queue8_test/function/queue_peek__then_0.mcfunction +5 -0
  25. package/dist/data/stdlib_queue8_test/function/queue_pop__merge_1.mcfunction +15 -0
  26. package/dist/data/stdlib_queue8_test/function/queue_pop__then_0.mcfunction +5 -0
  27. package/dist/data/stdlib_queue8_test/function/queue_push__const_11.mcfunction +6 -0
  28. package/dist/data/stdlib_queue8_test/function/queue_push__const_22.mcfunction +6 -0
  29. package/dist/data/stdlib_queue8_test/function/queue_size.mcfunction +13 -0
  30. package/dist/data/stdlib_queue8_test/function/test_queue_push_and_size.mcfunction +13 -0
  31. package/dist/data/test/function/load.mcfunction +1 -0
  32. package/dist/data/test/function/say_at.mcfunction +6 -0
  33. package/dist/data/test/function/test.mcfunction +4 -0
  34. package/dist/pack.mcmeta +6 -0
  35. package/dist/package.json +1 -1
  36. package/dist/src/__tests__/formatter-extra.test.d.ts +7 -0
  37. package/dist/src/__tests__/formatter-extra.test.js +123 -0
  38. package/dist/src/__tests__/global-vars.test.d.ts +13 -0
  39. package/dist/src/__tests__/global-vars.test.js +156 -0
  40. package/dist/src/__tests__/lint/new-rules.test.d.ts +9 -0
  41. package/dist/src/__tests__/lint/new-rules.test.js +402 -0
  42. package/dist/src/__tests__/lsp-rename.test.d.ts +8 -0
  43. package/dist/src/__tests__/lsp-rename.test.js +157 -0
  44. package/dist/src/__tests__/mc-integration/say-fstring.test.d.ts +11 -0
  45. package/dist/src/__tests__/mc-integration/say-fstring.test.js +220 -0
  46. package/dist/src/__tests__/mc-integration/stdlib-coverage-2.test.js +1 -1
  47. package/dist/src/__tests__/mc-integration/stdlib-coverage-3.test.js +1 -1
  48. package/dist/src/__tests__/mc-integration/stdlib-coverage-4.test.js +1 -1
  49. package/dist/src/__tests__/mc-integration/stdlib-coverage-5.test.js +1 -1
  50. package/dist/src/__tests__/mc-integration/stdlib-coverage-6.test.js +1 -1
  51. package/dist/src/__tests__/mc-integration/stdlib-coverage-7.test.js +1 -1
  52. package/dist/src/__tests__/mc-integration/stdlib-coverage-8.test.js +1 -1
  53. package/dist/src/__tests__/mc-syntax.test.js +4 -1
  54. package/dist/src/__tests__/monomorphize-coverage.test.d.ts +9 -0
  55. package/dist/src/__tests__/monomorphize-coverage.test.js +204 -0
  56. package/dist/src/__tests__/optimizer-cse.test.d.ts +7 -0
  57. package/dist/src/__tests__/optimizer-cse.test.js +226 -0
  58. package/dist/src/__tests__/parser.test.js +4 -13
  59. package/dist/src/__tests__/repl-server-extra.test.js +6 -7
  60. package/dist/src/__tests__/repl-server.test.js +5 -7
  61. package/dist/src/__tests__/stdlib/queue.test.js +6 -6
  62. package/dist/src/cli.js +0 -0
  63. package/dist/src/lexer/index.js +2 -1
  64. package/dist/src/lint/index.d.ts +12 -5
  65. package/dist/src/lint/index.js +730 -5
  66. package/dist/src/lsp/main.js +0 -0
  67. package/dist/src/mc-test/client.d.ts +21 -0
  68. package/dist/src/mc-test/client.js +34 -0
  69. package/dist/src/mir/lower.js +108 -6
  70. package/dist/src/optimizer/interprocedural.js +37 -2
  71. package/dist/src/parser/decl-parser.d.ts +19 -0
  72. package/dist/src/parser/decl-parser.js +323 -0
  73. package/dist/src/parser/expr-parser.d.ts +46 -0
  74. package/dist/src/parser/expr-parser.js +759 -0
  75. package/dist/src/parser/index.d.ts +8 -129
  76. package/dist/src/parser/index.js +13 -2262
  77. package/dist/src/parser/stmt-parser.d.ts +28 -0
  78. package/dist/src/parser/stmt-parser.js +577 -0
  79. package/dist/src/parser/type-parser.d.ts +20 -0
  80. package/dist/src/parser/type-parser.js +257 -0
  81. package/dist/src/parser/utils.d.ts +34 -0
  82. package/dist/src/parser/utils.js +141 -0
  83. package/docs/dev/README-mc-integration-tests.md +141 -0
  84. package/docs/lint-rules.md +162 -0
  85. package/docs/stdlib/bigint.md +2 -0
  86. package/editors/vscode/README.md +63 -41
  87. package/editors/vscode/out/extension.js +1881 -1776
  88. package/editors/vscode/out/lsp-server.js +4257 -3651
  89. package/editors/vscode/package-lock.json +3 -3
  90. package/editors/vscode/package.json +1 -1
  91. package/examples/loops-demo.mcrs +87 -0
  92. package/package.json +1 -1
  93. package/redscript-docs/docs/en/stdlib/advanced.md +629 -0
  94. package/redscript-docs/docs/en/stdlib/bigint.md +316 -0
  95. package/redscript-docs/docs/en/stdlib/bits.md +292 -0
  96. package/redscript-docs/docs/en/stdlib/bossbar.md +177 -0
  97. package/redscript-docs/docs/en/stdlib/calculus.md +289 -0
  98. package/redscript-docs/docs/en/stdlib/color.md +353 -0
  99. package/redscript-docs/docs/en/stdlib/combat.md +88 -0
  100. package/redscript-docs/docs/en/stdlib/cooldown.md +82 -0
  101. package/redscript-docs/docs/en/stdlib/dialog.md +155 -0
  102. package/redscript-docs/docs/en/stdlib/easing.md +558 -0
  103. package/redscript-docs/docs/en/stdlib/ecs.md +475 -0
  104. package/redscript-docs/docs/en/stdlib/effects.md +324 -0
  105. package/redscript-docs/docs/en/stdlib/events.md +3 -0
  106. package/redscript-docs/docs/en/stdlib/expr.md +45 -0
  107. package/redscript-docs/docs/en/stdlib/fft.md +141 -0
  108. package/redscript-docs/docs/en/stdlib/geometry.md +430 -0
  109. package/redscript-docs/docs/en/stdlib/graph.md +259 -0
  110. package/redscript-docs/docs/en/stdlib/heap.md +185 -0
  111. package/redscript-docs/docs/en/stdlib/interactions.md +179 -0
  112. package/redscript-docs/docs/en/stdlib/inventory.md +97 -0
  113. package/redscript-docs/docs/en/stdlib/linalg.md +557 -0
  114. package/redscript-docs/docs/en/stdlib/list.md +559 -0
  115. package/redscript-docs/docs/en/stdlib/map.md +140 -0
  116. package/redscript-docs/docs/en/stdlib/math.md +193 -0
  117. package/redscript-docs/docs/en/stdlib/math_hp.md +149 -0
  118. package/redscript-docs/docs/en/stdlib/matrix.md +403 -0
  119. package/redscript-docs/docs/en/stdlib/mobs.md +965 -0
  120. package/redscript-docs/docs/en/stdlib/noise.md +244 -0
  121. package/redscript-docs/docs/en/stdlib/ode.md +253 -0
  122. package/redscript-docs/docs/en/stdlib/parabola.md +342 -0
  123. package/redscript-docs/docs/en/stdlib/particles.md +311 -0
  124. package/redscript-docs/docs/en/stdlib/pathfind.md +255 -0
  125. package/redscript-docs/docs/en/stdlib/physics.md +493 -0
  126. package/redscript-docs/docs/en/stdlib/player.md +78 -0
  127. package/redscript-docs/docs/en/stdlib/quaternion.md +673 -0
  128. package/redscript-docs/docs/en/stdlib/queue.md +134 -0
  129. package/redscript-docs/docs/en/stdlib/random.md +223 -0
  130. package/redscript-docs/docs/en/stdlib/result.md +143 -0
  131. package/redscript-docs/docs/en/stdlib/scheduler.md +183 -0
  132. package/redscript-docs/docs/en/stdlib/set_int.md +190 -0
  133. package/redscript-docs/docs/en/stdlib/sets.md +101 -0
  134. package/redscript-docs/docs/en/stdlib/signal.md +400 -0
  135. package/redscript-docs/docs/en/stdlib/sort.md +104 -0
  136. package/redscript-docs/docs/en/stdlib/spawn.md +147 -0
  137. package/redscript-docs/docs/en/stdlib/state.md +142 -0
  138. package/redscript-docs/docs/en/stdlib/strings.md +154 -0
  139. package/redscript-docs/docs/en/stdlib/tags.md +3451 -0
  140. package/redscript-docs/docs/en/stdlib/teams.md +153 -0
  141. package/redscript-docs/docs/en/stdlib/timer.md +246 -0
  142. package/redscript-docs/docs/en/stdlib/vec.md +158 -0
  143. package/redscript-docs/docs/en/stdlib/world.md +298 -0
  144. package/redscript-docs/docs/zh/stdlib/advanced.md +615 -0
  145. package/redscript-docs/docs/zh/stdlib/bigint.md +316 -0
  146. package/redscript-docs/docs/zh/stdlib/bits.md +292 -0
  147. package/redscript-docs/docs/zh/stdlib/bossbar.md +170 -0
  148. package/redscript-docs/docs/zh/stdlib/calculus.md +287 -0
  149. package/redscript-docs/docs/zh/stdlib/color.md +353 -0
  150. package/redscript-docs/docs/zh/stdlib/combat.md +88 -0
  151. package/redscript-docs/docs/zh/stdlib/cooldown.md +84 -0
  152. package/redscript-docs/docs/zh/stdlib/dialog.md +152 -0
  153. package/redscript-docs/docs/zh/stdlib/easing.md +558 -0
  154. package/redscript-docs/docs/zh/stdlib/ecs.md +472 -0
  155. package/redscript-docs/docs/zh/stdlib/effects.md +324 -0
  156. package/redscript-docs/docs/zh/stdlib/events.md +3 -0
  157. package/redscript-docs/docs/zh/stdlib/expr.md +37 -0
  158. package/redscript-docs/docs/zh/stdlib/fft.md +128 -0
  159. package/redscript-docs/docs/zh/stdlib/geometry.md +430 -0
  160. package/redscript-docs/docs/zh/stdlib/graph.md +259 -0
  161. package/redscript-docs/docs/zh/stdlib/heap.md +185 -0
  162. package/redscript-docs/docs/zh/stdlib/interactions.md +160 -0
  163. package/redscript-docs/docs/zh/stdlib/inventory.md +94 -0
  164. package/redscript-docs/docs/zh/stdlib/linalg.md +543 -0
  165. package/redscript-docs/docs/zh/stdlib/list.md +561 -0
  166. package/redscript-docs/docs/zh/stdlib/map.md +132 -0
  167. package/redscript-docs/docs/zh/stdlib/math.md +193 -0
  168. package/redscript-docs/docs/zh/stdlib/math_hp.md +143 -0
  169. package/redscript-docs/docs/zh/stdlib/matrix.md +396 -0
  170. package/redscript-docs/docs/zh/stdlib/mobs.md +965 -0
  171. package/redscript-docs/docs/zh/stdlib/noise.md +244 -0
  172. package/redscript-docs/docs/zh/stdlib/ode.md +243 -0
  173. package/redscript-docs/docs/zh/stdlib/parabola.md +337 -0
  174. package/redscript-docs/docs/zh/stdlib/particles.md +307 -0
  175. package/redscript-docs/docs/zh/stdlib/pathfind.md +255 -0
  176. package/redscript-docs/docs/zh/stdlib/physics.md +493 -0
  177. package/redscript-docs/docs/zh/stdlib/player.md +78 -0
  178. package/redscript-docs/docs/zh/stdlib/quaternion.md +669 -0
  179. package/redscript-docs/docs/zh/stdlib/queue.md +124 -0
  180. package/redscript-docs/docs/zh/stdlib/random.md +222 -0
  181. package/redscript-docs/docs/zh/stdlib/result.md +147 -0
  182. package/redscript-docs/docs/zh/stdlib/scheduler.md +173 -0
  183. package/redscript-docs/docs/zh/stdlib/set_int.md +180 -0
  184. package/redscript-docs/docs/zh/stdlib/sets.md +107 -0
  185. package/redscript-docs/docs/zh/stdlib/signal.md +373 -0
  186. package/redscript-docs/docs/zh/stdlib/sort.md +104 -0
  187. package/redscript-docs/docs/zh/stdlib/spawn.md +142 -0
  188. package/redscript-docs/docs/zh/stdlib/state.md +134 -0
  189. package/redscript-docs/docs/zh/stdlib/strings.md +107 -0
  190. package/redscript-docs/docs/zh/stdlib/tags.md +3451 -0
  191. package/redscript-docs/docs/zh/stdlib/teams.md +150 -0
  192. package/redscript-docs/docs/zh/stdlib/timer.md +254 -0
  193. package/redscript-docs/docs/zh/stdlib/vec.md +158 -0
  194. package/redscript-docs/docs/zh/stdlib/world.md +289 -0
  195. package/src/__tests__/formatter-extra.test.ts +139 -0
  196. package/src/__tests__/global-vars.test.ts +171 -0
  197. package/src/__tests__/lint/new-rules.test.ts +437 -0
  198. package/src/__tests__/lsp-rename.test.ts +171 -0
  199. package/src/__tests__/mc-integration/say-fstring.test.ts +211 -0
  200. package/src/__tests__/mc-integration/stdlib-coverage-2.test.ts +1 -1
  201. package/src/__tests__/mc-integration/stdlib-coverage-3.test.ts +1 -1
  202. package/src/__tests__/mc-integration/stdlib-coverage-4.test.ts +1 -1
  203. package/src/__tests__/mc-integration/stdlib-coverage-5.test.ts +1 -1
  204. package/src/__tests__/mc-integration/stdlib-coverage-6.test.ts +1 -1
  205. package/src/__tests__/mc-integration/stdlib-coverage-7.test.ts +1 -1
  206. package/src/__tests__/mc-integration/stdlib-coverage-8.test.ts +1 -1
  207. package/src/__tests__/mc-syntax.test.ts +3 -0
  208. package/src/__tests__/monomorphize-coverage.test.ts +220 -0
  209. package/src/__tests__/optimizer-cse.test.ts +250 -0
  210. package/src/__tests__/parser.test.ts +4 -13
  211. package/src/__tests__/repl-server-extra.test.ts +6 -6
  212. package/src/__tests__/repl-server.test.ts +5 -6
  213. package/src/__tests__/stdlib/queue.test.ts +6 -6
  214. package/src/lexer/index.ts +2 -1
  215. package/src/lint/index.ts +713 -5
  216. package/src/mc-test/client.ts +40 -0
  217. package/src/mir/lower.ts +111 -2
  218. package/src/optimizer/interprocedural.ts +40 -2
  219. package/src/parser/decl-parser.ts +349 -0
  220. package/src/parser/expr-parser.ts +838 -0
  221. package/src/parser/index.ts +17 -2558
  222. package/src/parser/stmt-parser.ts +585 -0
  223. package/src/parser/type-parser.ts +276 -0
  224. package/src/parser/utils.ts +173 -0
  225. package/src/stdlib/queue.mcrs +19 -6
@@ -0,0 +1,185 @@
1
+ # Heap
2
+
3
+ > Auto-generated from `src/stdlib/heap.mcrs` — do not edit manually.
4
+
5
+ ## API
6
+
7
+ - [heap_new](#heap-new)
8
+ - [heap_size](#heap-size)
9
+ - [heap_peek](#heap-peek)
10
+ - [heap_push](#heap-push)
11
+ - [heap_pop](#heap-pop)
12
+ - [max_heap_push](#max-heap-push)
13
+ - [max_heap_pop](#max-heap-pop)
14
+
15
+ ---
16
+
17
+ ## `heap_new` <Badge type="info" text="v1.0.0" />
18
+
19
+ Allocate a new empty heap with capacity for 64 elements.
20
+
21
+ ```redscript
22
+ fn heap_new(): int[]
23
+ ```
24
+
25
+ **Returns:** int[] with h[0]=0 (size) and h[1..64] pre-allocated as zeros
26
+
27
+ **Example**
28
+
29
+ ```redscript
30
+ let h: int[] = heap_new()
31
+ ```
32
+
33
+ ---
34
+
35
+ ## `heap_size` <Badge type="info" text="v1.0.0" />
36
+
37
+ Return the number of elements currently stored in the heap.
38
+
39
+ ```redscript
40
+ fn heap_size(h: int[]): int
41
+ ```
42
+
43
+ **Parameters**
44
+
45
+ | Parameter | Description |
46
+ |-----------|-------------|
47
+ | `h` | Heap array (created with heap_new) |
48
+
49
+ **Returns:** Current element count (h[0])
50
+
51
+ **Example**
52
+
53
+ ```redscript
54
+ let sz: int = heap_size(h)
55
+ ```
56
+
57
+ ---
58
+
59
+ ## `heap_peek` <Badge type="info" text="v1.0.0" />
60
+
61
+ Return the root element without removing it (min for MinHeap, max for MaxHeap).
62
+
63
+ ```redscript
64
+ fn heap_peek(h: int[]): int
65
+ ```
66
+
67
+ **Parameters**
68
+
69
+ | Parameter | Description |
70
+ |-----------|-------------|
71
+ | `h` | Non-empty heap array; precondition: heap_size(h) > 0 |
72
+
73
+ **Returns:** The root element (h[1])
74
+
75
+ **Example**
76
+
77
+ ```redscript
78
+ let top: int = heap_peek(h) // peek min without modifying heap
79
+ ```
80
+
81
+ ---
82
+
83
+ ## `heap_push` <Badge type="info" text="v1.0.0" />
84
+
85
+ Insert a value into a MinHeap (smallest element at root).
86
+
87
+ ```redscript
88
+ fn heap_push(h: int[], val: int): int[]
89
+ ```
90
+
91
+ **Parameters**
92
+
93
+ | Parameter | Description |
94
+ |-----------|-------------|
95
+ | `h` | Heap array (from heap_new) |
96
+ | `val` | Value to insert |
97
+
98
+ **Returns:** Updated heap array with val inserted and heap property maintained
99
+
100
+ **Example**
101
+
102
+ ```redscript
103
+ h = heap_push(h, 42)
104
+ h = heap_push(h, 7)
105
+ // heap_peek(h) == 7
106
+ ```
107
+
108
+ ---
109
+
110
+ ## `heap_pop` <Badge type="info" text="v1.0.0" />
111
+
112
+ Remove and discard the minimum element from a MinHeap.
113
+
114
+ ```redscript
115
+ fn heap_pop(h: int[]): int[]
116
+ ```
117
+
118
+ **Parameters**
119
+
120
+ | Parameter | Description |
121
+ |-----------|-------------|
122
+ | `h` | Non-empty MinHeap array; precondition: heap_size(h) > 0 |
123
+
124
+ **Returns:** Updated heap array with minimum removed and heap property restored
125
+
126
+ **Example**
127
+
128
+ ```redscript
129
+ let min_val: int = heap_peek(h)
130
+ h = heap_pop(h) // remove the minimum
131
+ ```
132
+
133
+ ---
134
+
135
+ ## `max_heap_push` <Badge type="info" text="v1.0.0" />
136
+
137
+ Insert a value into a MaxHeap (largest element at root).
138
+
139
+ ```redscript
140
+ fn max_heap_push(h: int[], val: int): int[]
141
+ ```
142
+
143
+ **Parameters**
144
+
145
+ | Parameter | Description |
146
+ |-----------|-------------|
147
+ | `h` | Heap array (from heap_new) |
148
+ | `val` | Value to insert |
149
+
150
+ **Returns:** Updated heap array with val inserted and max-heap property maintained
151
+
152
+ **Example**
153
+
154
+ ```redscript
155
+ h = max_heap_push(h, 5)
156
+ h = max_heap_push(h, 99)
157
+ // heap_peek(h) == 99
158
+ ```
159
+
160
+ ---
161
+
162
+ ## `max_heap_pop` <Badge type="info" text="v1.0.0" />
163
+
164
+ Remove and discard the maximum element from a MaxHeap.
165
+
166
+ ```redscript
167
+ fn max_heap_pop(h: int[]): int[]
168
+ ```
169
+
170
+ **Parameters**
171
+
172
+ | Parameter | Description |
173
+ |-----------|-------------|
174
+ | `h` | Non-empty MaxHeap array; precondition: heap_size(h) > 0 |
175
+
176
+ **Returns:** Updated heap array with maximum removed and max-heap property restored
177
+
178
+ **Example**
179
+
180
+ ```redscript
181
+ let max_val: int = heap_peek(h)
182
+ h = max_heap_pop(h) // remove the maximum
183
+ ```
184
+
185
+ ---
@@ -0,0 +1,179 @@
1
+ # Interactions
2
+
3
+ > Auto-generated from `src/stdlib/interactions.mcrs` — do not edit manually.
4
+
5
+ ## API
6
+
7
+ - [interactions_init](#interactions-init)
8
+ - [on_right_click](#on-right-click)
9
+ - [example_right_click](#example-right-click)
10
+ - [is_sneaking](#is-sneaking)
11
+ - [on_sneak_start](#on-sneak-start)
12
+ - [check_look_up](#check-look-up)
13
+ - [check_look_down](#check-look-down)
14
+ - [check_look_straight](#check-look-straight)
15
+ - [check_holding_item](#check-holding-item)
16
+ - [on_sneak_click](#on-sneak-click)
17
+ - [DOUBLE_TAP_WINDOW](#double-tap-window)
18
+ - [on_double_sneak](#on-double-sneak)
19
+
20
+ ---
21
+
22
+ ## `interactions_init`
23
+
24
+ Initializes the scoreboard objectives used by this module.
25
+ Call once during pack setup before any per-tick interaction checks.
26
+ Creates `rs.click`, `rs.sneak`, and `rs.attack`.
27
+
28
+ ```redscript
29
+ fn interactions_init()
30
+ ```
31
+
32
+ ---
33
+
34
+ ## `on_right_click`
35
+
36
+ Detects right-click input using the `rs.click` scoreboard.
37
+ Players with a positive click count are reset and tagged with `rs.clicked`.
38
+ The `callback_fn` parameter is reserved for future callback dispatch and is
39
+ not used by the current implementation.
40
+
41
+ ```redscript
42
+ fn on_right_click(callback_fn: string)
43
+ ```
44
+
45
+ **Parameters**
46
+
47
+ | Parameter | Description |
48
+ |-----------|-------------|
49
+ | `callback_fn` | Reserved callback identifier, currently unused |
50
+
51
+ ---
52
+
53
+ ## `example_right_click`
54
+
55
+ Demonstrates how to consume `rs.click` directly.
56
+ Broadcasts a message when a player right-clicks and resets the click count.
57
+
58
+ ```redscript
59
+ fn example_right_click()
60
+ ```
61
+
62
+ ---
63
+
64
+ ## `is_sneaking`
65
+
66
+ Returns whether the target is currently sneaking.
67
+ This checks whether `rs.sneak` is greater than zero.
68
+
69
+ ```redscript
70
+ fn is_sneaking(target: selector) -> int
71
+ ```
72
+
73
+ **Parameters**
74
+
75
+ | Parameter | Description |
76
+ |-----------|-------------|
77
+ | `target` | Player selector to inspect |
78
+
79
+ **Returns:** `1` if sneaking, otherwise `0`
80
+
81
+ ---
82
+
83
+ ## `on_sneak_start`
84
+
85
+ Tags players who started sneaking on the current tick.
86
+ Players with `rs.sneak == 1` receive the `rs.sneak_start` tag, and the tag
87
+ is removed from everyone else.
88
+
89
+ ```redscript
90
+ fn on_sneak_start()
91
+ ```
92
+
93
+ ---
94
+
95
+ ## `check_look_up`
96
+
97
+ Tags players currently looking upward.
98
+ Players with pitch from `-90` to `-45` receive the `rs.look_up` tag.
99
+
100
+ ```redscript
101
+ fn check_look_up()
102
+ ```
103
+
104
+ ---
105
+
106
+ ## `check_look_down`
107
+
108
+ Tags players currently looking downward.
109
+ Players with pitch from `45` to `90` receive the `rs.look_down` tag.
110
+
111
+ ```redscript
112
+ fn check_look_down()
113
+ ```
114
+
115
+ ---
116
+
117
+ ## `check_look_straight`
118
+
119
+ Tags players currently looking roughly straight ahead.
120
+ Players with pitch from `-45` to `45` receive the `rs.look_straight` tag.
121
+
122
+ ```redscript
123
+ fn check_look_straight()
124
+ ```
125
+
126
+ ---
127
+
128
+ ## `check_holding_item`
129
+
130
+ Placeholder helper for item-in-hand checks.
131
+ The current implementation only prints guidance because robust item checks
132
+ require predicates or explicit NBT checks.
133
+
134
+ ```redscript
135
+ fn check_holding_item(item_id: string)
136
+ ```
137
+
138
+ **Parameters**
139
+
140
+ | Parameter | Description |
141
+ |-----------|-------------|
142
+ | `item_id` | Expected item identifier or logical item key |
143
+
144
+ ---
145
+
146
+ ## `on_sneak_click`
147
+
148
+ Detects a sneak-plus-right-click combo.
149
+ Players who click while sneaking receive `rs.sneak_click`; otherwise they
150
+ receive the normal `rs.clicked` tag. Click counters are reset in both cases.
151
+
152
+ ```redscript
153
+ fn on_sneak_click()
154
+ ```
155
+
156
+ ---
157
+
158
+ ## `DOUBLE_TAP_WINDOW`
159
+
160
+ Double-sneak detection window in ticks.
161
+ A second sneak start within this many ticks counts as a double tap.
162
+
163
+ ```redscript
164
+ const DOUBLE_TAP_WINDOW: int = 10; // 0.5 second
165
+ ```
166
+
167
+ ---
168
+
169
+ ## `on_double_sneak`
170
+
171
+ Detects a double-tap sneak pattern.
172
+ Requires external scoreboards `rs.last_sneak` and `rs.tick` to be updated by
173
+ the caller. Players who qualify receive the `rs.double_sneak` tag.
174
+
175
+ ```redscript
176
+ fn on_double_sneak()
177
+ ```
178
+
179
+ ---
@@ -0,0 +1,97 @@
1
+ # Inventory
2
+
3
+ > Auto-generated from `src/stdlib/inventory.mcrs` — do not edit manually.
4
+
5
+ ## API
6
+
7
+ - [clear_inventory](#clear-inventory)
8
+ - [give_kit_warrior](#give-kit-warrior)
9
+ - [give_kit_archer](#give-kit-archer)
10
+ - [give_kit_mage](#give-kit-mage)
11
+ - [remove_item](#remove-item)
12
+
13
+ ---
14
+
15
+ ## `clear_inventory`
16
+
17
+ Clears all inventory slots from the target selector.
18
+
19
+ ```redscript
20
+ fn clear_inventory(target: selector)
21
+ ```
22
+
23
+ **Parameters**
24
+
25
+ | Parameter | Description |
26
+ |-----------|-------------|
27
+ | `target` | Player or entity selector whose inventory should be cleared |
28
+
29
+ ---
30
+
31
+ ## `give_kit_warrior`
32
+
33
+ Gives a melee-focused warrior kit to the target selector.
34
+ The kit includes iron armor, a sword, a shield, and food.
35
+
36
+ ```redscript
37
+ fn give_kit_warrior(target: selector)
38
+ ```
39
+
40
+ **Parameters**
41
+
42
+ | Parameter | Description |
43
+ |-----------|-------------|
44
+ | `target` | Player or entity selector receiving the kit |
45
+
46
+ ---
47
+
48
+ ## `give_kit_archer`
49
+
50
+ Gives a ranged archer kit to the target selector.
51
+ The kit includes a bow, arrows, light armor, and food.
52
+
53
+ ```redscript
54
+ fn give_kit_archer(target: selector)
55
+ ```
56
+
57
+ **Parameters**
58
+
59
+ | Parameter | Description |
60
+ |-----------|-------------|
61
+ | `target` | Player or entity selector receiving the kit |
62
+
63
+ ---
64
+
65
+ ## `give_kit_mage`
66
+
67
+ Gives a utility-heavy mage kit to the target selector.
68
+ The kit includes mobility, consumables, and splash damage items.
69
+
70
+ ```redscript
71
+ fn give_kit_mage(target: selector)
72
+ ```
73
+
74
+ **Parameters**
75
+
76
+ | Parameter | Description |
77
+ |-----------|-------------|
78
+ | `target` | Player or entity selector receiving the kit |
79
+
80
+ ---
81
+
82
+ ## `remove_item`
83
+
84
+ Removes all copies of a specific item from the target selector.
85
+
86
+ ```redscript
87
+ fn remove_item(target: selector, item: string)
88
+ ```
89
+
90
+ **Parameters**
91
+
92
+ | Parameter | Description |
93
+ |-----------|-------------|
94
+ | `target` | Player or entity selector whose inventory will be filtered |
95
+ | `item` | Item ID or item-with-NBT argument accepted by `clear` |
96
+
97
+ ---