Exemple #1
0
    def teleport(self, to_x, to_y, to_z):
        packet = EntityUpdate()

        self.entity_data.pos.x = to_x
        self.entity_data.pos.y = to_y
        self.entity_data.pos.z = to_z

        self.chunk = get_chunk(self.entity_data.pos)
        self.old_pos = self.entity_data.pos

        packet.set_entity(self.entity_data, 0)
        self.send_packet(packet)

        packet.set_entity(self.entity_data, self.entity_id)
        self.relay_packet(packet)
Exemple #2
0
    def heal(self, amount=None):
        if amount is not None and amount <= 0:
            return False

        packet = EntityUpdate()

        if amount is None or amount + self.entity_data.hp > 1000:
            self.entity_data.hp = 1000
        else:
            self.entity_data.hp += amount

        packet.set_entity(self.entity_data, self.entity_id)
        self.relay_packet(packet)

        packet.set_entity(self.entity_data, 0)
        self.send_packet(packet)