Fix hidden item metadata bug
This commit is contained in:
parent
0e616dc7c1
commit
6b2df0c27e
5
game.py
5
game.py
|
@ -510,15 +510,16 @@ class Game:
|
||||||
self.g.connection.write_packet(packet2)
|
self.g.connection.write_packet(packet2)
|
||||||
|
|
||||||
def handle_spawn_object(self, packet):
|
def handle_spawn_object(self, packet):
|
||||||
return
|
if packet.type_id != 37: return
|
||||||
print(packet)
|
print(packet)
|
||||||
|
|
||||||
def handle_entity_metadata(self, packet):
|
def handle_entity_metadata(self, packet):
|
||||||
return
|
return
|
||||||
if packet.metadata and packet.metadata[0].index == 1: return
|
if packet.metadata and packet.metadata[0].index != 7: return
|
||||||
print(packet)
|
print(packet)
|
||||||
|
|
||||||
def handle_spawn_living(self, packet):
|
def handle_spawn_living(self, packet):
|
||||||
|
return
|
||||||
print(packet)
|
print(packet)
|
||||||
|
|
||||||
def handle_entity_position(self, packet):
|
def handle_entity_position(self, packet):
|
||||||
|
|
|
@ -113,7 +113,10 @@ class ChatManager:
|
||||||
elif 'text' in data:
|
elif 'text' in data:
|
||||||
return data['text']
|
return data['text']
|
||||||
elif 'with' in data:
|
elif 'with' in data:
|
||||||
|
if len(data['with']) >= 2:
|
||||||
return '<{}> {}'.format(*[self.translate_chat(x) for x in data['with']])
|
return '<{}> {}'.format(*[self.translate_chat(x) for x in data['with']])
|
||||||
|
else:
|
||||||
|
return self.translate_chat(data['with'][0])
|
||||||
elif 'translate' in data:
|
elif 'translate' in data:
|
||||||
return data['translate']
|
return data['translate']
|
||||||
else:
|
else:
|
||||||
|
@ -127,6 +130,7 @@ class ChatManager:
|
||||||
print('[%s] %s'%(source, text))
|
print('[%s] %s'%(source, text))
|
||||||
except Exception as ex:
|
except Exception as ex:
|
||||||
print('Exception %r on message (%s): %s' % (ex, chat_packet.field_string('position'), chat_packet.json_data))
|
print('Exception %r on message (%s): %s' % (ex, chat_packet.field_string('position'), chat_packet.json_data))
|
||||||
|
return
|
||||||
|
|
||||||
if self.handler:
|
if self.handler:
|
||||||
self.handler((source, text))
|
self.handler((source, text))
|
||||||
|
|
|
@ -142,9 +142,11 @@ class Entry(Type):
|
||||||
1: VarInt,
|
1: VarInt,
|
||||||
2: Float,
|
2: Float,
|
||||||
3: String,
|
3: String,
|
||||||
|
5: Boolean,
|
||||||
6: Slot,
|
6: Slot,
|
||||||
7: Boolean,
|
7: Boolean,
|
||||||
9: Position,
|
9: Position,
|
||||||
|
18: VarInt,
|
||||||
}
|
}
|
||||||
|
|
||||||
def __init__(self, index, type, value):
|
def __init__(self, index, type, value):
|
||||||
|
|
Loading…
Reference in New Issue
Block a user