Repository navigation
Conversation
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>
uninstall only cleared timber:main and removed the scoreboards. Six other functions reschedule themselves (autoplant/loop, autoplant/mud_fix, settings/reset_gamerule, slow_chop/loop, utils/check_server, utils/reset) and four storage keys stayed in the world (timber:settings dialog, timber:slow_chop blocks_per_chop and time_between_chops, timber:max_command_sequence_length value). Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
The generated check now also covers every storage key the code writes to and every function that is scheduled. The keys get a value before the uninstall, a key that is still there afterwards fails the test. A schedule can't be looked at from a function, so it is compared with the schedule clear lines of uninstall. The message lists everything that is left. Checked with a new scoreboard, storage key and schedule that uninstall doesn't know, and with three lines taken out of uninstall: it fails with the names both times. Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
run.mcfunction looked for enchantments.levels.unbreaking, the levels wrapper is gone since 1.21.5, so the datapack never saw Unbreaking and every chop wore the axe fully. On a mega spruce (50 to 110 logs) an axe with Unbreaking III lost about one durability per log, like one without. Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
Silk Touch: the leaves of a chopped tree drop as leaf blocks with it and don't without it. Unbreaking III wears the axe less than half as much as there are logs on a mega spruce, without it about once per log. Looting doesn't apply to blocks and Fortune only nudges a random sapling chance, so neither is tested. The Unbreaking test fails without the fix of run.mcfunction (3 of 3 runs). That covers what the datapack offers from the outside: 85 tests on 26.1.2 and 26.3 (trees, mangroves, fungi, structures that must not be chopped, every setting, the settings menu, the per-player toggle, uninstall, enchantments), run by PackTest in the workflow. Closes #21 Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
The repository stores LF for every text file already, the working copy on Windows had CRLF (core.autocrlf) for some and LF for the files that tools wrote. A CR broke the shell scripts under WSL and Git Bash. The rules keep LF in the repository and in the working copy for scripts, functions and json whatever anybody's Git setting is, and leave images and structure files alone. Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
PackTest doesn't complain about a function that doesn't exist, so when the generation step was missing (latest.yml didn't have it) or broke, the uninstall test passed and checked nothing. The generated functions set a marker in their first line, the test asserts both markers. Without the generation step the test fails now, with it it passes. The weekly run of latest.yml had the same gap and would have reported a new Minecraft version as breaking the datapack: it generates the check now. Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
The workflow badge of GitHub only knows passing, failing and no status. The weekly check writes a small json file to the branch "badges" that shields.io shows as a badge: green when the latest release is covered or works, orange when the test tools (Fabric, PackTest) don't exist for a new release yet, red when it breaks the datapack. The logic is in a script and was tried against a local repository in all five states, including the first run that creates the branch. The file changes every run, so a "last check" badge (last commit of the branch, coloured by age) turns orange and red on its own when the schedule stops. GitHub switches schedules off after 60 days without activity in the repository, that can't be prevented for sure: the run also enables its own workflow through the API, which is reported to start the 60 days over, not confirmed by GitHub. The README gets the Test badge, the Latest Minecraft badge and the last check. Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
No description provided.