Update Conversion Table
[MineClone/MineClone2.git] / API.md
blob367734443cfc23e6c1c5c3e04eb14f7bb275ffb6
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_after_falling(pos)`: Called after a falling node finished falling and turned into a node.
26 Use the `mcl_sounds` mod for the sounds.
28 ## APIs
29 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/`
31 ### Items
32 * Doors: `ITEMS/mcl_doors`
33 * Fences and fence gates: `ITEMS/mcl_fences`
34 * Stairs and slabs: `ITEM/mcl_stairs`
35 * Walls: `ITEMS/mcl_walls`
36 * Beds: `ITEMS/mcl_beds`
37 * Buckets: `ITEMS/mcl_buckets`
38 * Dispenser support: `ITEMS/REDSTONE/mcl_dispensers`
40 ## Mobs
41 * Mobs: `ENTITIES/mods`
43 MineClone 2 uses Mobs Redo [`mobs`] by TenPlus1, a very powerful mod for adding mods of various types.
44 There are modificiations from the original mod for MineClone 2 compability. Some items have been removed or moved to other mods, but the API is identical.
45 You can add your own mobs, spawn eggs and spawning rules with this mod.
46 API documnetation is included in `ENTITIES/mobs/api.txt`.
48 ### Help
49 * Item help texts: `HELP/doc/doc_items`
50 * Low-level help entry and category framework: `HELP/doc/doc`
51 * Support for lookup tool (required for all entities): `HELP/doc/doc_identifier`
53 ### HUD
54 * Statbars: `HUD/hudbars`
56 ### Utility APIs
57 * Select random treasures: `CORE/mcl_loot`
58 * Get flowing direction of liquids: `CORE/flowlib`
59 * `on_walk_over` callback for nodes: `CORE/walkover` 
60 * Get node names close to player (to reduce constant querying): `PLAYER/mcl_playerinfo`
62 ### Unstable APIs
63 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!
65 * Panes (like glass panes and iron bars): `ITEMS/xpanes`
66 * `_on_ignite` callback: `ITEMS/mcl_fire`
67 * Farming: `ITEMS/mcl_farming`
68 * Anything related to redstone: Don't touch (yet)
69 * Any other mod not explicitly mentioned above
71 ### Planned APIs
73 * Flowers
74 * Saplings and trees
75 * Custom banner patterns
76 * Custom dimensions
77 * Custom portals
78 * Music discs
79 * Dispenser and dropper support
80 * Proper sky and weather APIs
81 * Explosion API