.dev

Modules1 min read

Resource packs

Prefetch your pack before the join and hear back how it went.

pack:1Tier A · Decorate

Good for

  • Big resource packs that do not slow down joins
  • Knowing who declined your pack

Big resource packs make joins slow. With a pack hint, Teho downloads your pack in the background before the server asks for it. When vanilla's pack request arrives, the pack is already in Teho's 250 MB cache and applies straight away.

Hint your pack

The easiest way is config:

YAML
resource-pack:
  url: "https://cdn.skyline.gg/skyline-v12.zip"
  sha1: "0123456789abcdef0123456789abcdef01234567"
  required: false

From code, send the hint as soon as the player is ready, and keep sending the pack the vanilla way as usual:

Java
teho.pack().hint("skyline-v12",
        "https://cdn.skyline.gg/skyline-v12.zip",
        "0123456789abcdef0123456789abcdef01234567",
        48_000_000L,
        true,
        "Skyline needs its texture pack");

The arguments are an id, the URL, the pack's SHA-1, its size in bytes, whether it is required, and the prompt text.

Hear back

pack().lastState() and TehoListener.onPackStatus(player, sha1, state) report how it went:

PackApi.StateMeaning
CACHEDThe pack was already in the cache.
DOWNLOADEDTeho fetched it ahead of the join.
FAILEDThe download failed or the hash did not match.
DECLINEDThe player declined the pack.