Difference between revisions of "BKCommonLib/CommonEntity"
Bergerkiller (talk | contribs) |
m (Changed external links to current wiki into wikilinks) |
||
Line 27: | Line 27: | ||
==Entity Controllers== | ==Entity Controllers== | ||
− | CommonEntity is the hub for Entity Controllers. For more information, see [ | + | CommonEntity is the hub for Entity Controllers. For more information, see [[BKCommonLib/Controller|this page]]. |
==Entity Network Controllers== | ==Entity Network Controllers== | ||
− | For spawned CommonEntities, network controllers can be assigned as well. For more information, see [ | + | For spawned CommonEntities, network controllers can be assigned as well. For more information, see [[BKCommonLib/NetworkController|this page]]. |
Latest revision as of 23:41, 25 September 2023
Introduction
The CommonEntity class provides additional advanced entity utilities Bukkit does not provide. Most evidently, these are:
Utilities to alter entity position, velocity Perform cross-world teleportation of all entity types Added properties (isInWater, isMoving, etc.) Entity controllers Entity network controllers In addition, it contains several 'specialized' CommonEntity extensions. For example, minecarts, players and items have an additional class to handle the entity-specific methods. More CommonEntity extensions are added as the project goes on, but it partially depends on what Bukkit is unable to provide by default.
Usage
The basic usage of CommonEntity instances is as follows:
Creating a new entity and spawning it afterwards
CommonEntity<?> entity = CommonEntity.create(EntityType.CREEPER); // Some pre-spawn conditions, and what not entity.spawn(location);
Obtaining a (new) CommonEntity from an existing Entity
CommonEntity<?> entity = CommonEntity.get(entity); CommonPlayer player = CommonEntity.get(playerEntity); CommonItem item = CommonEntity.get(itemEntity);
Entity Controllers
CommonEntity is the hub for Entity Controllers. For more information, see this page.
Entity Network Controllers
For spawned CommonEntities, network controllers can be assigned as well. For more information, see this page.