Ejemplo n.º 1
0
        public virtual void AttackTargetEntityWithCurrentItem(net.minecraft.src.Entity entity
                                                              )
        {
            int i = inventory.GetDamageVsEntity(entity);

            if (i > 0)
            {
                if (motionY < 0.0D)
                {
                    i++;
                }

                if (!entity.AttackEntityFrom(this, i))
                {
                    return;                                    // CRAFTBUKKIT -- Bypass durability if attack failed
                }
                net.minecraft.src.ItemStack itemstack = GetCurrentEquippedItem();
                if (itemstack != null && (entity is net.minecraft.src.EntityLiving))
                {
                    itemstack.HitEntity((net.minecraft.src.EntityLiving)entity, this);
                    if (itemstack.stackSize <= 0)
                    {
                        itemstack.Func_577_a(this);
                        DestroyCurrentEquippedItem();
                    }
                }
                if (entity is net.minecraft.src.EntityLiving)
                {
                    if (entity.IsEntityAlive())
                    {
                        SetOwnedEntitiesToAttack((net.minecraft.src.EntityLiving)entity, true);
                    }
                    AddStat(net.minecraft.src.StatList.StatDamageDealt, i);
                }
            }
        }