use of com.bergerkiller.bukkit.common.controller.DefaultEntityController in project BKCommonLib by bergerhealer.
the class CommonEntityType method createNMSHookEntity.
public <T extends Entity> CommonEntity<T> createNMSHookEntity(Location location) {
World world = location.getWorld();
double x = location.getX();
double y = location.getY();
double z = location.getZ();
EntityHook hook = new EntityHook();
hook.setStack(new Throwable());
Object handle = hook.constructInstance(this.nmsType.getType(), new Class<?>[] { NMSWorld.T.getType(), double.class, double.class, double.class }, new Object[] { Conversion.toWorldHandle.convert(world), x, y, z });
CommonEntity<T> entity = createCommonEntityFromHandle(handle);
entity.loc.set(entity.last.set(location));
DefaultEntityController controller = new DefaultEntityController();
controller.bind(entity, false);
return entity;
}
use of com.bergerkiller.bukkit.common.controller.DefaultEntityController in project BKCommonLib by bergerhealer.
the class CommonEntityType method createCommonEntityNull.
public <T extends Entity> CommonEntity<T> createCommonEntityNull() {
EntityHook hook = new EntityHook();
hook.setStack(new Throwable());
Object handle = hook.createInstance(this.nmsType.getType());
CommonEntity<T> entity = createCommonEntityFromHandle(handle);
DefaultEntityController controller = new DefaultEntityController();
controller.bind(entity, false);
return entity;
}
Aggregations