ItemFishingRod.java 文件源码

java
阅读 35 收藏 0 点赞 0 评论 0

项目:CraftBukkit 作者:
public ItemStack a(ItemStack itemstack, World world, EntityHuman entityhuman) {
    if (entityhuman.hookedFish != null) {
        int i = entityhuman.hookedFish.e();

        itemstack.damage(i, entityhuman);
        entityhuman.ba();
    } else {
        // CraftBukkit start
        EntityFishingHook hook = new EntityFishingHook(world, entityhuman);
        PlayerFishEvent playerFishEvent = new PlayerFishEvent((org.bukkit.entity.Player) entityhuman.getBukkitEntity(), null, (org.bukkit.entity.Fish) hook.getBukkitEntity(), PlayerFishEvent.State.FISHING);
        world.getServer().getPluginManager().callEvent(playerFishEvent);

        if (playerFishEvent.isCancelled()) {
            return itemstack;
        }
        // CraftBukkit end
        world.makeSound(entityhuman, "random.bow", 0.5F, 0.4F / (g.nextFloat() * 0.4F + 0.8F));
        if (!world.isStatic) {
            world.addEntity(hook); // CraftBukkit - moved creation up
        }

        entityhuman.ba();
    }

    return itemstack;
}
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号