• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

Java EntityProjectile类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了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);
    }
}
 
开发者ID:IntellectualSites,项目名称:PlotSquared,代码行数:21,代码来源:PlayerEvents.java


示例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;
}
 
开发者ID:Rsplwe,项目名称:Nukkit-Java9,代码行数:40,代码来源:ProjectileItem.java


示例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;
    }
}
 
开发者ID:Rsplwe,项目名称:Nukkit-Java9,代码行数:10,代码来源:EntityShootBowEvent.java


示例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;
}
 
开发者ID:JupiterDevelopmentTeam,项目名称:Jupiter,代码行数:39,代码来源:ProjectileItem.java


示例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;
}
 
开发者ID:IntellectualSites,项目名称:PlotSquared,代码行数:35,代码来源:PlayerEvents.java


示例6: ProjectileLaunchEvent

import cn.nukkit.entity.projectile.EntityProjectile; //导入依赖的package包/类
public ProjectileLaunchEvent(EntityProjectile entity) {
    this.entity = entity;
}
 
开发者ID:Rsplwe,项目名称:Nukkit-Java9,代码行数:4,代码来源:ProjectileLaunchEvent.java


示例7: getEntity

import cn.nukkit.entity.projectile.EntityProjectile; //导入依赖的package包/类
public EntityProjectile getEntity() {
    return (EntityProjectile) this.entity;
}
 
开发者ID:Rsplwe,项目名称:Nukkit-Java9,代码行数:4,代码来源:ProjectileLaunchEvent.java


示例8: ProjectileHitEvent

import cn.nukkit.entity.projectile.EntityProjectile; //导入依赖的package包/类
public ProjectileHitEvent(EntityProjectile entity) {
    this(entity, null);
}
 
开发者ID:Rsplwe,项目名称:Nukkit-Java9,代码行数:4,代码来源:ProjectileHitEvent.java


示例9: isProjectile

import cn.nukkit.entity.projectile.EntityProjectile; //导入依赖的package包/类
public boolean isProjectile() {
    return this.entity instanceof EntityProjectile;
}
 
开发者ID:Rsplwe,项目名称:Nukkit-Java9,代码行数:4,代码来源:EntityDespawnEvent.java


示例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;
}
 
开发者ID:Rsplwe,项目名称:Nukkit-Java9,代码行数:7,代码来源:EntityShootBowEvent.java


示例11: getProjectile

import cn.nukkit.entity.projectile.EntityProjectile; //导入依赖的package包/类
public EntityProjectile getProjectile() {
    return this.projectile;
}
 
开发者ID:Rsplwe,项目名称:Nukkit-Java9,代码行数:4,代码来源:EntityShootBowEvent.java



注:本文中的cn.nukkit.entity.projectile.EntityProjectile类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Java PermissionCallback类代码示例发布时间:2022-05-22
下一篇:
Java Registration类代码示例发布时间:2022-05-22
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap