@@ -86,6 +86,7 @@ def __init__(self):
8686 self .eid = 0
8787 self .name = ""
8888 self .uuid = ""
89+ self .mount = None
8990 self .abilities = Abilities ()
9091 self .game_info = GameInfo ()
9192 self .spawn_position = Position ()
@@ -104,6 +105,7 @@ class ClientInfoPlugin(PluginBase):
104105 events = {
105106 'LOGIN<Login Success' : 'handle_login_success' ,
106107 'PLAY<Join Game' : 'handle_join_game' ,
108+ 'PLAY<Attach Entity' : 'handle_attach_entity' ,
107109 'PLAY<Spawn Position' : 'handle_spawn_position' ,
108110 'PLAY<Update Health' : 'handle_update_health' ,
109111 'PLAY<Player Position and Look' : 'handle_position_update' ,
@@ -133,6 +135,15 @@ def handle_join_game(self, name, packet):
133135 self .client_info .game_info .set_dict (packet .data )
134136 self .event .emit ('client_join_game' , self .client_info .game_info )
135137
138+ def handle_attach_entity (self , name , packet ):
139+ eid , v_eid = packet .data ['eid' ], packet .data ['v_eid' ]
140+ if eid == self .client_info .eid :
141+ self .client_info .mount = v_eid
142+ self .event .emit ('client_mount' , v_eid )
143+ elif v_eid == self .client_info .mount and eid == - 1 :
144+ self .client_info .mount = None
145+ self .event .emit ('client_unmount' , v_eid )
146+
136147 # Spawn Position - Update client Spawn Position state
137148 def handle_spawn_position (self , name , packet ):
138149 self .client_info .spawn_position .set_dict (packet .data ['location' ])
@@ -171,9 +182,9 @@ def handle_player_list(self, name, packet):
171182 self .client_info .player_list [pl ['uuid' ]] = item
172183 self .uuids [pl ['uuid' ]] = item
173184 self .event .emit ('client_add_player' , item )
174- elif act in [ const .PL_UPDATE_GAMEMODE ,
185+ elif act in ( const .PL_UPDATE_GAMEMODE ,
175186 const .PL_UPDATE_LATENCY ,
176- const .PL_UPDATE_DISPLAY ] :
187+ const .PL_UPDATE_DISPLAY ) :
177188 if pl ['uuid' ] in self .uuids :
178189 item = self .uuids [pl ['uuid' ]]
179190 item .set_dict (pl )
0 commit comments