@@ -277,6 +277,12 @@ function updateModelTo1_0pre1(model: any) {
277
277
if ( element . entity_type ) element . config . entity_type = element . entity_type
278
278
if ( element . nbt ) {
279
279
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 } ` ) )
280
286
281
287
const recursePassengers = ( stringNbt : string ) : string [ ] => {
282
288
const nbt = NbtTag . fromString ( stringNbt ) as NbtCompound
@@ -287,15 +293,25 @@ function updateModelTo1_0pre1(model: any) {
287
293
const commands = passengers . map ( p => {
288
294
const id = ( p . get ( 'id' ) as NbtString ) . getAsString ( )
289
295
p . delete ( 'id' )
296
+ const tags = ( p . get ( 'Tags' ) as NbtList < NbtString > ) . map ( t =>
297
+ t . getAsString ( )
298
+ )
299
+ p . delete ( 'Tags' )
290
300
const data = p . toString ( )
291
301
return `execute summon ${ id } run {\n\t${ [
292
302
`data merge entity @s ${ data } ` ,
303
+ ...tags . map ( t => `tag @s add ${ t } ` ) ,
293
304
`tag @s add to_mount` ,
294
305
...recursePassengers ( data ) ,
295
306
] . join ( '\n\t' ) } \n}`
296
307
} )
297
308
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` ,
299
315
`execute on passengers run tag @s remove to_mount`
300
316
)
301
317
return commands
@@ -312,6 +328,7 @@ function updateModelTo1_0pre1(model: any) {
312
328
if ( summon_commands . length === 0 ) {
313
329
summon_commands . push ( `data merge entity @s ${ element . nbt as string } ` )
314
330
}
331
+
315
332
element . config . summon_commands = summon_commands . join ( '\n' )
316
333
}
317
334
}
@@ -395,9 +412,15 @@ function updateModelTo1_0pre1(model: any) {
395
412
datapackExporterSettings ?. root_entity_nbt &&
396
413
datapackExporterSettings . root_entity_nbt !== '{}'
397
414
) {
398
- blueprint . project_settings ! . summon_commands = `data merge entity @s ${
415
+ const commands : string [ ] = [ ]
416
+ const nbt = NbtTag . fromString (
399
417
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' )
401
424
}
402
425
403
426
console . log ( 'Finished Blueprint:' , blueprint )
0 commit comments