def use_entity(self, entity, cursor_pos=None,
                   action=constants.INTERACT_ENTITY):
        if self.auto_look:
            self.look_at(Vector3(entity))  # TODO look at cursor_pos

        if cursor_pos is not None and action == constants.INTERACT_ENTITY:
            action = constants.INTERACT_ENTITY_AT

        packet = {'target': entity.eid, 'action': action}
        if action == constants.INTERACT_ENTITY_AT:
            packet['target_x'] = cursor_pos.x
            packet['target_y'] = cursor_pos.y
            packet['target_z'] = cursor_pos.z
        self.net.push_packet('PLAY>Use Entity', packet)

        if self.auto_swing and action == constants.ATTACK_ENTITY:
            self.swing_arm()
Uses (right-click) an entity to open its window.
dataset/ETHPy150Open SpockBotMC/SpockBot/spockbot/plugins/helpers/interact.py/InteractPlugin.use_entity