use of com.bergerkiller.generated.net.minecraft.server.WorldServerHandle in project BKCommonLib by bergerhealer.
the class EntityUtil method addEntity.
/**
* Adds a single entity to the server
*
* @param entity to add
*/
public static void addEntity(org.bukkit.entity.Entity entity) {
EntityHandle nmsentity = CommonNMS.getHandle(entity);
WorldServerHandle nmsworld = nmsentity.getWorldServer();
entity.getWorld().getChunkAt(MathUtil.toChunk(nmsentity.getLocX()), MathUtil.toChunk(nmsentity.getLocZ()));
nmsentity.setDead(false);
// Remove an entity tracker for this entity if it was present
nmsworld.getEntityTracker().stopTracking(entity);
// Add the entity to the world
nmsworld.addEntity(nmsentity);
}
Aggregations