コード例 #1
0
 def send_with_context(value, socket, context):
     if context.protocol_earlier(204):
         value *= 63.5
     if context.protocol_later_eq(201):
         Float.send(value, socket)
     else:
         Byte.send(int(value), socket)
コード例 #2
0
ファイル: sound_effect_packet.py プロジェクト: afands/PyMcBot
 def send_with_context(value, socket, context):
     if context.protocol_version < 204:
         value *= 63.5
     if context.protocol_version >= 201:
         Float.send(value, socket)
     else:
         Byte.send(int(value), socket)
コード例 #3
0
 def write_fields(self, packet_buffer):
     VarInt.send(self.entity_id, packet_buffer)
     VarInt.send(int(self.type), packet_buffer)
     if self.type == self.Type.INTERACT_AT:
         Float.send(x, packet_buffer)
         Float.send(y, packet_buffer)
         Float.send(z, packet_buffer)
     if self.type == self.Type.INTERACT or self.type == self.Type.INTERACT_AT:
         VarInt.send(self.hand, packet_buffer)
     Boolean.send(self.sneaking, packet_buffer)
コード例 #4
0
 def write_fields(self, packet_buffer):
     Float.send(self.x, packet_buffer)
     Float.send(self.y, packet_buffer)
     Float.send(self.z, packet_buffer)
     Float.send(self.radius, packet_buffer)
     Integer.send(len(self.records), packet_buffer)
     for record in self.records:
         Byte.send(record.x, packet_buffer)
         Byte.send(record.y, packet_buffer)
         Byte.send(record.z, packet_buffer)
     Float.send(self.player_motion_x, packet_buffer)
     Float.send(self.player_motion_y, packet_buffer)
     Float.send(self.player_motion_z, packet_buffer)
コード例 #5
0
ファイル: explosion_packet.py プロジェクト: raxod502/pyCraft
 def write_fields(self, packet_buffer):
     Float.send(self.x, packet_buffer)
     Float.send(self.y, packet_buffer)
     Float.send(self.z, packet_buffer)
     Float.send(self.radius, packet_buffer)
     Integer.send(len(self.records), packet_buffer)
     for record in self.records:
         Byte.send(record.x, packet_buffer)
         Byte.send(record.y, packet_buffer)
         Byte.send(record.z, packet_buffer)
     Float.send(self.player_motion_x, packet_buffer)
     Float.send(self.player_motion_y, packet_buffer)
     Float.send(self.player_motion_z, packet_buffer)