Update to 1.4 protocol changes
This commit is contained in:
1 parent
3f9ccce4e2
commit
2a09899634
1 file changed
+19
-7
@@ -37,7 +37,10 @@ def handle03(FileObject):
|
|||||||
|
|
||||||
def handle04(FileObject):
|
def handle04(FileObject):
|
||||||
time = struct.unpack('!q', FileObject.read(8))[0]
|
time = struct.unpack('!q', FileObject.read(8))[0]
|
||||||
return time
|
dayTime = struct.unpack('!q', FileObject.read(8))[0]
|
||||||
|
return {'Time' : time,
|
||||||
|
'DayTime' : dayTime
|
||||||
|
}
|
||||||
|
|
||||||
def handle05(FileObject):
|
def handle05(FileObject):
|
||||||
EntityID = struct.unpack('!i', FileObject.read(4))[0]
|
EntityID = struct.unpack('!i', FileObject.read(4))[0]
|
||||||
@@ -150,19 +153,21 @@ def handle14(FileObject):
|
|||||||
|
|
||||||
def handle15(FileObject):
|
def handle15(FileObject):
|
||||||
EntityID = struct.unpack('!i', FileObject.read(4))[0]
|
EntityID = struct.unpack('!i', FileObject.read(4))[0]
|
||||||
Item = struct.unpack('!h', FileObject.read(2))[0]
|
ItemID = struct.unpack('!h', FileObject.read(2))[0]
|
||||||
|
if (ItemID != -1):
|
||||||
Count = struct.unpack('!b', FileObject.read(1))[0]
|
Count = struct.unpack('!b', FileObject.read(1))[0]
|
||||||
Damage = struct.unpack('!h', FileObject.read(2))[0]
|
Damage = struct.unpack('!h', FileObject.read(2))[0]
|
||||||
|
ArrayLength = struct.unpack('!h', FileObject.read(2))[0]
|
||||||
|
if (ArrayLength != -1):
|
||||||
|
Array = FileObject.read(ArrayLength) #TODO: find out what this does and do stuff accrodingly
|
||||||
x = struct.unpack('!i', FileObject.read(4))[0]
|
x = struct.unpack('!i', FileObject.read(4))[0]
|
||||||
y = struct.unpack('!i', FileObject.read(4))[0]
|
y = struct.unpack('!i', FileObject.read(4))[0]
|
||||||
z = struct.unpack('!i', FileObject.read(4))[0]
|
z = struct.unpack('!i', FileObject.read(4))[0]
|
||||||
Rotation = struct.unpack('!b', FileObject.read(1))[0]
|
Rotation = struct.unpack('!b', FileObject.read(1))[0]
|
||||||
Pitch = struct.unpack('!b', FileObject.read(1))[0]
|
Pitch = struct.unpack('!b', FileObject.read(1))[0]
|
||||||
Roll = struct.unpack('!b', FileObject.read(1))[0]
|
Roll = struct.unpack('!b', FileObject.read(1))[0]
|
||||||
return {'EntityID' : EntityID,
|
toReturn = {'EntityID' : EntityID,
|
||||||
'Item' : Item,
|
'ItemID' : ItemID,
|
||||||
'Count' : Count,
|
|
||||||
'Damage' : Damage,
|
|
||||||
'x' : x,
|
'x' : x,
|
||||||
'y' : y,
|
'y' : y,
|
||||||
'z' : z,
|
'z' : z,
|
||||||
@@ -170,6 +175,10 @@ def handle15(FileObject):
|
|||||||
'Pitch' : Pitch,
|
'Pitch' : Pitch,
|
||||||
'Roll' : Roll
|
'Roll' : Roll
|
||||||
}
|
}
|
||||||
|
if (ItemID != -1):
|
||||||
|
toReturn['Count'] = Count
|
||||||
|
toReturn['Damage'] = Damage
|
||||||
|
return toReturn
|
||||||
|
|
||||||
def handle16(FileObject):
|
def handle16(FileObject):
|
||||||
CollectedID = struct.unpack('!i', FileObject.read(4))[0]
|
CollectedID = struct.unpack('!i', FileObject.read(4))[0]
|
||||||
@@ -510,11 +519,13 @@ def handle3D(FileObject):
|
|||||||
Y = struct.unpack('!b', FileObject.read(1))[0]
|
Y = struct.unpack('!b', FileObject.read(1))[0]
|
||||||
Z = struct.unpack('!i', FileObject.read(4))[0]
|
Z = struct.unpack('!i', FileObject.read(4))[0]
|
||||||
Data = struct.unpack('!i', FileObject.read(4))[0]
|
Data = struct.unpack('!i', FileObject.read(4))[0]
|
||||||
|
NoVolDecrease = struct.unpack('?', FileObject.read(1))[0]
|
||||||
return {'EffectID' : EffectID,
|
return {'EffectID' : EffectID,
|
||||||
'X' : X,
|
'X' : X,
|
||||||
'Y' : Y,
|
'Y' : Y,
|
||||||
'Z' : Z,
|
'Z' : Z,
|
||||||
'Data' : Data
|
'Data' : Data,
|
||||||
|
'NoVolumeDecrease' : NoVolDecrease
|
||||||
}
|
}
|
||||||
|
|
||||||
def handle3E(FileObject):
|
def handle3E(FileObject):
|
||||||
@@ -776,6 +787,7 @@ def readEntityMetadata(FileObject):
|
|||||||
if ty == 5:
|
if ty == 5:
|
||||||
val = {}
|
val = {}
|
||||||
val["id"] = struct.unpack('!h', FileObject.read(2))[0]
|
val["id"] = struct.unpack('!h', FileObject.read(2))[0]
|
||||||
|
if (val["id"] != -1):
|
||||||
val["count"] = struct.unpack('!b', FileObject.read(1))[0]
|
val["count"] = struct.unpack('!b', FileObject.read(1))[0]
|
||||||
val["damage"] = struct.unpack('!h', FileObject.read(2))[0]
|
val["damage"] = struct.unpack('!h', FileObject.read(2))[0]
|
||||||
if ty == 6:
|
if ty == 6:
|
||||||
|
|||||||
Reference in new issue
Block a user