영상 캐시 기능 추가: 시작 시 미리받기 + 동적 재생 + FIFO 축출 + 주소 / 자동제거

- config 에 preload(미리받기 갯수)/keep(유지 갯수) 추가
- 시작 시 1..preload 캐시 미리받기, 재생 중에도 preload 개 앞까지 롤링 prefetch
- 재생 시 캐시 있으면 video_N, 없으면 전체 URL 로 동적 선택(데이터팩 self-tracking)
- keep 초과 시 가장 먼저 받은 캐시부터 삭제(FIFO)
- namespace 끝 / 자동 제거(normalize)
- command_block 한 tick 1회 발동 제약 회피: cache add/remove 직접 실행, clear 는 schedule

Co-Authored-By: Claude Opus 4 <noreply@anthropic.com>
This commit is contained in:
Claude (owner)
2026-06-04 22:28:29 +09:00
parent 5e9e810e56
commit f98dd9952b
18 changed files with 85 additions and 25 deletions

View File

@@ -2,15 +2,11 @@ $execute if data storage mq:tmp {video:{cmd:"delete"}} run setblock $(cmd_x) $(c
Command:"videoDelete $(x) $(y) $(z)", \
auto:0b \
}
$execute if data storage mq:tmp {video:{cmd:"num"}} run setblock $(cmd_x) $(cmd_y) $(cmd_z) minecraft:command_block[conditional=false,facing=up]{ \
Command:"videoPlace $(x) $(y) $(z) $(facing) $(w) $(h) $(sound) video_$(num)", \
$execute if data storage mq:tmp {video:{cmd:"play"}} run setblock $(cmd_x) $(cmd_y) $(cmd_z) minecraft:command_block[conditional=false,facing=up]{ \
Command:"videoPlace $(x) $(y) $(z) $(facing) $(w) $(h) $(sound) $(src)", \
auto:0b \
}
$execute if data storage mq:tmp {video:{cmd:"cache"}} run setblock $(cmd_x) $(cmd_y) $(cmd_z) minecraft:command_block[conditional=false,facing=up]{ \
Command:"videoCache add video_$(num) $(namespace)/$(cache_num)", \
auto:0b \
}
$execute if data storage mq:tmp {video:{cmd:"cmd"}} run setblock $(cmd_x) $(cmd_y) $(cmd_z) minecraft:command_block[conditional=false,facing=up]{ \
$execute if data storage mq:tmp {video:{cmd:"custom"}} run setblock $(cmd_x) $(cmd_y) $(cmd_z) minecraft:command_block[conditional=false,facing=up]{ \
Command:"$(cmd_value)", \
auto:0b \
}

View File

@@ -1,6 +0,0 @@
function mq:videos/clear
data modify storage mq:tmp video set from storage mq:main video
execute store result storage mq:tmp video.num int 1 run scoreboard players get index main
data modify storage mq:tmp video.cmd set value "custom"
$data modify storage mq:tmp video.cmd_value set value "$(cmd)"
function mq:videos/macro/cmd with storage mq:tmp video

View File

@@ -0,0 +1,8 @@
# mq:tmp video.src 를 결정한다.
# - 기본: 전체 URL "<namespace>/<num>"
# - mq:main video.cached 목록에 {i:num} 이 있으면(=videoCache add 로 등록됨)
# 등록 이름 "video_<num>" 사용 → 모드가 서버 config 에서 URL 로 resolve.
# cached 목록은 데이터팩이 videoCache add/remove 와 1:1 로 직접 추적하므로
# 모드에 캐시 존재 여부를 묻지 않고도 정확하다.
$data modify storage mq:tmp video.src set value "$(namespace)/$(num)"
$execute if data storage mq:main video.cached[{i:$(num)}] run data modify storage mq:tmp video.src set value "video_$(num)"