File tree Expand file tree Collapse file tree 1 file changed +8
-6
lines changed
PyMCTranslate/py3/api/version Expand file tree Collapse file tree 1 file changed +8
-6
lines changed Original file line number Diff line number Diff line change @@ -222,9 +222,10 @@ def nbt_from_list(
222222 _int_to_datatype [int (nbt_temp .list_data_type )] != nbt_type
223223 and len (nbt_temp ) > 0
224224 ):
225- nbt_temp .list_data_type = datatype_to_nbt (nbt_type ).tag_id
226- for index in range (len (nbt_temp )):
227- nbt_temp [index ] = datatype_to_nbt (nbt_type )()
225+ size = len (nbt_temp )
226+ nbt_temp .clear ()
227+ for index in range (size ):
228+ nbt_temp .append (datatype_to_nbt (nbt_type )())
228229
229230 # pad out the list to the length of path
230231 if path + 1 > len (nbt_temp ):
@@ -241,9 +242,10 @@ def nbt_from_list(
241242 elif isinstance (nbt_temp , TAG_List ):
242243 # if the list is a different type to data replace it with type(data)
243244 if nbt_temp .list_data_type != data .tag_id and len (nbt_temp ) > 0 :
244- nbt_temp .list_data_type = data .tag_id
245- for index in range (len (nbt_temp )):
246- nbt_temp [index ] = data .__class__ ()
245+ size = len (nbt_temp )
246+ nbt_temp .clear ()
247+ for index in range (size ):
248+ nbt_temp .append (data .__class__ ())
247249
248250 # pad out the list to the length of path
249251 if data_path + 1 > len (nbt_temp ):
You can’t perform that action at this time.
0 commit comments