-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathautodoc.lua
More file actions
629 lines (493 loc) · 17.5 KB
/
autodoc.lua
File metadata and controls
629 lines (493 loc) · 17.5 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
---@meta luafyautodoc
--#region Information
-- GENERATED AUTODOC
-- Generated: 2026-03-04T20:09:33.245086
-- Luafy Version: 2.0.0
-- Format: Lua LS library file
--#endregion
---@type table
ctx = {}
--#region Default Overrides
--- Load a module. To use default Lua behaviour, ignore the second argument. To load a module from within a datapack, add the namespace of the target datapack as the second argument.
---@param modname string Module name to load.
---@param namespace string | nil Namespace of datapack to load from. Leave blank to use default Lua require behaviour, which probably won't work.
---@return table
function require(modname, namespace) end
--#endregion
--#region String Aliases
---@alias Note string
---@alias Instrument string
---@alias TextComponentColor string
---@alias Identifier string
---@alias ArgtypeIdentifier string
---@alias ScriptEventIdentifier string
---@alias ItemIdentifier string
---@alias BlockIdentifier string
---@alias EntityTypeIdentifier string
---@alias BiomeIdentifier string
---@alias DimensionIdentifier string
---@alias EnchantmentIdentifier string
---@alias StatusEffectIdentifier string
--#endregion
--#region Enums
---@enum (key) Note
Note = {
G_FLAT_LOW = "G_FLAT_LOW",
A_FLAT_LOW = "A_FLAT_LOW",
E_LOW = "E_LOW",
F_SHARP_LOW = "F_SHARP_LOW",
B_HIGH = "B_HIGH",
B_FLAT_HIGH = "B_FLAT_HIGH",
C_SHARP_HIGH = "C_SHARP_HIGH",
E_HIGH = "E_HIGH",
D_LOW = "D_LOW",
C_SHARP_LOW = "C_SHARP_LOW",
G_FLAT_HIGH = "G_FLAT_HIGH",
D_HIGH = "D_HIGH",
F_SHARP_HIGH = "F_SHARP_HIGH",
G_HIGH = "G_HIGH",
A_FLAT_HIGH = "A_FLAT_HIGH",
C_LOW = "C_LOW",
A_HIGH = "A_HIGH",
G_LOW = "G_LOW",
C_HIGH = "C_HIGH",
F_HIGH = "F_HIGH",
A_LOW = "A_LOW",
B_LOW = "B_LOW",
D_SHARP_HIGH = "D_SHARP_HIGH",
B_FLAT_LOW = "B_FLAT_LOW",
F_LOW = "F_LOW",
D_SHARP_LOW = "D_SHARP_LOW",
}
---@enum (key) Instrument
Instrument = {
VIBRAPHONE = "VIBRAPHONE",
BASS = "BASS",
HIHAT = "HIHAT",
DIDGERIDOO = "DIDGERIDOO",
XYLOPHONE = "XYLOPHONE",
GLOCKENSPIEL = "GLOCKENSPIEL",
BIT = "BIT",
CHIME = "CHIME",
PLING = "PLING",
SNARE = "SNARE",
GUITAR = "GUITAR",
BANJO = "BANJO",
BASS_DRUM = "BASS_DRUM",
HARP = "HARP",
COWBELL = "COWBELL",
FLUTE = "FLUTE",
}
---@enum (key) TextComponentColor
TextComponentColor = {
GOLD = "GOLD",
GRAY = "GRAY",
AQUA = "AQUA",
WHITE = "WHITE",
BLUE = "BLUE",
DARK_AQUA = "DARK_AQUA",
DARK_BLUE = "DARK_BLUE",
GREEN = "GREEN",
RED = "RED",
DARK_PURPLE = "DARK_PURPLE",
DARK_RED = "DARK_RED",
LIGHT_PURPLE = "LIGHT_PURPLE",
BLACK = "BLACK",
DARK_GREEN = "DARK_GREEN",
YELLOW = "YELLOW",
DARK_GRAY = "DARK_GRAY",
}
--#endregion
--#region Script Object
--- Mathematical 3D Vector
---@class Vec3d
---@field x number x component
---@field y number y component
---@field z number z component
local Vec3d = {}
--- An object representing a mod installed on the server.
---@class Mod
local Mod = {}
--- Gets the id of this mod.
---@return string
function Mod.get_mod_id() end
--- The version of the mod currently installed.
---@return string
function Mod.get_version() end
--- Object representing the potential result of a script execution. Since scripts run asynchronously, this object allows for a result to be awaited if needed.
---@class ScriptResult
local ScriptResult = {}
--- Awaits this script to complete execution if it has not already, and returns the result.
---@return any | nil
function ScriptResult.await_result() end
--- Awaits this script to complete execution if it has not already, and returns if it succeeded.
---@return boolean
function ScriptResult.await_success() end
--- Awaits this script to complete execution if it has not already, and returns the error string if it failed, or nil if it succeeded.
---@return string | nil
function ScriptResult.await_error() end
--- Releases the internal Result Java object from the cache. Using this object after this has been called may result in an error.
---@return nil
function ScriptResult.release() end
--- An entity.
---@class Entity
local Entity = {}
--- Gets the entity's current position.
---@return Vec3d
function Entity.get_pos() end
--- Gets the entity's UUID.
---@return string
function Entity.get_uuid() end
--- Gets the entity's name.
---@return string
function Entity.get_name() end
--- Gets the id of the entity type that this entity is.
---@return string
function Entity.get_type_id() end
--- Gets the the entity type that this entity is.
---@return EntityType
function Entity.get_type() end
--- Returns true if this entity is a LivingEntity.
---@return boolean
function Entity.is_living() end
--- Return this entity as a LivingEntity.
---@return LivingEntity
function Entity.as_living() end
--- Returns true if this entity is a PlayerEntity.
---@return boolean
function Entity.is_player() end
--- Return this entity as a PlayerEntity.
---@return Player
function Entity.as_player() end
--- Execute a commmand as this entity.
---@param command string The command to execute.
---@return integer
function Entity.execute_as(command) end
--- A living entity.
---@class LivingEntity: Entity
local LivingEntity = {}
--- Returns this entities health.
---@return number
function LivingEntity.get_health() end
--- Damages this entity.
---@param damage_type string Identifier of a damage type.
---@param amount number Amount of damage to deal.
---@param source Entity | nil Optional entity that dealt this damage.
---@return nil
function LivingEntity.hurt(damage_type, amount, source) end
--- Applies infinite damage to this entity with the specified type. If no type is specified, the default damage source is used. Please note that if the entity is invulnerable to the specified damage source, it will not kill them!
---@param damage_type string | nil Identifier of a damage type.
---@param source Entity | nil Optional entity that killed this one.
---@return nil
function LivingEntity.kill(damage_type, source) end
--- Teleports this entity to the specified position
---@param pos Vec3d Position to teleport to.
---@param yaw number | nil Yaw angle of entity after teleporting. Defaults to current yaw.
---@param pitch number | nil Pitch angle of entity after teleporting. Defaults to current pitch.
---@param retain_velocity boolean | nil If true, the entity will retain their velocity after teleporting. Defaults to true.
---@param dimension_id string | nil Identifier of dimension to teleport to. Defaults to the entities current dimension.
---@return nil
function LivingEntity.teleport(pos, yaw, pitch, retain_velocity, dimension_id) end
--- Gets an itemstack from this entities inventory by an inventory slot reference.
---@param slot_reference string Reference to the slot to get the stack from.
---@return ItemStack
function LivingEntity.get_stack(slot_reference) end
--- A player.
---@class Player: LivingEntity
local Player = {}
--- Prints a line to this player's chat.
---@param msg string String to display.
---@return nil
function Player.tell(msg) end
--- Prints a text component to this player's chat.
---@param msg TextComponent Component to display.
---@return nil
function Player.tell_component(msg) end
--- Gives this player this stack.
---@param stack ItemStack Stack to give.
---@return nil
function Player.give_stack(stack) end
--- A block type.
---@class Block
local Block = {}
--- An item type.
---@class Item
local Item = {}
--- Creates an items stack of this item type.
---@param count integer | nil The number of items to create a stack of. Defaults to 1.
---@return ItemStack
function Item.create_stack(count) end
--- An entity type.
---@class EntityType
local EntityType = {}
--- Returns true if this entity can exist in peaceful difficulty.
---@return boolean
function EntityType.can_exist_in_peaceful() end
--- Returns true if this entity is immune to fire.
---@return boolean
function EntityType.is_fire_immune() end
--- Spawns a new instance of this entity.
---@param pos Vec3d Position to spawn at.
---@param dimension string | nil Id of dimension to spawn in.
---@return Entity
function EntityType.spawn(pos, dimension) end
--- Returns the id of this entity type.
---@return string
function EntityType.get_id() end
--- An item stack.
---@class ItemStack
local ItemStack = {}
--- Gets the item type of this stack.
---@return Item
function ItemStack.get_item_type() end
--- Gets the item id of this stack.
---@return string
function ItemStack.get_item_id() end
--- Gets the number of items in this stack.
---@return integer
function ItemStack.get_count() end
--- Sets the number of items in this stack.
---@param count integer Count to set.
---@return nil
function ItemStack.set_count(count) end
--- Gets a component from this stack as NBT.
---@param component_id string The id of the component type to fetch.
---@return table
function ItemStack.get_component(component_id) end
--- Sets a component from this stack as NBT.
---@param component_id string The id of the component type.
---@param nbt table The data to write. Will be encoded into the item stack.
---@return nil
function ItemStack.set_component(component_id, nbt) end
--- Text component.
---@class TextComponent
local TextComponent = {}
--- Serialises this text component to a JSON string.
---@return string
function TextComponent.serialise() end
--- Sets the text's color.
---@param color integer Color as an integer.
---@return TextComponent
function TextComponent.color(color) end
--- Sets the text's color.
---@param color TextComponentColor Predefined color.
---@return TextComponent
function TextComponent.color_predefined(color) end
--- Sets the text's font.
---@param font string Identifier of a Font to use.
---@return TextComponent
function TextComponent.font(font) end
--- Emboldens the text.
---@param flag boolean If true, emboldens the text.
---@return TextComponent
function TextComponent.bold(flag) end
--- Italicises the text.
---@param flag boolean If true, italicises the text.
---@return TextComponent
function TextComponent.italic(flag) end
--- Underlines the text.
---@param flag boolean If true, underlines the text.
---@return TextComponent
function TextComponent.underline(flag) end
--- Strikes through the text.
---@param flag boolean If true, strikes through the text.
---@return TextComponent
function TextComponent.strikethrough(flag) end
--- Obfuscates the text.
---@param flag boolean If true, obfuscates the text.
---@return TextComponent
function TextComponent.obfuscated(flag) end
--#endregion
--#region Script Api
minecraft = {}
--- Returns the current Minecraft version string.
---@return string
function minecraft.get_version() end
--- Prints an unformatted line to the command source.
---@param message string Message to be printed.
---@return nil
function minecraft.feedback(message) end
--- Prints a text component to the command source.
---@param message string Message to be printed.
---@return nil
function minecraft.feedback_component(message) end
--- Executes the given command from the server command source. Returns the result of the command.
---@param command string Command to be executed.
---@return integer
function minecraft.command(command) end
--- Plays the specified noteblock note at the given location.
---@param note Note Note to play
---@param instrument Instrument Instrument
---@param pos Vec3d Location to play sound at
---@param particle boolean If true, a particle will also render. Defaults to true.
---@return nil
function minecraft.note(note, instrument, pos, particle) end
--- Waits for a given number of seconds before continuing.
---@param seconds number Number of seconds to wait.
---@return nil
function minecraft.sleep(seconds) end
local registry = {}
--- Fetches an item type from the registry.
---@param id string Identifier of the item type.
---@return Item
function registry.item(id) end
--- Fetches an block type from the registry.
---@param id string Identifier of the block type.
---@return Block
function registry.block(id) end
--- Fetches an entity type from the registry.
---@param id string Identifier of the entity type.
---@return EntityType
function registry.entity_type(id) end
minecraft.registry = registry
local entities = {}
--- Uses an entity selector to find a player.
---@param selector string Entity selector
---@return Player
function entities.get_player_from_selector(selector) end
--- Uses an entity selector to find an entity.
---@param selector string Entity selector
---@return Entity
function entities.get_entity_from_selector(selector) end
--- Uses an entity selector to find several entities.
---@param selector string Entity selector
---@return Entity[]
function entities.get_entities_from_selector(selector) end
minecraft.entities = entities
local object = {}
--- Creates an ItemStack from an item and count.
---@param item Item Item type.
---@param count integer Count.
---@return ItemStack
function object.itemstack(item, count) end
minecraft.object = object
luafy = {}
--- Executes the script with the given identifier, and awaits its completion. Returns future result, that can be awaited if needed.
---@param script string Identifier of script to be executed.
---@param context table | nil Context to pass to script. Defaults to an empty table.
---@return ScriptResult
function luafy.script(script, context) end
--- Returns the context table for this script. The contents of this table depend on the event that called it, or the values passed by /luafy. This is the same as the global table `ctx`.
---@return table
function luafy.context() end
--- Returns a random hello world, as the mod does when Minecraft boots.
---@return string
function luafy.provide_hello_world() end
--- Returns the version of LuaJ used by the mod.
---@return string
function luafy.get_luaj_version() end
--- Dump a table to a string.
---@param table table Table to dump.
---@return string
function luafy.dump(table) end
math = {}
--- Creates a 3-component vector object.
---@param x number x component
---@param y number y component
---@param z number z component
---@return Vec3d
function math.vec3d(x, y, z) end
fabric = {}
--- Returns the current Fabric version string.
---@return string
function fabric.get_version() end
--- Returns true if the specified mod exists.
---@param modid string A mod id.
---@return boolean
function fabric.has_mod(modid) end
--- Returns an object representing an installed mod. Returns nil if the specified mod does not exist.
---@param modid string A mod id.
---@return Mod
function fabric.get_mod(modid) end
--- Returns a list of all the mods that are installed.
---@return string[]
function fabric.get_mods() end
text = {}
--- Creates a literal text component.
---@param literal string Literal text.
---@return TextComponent
function text.literal(literal) end
--- Creates a translatable text component.
---@param translatable string Translation key
---@param components TextComponent[] | nil Optional list of components to use as placeholders.
---@return TextComponent
function text.translatable(translatable, components) end
--- Creates a player sprite text component.
---@param player Player Player to use.
---@return TextComponent
function text.player_sprite(player) end
--- Creates a atlas-source sprite text component.
---@param atlas string Atlas to use.
---@param sprite string Sprite to use.
---@return TextComponent
function text.atlas_sprite(atlas, sprite) end
--- Creates a text component by concatenating several elements together.
---@param elements TextComponent[] Elements to concatenate together.
---@return TextComponent
function text.compound(elements) end
nbtstorage = {}
--- Reads abstract NBT data from storage.
---@param id string Storage id to read.
---@return table
function nbtstorage.read(id) end
--- Writes abstract NBT data to storage.
---@param id string Storage id to write to.
---@param table table Data to write.
---@return nil
function nbtstorage.write(id, table) end
--#endregion
--#region Script Event
-- luafy:load | Executes after a reload.;
--
-- luafy:tick | Executes every server tick.;
--
-- luafy:entity_takes_damage | Executes after an entity takes damage.;
-- entity: LivingEntity -> Living Entity that took damage.
-- attacker: Entity | nil -> Entity that dealt damage.
-- damage_taken: number -> Damage taken.
-- was_blocked: boolean -> If true, the damage was blocked.
--
-- luafy:entity_dies | Executes after an entity dies.;
-- entity: LivingEntity -> Living Entity that died.
-- attacker: Entity | nil -> Entity that killed this one.
--
-- luafy:player_joins_server | Executes when a player joins the server.;
-- player: Player -> Player that joined.
--
-- luafy:player_leaves_server | Executes when a player joins the server.;
-- player: Player -> Player that left.
--
--#endregion
--#region All Types Index
-- nil - luaj:nil
-- boolean - luaj:boolean
-- number - luaj:number
-- string - luaj:string
-- any - luaj:any
-- integer - luaj:integer
-- table - luaj:table
-- Note - luafy:note
-- Instrument - luafy:instrument
-- TextComponentColor - luafy:text_component_color
-- Vec3d - luafy:vec3d
-- Mod - luafy:mod
-- ScriptResult - luafy:script_result
-- Entity - luafy:entity
-- LivingEntity - luafy:living_entity
-- Player - luafy:player
-- Block - luafy:registry_block
-- Item - luafy:registry_item
-- EntityType - luafy:registry_entity_type
-- ItemStack - luafy:item_stack
-- TextComponent - luafy:text_component
-- Identifier - luafy:identifier
-- ArgtypeIdentifier - luafy:argtype_identifier
-- ScriptEventIdentifier - luafy:script_event_identifier
-- ItemIdentifier - luafy:item_identifier
-- BlockIdentifier - luafy:block_identifier
-- EntityTypeIdentifier - luafy:entity_type_identifier
-- BiomeIdentifier - luafy:biome_identifier
-- DimensionIdentifier - luafy:dimension_identifier
-- EnchantmentIdentifier - luafy:enchantment_identifier
-- StatusEffectIdentifier - luafy:effect_identifier
--#endregion