Skip to content

Commit 765caa2

Browse files
committed
🐛 Fix ticking locators not working when auto update is disabled
1 parent 2c19659 commit 765caa2

File tree

4 files changed

+25
-4
lines changed

4 files changed

+25
-4
lines changed

src/systems/datapackCompiler/1.20.4/animation.mcb

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -68,6 +68,11 @@ dir root {
6868
run function ./on_tick/transform_floating_entities
6969
}
7070
execute on passengers run tp @s ~ ~ ~ ~ ~
71+
} ELSE IF (has_ticking_locators) {
72+
execute \
73+
on passengers \
74+
if entity @s[tag=<%TAGS.GLOBAL_DATA()%>] \
75+
run function ./on_tick/transform_locators
7176
}
7277

7378
# Custom post-tick function
@@ -80,7 +85,7 @@ dir root {
8085

8186
IF (has_locators || has_cameras) {
8287
dir on_tick {
83-
function transform_floating_entities {
88+
function transform_locators {
8489
REPEAT (Object.values(rig.nodes).filter(node => node.type === 'locator')) as locator {
8590
block select_locator_<%locator.storage_name%> { with entity @s data.locators.<%locator.storage_name%>
8691
IF (locator.config?.use_entity) {
@@ -113,6 +118,10 @@ dir root {
113118
}
114119
}
115120
}
121+
}
122+
123+
function transform_floating_entities {
124+
function ./transform_locators
116125

117126
REPEAT (Object.values(rig.nodes).filter(node => node.type === 'camera')) as camera {
118127
block select_camera_<%camera.storage_name%> { with entity @s data.cameras.<%camera.storage_name%>

src/systems/datapackCompiler/1.20.4/global.mcb

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,9 +21,9 @@ dir global {
2121

2222
IF (debug_mode) {
2323
function on_tick minecraft:tick {
24-
execute as @e[type=item_display,tag=<%TAGS.GLOBAL_ROOT()%>] at @s run function *global/root/on_tick
24+
execute as @e[type=item_display,tag=<%TAGS.GLOBAL_ROOT()%>] at @s run function *global/root/on_tick
2525
}
26-
} ELSE IF (!is_static) {
26+
} ELSE {
2727
function on_tick minecraft:tick {
2828
execute as @e[type=item_display,tag=<%TAGS.GLOBAL_ROOT()%>] at @s run function #*global/root/on_tick
2929
}

src/systems/datapackCompiler/1.20.4/static.mcb

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,11 @@ dir root {
2727
run function ./on_tick/transform_floating_entities
2828
}
2929
execute on passengers run tp @s ~ ~ ~ ~ ~
30+
} ELSE IF (has_ticking_locators) {
31+
execute \
32+
on passengers \
33+
if entity @s[tag=<%TAGS.GLOBAL_DATA()%>] \
34+
run function ./on_tick/transform_locators
3035
}
3136

3237
# Custom post-tick function
@@ -39,7 +44,7 @@ dir root {
3944

4045
IF (has_locators || has_cameras) {
4146
dir on_tick {
42-
function transform_floating_entities {
47+
function transform_locators {
4348
REPEAT (Object.values(rig.nodes).filter(node => node.type === 'locator')) as locator {
4449
block select_locator_<%locator.storage_name%> { with entity @s data.locators.<%locator.storage_name%>
4550
IF (locator.config?.use_entity) {
@@ -72,6 +77,10 @@ dir root {
7277
}
7378
}
7479
}
80+
}
81+
82+
function transform_floating_entities {
83+
function ./transform_locators
7584

7685
REPEAT (Object.values(rig.nodes).filter(node => node.type === 'camera')) as camera {
7786
block select_camera_<%camera.storage_name%> { with entity @s data.cameras.<%camera.storage_name%>

src/systems/datapackCompiler/index.ts

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -997,6 +997,9 @@ const dataPackCompiler: DataPackCompiler = async ({
997997
has_entity_locators:
998998
Object.values(rig.nodes).filter(n => n.type === 'locator' && n.config?.use_entity)
999999
.length > 0,
1000+
has_ticking_locators:
1001+
Object.values(rig.nodes).filter(n => n.type === 'locator' && n.config?.on_tick_function)
1002+
.length > 0,
10001003
has_cameras: Object.values(rig.nodes).filter(n => n.type === 'camera').length > 0,
10011004
is_static: isStatic,
10021005
getNodeTags,

0 commit comments

Comments
 (0)