- 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>
13 lines
677 B
MCFunction
13 lines
677 B
MCFunction
# 재생 진행에 맞춰 항상 preload 개 앞까지 캐시를 채운다.
|
|
# 현재 index 에서 (preload-1) 만큼 앞선 영상을 받아두면 시작 시 preload(1..N)
|
|
# 와 합쳐져 N개 버퍼가 굴러간다.
|
|
execute store result score cache_preload func.temp run data get storage mq:main video.preload
|
|
execute if score cache_preload func.temp matches ..0 run return 0
|
|
|
|
scoreboard players operation cache_target func.temp = index main
|
|
scoreboard players operation cache_target func.temp += cache_preload func.temp
|
|
scoreboard players remove cache_target func.temp 1
|
|
execute if score cache_target func.temp > max_index main run return 0
|
|
|
|
function mq:videos/cache/add_one
|