🔄 livereload#

Reloads the world on each build, through beet link or the configured datapack destinations.

get_local_datapack_destinations(
ctx: Context,
) → list[str][source]#

Return the resolved local datapack destinations from meta.stewbeet.build_copy_destinations.datapack.

Parameters:

ctx – The beet context.

Returns:

Resolved absolute paths of local datapack destination folders (may be empty).

Return type:

list[str]

get_sftp_datapack_destinations(
ctx: Context,
) → list[str][source]#

Return the remote sftp:// datapack destinations from meta.stewbeet.build_copy_destinations.datapack.

Parameters:

ctx – The beet context.

Returns:

sftp:// datapack destination URLs (may be empty).

Return type:

list[str]

get_local_resource_pack_destinations(
ctx: Context,
) → list[str][source]#

Return the resolved local resource pack destinations from meta.stewbeet.build_copy_destinations.resource_pack.

Parameters:

ctx – The beet context.

Returns:

Resolved absolute paths of local resource pack destination folders (may be empty).

Return type:

list[str]

find_minecraft_dir(
ctx: Context,
data_pack_dir: Path | None = None,
link_minecraft: str | None = None,
) → str | None[source]#

Locate the client Minecraft directory holding logs/latest.log, None if it cannot be determined.

Live reload tails that log’s [CHAT] lines to remove the polling datapack after each /reload, so it is the client .minecraft even when the datapack is deployed to a separate local or sftp server.

Resolution order:
  1. Explicit override meta.stewbeet.livereload.minecraft (directory containing logs/)

  2. The beet link Minecraft directory (if the project is also linked)

  3. Walking up from each local resource pack destination (the client .minecraft, where [CHAT] is logged)

  4. Walking up from the local datapack destination (singleplayer worlds stored under .minecraft/saves)

Parameters:
  • data_pack_dir – A local datapack destination folder, if any.

  • link_minecraft – The Minecraft directory from beet link, if any.

patch_livereload_for_copy_destinations(
ctx: Context,
) → None[source]#

Monkey-patch beet.contrib.livereload so live reloading also targets the folders listed in meta.stewbeet.build_copy_destinations.datapack (local and remote sftp://), in addition to the usual beet link folder.

This lets users get automatic in-game /reload with nothing more than their existing build_copy_destinations configuration (no beet link required). All methods coexist: a linked folder, local copy destinations and remote sftp:// destinations all get reloaded together.

The patch is idempotent (safe to call several times, e.g. from both stewbeet.plugins.initialize and stewbeet.plugins.livereload) and is a no-op if livereload isn’t installed or no datapack destination is configured.

Parameters:

ctx – The beet context.

livereload_with_copy_destinations(
ctx: Context,
) → None[source]#

Replacement for beet.contrib.livereload.livereload supporting local and SFTP copy destinations.

beet_default(
ctx: Context,
) → Generator[None][source]#

Live reload wrapper plugin for StewBeet.

Triggers an in-game /reload after every build, one-shot or watched, through the beet link folder and/or the StewBeet build_copy_destinations.datapack folders (local and remote sftp://). The polling datapack left by the previous build is removed first, so that the game sees it appear again and reloads. Simply require this plugin (or add it to the pipeline) instead of wiring up beet.contrib.livereload and beet link manually.

Parameters:

ctx – The beet context.

remove_previous_polling_packs(
ctx: Context,
) → None[source]#

Remove the polling datapack a previous build left in each destination, as the game only reloads when one appears.