Untitled

 avatar
unknown
java
a month ago
3.3 kB
5
Indexable
float f = (float)this.getAttributeInstance(GenericAttributes.ATTACK_DAMAGE).getValue();
            byte b0 = 0;
            float f1 = 0.0F;
            if (entity instanceof EntityLiving) {
                f1 = EnchantmentManager.a(this.bA(), ((EntityLiving)entity).getMonsterType());
            } else {
                f1 = EnchantmentManager.a(this.bA(), EnumMonsterType.UNDEFINED);
            }

            int i = b0 + EnchantmentManager.a(this);
            if (this.isSprinting()) {
                ++i;
            }

            if (f > 0.0F || f1 > 0.0F) {
                boolean flag = !this.world.paperSpigotConfig.disablePlayerCrits && this.fallDistance > 0.0F && !this.onGround && !this.k_() && !this.V() && !this.hasEffect(MobEffectList.BLINDNESS) && this.vehicle == null && entity instanceof EntityLiving;
                if (flag && f > 0.0F) {
                    f *= 1.5F;
                }

                f += f1;
                boolean flag1 = false;
                int j = EnchantmentManager.getFireAspectEnchantmentLevel(this);
                if (entity instanceof EntityLiving && j > 0 && !entity.isBurning()) {
                    EntityCombustByEntityEvent combustEvent = new EntityCombustByEntityEvent(this.getBukkitEntity(), entity.getBukkitEntity(), 1);
                    Bukkit.getPluginManager().callEvent(combustEvent);
                    if (!combustEvent.isCancelled()) {
                        flag1 = true;
                        entity.setOnFire(combustEvent.getDuration());
                    }
                }

                double d0 = entity.motX;
                double d1 = entity.motY;
                double d2 = entity.motZ;
                boolean flag2 = entity.damageEntity(DamageSource.playerAttack(this), f);
                if (flag2) {
                    if (i > 0) {
                        entity.g((double)(-MathHelper.sin(this.yaw * (float)Math.PI / 180.0F) * (float)i * 0.5F), 0.1, (double)(MathHelper.cos(this.yaw * (float)Math.PI / 180.0F) * (float)i * 0.5F));
                        this.motX *= 0.6;
                        this.motZ *= 0.6;
                        this.setSprinting(false);
                    }

                    if (entity instanceof EntityPlayer && entity.velocityChanged) {
                        boolean cancelled = false;
                        Player player = (Player)entity.getBukkitEntity();
                        Vector velocity = new Vector(d0, d1, d2);
                        PlayerVelocityEvent event = new PlayerVelocityEvent(player, velocity.clone());
                        this.world.getServer().getPluginManager().callEvent(event);
                        if (event.isCancelled()) {
                            cancelled = true;
                        } else if (!velocity.equals(event.getVelocity())) {
                            player.setVelocity(event.getVelocity());
                        }

                        if (!cancelled) {
                            ((EntityPlayer)entity).playerConnection.sendPacket(new PacketPlayOutEntityVelocity(entity));
                            entity.velocityChanged = false;
                            entity.motX = d0;
                            entity.motY = d1;
                            entity.motZ = d2;
                        }
                    }
Leave a Comment