BKCommonLib/CommonEntity

From BergerHealer Wiki
Revision as of 20:13, 9 June 2021 by RyanDo (talk | contribs) (Created page with "« Go back ==Introduction== The CommonEntity class provides additional advanced entity utilities Bukkit does not provide. Most evidently, these are: Utilitie...")
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to navigation Jump to search

« Go back

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.