

def use_entity(self, entity, cursor_pos=None, action=constants.INTERACT_ENTITY):
    '\n        Uses (right-click) an entity to open its window.\n        Setting ``cursor_pos`` sets ``action`` to "interact at".\n        '
    if self.auto_look:
        self.look_at(Vector3(entity))
    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()

dataset/ETHPy150Open SpockBotMC/SpockBot/spockbot/plugins/helpers/interact.py InteractPlugin.use_entity/original