Skip to content

Test - #31

Closed
Moggla wants to merge 27 commits into
mainfrom
CI-CD
Closed

Test#31
Moggla wants to merge 27 commits into
mainfrom
CI-CD

Conversation

@Moggla

@Moggla Moggla commented Sep 21, 2026

Copy link
Copy Markdown
Owner

No description provided.

Moggla and others added 27 commits September 21, 2026 00:19
Remove the legacy overlays, raise min_format to 101 and update the
incompatibility warning.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
timber:help now opens a dialog, which is also added to the pause screen.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
The dialog is filled with the current scores on every open and writes
them back on Done. Chop Slowly / Drop Loot exclusivity and the
Stop Chopping -> Wear Out dependency are enforced, and the slow chop
and auto plant loops are started when enabled.

Closes #17

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
Replaced by the dialogs. toggle/timber stays for /trigger TimberToggle.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
Overlay formats is deprecated since pack format 82 and makes the pack
fail to load.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
The toggle button runs /trigger TimberToggle, which every player can use.
The settings button now hints that operator permissions are required.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
The checkbox dialog needed `function timber:settings/set`, which shows a
confirmation screen for every click. Dialog buttons now only run
`/trigger`, and the datapack reacts to it.

Settings menu
- Every setting is a button "Name: ON/OFF" with its description as a
  tooltip. Settings which depend on another one show "Locked" and the
  reason as a tooltip (Chop Slowly / Loot to Inventory, Stop on Axe
  Break / Wear Out Tool More).
- The menu is built by functions on every open, so it always shows the
  current values. ON/OFF, Locked and the "Name: value" format use
  Minecraft's own translations.
- The four number settings get their own slider dialog. The value is
  sent as `1<value>` in a single trigger.
- Tools (the axes) is a sub page, everything else is on the main page.
  Long names are shortened, the full text stays in the tooltip.

Triggers
- `TimberToggle` stays enabled for everybody. Values above 1 are used by
  the help dialog (open settings, toggle, close).
- `TimberSettings` and the slider triggers are only enabled while the
  menu is used and disabled again on leaving it or after 5 minutes
  without a click.
- Only players with the tag `timber_admin` can change settings; everybody
  else gets a message with a clickable `/tag @s add timber_admin`.

Help dialog
- Buttons: check for updates, settings, toggle Timber for me.
- The dialog opened from the pause screen is static and shows a neutral
  toggle label; the dynamic version shows Timber ON/OFF for the player.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
- Add tests datapack with a test that mines the bottom log of an oak
  tree with a fake player and expects the whole tree to be chopped
- Add test workflow for pull requests and pushes to main, run on
  Minecraft 26.1.2 and 26.3, with a "Test result" job to require in
  the branch ruleset
- Add weekly latest workflow that tests newer Minecraft releases and
  opens an issue with the result
- Add script to set up the Fabric server, Fabric API and PackTest

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
The oak test now generates a vanilla tree with place feature and checks the
whole area instead of single blocks. Shared setup lives in helper functions
under timber_test:. Leaves left with distance=7 only warn: the test logs a
TIMBER-WARNING line and the workflow shows it as a GitHub warning.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
Tests run in parallel next to each other. Each one now uses the 20x24x20
timber_test:arena template and its own tagged dummy player. Adds a birch test.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
Tests wait until the base log is gone, give the datapack two ticks to react and
then wait until no marker is left in the arena. await does not work inside a
called function, so the three lines are repeated in each test.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
Every test generates the tree with place feature in a 40x40x40 arena, lets the
dummy mine the base log and checks that no log or leaf is left. The base check
only looks at the base log, acacia and azalea trunks lean away early. Checks
run in two slabs because a command may only touch 32768 blocks.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
…n gaps

The tall mangrove leans, its trunk does not start above the place where it is
generated. The tests now search the whole arena for the lowest log and put the
dummy next to it (the datapack only looks 7 blocks around the player). Tree
generation retries because place feature sometimes fails for tall mangroves.

Trees with fewer than min_leaves_found leaves next to a trunk must not be
chopped and give a warning. A chop that starts at a mangrove log can leave parts
standing (chop_down is off), that only warns too. Scores that were read after
an await are now per test, parallel tests overwrote each other. Adds a debug
mode (#debug) that leaves the arena untouched to look at it.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
Six tests: crimson and warped fungus (grown and planted variant) and the huge
red and brown mushroom. chop_fungi is off by default, so the tests switch it
on; it is global and the tests run in parallel, so its users are counted and it
is switched back when the last one is done. Nether fungi need nylium under them,
place feature fails silently otherwise.

With chop_fungi on, every chop ends with a kill of all marker items of mushroom
stems in the world, a chop in the same tick can delete the marker of another
mushroom. The mushroom tests therefore run later and one after the other.
Stems have to be gone, cap blocks that are left only warn.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
A hut and a stack of logs without leaves, and a column with 4 leaves next to it
are not chopped, the same column with 5 leaves is (min_leaves_found is 5), the
same setup with one leaf more or less shows the rule holds at its edge.

Five leaves placed by a player (persistent) next to a stack of logs are chopped
anyway: the README says only natural leaves count, the leaf predicate does not
check that and the persistent setting is not read anywhere. That is a known
gap, the test warns instead of failing.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
Since v5.1.6 (a93c4dd, mangrove propagules) the leaf predicate accepted every
leaf block. The check that the setting "persistent" switched on in v2.1.0 was
lost with it: a leaf counts if it is natural (persistent=false), or if it is
any leaf and the player has the setting on (timber_prsistent, set in run).
Leaves placed by a player next to logs made a hut or a log stack a tree.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
PackTest's assert score does not take a comparison of two scores, and the parse
error inside a macro function is swallowed: assert_only_mined_gone and
assert_not_chopped could never fail, so every test using them was green. They
subtract and compare with matches now. Checked with a chopped column (fails)
and the same column with 4 leaves (passes).

placed_leaves_should_not_count is a hard test now: it fails without the fix of
the leaf predicate and passes with it.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
Global settings can't be changed by tests that run in parallel. PackTest runs
the tests of different environments as batches one after the other, so every
setting gets an environment whose setup sets it and whose teardown puts the
default back. 28 tests: sneaking, all seven axes on and off, chop_down,
wear_out, hunger, destroy_leaves, chop_trees, max_tree_size, persistent, and
min_leaves_found 13 and 14 (an oak has exactly 13 leaves next to its trunk).

max_tree_size caps the chop, it doesn't refuse the tree (matches the menu text).
A dummy can't duck under a block: sneaking tests use a column with leaves from
height 3 on, a random oak has leaves above the dummy in one of three cases.

The tests raise max_command_forks: dozens of chops in the same tick got to the
limit, one in about 10 suite runs left leaves standing, 0 in 30 with it. The
adjacency count includes hanging mangrove propagules like the leaf predicate.
Chops that start at a mangrove root only warn about leftovers now, like the
ones that start at a log.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
chop_fungi is a global setting. The fungus tests get a test environment that
switches it on and back off, that replaces the counting of its users and the
long delay. Two default tests show that a fungus is not chopped while chop_fungi
is off (the default).

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
Three tests in their own environments: the tree goes block by block (still
going after 10 ticks, all gone in the end), time_between_chops 10 makes it
slower, blocks_per_chop 20 makes the whole tree go in 12 ticks. The loop that
does the work is started by the setup of the environment. Checked against the
same tests without slow chop and at the default speed: they fail there.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
A column of mangrove logs with roots on three sides and natural leaves, so the
result doesn't depend on the random shape of a generated mangrove. Roots are
removed by default and stay with destroy_roots off, mining a root chops the tree
by default and doesn't with start_chop_on_root off. Both off tests fail without
their environment.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
…r groups

plant_sapling on plants a sapling item, off doesn't (the loop schedules itself,
the teardown clears the scheduled round so it can't plant in the next batch).
drop_loot on puts the logs of a chop into the inventory, a dummy picks nothing
up so the block it mined itself stays on the ground. stop_chopping on stops the
chop when the axe is nearly worn out, off chops the whole tree anyway. The
"on" tests fail without their environment.

The tests of the default environment are spread over five empty environments,
they run as batches one after the other, that halves the ticks with dozens of
chops. Big crowns (2x2 trunks, cherry, fancy oak) sometimes keep a few leaves,
their logs have to be gone, leftover leaves only warn.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
All 23 flips switch their setting and back through dispatch as an admin. The
options that exclude each other refuse the flip (slow chop and loot to
inventory, stop on axe break and wear out), and every refusal is followed by
the same flip working after the blocking setting is switched back, so it is
the guard that refused it. Only a player with the tag timber_admin can change
a setting. The four sliders set 1, 7, 25, 100 and 1000 (they come as 1 followed
by the value). A player who switched Timber off with TimberToggle doesn't chop,
switched on again chops. Each of the menu tests has an environment that puts
all settings back. The controls without the admin tag, with a wrong value and
without the toggle fail.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
A script (.github/scripts/gen-uninstall-check.py) reads every function of the
datapack, collects the "scoreboard objectives add" and generates one check per
objective. The test runs timber:uninstall and then the generated check, so a
scoreboard or trigger that is added to init and forgotten in uninstall makes it
fail with the names. The workflow runs the script before the tests. The
teardown of the environment brings the datapack back with init and main.

The script also warns about what a function can't look at: scheduled functions
and storages that uninstall doesn't clear (today six schedules and three
storages). fail ends the function it is in, so the check collects the names in
a list and reports them at the end.

A second test shows that with slow chop on, leaves placed by a player still
don't make a log stack a tree: it fails with the old leaf predicate.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
@Moggla Moggla closed this Sep 21, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant