PlayerConnection.java 文件源码

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

项目:Craft-city 作者:
public void a(Packet18ArmAnimation packet18armanimation) {
    if (this.player.dead) return; // CraftBukkit

    if (packet18armanimation.b == 1) {
        // CraftBukkit start - Raytrace to look for 'rogue armswings'
        float f = 1.0F;
        float f1 = this.player.lastPitch + (this.player.pitch - this.player.lastPitch) * f;
        float f2 = this.player.lastYaw + (this.player.yaw - this.player.lastYaw) * f;
        double d0 = this.player.lastX + (this.player.locX - this.player.lastX) * (double) f;
        double d1 = this.player.lastY + (this.player.locY - this.player.lastY) * (double) f + 1.62D - (double) this.player.height;
        double d2 = this.player.lastZ + (this.player.locZ - this.player.lastZ) * (double) f;
        Vec3D vec3d = this.player.world.getVec3DPool().create(d0, d1, d2);

        float f3 = MathHelper.cos(-f2 * 0.017453292F - 3.1415927F);
        float f4 = MathHelper.sin(-f2 * 0.017453292F - 3.1415927F);
        float f5 = -MathHelper.cos(-f1 * 0.017453292F);
        float f6 = MathHelper.sin(-f1 * 0.017453292F);
        float f7 = f4 * f5;
        float f8 = f3 * f5;
        double d3 = 5.0D;
        Vec3D vec3d1 = vec3d.add((double) f7 * d3, (double) f6 * d3, (double) f8 * d3);
        MovingObjectPosition movingobjectposition = this.player.world.rayTrace(vec3d, vec3d1, true);

        if (movingobjectposition == null || movingobjectposition.type != EnumMovingObjectType.TILE) {
            CraftEventFactory.callPlayerInteractEvent(this.player, Action.LEFT_CLICK_AIR, this.player.inventory.getItemInHand());
        }

        // Arm swing animation
        PlayerAnimationEvent event = new PlayerAnimationEvent(this.getPlayer());
        this.server.getPluginManager().callEvent(event);

        if (event.isCancelled()) return;
        // CraftBukkit end

        this.player.bK();
    }
}
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号