Beispiel #1
0
 def read(self, file_object):
     action_id = VarInt.read(file_object)
     self.action_type = PlayerListItemPacket.Action.type_from_id(action_id)
     action_count = VarInt.read(file_object)
     self.actions = []
     for i in range(action_count):
         action = self.action_type()
         action.read(file_object)
         self.actions.append(action)
Beispiel #2
0
 def _read(self, file_object):
     self.name = String.read(file_object)
     prop_count = VarInt.read(file_object)
     self.properties = []
     for i in range(prop_count):
         property = PlayerListItemPacket.PlayerProperty()
         property.read(file_object)
         self.properties.append(property)
     self.gamemode = VarInt.read(file_object)
     self.ping = VarInt.read(file_object)
     has_display_name = Boolean.read(file_object)
     if has_display_name:
         self.display_name = String.read(file_object)
     else:
         self.display_name = None
Beispiel #3
0
 def _send(self, packet_buffer):
     String.send(self.name, packet_buffer)
     VarInt.send(len(self.properties), packet_buffer)
     for property in self.properties:
         property.send(packet_buffer)
     VarInt.send(self.gamemode, packet_buffer)
     VarInt.send(self.ping, packet_buffer)
     if self.display_name is not None:
         Boolean.send(True, packet_buffer)
         String.send(self.display_name, packet_buffer)
     else:
         Boolean.send(False, packet_buffer)
Beispiel #4
0
 def write(self, packet_buffer):
     UnsignedByte.send(self.x << 4 | self.z & 0xF, packet_buffer)
     UnsignedByte.send(self.y, packet_buffer)
     VarInt.send(self.block_state_id, packet_buffer)
Beispiel #5
0
 def write_fields(self, packet_buffer):
     VarInt.send(self.action_type.action_id, packet_buffer)
     VarInt.send(len(self.actions), packet_buffer)
     for action in self.actions:
         action.send(packet_buffer)
Beispiel #6
0
 def _send(self, packet_buffer):
     VarInt.send(self.ping, packet_buffer)
Beispiel #7
0
 def _read(self, file_object):
     self.ping = VarInt.read(file_object)
Beispiel #8
0
 def _send(self, packet_buffer):
     VarInt.send(self.gamemode, packet_buffer)
Beispiel #9
0
 def _read(self, file_object):
     self.gamemode = VarInt.read(file_object)