mirror of
https://github.com/ammaraskar/pyCraft.git
synced 2025-01-24 16:41:28 +01:00
Update to protocol version 60
This commit is contained in:
parent
7e993237e3
commit
b14e9927f7
@ -281,6 +281,8 @@ class PacketListener(threading.Thread):
|
||||
packet = PacketListenerManager.handle3D(self.FileObject)
|
||||
elif (response == "\x3E"):
|
||||
packet = PacketListenerManager.handle3E(self.FileObject)
|
||||
elif (response == "\x3F"):
|
||||
packet = PacketListenerManager.handle3F(self.FileObject)
|
||||
elif (response == "\x46"):
|
||||
packet = PacketListenerManager.handle46(self.FileObject)
|
||||
elif (response == "\x47"):
|
||||
@ -313,6 +315,14 @@ class PacketListener(threading.Thread):
|
||||
packet = PacketListenerManager.handleCA(self.FileObject)
|
||||
elif (response == "\xCB"):
|
||||
packet = PacketListenerManager.handleCB(self.FileObject)
|
||||
elif (response == "\xCE"):
|
||||
packet = PacketListenerManager.handleCE(self.FileObject)
|
||||
elif (response == "\xCF"):
|
||||
packet = PacketListenerManager.handleCF(self.FileObject)
|
||||
elif (response == "\xD0"):
|
||||
packet = PacketListenerManager.handleD0(self.FileObject)
|
||||
elif (response == "\xD1"):
|
||||
packet = PacketListenerManager.handleD1(self.FileObject)
|
||||
elif (response == "\xFA"):
|
||||
packet = PacketListenerManager.handleFA(self.FileObject)
|
||||
elif (response == "\xFC"):
|
||||
|
@ -602,6 +602,27 @@ def handle3E(FileObject):
|
||||
'Volume': Volume,
|
||||
'Pitch': Pitch
|
||||
}
|
||||
|
||||
def handle3F(FileObject):
|
||||
name = DataUtil.readString(FileObject)
|
||||
x = DataUtil.readFloat(FileObject)
|
||||
y = DataUtil.readFloat(FileObject)
|
||||
z = DataUtil.readFloat(FileObject)
|
||||
offsetx = DataUtil.readFloat(FileObject)
|
||||
offsety = DataUtil.readFloat(FileObject)
|
||||
offsetz = DataUtil.readFloat(FileObject)
|
||||
speed = DataUtil.readFloat(FileObject)
|
||||
num = DataUtil.readInt(FileObject)
|
||||
return {'Name' : name,
|
||||
'x' : x,
|
||||
'y' : y,
|
||||
'z' : z,
|
||||
'Offset x' : offsetx,
|
||||
'Offset y' : offsety,
|
||||
'Offset z' : offsetz,
|
||||
'Speed' : speed,
|
||||
'Number' : num
|
||||
}
|
||||
|
||||
|
||||
def handle46(FileObject):
|
||||
@ -776,10 +797,46 @@ def handleCA(FileObject):
|
||||
'Walk Speed': WalkSpeed
|
||||
}
|
||||
|
||||
|
||||
def handleCB(FileObject):
|
||||
text = DataUtil.readString(FileObject)
|
||||
return {'Text': text}
|
||||
|
||||
def handleCE(FileObject):
|
||||
name = DataUtil.readString(FileObject)
|
||||
display_text = DataUtil.readString(FileObject)
|
||||
create_or_remove = DataUtil.readBoolean(FileObject)
|
||||
return {'Name' : name,
|
||||
'Display Name' : display_text,
|
||||
'Remove' : create_or_remove
|
||||
}
|
||||
|
||||
def handleCF(FileObject):
|
||||
name = DataUtil.readString(FileObject)
|
||||
remove = DataUtil.readBoolean(FileObject)
|
||||
score_name = DataUtil.readString(FileObject)
|
||||
value = DataUtil.readInt(FileObject)
|
||||
|
||||
def handleD0(FileObject):
|
||||
position = DataUtil.readByte(FileObject)
|
||||
score = DataUtil.readString(FileObject)
|
||||
return {'Position' : position,
|
||||
'Score' : score
|
||||
}
|
||||
|
||||
def handleD1(FileObject):
|
||||
team = DataUtil.readString(FileObject)
|
||||
mode = DataUtil.readByte(FileObject)
|
||||
toReturn = {'Team' : team, 'Mode' : mode}
|
||||
if mode == 0 or mode == 2:
|
||||
toReturn['Display Name'] = DataUtil.readString(FileObject)
|
||||
toReturn['Prefix'] = DataUtil.readString(FileObject)
|
||||
toReturn['Suffix'] = DataUtil.readString(FileObject)
|
||||
if mode == 0 or mode == 3 or mode == 4:
|
||||
count = DataUtil.readShort(FileObject)
|
||||
players = []
|
||||
for i in range(count):
|
||||
players.append(DataUtil.readString(FileObject))
|
||||
return toReturn
|
||||
|
||||
|
||||
def handleFA(FileObject):
|
||||
|
@ -13,7 +13,7 @@ def sendHandshake(socket, username, host, port):
|
||||
socket.send("\x02")
|
||||
|
||||
#byte - protocol version
|
||||
DataUtil.sendByte(socket, 51)
|
||||
DataUtil.sendByte(socket, 60)
|
||||
|
||||
#string - username
|
||||
DataUtil.sendString(socket, username)
|
||||
|
Loading…
Reference in New Issue
Block a user