Fix hidden item metadata bug

This commit is contained in:
Tanner Collin 2020-09-24 16:02:15 -06:00
parent 0e616dc7c1
commit 6b2df0c27e
4 changed files with 10 additions and 4 deletions

View File

@ -23,4 +23,3 @@ WINDOWS = {
slot_diff=45, slot_diff=45,
), ),
} }

View File

@ -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):

View File

@ -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:
return '<{}> {}'.format(*[self.translate_chat(x) for x in data['with']]) if len(data['with']) >= 2:
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))

View File

@ -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):