本文整理汇总了Java中cn.nukkit.entity.projectile.EntityProjectile类的典型用法代码示例。如果您正苦于以下问题:Java EntityProjectile类的具体用法?Java EntityProjectile怎么用?Java EntityProjectile使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
EntityProjectile类属于cn.nukkit.entity.projectile包,在下文中一共展示了EntityProjectile类的11个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: onProjectileLaunch
import cn.nukkit.entity.projectile.EntityProjectile; //导入依赖的package包/类
@EventHandler
public void onProjectileLaunch(ProjectileLaunchEvent event) {
EntityProjectile entity = event.getEntity();
if (!(entity instanceof EntityPotion)) {
return;
}
Entity shooter = entity.shootingEntity;
if (!(shooter instanceof Player)) {
return;
}
Location l = NukkitUtil.getLocation(entity);
if (!PS.get().hasPlotArea(l.getWorld())) {
return;
}
PlotPlayer pp = NukkitUtil.getPlayer((Player) shooter);
Plot plot = l.getOwnedPlot();
if (plot != null && !plot.isAdded(pp.getUUID())) {
kill(entity, event);
}
}
示例2: onClickAir
import cn.nukkit.entity.projectile.EntityProjectile; //导入依赖的package包/类
public boolean onClickAir(Player player, Vector3 directionVector) {
CompoundTag nbt = new CompoundTag()
.putList(new ListTag<DoubleTag>("Pos")
.add(new DoubleTag("", player.x))
.add(new DoubleTag("", player.y + player.getEyeHeight()))
.add(new DoubleTag("", player.z)))
.putList(new ListTag<DoubleTag>("Motion")
.add(new DoubleTag("", directionVector.x))
.add(new DoubleTag("", directionVector.y))
.add(new DoubleTag("", directionVector.z)))
.putList(new ListTag<FloatTag>("Rotation")
.add(new FloatTag("", (float) player.yaw))
.add(new FloatTag("", (float) player.pitch)));
this.correctNBT(nbt);
Entity projectile = Entity.createEntity(this.getProjectileEntityType(), player.getLevel().getChunk(player.getFloorX() >> 4, player.getFloorZ() >> 4), nbt, player);
if (projectile != null) {
projectile.setMotion(projectile.getMotion().multiply(this.getThrowForce()));
this.count--;
if (projectile instanceof EntityProjectile) {
ProjectileLaunchEvent ev = new ProjectileLaunchEvent((EntityProjectile) projectile);
player.getServer().getPluginManager().callEvent(ev);
if (ev.isCancelled()) {
projectile.kill();
} else {
projectile.spawnToAll();
player.getLevel().addSound(new LaunchSound(player), player.getViewers().values());
}
} else {
projectile.spawnToAll();
}
} else {
return false;
}
return true;
}
示例3: setProjectile
import cn.nukkit.entity.projectile.EntityProjectile; //导入依赖的package包/类
public void setProjectile(Entity projectile) {
if (projectile != this.projectile) {
if (this.projectile.getViewers().size() == 0) {
this.projectile.kill();
this.projectile.close();
}
this.projectile = (EntityProjectile) projectile;
}
}
示例4: onClickAir
import cn.nukkit.entity.projectile.EntityProjectile; //导入依赖的package包/类
public boolean onClickAir(Player player, Vector3 directionVector) {
CompoundTag nbt = new CompoundTag()
.putList(new ListTag<DoubleTag>("Pos")
.add(new DoubleTag("", player.x))
.add(new DoubleTag("", player.y + player.getEyeHeight()))
.add(new DoubleTag("", player.z)))
.putList(new ListTag<DoubleTag>("Motion")
.add(new DoubleTag("", directionVector.x))
.add(new DoubleTag("", directionVector.y))
.add(new DoubleTag("", directionVector.z)))
.putList(new ListTag<FloatTag>("Rotation")
.add(new FloatTag("", (float) player.yaw))
.add(new FloatTag("", (float) player.pitch)));
this.correctNBT(nbt);
Entity projectile = Entity.createEntity(this.getProjectileEntityType(), player.getLevel().getChunk(player.getFloorX() >> 4, player.getFloorZ() >> 4), nbt, player);
if (projectile != null) {
projectile.setMotion(projectile.getMotion().multiply(this.getThrowForce()));
this.count--;
if (projectile instanceof EntityProjectile) {
ProjectileLaunchEvent ev = new ProjectileLaunchEvent((EntityProjectile) projectile);
player.getServer().getPluginManager().callEvent(ev);
if (ev.isCancelled()) {
projectile.kill();
} else {
projectile.spawnToAll();
player.getLevel().addSound(new LaunchSound(player), player.getViewers().values());
}
} else {
projectile.spawnToAll();
}
} else {
return false;
}
return true;
}
示例5: onProjectileHit
import cn.nukkit.entity.projectile.EntityProjectile; //导入依赖的package包/类
@EventHandler
public boolean onProjectileHit(ProjectileHitEvent event) {
EntityProjectile entity = (EntityProjectile) event.getEntity();
Location loc = NukkitUtil.getLocation(entity);
if (!PS.get().hasPlotArea(loc.getWorld())) {
return true;
}
PlotArea area = loc.getPlotArea();
if (area == null) {
return true;
}
Plot plot = area.getPlotAbs(loc);
Entity shooter = entity.shootingEntity;
if (shooter instanceof Player) {
PlotPlayer pp = NukkitUtil.getPlayer((Player) shooter);
if (plot == null) {
if (!Permissions.hasPermission(pp, C.PERMISSION_PROJECTILE_UNOWNED)) {
kill(entity, event);
return false;
}
return true;
}
if (plot.isAdded(pp.getUUID()) || Permissions.hasPermission(pp, C.PERMISSION_PROJECTILE_OTHER)) {
return true;
}
kill(entity, event);
return false;
}
if (shooter == null) {
kill(entity, event);
return false;
}
return true;
}
示例6: ProjectileLaunchEvent
import cn.nukkit.entity.projectile.EntityProjectile; //导入依赖的package包/类
public ProjectileLaunchEvent(EntityProjectile entity) {
this.entity = entity;
}
示例7: getEntity
import cn.nukkit.entity.projectile.EntityProjectile; //导入依赖的package包/类
public EntityProjectile getEntity() {
return (EntityProjectile) this.entity;
}
示例8: ProjectileHitEvent
import cn.nukkit.entity.projectile.EntityProjectile; //导入依赖的package包/类
public ProjectileHitEvent(EntityProjectile entity) {
this(entity, null);
}
示例9: isProjectile
import cn.nukkit.entity.projectile.EntityProjectile; //导入依赖的package包/类
public boolean isProjectile() {
return this.entity instanceof EntityProjectile;
}
示例10: EntityShootBowEvent
import cn.nukkit.entity.projectile.EntityProjectile; //导入依赖的package包/类
public EntityShootBowEvent(EntityLiving shooter, Item bow, EntityProjectile projectile, double force) {
this.entity = shooter;
this.bow = bow;
this.projectile = projectile;
this.force = force;
}
示例11: getProjectile
import cn.nukkit.entity.projectile.EntityProjectile; //导入依赖的package包/类
public EntityProjectile getProjectile() {
return this.projectile;
}