Update helptext of obsidian
[MineClone/MineClone2.git] / API.md
blob344414b7219e64fd60488e8376eb167ce6ae42c6
1 # API
2 ## Groups
3 MineClone 2 makes very extensive use of groups. Making sure your items and objects have the correct group memberships is very important.
4 Groups are explained in `GROUPS.md`.
6 ## Mod naming convention
7 Mods mods in MineClone 2 follow a simple naming convention: Mods with the prefix “`mcl_`” are specific to MineClone 2, although they may be based on an existing standalone. Mods which lack this prefix are *usually* verbatim copies of a standalone mod. Some modifications may still have been applied, but the APIs are held compatible.
9 ## Adding items
10 ### Special fields
12 Items can have these fields:
13 * `_mcl_generate_description(itemstack)`: Required for any items which manipulate their
14    description in any way. This function takes an itemstack of its own type and must set
15    the proper advanced description for this itemstack. If you don't do this, anvils will
16    fail at properly restoring the description when their custom name gets cleared at an
17    anvil.
18    See `mcl_banners` for an example.
20 All nodes can have these fields:
22 * `_mcl_hardness`: Hardness of the block, ranges from 0 to infinity (represented by -1). Determines digging times. Default: 0
23 * `_mcl_blast_resistance`: How well this block blocks and resists explosions. Default: 0
24 * `_mcl_falling_node_alternative`: If set to an itemstring, the node will turn into this node before it starts to fall.
25 * `_mcl_after_falling(pos)`: Called after a falling node finished falling and turned into a node.
27 Use the `mcl_sounds` mod for the sounds.
29 ## APIs
30 A lot of things are possible by using one of the APIs in the mods. Note that not all APIs are documented yet, but it is planned. The following APIs should be more or less stable but keep in mind that MineClone 2 is still unfinished. All directory names are relative to `mods/`
32 ### Items
33 * Doors: `ITEMS/mcl_doors`
34 * Fences and fence gates: `ITEMS/mcl_fences`
35 * Stairs and slabs: `ITEM/mcl_stairs`
36 * Walls: `ITEMS/mcl_walls`
37 * Beds: `ITEMS/mcl_beds`
38 * Buckets: `ITEMS/mcl_buckets`
39 * Dispenser support: `ITEMS/REDSTONE/mcl_dispensers`
41 ## Mobs
42 * Mobs: `ENTITIES/mcl_mods`
44 MineClone 2 uses its own mobs framework, called “Mobs Redo: MineClone 2 Edition” or “MRM” for short.
45 This is a fork of Mobs Redo [`mobs`] by TenPlus1.
47 You can add your own mobs, spawn eggs and spawning rules with this mod.
48 API documnetation is included in `ENTITIES/mcl_mobs/api.txt`.
50 This mod includes modificiations from the original Mobs Redo. Some items have been removed or moved to other mods.
51 The API is mostly identical, but a few features have been added. Compability is not really a goal,
52 but function and attribute names of Mobs Redo 1.41 are kept.
53 If you have code for a mod which works fine under Mobs Redo, it should be easy to make it work in MineClone 2,
54 chances are good that it works out of the box.
56 ### Help
57 * Item help texts: `HELP/doc/doc_items`
58 * Low-level help entry and category framework: `HELP/doc/doc`
59 * Support for lookup tool (required for all entities): `HELP/doc/doc_identifier`
61 ### HUD
62 * Statbars: `HUD/hudbars`
64 ### Utility APIs
65 * Change player physics: `PLAYER/playerphysics`
66 * Select random treasures: `CORE/mcl_loot`
67 * Get flowing direction of liquids: `CORE/flowlib`
68 * `on_walk_over` callback for nodes: `CORE/walkover` 
69 * Get node names close to player (to reduce constant querying): `PLAYER/mcl_playerinfo`
71 ### Unstable APIs
72 The following APIs may be subject to change in future. You could already use these APIs but there will probably be breaking changes in the future, or the API is not as fleshed out as it should be. Use at your own risk!
74 * Panes (like glass panes and iron bars): `ITEMS/xpanes`
75 * `_on_ignite` callback: `ITEMS/mcl_fire`
76 * Farming: `ITEMS/mcl_farming`
77 * Anything related to redstone: Don't touch (yet)
78 * Any other mod not explicitly mentioned above
80 ### Planned APIs
82 * Flowers
83 * Saplings and trees
84 * Custom banner patterns
85 * Custom dimensions
86 * Custom portals
87 * Music discs
88 * Dispenser and dropper support
89 * Proper sky and weather APIs
90 * Explosion API