Skip to content

Commit 55566b3

Browse files
committed
🩹 Fix old blueprints losing locator summon / ticking commands
1 parent ec8fef8 commit 55566b3

File tree

1 file changed

+13
-1
lines changed

1 file changed

+13
-1
lines changed

src/formats/blueprint/dfu.ts

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -613,8 +613,8 @@ function updateModelTo1_8_0(model: any) {
613613
delete fixed.blueprint_settings.target_minecraft_versions
614614
}
615615

616-
// Update text display backgrounds to use 8 digit hex colors instead of separate alpha
617616
if (Array.isArray(fixed.elements)) {
617+
// Update text display backgrounds to use 8 digit hex colors instead of separate alpha
618618
const textDisplays = fixed.elements.filter(e => e.type === TextDisplay.type)
619619
for (const display of textDisplays) {
620620
if (display.backgroundAlpha !== undefined) {
@@ -625,6 +625,18 @@ function updateModelTo1_8_0(model: any) {
625625
delete display.backgroundAlpha
626626
}
627627
}
628+
// Update locators to use new event function names
629+
const locators = fixed.elements.filter(e => e.type === Locator.prototype.type)
630+
for (const locator of locators) {
631+
if (locator.config?.summon_commands) {
632+
locator.config.on_summon_function = locator.config.summon_commands
633+
delete locator.config.summon_commands
634+
}
635+
if (locator.config?.ticking_commands) {
636+
locator.config.on_tick_function = locator.config.ticking_commands
637+
delete locator.config.ticking_commands
638+
}
639+
}
628640
}
629641

630642
return fixed

0 commit comments

Comments
 (0)