Interface MobRegistry
public interface MobRegistry
Where mobs are declared: the built-in ones, the ones plugins bend, and the ones they invent.
- Since:
- 0.1.0
-
Method Summary
Modifier and TypeMethodDescriptionvoidattach(Key mobType, MobBehaviour.Factory factory, Object owner) Attaches a behaviour to every mob of a kind spawned from now on.definition(Key mobType) booleanDrops the behaviours one plugin attached to a mob.booleanvoidregister(MobDefinition definition, Object owner) Declares a mob of its own.Spawns a mob into the world.types()booleanunregister(Key mobType) Drops a definition declared throughregister(MobDefinition, Object).voidunregisterAll(Object owner) Drops every definition and behaviour a plugin declared.
-
Method Details
-
register
Declares a mob of its own.- Parameters:
definition- the mob to declareowner- the plugin declaring it- Throws:
IllegalArgumentException- ifMobDefinition.networkType()is not a known entity type- Since:
- 0.1.0
-
attach
Attaches a behaviour to every mob of a kind spawned from now on.- Parameters:
mobType- the mob to bend, built-in or registeredfactory- builds the behaviour for each such mobowner- the plugin attaching it- Since:
- 0.1.0
-
unregister
Drops a definition declared throughregister(MobDefinition, Object).- Parameters:
mobType- the key to drop- Returns:
trueif a definition was registered under that key- Since:
- 0.1.0
-
detach
-
unregisterAll
Drops every definition and behaviour a plugin declared.- Parameters:
owner- the plugin to clean up after- Since:
- 0.1.0
-
definition
- Parameters:
mobType- the key to look up- Returns:
- the definition registered under that key, empty for a built-in mob
- Since:
- 0.1.0
-
definitions
Collection<MobDefinition> definitions()- Returns:
- every definition registered by a plugin
- Since:
- 0.1.0
-
types
-
isMob
- Parameters:
mobType- the key to test- Returns:
truewhen a mob can be spawned under that key- Since:
- 0.1.0
-
spawn
-