BKCommonLib/CommonEntity

From BergerHealer Wiki
Jump to navigation Jump to search
No edit summary
No edit summary
 
(One intermediate revision by one other user not shown)
Line 1: Line 1:
[[BKCommonLib|« Go back]]
==Introduction==
==Introduction==
The CommonEntity class provides additional advanced entity utilities Bukkit does not provide. Most evidently, these are:
The CommonEntity class provides additional advanced entity utilities Bukkit does not provide. Most evidently, these are:
Line 27: Line 25:


==Entity Controllers==
==Entity Controllers==
CommonEntity is the hub for Entity Controllers. For more information, see [https://wiki.traincarts.net/p/BKCommonLib/Controller this page].
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 [https://wiki.traincarts.net/p/BKCommonLib/NetworkController this page].
For spawned CommonEntities, network controllers can be assigned as well. For more information, see [[BKCommonLib/NetworkController|this page]].

Latest revision as of 09:42, 12 October 2025

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.