Module api.lua
API
Functions
asm.getEgg (entity) | Retrieves egg that spawns specified entity. |
asm.registerEggRecipe (name, ingredients) | Adds a craft recipe for an egg. |
asm.registerEgg (def) | Registers new egg in game. |
Tables
EggDef | Egg definition table. |
Functions
- asm.getEgg (entity)
-
Retrieves egg that spawns specified entity.
Parameters:
- entity string Entity name spawned by egg.
Returns:
-
string
Egg name or
nil
. - asm.registerEggRecipe (name, ingredients)
-
Adds a craft recipe for an egg.
Alias: asm.addEggRecipe
Parameters:
- name Name of spawnegg that will be created from recipe.
- ingredients
Items used for recipe in addition to
spawneggs:egg
. Can be string or list.
- asm.registerEgg (def)
-
Registers new egg in game.
Alias: asm.addEgg
Parameters:
- def EggDef table.
Tables
- EggDef
-
Egg definition table.
Fields:
- name string Name of the egg. Will be appended to "spawneggs:".
- title string Description displayed for item. (optional)
- inventory_image string Image displayed in inventory.
- spawn string Entity that will be spawned from egg.
- ingredients
table
Ingredients to use, in addition to
spawneggs:egg
, to register craft recipe. Can be a table or string. (optional)