@@ -277,6 +277,12 @@ function updateModelTo1_0pre1(model: any) {
277277 if ( element . entity_type ) element . config . entity_type = element . entity_type
278278 if ( element . nbt ) {
279279 const summon_commands : string [ ] = [ ]
280+ const nbt = NbtTag . fromString ( element . nbt as string ) as NbtCompound
281+ nbt . delete ( 'Passengers' )
282+ const tags = ( nbt . get ( 'Tags' ) as NbtList < NbtString > ) ?. map ( t => t . getAsString ( ) )
283+ nbt . delete ( 'Tags' )
284+ summon_commands . push ( 'data merge entity @s ' + nbt . toString ( ) )
285+ if ( tags ) summon_commands . push ( ...tags . map ( t => `tag @s add ${ t } ` ) )
280286
281287 const recursePassengers = ( stringNbt : string ) : string [ ] => {
282288 const nbt = NbtTag . fromString ( stringNbt ) as NbtCompound
@@ -287,15 +293,25 @@ function updateModelTo1_0pre1(model: any) {
287293 const commands = passengers . map ( p => {
288294 const id = ( p . get ( 'id' ) as NbtString ) . getAsString ( )
289295 p . delete ( 'id' )
296+ const tags = ( p . get ( 'Tags' ) as NbtList < NbtString > ) . map ( t =>
297+ t . getAsString ( )
298+ )
299+ p . delete ( 'Tags' )
290300 const data = p . toString ( )
291301 return `execute summon ${ id } run {\n\t${ [
292302 `data merge entity @s ${ data } ` ,
303+ ...tags . map ( t => `tag @s add ${ t } ` ) ,
293304 `tag @s add to_mount` ,
294305 ...recursePassengers ( data ) ,
295306 ] . join ( '\n\t' ) } \n}`
296307 } )
297308 commands . push (
298- `ride @e[tag=to_mount,distance=..0.01] mount @s` ,
309+ `tag @s add vehicle` ,
310+ `execute as @e[tag=to_mount,distance=..0.01] run {` ,
311+ `\tride @s mount @e[tag=vehicle,limit=1]` ,
312+ `\ttag @s remove to_mount` ,
313+ `}` ,
314+ `tag @s remove vehicle` ,
299315 `execute on passengers run tag @s remove to_mount`
300316 )
301317 return commands
@@ -312,6 +328,7 @@ function updateModelTo1_0pre1(model: any) {
312328 if ( summon_commands . length === 0 ) {
313329 summon_commands . push ( `data merge entity @s ${ element . nbt as string } ` )
314330 }
331+
315332 element . config . summon_commands = summon_commands . join ( '\n' )
316333 }
317334 }
@@ -395,9 +412,15 @@ function updateModelTo1_0pre1(model: any) {
395412 datapackExporterSettings ?. root_entity_nbt &&
396413 datapackExporterSettings . root_entity_nbt !== '{}'
397414 ) {
398- blueprint . project_settings ! . summon_commands = `data merge entity @s ${
415+ const commands : string [ ] = [ ]
416+ const nbt = NbtTag . fromString (
399417 datapackExporterSettings . root_entity_nbt as string
400- } `
418+ ) as NbtCompound
419+ const tags = ( nbt . get ( 'Tags' ) as NbtList < NbtString > ) ?. map ( t => t . getAsString ( ) )
420+ nbt . delete ( 'Tags' )
421+ if ( [ ...nbt . keys ( ) ] . length !== 0 ) commands . push ( 'data merge entity @s ' + nbt . toString ( ) )
422+ if ( tags ) commands . push ( ...tags . map ( t => `tag @s add ${ t } ` ) )
423+ blueprint . project_settings ! . summon_commands = commands . join ( '\n' )
401424 }
402425
403426 console . log ( 'Finished Blueprint:' , blueprint )
0 commit comments