Entities in Minetest include any objects than can move without being removed other than particles. Entities include the player entity, mobs, and any other moving visuals you want to create.


For information about mobs, see "Basic operations" on the Bucket_Game page.

Information for Developers

The Bucket_Game page has or will have information for programming mobs in the "Mobs in general" category. The information here is therefore focused on creating entities that do not operate the same way that the mobs API operates them, and on creating or improving mobs APIs.

Mobs are an extension of entities, and several mob APIs exist. The codermobs modpack's "mobs" directory is the mobs api of Bucket_Game. Other mob APIs may also be called "mobs." Generally, mobs APIs should not coexist in a world, so overlaps in naming are not a problem.

Entities can contain any number of Lua properties. They are generally controlled by Lua.

If you need entities that do things other than what mobs do, you can extend Entities differently. A few community-created mobs do not depend on any API. For examples on how to do this, see the "Various independent mobs" section near the bottom of the List of Minetest Mobs article.

The mobs API (or your non-mob entity) handle load (deserialize) and save (serialize). However, the engine does the actual reading and writing, and the format saved is extensible, so adding or removing attributes does not cause any problems with the map format. However, if you run the same world that used an older version of your mod (or of the mobs API) that had fewer attributes (or attributes with different names in the case of the example below), you should check whether your variable exists upon deserialize. You should add it if it is missing from any mob your world contains. The following example is from codermobs/mobs/api.lua:

    if not self.base_selbox then
        self.base_selbox = self.selectionbox or self.base_colbox

Removing old entities

If you disable a mod or configuration option that had provided entities, you must safely remove the entities to ensure that no world corruption occurs. Codermobs does this for you (by carefully using clearobjects on entities that are not defined).

© 2012-2020 Final Minetest    |  Privacy   |  Contact   |  Notices.   Minetest is an unregistered trademark of the Final Minetest project in use since 2012.