API Documentation/Basic steps
This documentation page will show you the basic concept of the API.
Important information
Be aware that the Controllable Mobs API is NOT thread-safe! All methods of this API have to be called from within the main thread!
Basic steps
- Make an entity controllable
- Adjust its properties
- Set up its AI
- Control it (perform actions)
- Release control
1. Make an entity controllable
By default, entities are not controllable. You have to pick one entity and make it controllable. Read this tutorial to see how it works!
2. Adjust the entity's attributes
This step is optional. You may change attributes of the entity, which may have an impact on its behavior later. Read this tutorial to see how it works!
3. Set up the AI
This step is optional. You can delete or modify the AI of the controlled entity. Read this tutorial to see how it works!
What the AI is for:
- automatically move or look around
- automatically assign targets
- determine how the entity deals with its target (follow? melee attack? ranged attack?)
- react to other entities or the environment
4. Perform actions
This step is optional as well, but you most likely want to go through it. You can order the entity to do specific actions. Read this tutorial to see how it works!
What actions are for:
- move or look at a given location
- set a custom target
- minor others (jump, die, ...)
Custom actions override the actions assigned by the AI. However, some parts of the AI are required to successfully execute custom actions.
5. Release control
When you have finished with whatever you wanted to do, then release control of the entity by using ControllableMobs.releaseControl(controlledEntity). This will restore all default properties and AI behaviors and will remove any actions. Memory will be freed.
You know the basics and theory? Continue reading and have a look at some code examples!