1
0
Fork 0
VoxeLibre/API.md

82 lines
3.5 KiB
Markdown
Raw Normal View History

2017-01-11 13:34:08 +01:00
# API
## Groups
2017-08-23 16:39:57 +02:00
MineClone 2 makes very extensive use of groups. Making sure your items and objects have the correct group memberships is very important.
2017-02-21 21:28:58 +01:00
Groups are explained in `GROUPS.md`.
2017-08-23 16:39:57 +02:00
## Mod naming convention
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.
2017-01-11 13:34:08 +01:00
2017-08-23 16:39:57 +02:00
## Adding items
### Special fields
2017-01-11 13:34:08 +01:00
Items can have these fields:
* `_mcl_generate_description(itemstack)`: Required for any items which manipulate their
description in any way. This function takes an itemstack of its own type and must set
the proper advanced description for this itemstack. If you don't do this, anvils will
fail at properly restoring the description when their custom name gets cleared at an
anvil.
See `mcl_banners` for an example.
2017-08-23 16:39:57 +02:00
All nodes can have these fields:
2017-01-11 13:34:08 +01:00
2017-08-23 16:39:57 +02:00
* `_mcl_hardness`: Hardness of the block, ranges from 0 to infinity (represented by -1). Determines digging times. Default: 0
2017-11-24 06:47:19 +01:00
* `_mcl_blast_resistance`: How well this block blocks and resists explosions. Default: 0
2018-02-05 19:58:31 +01:00
* `_mcl_after_falling(pos)`: Called after a falling node finished falling and turned into a node.
2017-01-11 13:34:08 +01:00
2017-08-23 16:39:57 +02:00
Use the `mcl_sounds` mod for the sounds.
## APIs
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/`
### Items
* Doors: `ITEMS/mcl_doors`
* Fences and fence gates: `ITEMS/mcl_fences`
* Walls: `ITEMS/mcl_walls`
* Beds: `ITEMS/mcl_beds`
* Buckets: `ITEMS/mcl_buckets`
2018-02-01 23:00:50 +01:00
* Dispenser support: `ITEMS/REDSTONE/mcl_dispensers`
2017-02-21 21:28:58 +01:00
## Mobs
2017-08-23 16:39:57 +02:00
* Mobs: `ENTITIES/mods`
MineClone 2 uses Mobs Redo [`mobs`] by TenPlus1, a very powerful mod for adding mods of various types.
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.
2017-02-21 21:28:58 +01:00
You can add your own mobs, spawn eggs and spawning rules with this mod.
2017-08-23 16:39:57 +02:00
API documnetation is included in `ENTITIES/mobs/api.txt`.
### Help
* Item help texts: `HELP/doc/doc_items`
* Low-level help entry and category framework: `HELP/doc/doc`
* Support for lookup tool (required for all entities): `HELP/doc/doc_identifier`
### HUD
* Statbars: `HUD/hudbars`
### Utility APIs
* Select random treasures: `CORE/mcl_loot`
* Get flowing direction of liquids: `CORE/flowlib`
* `on_walk_over` callback for nodes: `CORE/walkover`
* Get node names close to player (to reduce constant querying): `PLAYER/mcl_playerinfo`
### Unstable APIs
2017-11-24 06:47:19 +01:00
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!
2017-01-16 21:21:47 +01:00
2017-08-23 16:39:57 +02:00
* Panes (like glass panes and iron bars): `ITEMS/xpanes`
* Slabs and stairs: `ITEM/mcl_stairs` **and** `ITEMS/mcstair`
* `_on_ignite` callback: `ITEMS/mcl_fire`
* Farming: `ITEMS/mcl_farming`
2017-11-24 06:47:19 +01:00
* Anything related to redstone: Don't touch (yet)
* Any other mod not explicitly mentioned above
2017-08-23 16:39:57 +02:00
### Planned APIs
2017-08-23 16:39:57 +02:00
* Flowers
* Saplings and trees
* Custom banner patterns
* Custom dimensions
* Custom portals
* Music discs
* Dispenser and dropper support
* Proper sky and weather APIs
* Explosion API