diff --git a/.gitattributes b/.gitattributes new file mode 100644 index 0000000..6648bfb --- /dev/null +++ b/.gitattributes @@ -0,0 +1,16 @@ +# Text files are stored with LF in the repository and checked out with LF, whatever the local Git setting (core.autocrlf on Windows) +# or the editor is. The shell scripts run under Linux, WSL and Git Bash, a CR at the end of a line breaks them, and Minecraft reads LF just fine. +* text=auto +*.sh text eol=lf +*.py text eol=lf +*.yml text eol=lf +*.md text eol=lf +*.mcfunction text eol=lf +*.json text eol=lf +*.mcmeta text eol=lf + +# never touch these +*.png binary +*.gif binary +*.pdn binary +*.nbt binary diff --git a/.github/resources/help.png b/.github/resources/help.png index f11ce6c..0ce8279 100644 Binary files a/.github/resources/help.png and b/.github/resources/help.png differ diff --git a/.github/resources/settings1.png b/.github/resources/settings1.png index 8593fa8..f94389b 100644 Binary files a/.github/resources/settings1.png and b/.github/resources/settings1.png differ diff --git a/.github/resources/settings2.png b/.github/resources/settings2.png index c0f0467..ae4e97e 100644 Binary files a/.github/resources/settings2.png and b/.github/resources/settings2.png differ diff --git a/.github/scripts/gen-uninstall-check.py b/.github/scripts/gen-uninstall-check.py new file mode 100644 index 0000000..21d784d --- /dev/null +++ b/.github/scripts/gen-uninstall-check.py @@ -0,0 +1,92 @@ +#!/usr/bin/env python3 +"""Generates the checks of the uninstall test from the code of the datapack, so nobody has to keep a list. + +Usage: gen-uninstall-check.py + +Writes two functions into /data/timber_test/function/generated/: +- uninstall_prepare: puts something into every storage key the datapack writes to, so that the removal is something to check. +- uninstall_objectives: runs after timber:uninstall and FAILS, with the names, if something of the datapack is left: + * a scoreboard objective (triggers are objectives) that any function creates with "scoreboard objectives add" + * a storage key that any function writes to (storage timber:x key) + * a scheduled function (schedule function) that uninstall doesn't clear with schedule clear. A schedule can't be looked + at from a function, so that one is compared with the code of uninstall.mcfunction. +A new scoreboard, storage key or schedule that is added to the datapack and forgotten in uninstall makes the test fail. +""" +import os +import re +import sys + +repo, dest = sys.argv[1], sys.argv[2] + +# 121/ holds the overlay of the newest pack format, both are scanned +folders = [os.path.join(repo, "data", "timber", "function"), os.path.join(repo, "121", "data", "timber", "function")] +uninstall_text = "" +objectives, schedules, storage_keys = set(), set(), set() +for folder in folders: + for root, _, files in os.walk(folder): + for name in files: + if not name.endswith(".mcfunction"): + continue + path = os.path.join(root, name) + text = open(path, encoding="utf-8", errors="replace").read() + if os.path.relpath(path, folder).replace(os.sep, "/") == "uninstall.mcfunction": + uninstall_text += text + "\n" + continue + objectives.update(re.findall(r"scoreboard objectives add (\S+)", text)) + schedules.update(re.findall(r"schedule function (timber:[\w/]+)", text)) + # storage timber:settings dialog.inputs[0].initial -> (timber:settings, dialog), the top level key is what gets removed + storage_keys.update(re.findall(r"storage (timber:\w+) (\w+)", text)) + +if not objectives: + sys.exit("gen-uninstall-check: no 'scoreboard objectives add' found in " + str(folders) + ", is the path right?") + +out = os.path.join(dest, "data", "timber_test", "function", "generated") +os.makedirs(out, exist_ok=True) + + +def write(name, lines): + with open(os.path.join(out, name), "w", newline="\n") as f: + f.write("\n".join(lines) + "\n") + + +HEADER = "#> GENERATED by .github/scripts/gen-uninstall-check.py from the code of the datapack, do not edit." + +# --- before the uninstall: something in every storage key +# The first line of both functions sets a marker that the test checks: PackTest doesn't complain about a function that doesn't +# exist, without the marker a missing or broken generation step would leave a test that checks nothing and passes. +write("uninstall_prepare.mcfunction", [HEADER, "#> Puts a value into every storage key the datapack writes to.", + "scoreboard objectives add timber_test dummy", "scoreboard players set #uninstall_prepare_ran timber_test 1"] + + [f"data modify storage {sid} {key} set value 1" for sid, key in sorted(storage_keys)]) + +# --- after the uninstall +lines = [ + HEADER, + "#> Fails if anything of the datapack is left after timber:uninstall, the names are in the message.", + "scoreboard objectives add timber_test dummy", + "scoreboard players set #uninstall_check_ran timber_test 1", + "data modify storage timber_test:uninstall left set value []", +] +for name in sorted(objectives): + # adding 0 to a holder works when the objective exists and fails when it doesn't. + # The names go into a list, a fail in the loop would end this function at the first one. + lines += [ + f"execute store success score #exists timber_test run scoreboard players add #uninstall_probe {name} 0", + f'execute if score #exists timber_test matches 1 run data modify storage timber_test:uninstall left append value "scoreboard {name}"', + f"execute if score #exists timber_test matches 1 run scoreboard players reset #uninstall_probe {name}", + ] +for sid, key in sorted(storage_keys): + # data get fails when the key is not there + lines += [ + f"execute store success score #exists timber_test run data get storage {sid} {key}", + f'execute if score #exists timber_test matches 1 run data modify storage timber_test:uninstall left append value "storage {sid} {key}"', + ] +cleared_schedules = set(re.findall(r"schedule clear (timber:[\w/]+)", uninstall_text)) +for target in sorted(schedules - cleared_schedules): + lines.append(f'data modify storage timber_test:uninstall left append value "schedule {target} (not cleared in uninstall.mcfunction)"') + +lines.append('execute if data storage timber_test:uninstall left[0] run fail [{"text":"left after uninstall: "},{"nbt":"left","storage":"timber_test:uninstall"}]') +lines.append("# (no assert after the fail: it would replace the message with an \"Expected ...\" without the names)") +write("uninstall_objectives.mcfunction", lines) + +print(f"gen-uninstall-check: {len(objectives)} objectives, {len(storage_keys)} storage keys, {len(schedules)} schedules " + f"({len(schedules - cleared_schedules)} not cleared by uninstall)") diff --git a/.github/scripts/publish-latest-badge.sh b/.github/scripts/publish-latest-badge.sh new file mode 100644 index 0000000..a2190af --- /dev/null +++ b/.github/scripts/publish-latest-badge.sh @@ -0,0 +1,53 @@ +#!/usr/bin/env bash +# Writes the badge of the weekly check (latest.json) to the branch "badges", shields.io reads it as an endpoint badge. +# +# GitHub's own workflow badge only knows passing, failing and no status. This one can be orange when the test tools (Fabric, +# PackTest) are not there for a new Minecraft release yet, and its file changes every run, so the "last commit" badge of the +# branch turns orange and red by itself when the schedule stops (GitHub switches schedules off after 60 days without activity). +# +# Input (environment): REMOTE (url to push to), and what the workflow knows: +# VERSION_OUTCOME outcome of the step that looks up the latest release (success = it worked) +# MC the latest release +# NEWER true if MC is newer than the highest version of the test matrix +# READY true if the test tools exist for MC +# TESTS outcome of the tests on MC +set -euo pipefail + +: "${REMOTE:?REMOTE is the url of the repository to push the branch badges to}" +MC="${MC:-}"; NEWER="${NEWER:-}"; READY="${READY:-}"; TESTS="${TESTS:-}"; VERSION_OUTCOME="${VERSION_OUTCOME:-}" + +if [ "$VERSION_OUTCOME" != "success" ] || [ -z "$MC" ]; then + MESSAGE="check did not run"; COLOR="lightgrey" +elif [ "$NEWER" != "true" ]; then + MESSAGE="$MC is in the test matrix"; COLOR="brightgreen" +elif [ "$READY" != "true" ]; then + MESSAGE="$MC, test tools not ready yet"; COLOR="orange" +elif [ "$TESTS" = "success" ]; then + MESSAGE="$MC works"; COLOR="brightgreen" +else + MESSAGE="$MC breaks"; COLOR="red" +fi +CHECKED=$(date -u +%Y-%m-%dT%H:%MZ) +echo "Badge: $MESSAGE ($COLOR)" + +WORK=$(mktemp -d) +trap 'rm -rf "$WORK"' EXIT +cd "$WORK" +git init -q +git config user.name "github-actions[bot]" +git config user.email "41898282+github-actions[bot]@users.noreply.github.com" +git remote add origin "$REMOTE" +if git ls-remote --exit-code --heads origin badges > /dev/null 2>&1; then + git fetch -q --depth 1 origin badges + git checkout -q -B badges FETCH_HEAD +else + git checkout -q --orphan badges +fi + +# "checked" is not read by shields, it makes the file (and with it the last commit of the branch) change every run +printf '{\n "schemaVersion": 1,\n "label": "latest Minecraft",\n "message": "%s",\n "color": "%s",\n "cacheSeconds": 3600,\n "checked": "%s"\n}\n' \ + "$MESSAGE" "$COLOR" "$CHECKED" > latest.json +git add latest.json +# two runs in the same minute with the same result give the same file +git diff --cached --quiet || git commit -q -m "Weekly check: $MESSAGE" +git push -q origin badges diff --git a/.github/scripts/setup-test-server.sh b/.github/scripts/setup-test-server.sh new file mode 100644 index 0000000..1365bad --- /dev/null +++ b/.github/scripts/setup-test-server.sh @@ -0,0 +1,37 @@ +#!/usr/bin/env bash +# Sets up a Fabric server with Fabric API and PackTest for the given Minecraft version in the current directory. +# Exit code 3 means the tooling is not available for that version (yet), any other non-zero code is a real error. +set -euo pipefail + +MC="$1" +UA="Moggla/Timber-Datapack CI" + +# prints the download url of the newest release of a Modrinth project for $MC, or nothing if there is none +modrinth_url() { + curl -fsSL -A "$UA" -G "https://api.modrinth.com/v2/project/$1/version" \ + --data-urlencode "game_versions=[\"$MC\"]" \ + --data-urlencode 'loaders=["fabric"]' \ + | jq -r '[.[] | select(.version_type == "release")][0].files[0].url // empty' +} + +FABRIC_API=$(modrinth_url fabric-api) +PACKTEST=$(modrinth_url packtest) +LOADER=$(curl -fsSL https://meta.fabricmc.net/v2/versions/loader | jq -r '[.[] | select(.stable)][0].version') +INSTALLER=$(curl -fsSL https://meta.fabricmc.net/v2/versions/installer | jq -r '[.[] | select(.stable)][0].version') +# the meta api answers unknown versions with an error or an empty list +SERVER=$(curl -sSL "https://meta.fabricmc.net/v2/versions/loader/$MC" | jq -r 'if type == "array" and length > 0 then "yes" else empty end' 2>/dev/null || true) + +MISSING="" +[ -n "$SERVER" ] || MISSING="$MISSING Fabric server," +[ -n "$FABRIC_API" ] || MISSING="$MISSING Fabric API," +[ -n "$PACKTEST" ] || MISSING="$MISSING PackTest," +if [ -n "$MISSING" ]; then + echo "Not available for Minecraft $MC yet:${MISSING%,}" >&2 + exit 3 +fi + +mkdir -p mods +curl -fsSL -o server.jar "https://meta.fabricmc.net/v2/versions/loader/$MC/$LOADER/$INSTALLER/server/jar" +curl -fsSL -o mods/fabric-api.jar "$FABRIC_API" +curl -fsSL -o mods/packtest.jar "$PACKTEST" +echo "eula=true" > eula.txt diff --git a/.github/workflows/latest.yml b/.github/workflows/latest.yml new file mode 100644 index 0000000..d79c820 --- /dev/null +++ b/.github/workflows/latest.yml @@ -0,0 +1,138 @@ +name: Latest Minecraft + +# Checks whether the datapack works on a Minecraft release newer than the ones in the test matrix +# and opens an issue with the result, so that nobody has to look at the runs. +# Not a required check: Fabric, Fabric API and PackTest usually lag a few days behind a new release. +on: + schedule: + - cron: "0 6 * * 1" + workflow_dispatch: + +permissions: + contents: write # the badge goes to the branch "badges" + issues: write + actions: write # to enable this workflow again, see the last step + +jobs: + latest: + name: Latest Minecraft release + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v4 + + - name: Find latest release + id: version + run: | + MANIFEST=$(curl -fsSL https://piston-meta.mojang.com/mc/game/version_manifest_v2.json) + MC=$(jq -r '.latest.release' <<< "$MANIFEST") + URL=$(jq -r --arg id "$MC" '.versions[] | select(.id == $id) | .url' <<< "$MANIFEST") + JAVA=$(curl -fsSL "$URL" | jq -r '.javaVersion.majorVersion') + + # highest version that the test matrix already covers + SUPPORTED=$(sed -n 's/.*minecraft: "\([^"]*\)".*/\1/p' .github/workflows/test.yml | sort -V | tail -n 1) + + echo "mc=$MC" >> "$GITHUB_OUTPUT" + echo "java=$JAVA" >> "$GITHUB_OUTPUT" + if [ "$MC" != "$SUPPORTED" ] && [ "$(printf '%s\n%s\n' "$SUPPORTED" "$MC" | sort -V | tail -n 1)" = "$MC" ]; then + echo "newer=true" >> "$GITHUB_OUTPUT" + echo "Latest Minecraft release $MC is newer than the supported $SUPPORTED (Java $JAVA)" + else + echo "newer=false" >> "$GITHUB_OUTPUT" + echo "Latest Minecraft release $MC is already covered by the test matrix (highest: $SUPPORTED)." | tee -a "$GITHUB_STEP_SUMMARY" + fi + + - uses: actions/setup-java@v4 + if: steps.version.outputs.newer == 'true' + with: + distribution: temurin + java-version: ${{ steps.version.outputs.java }} + + - name: Set up Fabric server, Fabric API and PackTest + id: setup + if: steps.version.outputs.newer == 'true' + run: | + set +e + bash .github/scripts/setup-test-server.sh "${{ steps.version.outputs.mc }}" + CODE=$? + if [ $CODE -eq 3 ]; then + echo "ready=false" >> "$GITHUB_OUTPUT" + echo "Minecraft ${{ steps.version.outputs.mc }} can't be tested yet, the test tooling isn't available for it. Trying again next time." | tee -a "$GITHUB_STEP_SUMMARY" + exit 0 + fi + [ $CODE -eq 0 ] || exit $CODE + echo "ready=true" >> "$GITHUB_OUTPUT" + + - name: Install datapacks + if: steps.setup.outputs.ready == 'true' + run: | + mkdir -p world/datapacks/timber world/datapacks/timber_test + cp -r data pack.mcmeta 121 world/datapacks/timber/ + cp -r tests/. world/datapacks/timber_test/ + + # the uninstall test checks the scoreboards the code of the datapack creates, without this step it fails + - name: Generate the uninstall check + if: steps.setup.outputs.ready == 'true' + run: python3 .github/scripts/gen-uninstall-check.py . world/datapacks/timber_test + + - name: Run tests + id: tests + if: steps.setup.outputs.ready == 'true' + continue-on-error: true + run: java -Xmx2G -Dpacktest.auto -Dpacktest.auto.annotations -jar server.jar nogui + + - name: Open an issue with the result + if: steps.setup.outputs.ready == 'true' + env: + GH_TOKEN: ${{ github.token }} + MC: ${{ steps.version.outputs.mc }} + OUTCOME: ${{ steps.tests.outcome }} + RUN_URL: ${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }} + run: | + if [ "$OUTCOME" = "success" ]; then + TITLE="Minecraft $MC works with the datapack" + BODY="The tests pass on Minecraft $MC ([run]($RUN_URL)). + + To support it: + - bump \`max_format\` in \`pack.mcmeta\` + - add \`$MC\` to the matrix in \`.github/workflows/test.yml\` + - release the update" + else + TITLE="Minecraft $MC breaks the datapack" + BODY="The tests fail on Minecraft $MC ([run]($RUN_URL)). See the annotations of the run for the failed tests." + fi + + # closed issues count too, so a handled version doesn't get reported again + EXISTING=$(gh issue list --state all --search "\"$TITLE\" in:title" --json title --jq "[.[] | select(.title == \"$TITLE\")] | length") + if [ "$EXISTING" -gt 0 ]; then + echo "Issue \"$TITLE\" already exists." | tee -a "$GITHUB_STEP_SUMMARY" + else + gh issue create --title "$TITLE" --body "$BODY" --label "CI/CD" + echo "Opened issue \"$TITLE\"." | tee -a "$GITHUB_STEP_SUMMARY" + fi + + # The badge of the README: orange when the test tools don't exist for the new release yet, see publish-latest-badge.sh + - name: Publish the badge + if: always() + continue-on-error: true + env: + REMOTE: https://x-access-token:${{ github.token }}@github.com/${{ github.repository }}.git + VERSION_OUTCOME: ${{ steps.version.outcome }} + MC: ${{ steps.version.outputs.mc }} + NEWER: ${{ steps.version.outputs.newer }} + READY: ${{ steps.setup.outputs.ready }} + TESTS: ${{ steps.tests.outcome }} + run: bash .github/scripts/publish-latest-badge.sh + + # GitHub switches schedules off after 60 days without activity in the repository. Enabling the workflow again is reported to + # start those 60 days over (not confirmed by GitHub's documentation). It does no harm when it doesn't, and the "last check" badge + # turns orange and red by itself when the schedule stops anyway. + - name: Keep the schedule alive + if: always() + continue-on-error: true + env: + GH_TOKEN: ${{ github.token }} + run: gh api --method PUT "repos/${{ github.repository }}/actions/workflows/latest.yml/enable" + + - name: Fail if the tests failed + if: steps.tests.outcome == 'failure' + run: exit 1 diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml new file mode 100644 index 0000000..8048f86 --- /dev/null +++ b/.github/workflows/test.yml @@ -0,0 +1,63 @@ +name: Test + +on: + pull_request: + push: + branches: [main] + +jobs: + test: + name: Minecraft ${{ matrix.minecraft }} + runs-on: ubuntu-latest + strategy: + fail-fast: false + matrix: + include: + - minecraft: "26.1.2" + java: "25" + - minecraft: "26.3" + java: "25" + steps: + - uses: actions/checkout@v4 + + - uses: actions/setup-java@v4 + with: + distribution: temurin + java-version: ${{ matrix.java }} + + - name: Set up Fabric server, Fabric API and PackTest + run: bash .github/scripts/setup-test-server.sh "${{ matrix.minecraft }}" + + - name: Install datapacks + run: | + mkdir -p world/datapacks/timber world/datapacks/timber_test + cp -r data pack.mcmeta 121 world/datapacks/timber/ + cp -r tests/. world/datapacks/timber_test/ + + # the uninstall test checks the scoreboards the code of the datapack creates, so a forgotten one can't slip through + - name: Generate the uninstall check + run: python3 .github/scripts/gen-uninstall-check.py . world/datapacks/timber_test + + - name: Run tests + run: | + set -o pipefail + java -Xmx2G -Dpacktest.auto -Dpacktest.auto.annotations -jar server.jar nogui | tee server-output.log + + # tests can log a line with TIMBER-WARNING and still pass, show those as warnings so they don't go unnoticed + - name: Report test warnings + if: always() + run: | + grep -h 'TIMBER-WARNING' server-output.log | sed 's/.*TIMBER-WARNING //' | while read -r line; do + echo "::warning title=Test warning (Minecraft ${{ matrix.minecraft }})::$line" + echo "- Minecraft ${{ matrix.minecraft }}: $line" >> "$GITHUB_STEP_SUMMARY" + done || true + + # single check to require in the branch ruleset, so changing the matrix doesn't need a ruleset update + test-result: + name: Test result + needs: test + if: always() + runs-on: ubuntu-latest + steps: + - name: Fail if any test job failed or was cancelled + run: test "${{ needs.test.result }}" = "success" diff --git a/121/data/timber/predicate/block/leaf.json b/121/data/timber/predicate/block/leaf.json index 4e4ac16..7f82968 100644 --- a/121/data/timber/predicate/block/leaf.json +++ b/121/data/timber/predicate/block/leaf.json @@ -5,10 +5,35 @@ "type": "minecraft:location_check", "predicate": { "block": { - "blocks": "#minecraft:leaves" + "blocks": "#minecraft:leaves", + "state": { + "persistent": "false" + } } } }, + { + "type": "minecraft:all_of", + "terms": [ + { + "type": "minecraft:location_check", + "predicate": { + "block": { + "blocks": "#minecraft:leaves" + } + } + }, + { + "type": "minecraft:entity_scores", + "entity": "this", + "scores": { + "timber_prsistent": { + "min": 1 + } + } + } + ] + }, { "type": "minecraft:location_check", "predicate": { diff --git a/18-26/data/minecraft/loot_tables/blocks/mushroom_stem.json b/18-26/data/minecraft/loot_tables/blocks/mushroom_stem.json deleted file mode 100644 index 4de3d97..0000000 --- a/18-26/data/minecraft/loot_tables/blocks/mushroom_stem.json +++ /dev/null @@ -1,52 +0,0 @@ -{ - "type": "minecraft:block", - "pools": [ - { - "rolls": 1, - "entries": [ - { - "type": "minecraft:item", - "name": "minecraft:mushroom_stem" - } - ], - "conditions": [ - { - "condition": "minecraft:match_tool", - "predicate": { - "enchantments": [ - { - "enchantment": "minecraft:silk_touch", - "levels": { - "min": 1 - } - } - ] - } - } - ] - }, - { - "rolls": 1, - "entries": [ - { - "type": "minecraft:item", - "name": "minecraft:knowledge_book", - "functions": [ - { - "function": "minecraft:set_nbt", - "tag": "{Tags:[timber_location]}" - } - ], - "conditions": [ - { - "condition": "minecraft:match_tool", - "predicate": { - "tag": "timber:axes" - } - } - ] - } - ] - } - ] -} \ No newline at end of file diff --git a/18-26/data/timber/functions/autoplant/plant.mcfunction b/18-26/data/timber/functions/autoplant/plant.mcfunction deleted file mode 100644 index a9bcf97..0000000 --- a/18-26/data/timber/functions/autoplant/plant.mcfunction +++ /dev/null @@ -1,17 +0,0 @@ -# replace item-sapling with block-sapling (special case for mud, because fallingblock get destroyed. 0.125 is the height when you sink into the mud) -execute unless block ~ ~ ~ minecraft:air run summon marker ~ ~ ~ {Tags:["timber_mud","global.ignore"]} -execute unless block ~ ~ ~ minecraft:air run schedule function timber:autoplant/mud_fix 1t -execute unless block ~ ~ ~ minecraft:air run setblock ~ ~ ~ minecraft:muddy_mangrove_roots -summon minecraft:falling_block ~ ~0.125 ~ {BlockState:{Name:"minecraft:barrier"},Time:1,DropItem:0b,Tags:["timber_item_to_block"]} -execute positioned ~ ~0.125 ~ run data modify entity @e[type=minecraft:falling_block,tag=timber_item_to_block,distance=...1,sort=arbitrary,limit=1] BlockState.Name set from entity @s Item.id - -# on stacks -1 -execute store result score @s timber run data get entity @s Item.Count -scoreboard players remove @s timber 1 -execute store result entity @s Item.Count byte 1 run scoreboard players get @s timber -scoreboard players reset @s timber -# cheap custom server fix -execute if score not_vanilla timber matches 1 run kill @s - -# sapling will be checked every time -tag @s remove timber_checked \ No newline at end of file diff --git a/18-26/data/timber/functions/init.mcfunction b/18-26/data/timber/functions/init.mcfunction deleted file mode 100644 index dd644cf..0000000 --- a/18-26/data/timber/functions/init.mcfunction +++ /dev/null @@ -1,38 +0,0 @@ -# longer maxCommandChainLength -gamerule maxCommandChainLength 1000000000 - -# create scoreboards -scoreboard objectives add timber_w_axe minecraft.used:minecraft.wooden_axe -scoreboard objectives add timber_s_axe minecraft.used:minecraft.stone_axe -scoreboard objectives add timber_i_axe minecraft.used:minecraft.iron_axe -scoreboard objectives add timber_g_axe minecraft.used:minecraft.golden_axe -scoreboard objectives add timber_d_axe minecraft.used:minecraft.diamond_axe -scoreboard objectives add timber_n_axe minecraft.used:minecraft.netherite_axe -scoreboard objectives add timber dummy -scoreboard objectives add TimberToggle trigger {"text":"Timber Toggle","color":"#724E21"} -scoreboard objectives add timber_disabled dummy -scoreboard objectives add timber_prsistent dummy - -# non-overriding default values -function timber:settings/default_values -scoreboard players set running timber 0 - -# start optional loops -execute if score plant_sapling timber matches 1.. run function timber:autoplant/loop -execute if score slow_chop timber matches 1.. run function timber:slow_chop/loop - -# check loottable compatibility of mushroom stem -setblock ~ 255 ~ minecraft:chest -setblock ~ 255 ~1 minecraft:mushroom_stem -loot insert ~ 255 ~ mine ~ 255 ~1 minecraft:diamond_axe -execute unless data block ~ 255 ~ Items[{id:"minecraft:knowledge_book"}] run tellraw @a[tag=!noTimberWarning] ["",{"text":"Timber Datapack Warning: ","color":"red"},{"text":"Incompatibility with the mushroom_stem loottable of another datapack!"}] -fill ~-1 255 ~-1 ~1 255 ~1 minecraft:air -execute store result score doTileDrops timber run gamerule doTileDrops -execute if score doTileDrops timber matches 0 run tellraw @a[tag=!noTimberWarning] ["",{"text":"Timber Datapack Warning: ","color":"red"},{"text":"This datapack only works when gamerule doTileDrops is set to true!"}] - -# Getting the game version and checking if it is compatible with the datapack https://minecraft.fandom.com/wiki/Data_version -execute store result score game_version timber run data get entity @r DataVersion -execute if score game_version timber matches ..3442 run tellraw @a[tag=!noTimberWarning] ["",{"text":"Timber Datapack Warning: ","color":"red"},{"text":"This datapack is not compatible with all the versions before 1.20!"}] - -# Checking if the server uses a different jar from the vanilla one -function timber:utils/check_server \ No newline at end of file diff --git a/18-26/data/timber/functions/run.mcfunction b/18-26/data/timber/functions/run.mcfunction deleted file mode 100644 index 3466cdd..0000000 --- a/18-26/data/timber/functions/run.mcfunction +++ /dev/null @@ -1,46 +0,0 @@ -# reset -scoreboard players set leaves_found timber 0 -scoreboard players set tree_size timber 0 -scoreboard players set tree_type timber 0 - -# load settings to other scoreboard (leaves persistent) -execute unless score persistent timber matches 1.. run scoreboard players set @s timber_prsistent 0 -execute if score persistent timber matches 1.. run scoreboard players set @s timber_prsistent 1 - -# search last broken item (place of tree) and set a marker (limit=1 removed, because carpet on log breaks this) -execute at @e[type=minecraft:item,distance=..7,nbt={Age:0s}] run summon marker ~ ~ ~ {Tags:["timber_tree","global.ignore"]} - -# Enchantments randomizer -scoreboard players set unbreaking timber 0 -execute if entity @s[nbt={SelectedItem:{tag:{Enchantments:[{id:"minecraft:unbreaking",lvl:1s}]}}}] run scoreboard players set unbreaking timber 1 -execute if entity @s[nbt={SelectedItem:{tag:{Enchantments:[{id:"minecraft:unbreaking",lvl:2s}]}}}] run scoreboard players set unbreaking timber 2 -execute if entity @s[nbt={SelectedItem:{tag:{Enchantments:[{id:"minecraft:unbreaking",lvl:3s}]}}}] run scoreboard players set unbreaking timber 3 - -# get durability -function timber:tool/durability_get - -# scan through tree - # tree (limit=1,sort=arbitrary removed, because carpet on log breaks this) - execute if score chop_trees timber matches 1.. at @e[type=minecraft:marker,tag=timber_tree,tag=!timber_slow_chop,distance=..7] run function timber:algorithm/tree/run - execute store result score leaves_found timber if entity @e[type=minecraft:marker,tag=timber_leaves_found] - # if tree is valid - execute if score leaves_found timber >= min_leaves_found timber unless score tree_size timber matches 0 run scoreboard players set tree_type timber 1 - - # fungi (only if not tree already) - execute if score tree_type timber matches 0 if score chop_fungi timber matches 1.. run function timber:run_fungi - -# if tree or fungi is valid (tree = 1 | fungus = 2) -execute unless score tree_type timber matches 0 if score tree_size timber <= max_tree_size timber run function timber:validated - -# remove markers -execute if score chop_fungi timber matches 1.. run kill @e[type=minecraft:item,nbt={Item:{tag:{Tags:[timber_location]}}}] -execute if score chop_fungi timber matches 1.. run clear @s knowledge_book{Tags:[timber_location]} -kill @e[type=minecraft:marker,tag=timber_tree,tag=!timber_slow_chop] -kill @e[type=minecraft:marker,tag=timber_log,tag=!timber_destroy] -kill @e[type=minecraft:marker,tag=timber_leaf,tag=!timber_destroy] -kill @e[type=minecraft:marker,tag=timber_root,tag=!timber_destroy] -kill @e[type=minecraft:marker,tag=timber_stem,tag=!timber_destroy] -kill @e[type=minecraft:marker,tag=timber_cap,tag=!timber_destroy] -kill @e[type=minecraft:marker,tag=timber_leaves_found] -kill @e[type=minecraft:marker,tag=timber_leaf_distance] -kill @e[type=minecraft:marker,tag=timber_other_stem] \ No newline at end of file diff --git a/18-26/data/timber/functions/slow_chop/destroy_loop.mcfunction b/18-26/data/timber/functions/slow_chop/destroy_loop.mcfunction deleted file mode 100644 index 97282b3..0000000 --- a/18-26/data/timber/functions/slow_chop/destroy_loop.mcfunction +++ /dev/null @@ -1,25 +0,0 @@ -# loop -$schedule function timber:slow_chop/loop $(time_between_chops)t replace - -# api -$execute at @e[type=minecraft:marker,tag=timber_slow_chop] as @e[type=minecraft:marker,tag=timber_destroy,sort=nearest,limit=$(blocks_per_chop)] at @s run function timber:slow_chop/api - -# destroy n block -$execute at @e[type=minecraft:marker,tag=timber_slow_chop] as @e[type=minecraft:armor_stand,tag=timber_tool,y=-64,distance=...1,sort=arbitrary,limit=1] at @e[type=minecraft:marker,tag=timber_destroy,sort=nearest,limit=$(blocks_per_chop)] run loot spawn ~ ~ ~ mine ~ ~ ~ mainhand - -# destroy animation (doTileDrops can be changed, because datapack wouldn't get to this point otherwise) -gamerule doTileDrops false -$execute at @e[type=minecraft:marker,tag=timber_slow_chop] at @e[type=minecraft:marker,tag=timber_destroy,sort=nearest,limit=$(blocks_per_chop)] run setblock ~ ~ ~ minecraft:air destroy -gamerule doTileDrops true - -# stop sound -$execute at @e[type=minecraft:marker,tag=timber_slow_chop] if score stopsound timber matches 1.. at @e[type=minecraft:marker,tag=timber_destroy,sort=nearest,limit=$(blocks_per_chop)] as @a[distance=..20,tag=!global.ignore.gui] run function timber:utils/stopsound - -# delete location item -$execute at @e[type=minecraft:marker,tag=timber_slow_chop] at @e[type=minecraft:marker,tag=timber_destroy,sort=nearest,limit=$(blocks_per_chop)] run kill @e[type=minecraft:item,distance=..1,nbt={Item:{tag:{Tags:["timber_location"]}}}] - -# remove marker of processed blocks -$execute at @e[type=minecraft:marker,tag=timber_slow_chop] run kill @e[type=minecraft:marker,tag=timber_destroy,sort=nearest,limit=$(blocks_per_chop)] - -# delete tree markers after chopping -execute unless entity @e[type=minecraft:marker,tag=timber_destroy] run function timber:slow_chop/delete_markers \ No newline at end of file diff --git a/18-26/data/timber/functions/tool/wear_out.mcfunction b/18-26/data/timber/functions/tool/wear_out.mcfunction deleted file mode 100644 index d6b6e58..0000000 --- a/18-26/data/timber/functions/tool/wear_out.mcfunction +++ /dev/null @@ -1,3 +0,0 @@ -# wear out tool -execute store result storage timber:temp durability int 1 run scoreboard players get durability timber -item modify entity @s weapon.mainhand timber:wear_out \ No newline at end of file diff --git a/18-26/data/timber/functions/used_axe.mcfunction b/18-26/data/timber/functions/used_axe.mcfunction deleted file mode 100644 index 744ef4b..0000000 --- a/18-26/data/timber/functions/used_axe.mcfunction +++ /dev/null @@ -1,18 +0,0 @@ -# is this axe enabled? -execute unless score @s timber_disabled matches 1.. if score @s timber_w_axe matches 1.. if score wooden_axe timber matches 1.. run function timber:sneaking -execute unless score @s timber_disabled matches 1.. if score @s timber_s_axe matches 1.. if score stone_axe timber matches 1.. run function timber:sneaking -execute unless score @s timber_disabled matches 1.. if score @s timber_i_axe matches 1.. if score iron_axe timber matches 1.. run function timber:sneaking -execute unless score @s timber_disabled matches 1.. if score @s timber_g_axe matches 1.. if score golden_axe timber matches 1.. run function timber:sneaking -execute unless score @s timber_disabled matches 1.. if score @s timber_d_axe matches 1.. if score diamond_axe timber matches 1.. run function timber:sneaking -execute unless score @s timber_disabled matches 1.. if score @s timber_n_axe matches 1.. if score netherite_axe timber matches 1.. run function timber:sneaking - -# remove mushroom_stem marker -kill @e[type=minecraft:item,distance=..7,nbt={Item:{tag:{Tags:[timber_location]}}}] - -# reset scores -scoreboard players set @s timber_w_axe 0 -scoreboard players set @s timber_s_axe 0 -scoreboard players set @s timber_i_axe 0 -scoreboard players set @s timber_g_axe 0 -scoreboard players set @s timber_d_axe 0 -scoreboard players set @s timber_n_axe 0 \ No newline at end of file diff --git a/18-26/data/timber/item_modifiers/wear_out.json b/18-26/data/timber/item_modifiers/wear_out.json deleted file mode 100644 index 605acf8..0000000 --- a/18-26/data/timber/item_modifiers/wear_out.json +++ /dev/null @@ -1,16 +0,0 @@ -[ - { - "function": "minecraft:copy_nbt", - "source": { - "type": "minecraft:storage", - "source": "timber:temp" - }, - "ops": [ - { - "source": "durability", - "target": "Damage", - "op": "replace" - } - ] - } -] \ No newline at end of file diff --git a/18-26/data/timber/predicates/block/cap.json b/18-26/data/timber/predicates/block/cap.json deleted file mode 100644 index 2e456e1..0000000 --- a/18-26/data/timber/predicates/block/cap.json +++ /dev/null @@ -1,37 +0,0 @@ -{ - "condition": "minecraft:any_of", - "terms": [ - { - "condition": "minecraft:location_check", - "predicate": { - "block": { - "tag": "minecraft:wart_blocks" - } - } - }, - { - "condition": "minecraft:location_check", - "predicate": { - "block": { - "blocks": ["minecraft:shroomlight"] - } - } - }, - { - "condition": "minecraft:location_check", - "predicate": { - "block": { - "blocks": ["minecraft:brown_mushroom_block"] - } - } - }, - { - "condition": "minecraft:location_check", - "predicate": { - "block": { - "blocks": ["minecraft:red_mushroom_block"] - } - } - } - ] -} \ No newline at end of file diff --git a/18-26/data/timber/predicates/block/leaf.json b/18-26/data/timber/predicates/block/leaf.json deleted file mode 100644 index 86425b5..0000000 --- a/18-26/data/timber/predicates/block/leaf.json +++ /dev/null @@ -1,26 +0,0 @@ -{ - "condition": "minecraft:any_of", - "terms": [ - { - "condition": "minecraft:location_check", - "predicate": { - "block": { - "tag": "minecraft:leaves" - } - } - }, - { - "condition": "minecraft:location_check", - "predicate": { - "block": { - "blocks": [ - "minecraft:mangrove_propagule" - ], - "state": { - "hanging": "true" - } - } - } - } - ] -} diff --git a/18-26/data/timber/predicates/block/log.json b/18-26/data/timber/predicates/block/log.json deleted file mode 100644 index 759b71c..0000000 --- a/18-26/data/timber/predicates/block/log.json +++ /dev/null @@ -1,8 +0,0 @@ -{ - "condition": "minecraft:location_check", - "predicate": { - "block": { - "tag": "minecraft:logs" - } - } -} diff --git a/18-26/data/timber/predicates/block/stem.json b/18-26/data/timber/predicates/block/stem.json deleted file mode 100644 index a6b9e8e..0000000 --- a/18-26/data/timber/predicates/block/stem.json +++ /dev/null @@ -1,21 +0,0 @@ -{ - "condition": "minecraft:any_of", - "terms": [ - { - "condition": "minecraft:location_check", - "predicate": { - "block": { - "tag": "minecraft:logs" - } - } - }, - { - "condition": "minecraft:location_check", - "predicate": { - "block": { - "blocks": ["minecraft:mushroom_stem"] - } - } - } - ] -} \ No newline at end of file diff --git a/18-26/data/timber/predicates/item/log.json b/18-26/data/timber/predicates/item/log.json deleted file mode 100644 index 941fb0b..0000000 --- a/18-26/data/timber/predicates/item/log.json +++ /dev/null @@ -1,11 +0,0 @@ -{ - "condition": "minecraft:entity_properties", - "entity": "this", - "predicate": { - "equipment": { - "mainhand": { - "tag": "minecraft:logs" - } - } - } -} \ No newline at end of file diff --git a/18-26/data/timber/predicates/item/root.json b/18-26/data/timber/predicates/item/root.json deleted file mode 100644 index 3fd61cd..0000000 --- a/18-26/data/timber/predicates/item/root.json +++ /dev/null @@ -1,14 +0,0 @@ -{ - "condition": "minecraft:entity_properties", - "entity": "this", - "predicate": { - "equipment": { - "mainhand": { - "items": [ - "minecraft:mangrove_roots" - ] - } - } - } -} - \ No newline at end of file diff --git a/18-26/data/timber/predicates/item/sapling.json b/18-26/data/timber/predicates/item/sapling.json deleted file mode 100644 index ab208e0..0000000 --- a/18-26/data/timber/predicates/item/sapling.json +++ /dev/null @@ -1,11 +0,0 @@ -{ - "condition": "minecraft:entity_properties", - "entity": "this", - "predicate": { - "equipment": { - "mainhand": { - "tag": "minecraft:saplings" - } - } - } -} \ No newline at end of file diff --git a/18-26/data/timber/predicates/item/stem.json b/18-26/data/timber/predicates/item/stem.json deleted file mode 100644 index 5d8c572..0000000 --- a/18-26/data/timber/predicates/item/stem.json +++ /dev/null @@ -1,39 +0,0 @@ -{ - "condition": "minecraft:any_of", - "terms": [ - { - "condition": "minecraft:entity_properties", - "entity": "this", - "predicate": { - "equipment": { - "mainhand": { - "tag": "minecraft:logs" - } - } - } - }, - { - "condition": "minecraft:entity_properties", - "entity": "this", - "predicate": { - "equipment": { - "mainhand": { - "items": ["minecraft:mushroom_stem"] - } - } - } - }, - { - "condition": "minecraft:entity_properties", - "entity": "this", - "predicate": { - "equipment": { - "mainhand": { - "items": ["minecraft:knowledge_book"], - "nbt": "{Tags:[timber_location]}" - } - } - } - } - ] -} \ No newline at end of file diff --git a/18-26/data/timber/predicates/used_axe.json b/18-26/data/timber/predicates/used_axe.json deleted file mode 100644 index 1639a11..0000000 --- a/18-26/data/timber/predicates/used_axe.json +++ /dev/null @@ -1,65 +0,0 @@ -{ - "condition": "minecraft:any_of", - "terms": [ - { - "condition": "minecraft:entity_scores", - "entity": "this", - "scores": { - "timber_w_axe": { - "min": 1, - "max": 2147483647 - } - } - }, - { - "condition": "minecraft:entity_scores", - "entity": "this", - "scores": { - "timber_s_axe": { - "min": 1, - "max": 2147483647 - } - } - }, - { - "condition": "minecraft:entity_scores", - "entity": "this", - "scores": { - "timber_i_axe": { - "min": 1, - "max": 2147483647 - } - } - }, - { - "condition": "minecraft:entity_scores", - "entity": "this", - "scores": { - "timber_g_axe": { - "min": 1, - "max": 2147483647 - } - } - }, - { - "condition": "minecraft:entity_scores", - "entity": "this", - "scores": { - "timber_d_axe": { - "min": 1, - "max": 2147483647 - } - } - }, - { - "condition": "minecraft:entity_scores", - "entity": "this", - "scores": { - "timber_n_axe": { - "min": 1, - "max": 2147483647 - } - } - } - ] -} \ No newline at end of file diff --git a/18-26/data/timber/tags/functions/api/break_cap.json b/18-26/data/timber/tags/functions/api/break_cap.json deleted file mode 100644 index ab3fce9..0000000 --- a/18-26/data/timber/tags/functions/api/break_cap.json +++ /dev/null @@ -1,4 +0,0 @@ -{ - "values":[ - ] -} \ No newline at end of file diff --git a/18-26/data/timber/tags/functions/api/break_leaf.json b/18-26/data/timber/tags/functions/api/break_leaf.json deleted file mode 100644 index ab3fce9..0000000 --- a/18-26/data/timber/tags/functions/api/break_leaf.json +++ /dev/null @@ -1,4 +0,0 @@ -{ - "values":[ - ] -} \ No newline at end of file diff --git a/18-26/data/timber/tags/functions/api/break_log.json b/18-26/data/timber/tags/functions/api/break_log.json deleted file mode 100644 index ab3fce9..0000000 --- a/18-26/data/timber/tags/functions/api/break_log.json +++ /dev/null @@ -1,4 +0,0 @@ -{ - "values":[ - ] -} \ No newline at end of file diff --git a/18-26/data/timber/tags/functions/api/break_root.json b/18-26/data/timber/tags/functions/api/break_root.json deleted file mode 100644 index ab3fce9..0000000 --- a/18-26/data/timber/tags/functions/api/break_root.json +++ /dev/null @@ -1,4 +0,0 @@ -{ - "values":[ - ] -} \ No newline at end of file diff --git a/18-26/data/timber/tags/functions/api/break_stem.json b/18-26/data/timber/tags/functions/api/break_stem.json deleted file mode 100644 index ab3fce9..0000000 --- a/18-26/data/timber/tags/functions/api/break_stem.json +++ /dev/null @@ -1,4 +0,0 @@ -{ - "values":[ - ] -} \ No newline at end of file diff --git a/18-26/data/timber/tags/items/axes.json b/18-26/data/timber/tags/items/axes.json deleted file mode 100644 index c496215..0000000 --- a/18-26/data/timber/tags/items/axes.json +++ /dev/null @@ -1,10 +0,0 @@ -{ - "values":[ - "minecraft:wooden_axe", - "minecraft:stone_axe", - "minecraft:iron_axe", - "minecraft:golden_axe", - "minecraft:diamond_axe", - "minecraft:netherite_axe" - ] -} \ No newline at end of file diff --git a/18-41/data/minecraft/loot_tables/blocks/mushroom_stem.json b/18-41/data/minecraft/loot_tables/blocks/mushroom_stem.json deleted file mode 100644 index efe0d2b..0000000 --- a/18-41/data/minecraft/loot_tables/blocks/mushroom_stem.json +++ /dev/null @@ -1,51 +0,0 @@ -{ - "type": "minecraft:block", - "pools": [ - { - "rolls": 1, - "entries": [ - { - "type": "minecraft:item", - "name": "minecraft:mushroom_stem" - } - ], - "conditions": [ - { - "condition": "minecraft:match_tool", - "predicate": { - "components": { - "minecraft:enchantments": { - "levels": { - "minecraft:silk_touch": 1 - } - } - } - } - } - ] - }, - { - "rolls": 1, - "entries": [ - { - "type": "minecraft:item", - "name": "minecraft:knowledge_book", - "functions": [ - { - "function": "minecraft:set_custom_data", - "tag": "{Tags:[\"timber_location\"]}" - } - ], - "conditions": [ - { - "condition": "minecraft:match_tool", - "predicate": { - "items": "#timber:axes" - } - } - ] - } - ] - } - ] -} \ No newline at end of file diff --git a/18-41/data/minecraft/tags/functions/load.json b/18-41/data/minecraft/tags/functions/load.json deleted file mode 100644 index 420a05c..0000000 --- a/18-41/data/minecraft/tags/functions/load.json +++ /dev/null @@ -1,6 +0,0 @@ -{ - "values": [ - "timber:init", - "timber:main" - ] -} diff --git a/18-41/data/timber/functions/algorithm/fungus/chop.mcfunction b/18-41/data/timber/functions/algorithm/fungus/chop.mcfunction deleted file mode 100644 index 1308490..0000000 --- a/18-41/data/timber/functions/algorithm/fungus/chop.mcfunction +++ /dev/null @@ -1,31 +0,0 @@ -# resets -scoreboard players set durability_okay timber 1 - -# keep track of tree size -scoreboard players add tree_size timber 1 - -# wear out tool -function timber:tool/durability_count - -# tool durability check -execute if score stop_chopping timber matches 1.. run function timber:tool/durability_check - -##### if on top -execute positioned ~ ~1 ~ unless predicate timber:block/stem run function timber:algorithm/fungus/validate_cap -# mark cap that have been checked -execute positioned ~ ~ ~1 unless entity @e[type=minecraft:marker,tag=timber_leaves_found,distance=...1,sort=nearest,limit=1] if predicate timber:block/cap run summon marker ~ ~ ~ {Tags:["timber_leaves_found"]} -execute positioned ~ ~ ~-1 unless entity @e[type=minecraft:marker,tag=timber_leaves_found,distance=...1,sort=nearest,limit=1] if predicate timber:block/cap run summon marker ~ ~ ~ {Tags:["timber_leaves_found"]} -execute positioned ~1 ~ ~ unless entity @e[type=minecraft:marker,tag=timber_leaves_found,distance=...1,sort=nearest,limit=1] if predicate timber:block/cap run summon marker ~ ~ ~ {Tags:["timber_leaves_found"]} -execute positioned ~-1 ~ ~ unless entity @e[type=minecraft:marker,tag=timber_leaves_found,distance=...1,sort=nearest,limit=1] if predicate timber:block/cap run summon marker ~ ~ ~ {Tags:["timber_leaves_found"]} -execute positioned ~ ~1 ~ unless entity @e[type=minecraft:marker,tag=timber_leaves_found,distance=...1,sort=nearest,limit=1] if predicate timber:block/cap run summon marker ~ ~ ~ {Tags:["timber_leaves_found"]} -execute positioned ~ ~-1 ~ unless entity @e[type=minecraft:marker,tag=timber_leaves_found,distance=...1,sort=nearest,limit=1] if predicate timber:block/cap run summon marker ~ ~ ~ {Tags:["timber_leaves_found"]} - -# mark block that will get destroyed -execute if score durability_okay timber matches 1.. if score tree_size timber < max_tree_size timber run summon marker ~ ~ ~ {Tags:["timber_stem"]} - -# search for next stem -execute if score durability_okay timber matches 1.. if score tree_size timber < max_tree_size timber run function timber:algorithm/fungus/search - -# destroy cap (always) -execute run scoreboard players set leaf_distance timber 0 -function timber:algorithm/fungus/leaves/search \ No newline at end of file diff --git a/18-41/data/timber/functions/algorithm/fungus/leaves/destroy.mcfunction b/18-41/data/timber/functions/algorithm/fungus/leaves/destroy.mcfunction deleted file mode 100644 index e5389ec..0000000 --- a/18-41/data/timber/functions/algorithm/fungus/leaves/destroy.mcfunction +++ /dev/null @@ -1,3 +0,0 @@ -execute if score leaf_distance timber <= max_tree_size timber run summon marker ~ ~ ~ {Tags:["timber_cap"]} - -execute if score leaf_distance timber <= max_tree_size timber run function timber:algorithm/fungus/leaves/search \ No newline at end of file diff --git a/18-41/data/timber/functions/algorithm/fungus/leaves/find_other_stems.mcfunction b/18-41/data/timber/functions/algorithm/fungus/leaves/find_other_stems.mcfunction deleted file mode 100644 index 899a15c..0000000 --- a/18-41/data/timber/functions/algorithm/fungus/leaves/find_other_stems.mcfunction +++ /dev/null @@ -1,7 +0,0 @@ -# find other stems -execute at @e[type=minecraft:marker,tag=timber_cap] positioned ~ ~ ~1 if predicate timber:block/stem unless entity @e[type=minecraft:marker,tag=timber_stem,distance=...1,sort=arbitrary,limit=1] unless entity @e[type=minecraft:marker,tag=timber_other_stem,distance=...1,sort=arbitrary,limit=1] run summon marker ~ ~ ~ {Tags:["timber_other_stem"]} -execute at @e[type=minecraft:marker,tag=timber_cap] positioned ~ ~ ~-1 if predicate timber:block/stem unless entity @e[type=minecraft:marker,tag=timber_stem,distance=...1,sort=arbitrary,limit=1] unless entity @e[type=minecraft:marker,tag=timber_other_stem,distance=...1,sort=arbitrary,limit=1] run summon marker ~ ~ ~ {Tags:["timber_other_stem"]} -execute at @e[type=minecraft:marker,tag=timber_cap] positioned ~1 ~ ~ if predicate timber:block/stem unless entity @e[type=minecraft:marker,tag=timber_stem,distance=...1,sort=arbitrary,limit=1] unless entity @e[type=minecraft:marker,tag=timber_other_stem,distance=...1,sort=arbitrary,limit=1] run summon marker ~ ~ ~ {Tags:["timber_other_stem"]} -execute at @e[type=minecraft:marker,tag=timber_cap] positioned ~-1 ~ ~ if predicate timber:block/stem unless entity @e[type=minecraft:marker,tag=timber_stem,distance=...1,sort=arbitrary,limit=1] unless entity @e[type=minecraft:marker,tag=timber_other_stem,distance=...1,sort=arbitrary,limit=1] run summon marker ~ ~ ~ {Tags:["timber_other_stem"]} -execute at @e[type=minecraft:marker,tag=timber_cap] positioned ~ ~1 ~ if predicate timber:block/stem unless entity @e[type=minecraft:marker,tag=timber_stem,distance=...1,sort=arbitrary,limit=1] unless entity @e[type=minecraft:marker,tag=timber_other_stem,distance=...1,sort=arbitrary,limit=1] run summon marker ~ ~ ~ {Tags:["timber_other_stem"]} -execute at @e[type=minecraft:marker,tag=timber_cap] positioned ~ ~-1 ~ if predicate timber:block/stem unless entity @e[type=minecraft:marker,tag=timber_stem,distance=...1,sort=arbitrary,limit=1] unless entity @e[type=minecraft:marker,tag=timber_other_stem,distance=...1,sort=arbitrary,limit=1] run summon marker ~ ~ ~ {Tags:["timber_other_stem"]} \ No newline at end of file diff --git a/18-41/data/timber/functions/algorithm/fungus/leaves/search.mcfunction b/18-41/data/timber/functions/algorithm/fungus/leaves/search.mcfunction deleted file mode 100644 index d2a0e7f..0000000 --- a/18-41/data/timber/functions/algorithm/fungus/leaves/search.mcfunction +++ /dev/null @@ -1,18 +0,0 @@ -scoreboard players add leaf_distance timber 1 -# search for next cap -execute positioned ~ ~ ~1 unless entity @e[type=minecraft:marker,tag=timber_cap,distance=...1,sort=arbitrary,limit=1] if predicate timber:block/cap run function timber:algorithm/fungus/leaves/destroy -execute positioned ~ ~ ~-1 unless entity @e[type=minecraft:marker,tag=timber_cap,distance=...1,sort=arbitrary,limit=1] if predicate timber:block/cap run function timber:algorithm/fungus/leaves/destroy -execute positioned ~1 ~ ~ unless entity @e[type=minecraft:marker,tag=timber_cap,distance=...1,sort=arbitrary,limit=1] if predicate timber:block/cap run function timber:algorithm/fungus/leaves/destroy -execute positioned ~-1 ~ ~ unless entity @e[type=minecraft:marker,tag=timber_cap,distance=...1,sort=arbitrary,limit=1] if predicate timber:block/cap run function timber:algorithm/fungus/leaves/destroy -execute positioned ~ ~1 ~ unless entity @e[type=minecraft:marker,tag=timber_cap,distance=...1,sort=arbitrary,limit=1] if predicate timber:block/cap run function timber:algorithm/fungus/leaves/destroy -execute positioned ~ ~-1 ~ unless entity @e[type=minecraft:marker,tag=timber_cap,distance=...1,sort=arbitrary,limit=1] if predicate timber:block/cap run function timber:algorithm/fungus/leaves/destroy - -execute positioned ~ ~-1 ~1 unless entity @e[type=minecraft:marker,tag=timber_cap,distance=...1,sort=arbitrary,limit=1] if predicate timber:block/cap run function timber:algorithm/fungus/leaves/destroy -execute positioned ~ ~-1 ~-1 unless entity @e[type=minecraft:marker,tag=timber_cap,distance=...1,sort=arbitrary,limit=1] if predicate timber:block/cap run function timber:algorithm/fungus/leaves/destroy -execute positioned ~1 ~-1 ~ unless entity @e[type=minecraft:marker,tag=timber_cap,distance=...1,sort=arbitrary,limit=1] if predicate timber:block/cap run function timber:algorithm/fungus/leaves/destroy -execute positioned ~-1 ~-1 ~ unless entity @e[type=minecraft:marker,tag=timber_cap,distance=...1,sort=arbitrary,limit=1] if predicate timber:block/cap run function timber:algorithm/fungus/leaves/destroy - -execute positioned ~1 ~-1 ~1 unless entity @e[type=minecraft:marker,tag=timber_cap,distance=...1,sort=arbitrary,limit=1] if predicate timber:block/cap run function timber:algorithm/fungus/leaves/destroy -execute positioned ~-1 ~-1 ~-1 unless entity @e[type=minecraft:marker,tag=timber_cap,distance=...1,sort=arbitrary,limit=1] if predicate timber:block/cap run function timber:algorithm/fungus/leaves/destroy -execute positioned ~1 ~-1 ~-1 unless entity @e[type=minecraft:marker,tag=timber_cap,distance=...1,sort=arbitrary,limit=1] if predicate timber:block/cap run function timber:algorithm/fungus/leaves/destroy -execute positioned ~-1 ~-1 ~1 unless entity @e[type=minecraft:marker,tag=timber_cap,distance=...1,sort=arbitrary,limit=1] if predicate timber:block/cap run function timber:algorithm/fungus/leaves/destroy \ No newline at end of file diff --git a/18-41/data/timber/functions/algorithm/fungus/run.mcfunction b/18-41/data/timber/functions/algorithm/fungus/run.mcfunction deleted file mode 100644 index 6db2dbe..0000000 --- a/18-41/data/timber/functions/algorithm/fungus/run.mcfunction +++ /dev/null @@ -1,5 +0,0 @@ -# check if item is a stem -summon minecraft:armor_stand ~ ~ ~ {Silent:1b,Invulnerable:1b,Marker:1b,Invisible:1b,Tags:["timber_item_check"]} -data modify entity @e[type=minecraft:armor_stand,tag=timber_item_check,distance=...1,sort=arbitrary,limit=1] HandItems[0] set from entity @e[distance=...1,type=minecraft:item,sort=nearest,limit=1,nbt={Age:0s}] Item -execute if entity @e[type=minecraft:armor_stand,tag=timber_item_check,distance=...1,sort=arbitrary,limit=1,predicate=timber:item/stem] run function timber:algorithm/fungus/chop -kill @e[type=minecraft:armor_stand,tag=timber_item_check,distance=...1,sort=arbitrary,limit=1] \ No newline at end of file diff --git a/18-41/data/timber/functions/algorithm/fungus/search.mcfunction b/18-41/data/timber/functions/algorithm/fungus/search.mcfunction deleted file mode 100644 index 07e10c9..0000000 --- a/18-41/data/timber/functions/algorithm/fungus/search.mcfunction +++ /dev/null @@ -1,24 +0,0 @@ -# search for next log -execute positioned ~ ~1 ~ if predicate timber:block/stem unless entity @e[type=minecraft:marker,tag=timber_stem,distance=...1,sort=arbitrary,limit=1] run function timber:algorithm/fungus/chop -execute positioned ~ ~1 ~1 if predicate timber:block/stem unless entity @e[type=minecraft:marker,tag=timber_stem,distance=...1,sort=arbitrary,limit=1] run function timber:algorithm/fungus/chop -execute positioned ~ ~1 ~-1 if predicate timber:block/stem unless entity @e[type=minecraft:marker,tag=timber_stem,distance=...1,sort=arbitrary,limit=1] run function timber:algorithm/fungus/chop -execute positioned ~1 ~1 ~ if predicate timber:block/stem unless entity @e[type=minecraft:marker,tag=timber_stem,distance=...1,sort=arbitrary,limit=1] run function timber:algorithm/fungus/chop -execute positioned ~1 ~1 ~1 if predicate timber:block/stem unless entity @e[type=minecraft:marker,tag=timber_stem,distance=...1,sort=arbitrary,limit=1] run function timber:algorithm/fungus/chop -execute positioned ~1 ~1 ~-1 if predicate timber:block/stem unless entity @e[type=minecraft:marker,tag=timber_stem,distance=...1,sort=arbitrary,limit=1] run function timber:algorithm/fungus/chop -execute positioned ~-1 ~1 ~ if predicate timber:block/stem unless entity @e[type=minecraft:marker,tag=timber_stem,distance=...1,sort=arbitrary,limit=1] run function timber:algorithm/fungus/chop -execute positioned ~-1 ~1 ~1 if predicate timber:block/stem unless entity @e[type=minecraft:marker,tag=timber_stem,distance=...1,sort=arbitrary,limit=1] run function timber:algorithm/fungus/chop -execute positioned ~-1 ~1 ~-1 if predicate timber:block/stem unless entity @e[type=minecraft:marker,tag=timber_stem,distance=...1,sort=arbitrary,limit=1] run function timber:algorithm/fungus/chop - -execute positioned ~ ~ ~1 if predicate timber:block/stem unless entity @e[type=minecraft:marker,tag=timber_stem,distance=...1,sort=arbitrary,limit=1] run function timber:algorithm/fungus/chop -execute positioned ~ ~ ~-1 if predicate timber:block/stem unless entity @e[type=minecraft:marker,tag=timber_stem,distance=...1,sort=arbitrary,limit=1] run function timber:algorithm/fungus/chop -execute positioned ~1 ~ ~ if predicate timber:block/stem unless entity @e[type=minecraft:marker,tag=timber_stem,distance=...1,sort=arbitrary,limit=1] run function timber:algorithm/fungus/chop -execute positioned ~1 ~ ~1 if predicate timber:block/stem unless entity @e[type=minecraft:marker,tag=timber_stem,distance=...1,sort=arbitrary,limit=1] run function timber:algorithm/fungus/chop -execute positioned ~1 ~ ~-1 if predicate timber:block/stem unless entity @e[type=minecraft:marker,tag=timber_stem,distance=...1,sort=arbitrary,limit=1] run function timber:algorithm/fungus/chop -execute positioned ~-1 ~ ~ if predicate timber:block/stem unless entity @e[type=minecraft:marker,tag=timber_stem,distance=...1,sort=arbitrary,limit=1] run function timber:algorithm/fungus/chop -execute positioned ~-1 ~ ~1 if predicate timber:block/stem unless entity @e[type=minecraft:marker,tag=timber_stem,distance=...1,sort=arbitrary,limit=1] run function timber:algorithm/fungus/chop -execute positioned ~-1 ~ ~-1 if predicate timber:block/stem unless entity @e[type=minecraft:marker,tag=timber_stem,distance=...1,sort=arbitrary,limit=1] run function timber:algorithm/fungus/chop - -execute positioned ~ ~2 ~ if predicate timber:block/stem unless entity @e[type=minecraft:marker,tag=timber_stem,distance=...1,sort=arbitrary,limit=1] run function timber:algorithm/fungus/chop - -# search for next log downwards -execute if score chop_down timber matches 1.. run function timber:algorithm/fungus/search_down \ No newline at end of file diff --git a/18-41/data/timber/functions/algorithm/fungus/search_down.mcfunction b/18-41/data/timber/functions/algorithm/fungus/search_down.mcfunction deleted file mode 100644 index a9edfb2..0000000 --- a/18-41/data/timber/functions/algorithm/fungus/search_down.mcfunction +++ /dev/null @@ -1,10 +0,0 @@ -# search for next log downwards -execute positioned ~ ~-1 ~ if predicate timber:block/stem unless entity @e[type=minecraft:marker,tag=timber_stem,distance=...1,sort=arbitrary,limit=1] run function timber:algorithm/fungus/chop -execute positioned ~ ~-1 ~1 if predicate timber:block/stem unless entity @e[type=minecraft:marker,tag=timber_stem,distance=...1,sort=arbitrary,limit=1] run function timber:algorithm/fungus/chop -execute positioned ~ ~-1 ~-1 if predicate timber:block/stem unless entity @e[type=minecraft:marker,tag=timber_stem,distance=...1,sort=arbitrary,limit=1] run function timber:algorithm/fungus/chop -execute positioned ~1 ~-1 ~ if predicate timber:block/stem unless entity @e[type=minecraft:marker,tag=timber_stem,distance=...1,sort=arbitrary,limit=1] run function timber:algorithm/fungus/chop -execute positioned ~1 ~-1 ~1 if predicate timber:block/stem unless entity @e[type=minecraft:marker,tag=timber_stem,distance=...1,sort=arbitrary,limit=1] run function timber:algorithm/fungus/chop -execute positioned ~1 ~-1 ~-1 if predicate timber:block/stem unless entity @e[type=minecraft:marker,tag=timber_stem,distance=...1,sort=arbitrary,limit=1] run function timber:algorithm/fungus/chop -execute positioned ~-1 ~-1 ~ if predicate timber:block/stem unless entity @e[type=minecraft:marker,tag=timber_stem,distance=...1,sort=arbitrary,limit=1] run function timber:algorithm/fungus/chop -execute positioned ~-1 ~-1 ~1 if predicate timber:block/stem unless entity @e[type=minecraft:marker,tag=timber_stem,distance=...1,sort=arbitrary,limit=1] run function timber:algorithm/fungus/chop -execute positioned ~-1 ~-1 ~-1 if predicate timber:block/stem unless entity @e[type=minecraft:marker,tag=timber_stem,distance=...1,sort=arbitrary,limit=1] run function timber:algorithm/fungus/chop \ No newline at end of file diff --git a/18-41/data/timber/functions/algorithm/fungus/validate_cap.mcfunction b/18-41/data/timber/functions/algorithm/fungus/validate_cap.mcfunction deleted file mode 100644 index e41d9b6..0000000 --- a/18-41/data/timber/functions/algorithm/fungus/validate_cap.mcfunction +++ /dev/null @@ -1,6 +0,0 @@ -# mark leaf that have been checked -execute positioned ~ ~ ~1 unless entity @e[type=minecraft:marker,tag=timber_leaves_found,distance=...1,sort=nearest,limit=1] if predicate timber:block/cap run summon marker ~ ~ ~ {Tags:["timber_leaves_found"]} -execute positioned ~ ~ ~-1 unless entity @e[type=minecraft:marker,tag=timber_leaves_found,distance=...1,sort=nearest,limit=1] if predicate timber:block/cap run summon marker ~ ~ ~ {Tags:["timber_leaves_found"]} -execute positioned ~1 ~ ~ unless entity @e[type=minecraft:marker,tag=timber_leaves_found,distance=...1,sort=nearest,limit=1] if predicate timber:block/cap run summon marker ~ ~ ~ {Tags:["timber_leaves_found"]} -execute positioned ~-1 ~ ~ unless entity @e[type=minecraft:marker,tag=timber_leaves_found,distance=...1,sort=nearest,limit=1] if predicate timber:block/cap run summon marker ~ ~ ~ {Tags:["timber_leaves_found"]} -execute positioned ~ ~ ~ unless entity @e[type=minecraft:marker,tag=timber_leaves_found,distance=...1,sort=nearest,limit=1] if predicate timber:block/cap run summon marker ~ ~ ~ {Tags:["timber_leaves_found"]} \ No newline at end of file diff --git a/18-41/data/timber/functions/algorithm/tree/chop.mcfunction b/18-41/data/timber/functions/algorithm/tree/chop.mcfunction deleted file mode 100644 index f3c591f..0000000 --- a/18-41/data/timber/functions/algorithm/tree/chop.mcfunction +++ /dev/null @@ -1,29 +0,0 @@ -# resets -scoreboard players set durability_okay timber 1 - -# keep track of tree size -scoreboard players add tree_size timber 1 - -# wear out tool -function timber:tool/durability_count - -# tool durability check -execute if score stop_chopping timber matches 1.. unless score unbreakable timber matches 1 run function timber:tool/durability_check - -# mark leaf that have been checked -execute positioned ~ ~ ~1 unless entity @e[type=minecraft:marker,tag=timber_leaves_found,distance=...1,sort=nearest,limit=1] if predicate timber:block/leaf run summon marker ~ ~ ~ {Tags:["timber_leaves_found"]} -execute positioned ~ ~ ~-1 unless entity @e[type=minecraft:marker,tag=timber_leaves_found,distance=...1,sort=nearest,limit=1] if predicate timber:block/leaf run summon marker ~ ~ ~ {Tags:["timber_leaves_found"]} -execute positioned ~1 ~ ~ unless entity @e[type=minecraft:marker,tag=timber_leaves_found,distance=...1,sort=nearest,limit=1] if predicate timber:block/leaf run summon marker ~ ~ ~ {Tags:["timber_leaves_found"]} -execute positioned ~-1 ~ ~ unless entity @e[type=minecraft:marker,tag=timber_leaves_found,distance=...1,sort=nearest,limit=1] if predicate timber:block/leaf run summon marker ~ ~ ~ {Tags:["timber_leaves_found"]} -execute positioned ~ ~1 ~ unless entity @e[type=minecraft:marker,tag=timber_leaves_found,distance=...1,sort=nearest,limit=1] if predicate timber:block/leaf run summon marker ~ ~ ~ {Tags:["timber_leaves_found"]} -execute positioned ~ ~-1 ~ unless entity @e[type=minecraft:marker,tag=timber_leaves_found,distance=...1,sort=nearest,limit=1] if predicate timber:block/leaf run summon marker ~ ~ ~ {Tags:["timber_leaves_found"]} - -# mark block that will get destroyed -execute if score durability_okay timber matches 1.. if score tree_size timber < max_tree_size timber run summon marker ~ ~ ~ {Tags:["timber_log"]} - -# search for next log/root -execute if score durability_okay timber matches 1.. if score tree_size timber < max_tree_size timber run function timber:algorithm/tree/search_1 - -# destroy leaves -execute if score destroy_leaves timber matches 1.. run scoreboard players set leaf_distance timber 0 -execute if score destroy_leaves timber matches 1.. run function timber:algorithm/tree/leaves/search \ No newline at end of file diff --git a/18-41/data/timber/functions/algorithm/tree/chop_roots.mcfunction b/18-41/data/timber/functions/algorithm/tree/chop_roots.mcfunction deleted file mode 100644 index 0b57e1e..0000000 --- a/18-41/data/timber/functions/algorithm/tree/chop_roots.mcfunction +++ /dev/null @@ -1,17 +0,0 @@ -# resets -scoreboard players set durability_okay timber 1 - -# keep track of tree size -scoreboard players add tree_size timber 1 - -# wear out tool -function timber:tool/durability_count - -# tool durability check -execute if score stop_chopping timber matches 1.. unless score unbreakable timber matches 1 run function timber:tool/durability_check - -# mark block that will get destroyed -execute if score durability_okay timber matches 1.. if score tree_size timber < max_tree_size timber run summon marker ~ ~ ~ {Tags:["timber_root"]} - -# search for next log/root -execute if score durability_okay timber matches 1.. if score tree_size timber < max_tree_size timber run function timber:algorithm/tree/search_1 \ No newline at end of file diff --git a/18-41/data/timber/functions/algorithm/tree/leaves/destroy.mcfunction b/18-41/data/timber/functions/algorithm/tree/leaves/destroy.mcfunction deleted file mode 100644 index 500641f..0000000 --- a/18-41/data/timber/functions/algorithm/tree/leaves/destroy.mcfunction +++ /dev/null @@ -1,8 +0,0 @@ -# get leaf distance (in score leaf_distance timber) -function timber:algorithm/tree/leaves/get_distance - -# decide if leaf is closer to the current tree then mark it so that it will get destroyed -execute if score leaf_distance_old timber < leaf_distance timber run summon marker ~ ~ ~ {Tags:["timber_leaf"]} - -# search for next leaf -execute if score leaf_distance_old timber < leaf_distance timber run function timber:algorithm/tree/leaves/search \ No newline at end of file diff --git a/18-41/data/timber/functions/algorithm/tree/leaves/get_distance.mcfunction b/18-41/data/timber/functions/algorithm/tree/leaves/get_distance.mcfunction deleted file mode 100644 index ece384e..0000000 --- a/18-41/data/timber/functions/algorithm/tree/leaves/get_distance.mcfunction +++ /dev/null @@ -1,17 +0,0 @@ -scoreboard players set leaf_distance timber 0 -execute if block ~ ~ ~ #minecraft:leaves[distance=1] run scoreboard players set leaf_distance timber 1 -execute if block ~ ~ ~ #minecraft:leaves[distance=2] run scoreboard players set leaf_distance timber 2 -execute if block ~ ~ ~ #minecraft:leaves[distance=3] run scoreboard players set leaf_distance timber 3 -execute if block ~ ~ ~ #minecraft:leaves[distance=4] run scoreboard players set leaf_distance timber 4 -execute if block ~ ~ ~ #minecraft:leaves[distance=5] run scoreboard players set leaf_distance timber 5 -execute if block ~ ~ ~ #minecraft:leaves[distance=6] run scoreboard players set leaf_distance timber 6 -execute if block ~ ~ ~ #minecraft:leaves[distance=7] run scoreboard players set leaf_distance timber 7 -execute if block ~ ~ ~ #minecraft:leaves[distance=8] run scoreboard players set leaf_distance timber 8 -execute if block ~ ~ ~ #minecraft:leaves[distance=9] run scoreboard players set leaf_distance timber 9 -execute if block ~ ~ ~ #minecraft:leaves[distance=10] run scoreboard players set leaf_distance timber 10 -execute if block ~ ~ ~ #minecraft:leaves[distance=11] run scoreboard players set leaf_distance timber 11 -execute if block ~ ~ ~ #minecraft:leaves[distance=12] run scoreboard players set leaf_distance timber 12 -execute if block ~ ~ ~ #minecraft:leaves[distance=13] run scoreboard players set leaf_distance timber 13 -execute if block ~ ~ ~ #minecraft:leaves[distance=14] run scoreboard players set leaf_distance timber 14 -# always destroy mangrove sapling -execute if block ~ ~ ~ minecraft:mangrove_propagule run scoreboard players set leaf_distance timber 15 \ No newline at end of file diff --git a/18-41/data/timber/functions/algorithm/tree/leaves/search.mcfunction b/18-41/data/timber/functions/algorithm/tree/leaves/search.mcfunction deleted file mode 100644 index 13bbd5e..0000000 --- a/18-41/data/timber/functions/algorithm/tree/leaves/search.mcfunction +++ /dev/null @@ -1,17 +0,0 @@ -# save leaves distance tag at its position -summon marker ~ ~ ~ {Tags:["timber_leaf_distance"]} -scoreboard players operation @e[type=minecraft:marker,tag=timber_leaf_distance,distance=...1,sort=arbitrary,limit=1] timber = leaf_distance timber - -# load leaves distance tag and search for next leaf -scoreboard players operation leaf_distance_old timber = @e[type=minecraft:marker,tag=timber_leaf_distance,distance=...1,sort=arbitrary,limit=1] timber -execute positioned ~ ~ ~1 unless entity @e[type=minecraft:marker,tag=timber_leaf_distance,distance=...1,sort=arbitrary,limit=1] if predicate timber:block/leaf run function timber:algorithm/tree/leaves/destroy -scoreboard players operation leaf_distance_old timber = @e[type=minecraft:marker,tag=timber_leaf_distance,distance=...1,sort=arbitrary,limit=1] timber -execute positioned ~ ~ ~-1 unless entity @e[type=minecraft:marker,tag=timber_leaf_distance,distance=...1,sort=arbitrary,limit=1] if predicate timber:block/leaf run function timber:algorithm/tree/leaves/destroy -scoreboard players operation leaf_distance_old timber = @e[type=minecraft:marker,tag=timber_leaf_distance,distance=...1,sort=arbitrary,limit=1] timber -execute positioned ~1 ~ ~ unless entity @e[type=minecraft:marker,tag=timber_leaf_distance,distance=...1,sort=arbitrary,limit=1] if predicate timber:block/leaf run function timber:algorithm/tree/leaves/destroy -scoreboard players operation leaf_distance_old timber = @e[type=minecraft:marker,tag=timber_leaf_distance,distance=...1,sort=arbitrary,limit=1] timber -execute positioned ~-1 ~ ~ unless entity @e[type=minecraft:marker,tag=timber_leaf_distance,distance=...1,sort=arbitrary,limit=1] if predicate timber:block/leaf run function timber:algorithm/tree/leaves/destroy -scoreboard players operation leaf_distance_old timber = @e[type=minecraft:marker,tag=timber_leaf_distance,distance=...1,sort=arbitrary,limit=1] timber -execute positioned ~ ~1 ~ unless entity @e[type=minecraft:marker,tag=timber_leaf_distance,distance=...1,sort=arbitrary,limit=1] if predicate timber:block/leaf run function timber:algorithm/tree/leaves/destroy -scoreboard players operation leaf_distance_old timber = @e[type=minecraft:marker,tag=timber_leaf_distance,distance=...1,sort=arbitrary,limit=1] timber -execute positioned ~ ~-1 ~ unless entity @e[type=minecraft:marker,tag=timber_leaf_distance,distance=...1,sort=arbitrary,limit=1] if predicate timber:block/leaf run function timber:algorithm/tree/leaves/destroy \ No newline at end of file diff --git a/18-41/data/timber/functions/algorithm/tree/run.mcfunction b/18-41/data/timber/functions/algorithm/tree/run.mcfunction deleted file mode 100644 index 172c583..0000000 --- a/18-41/data/timber/functions/algorithm/tree/run.mcfunction +++ /dev/null @@ -1,6 +0,0 @@ -# check if item is in tag #minecraft:logs -summon minecraft:armor_stand ~ ~ ~ {Silent:1b,Invulnerable:1b,Marker:1b,Invisible:1b,Tags:["timber_item_check"]} -data modify entity @e[type=minecraft:armor_stand,tag=timber_item_check,distance=...1,sort=arbitrary,limit=1] HandItems[0] set from entity @e[type=minecraft:item,distance=...1,sort=nearest,limit=1,nbt={Age:0s}] Item -execute if entity @e[type=minecraft:armor_stand,tag=timber_item_check,distance=...1,sort=arbitrary,limit=1,predicate=timber:item/log] run function timber:algorithm/tree/chop -execute if score start_chop_on_root timber matches 1.. if entity @e[type=minecraft:armor_stand,tag=timber_item_check,distance=...1,sort=arbitrary,limit=1,predicate=timber:item/root] run function timber:algorithm/tree/chop_roots -kill @e[type=minecraft:armor_stand,tag=timber_item_check,distance=...1,sort=arbitrary,limit=1] diff --git a/18-41/data/timber/functions/algorithm/tree/search_1.mcfunction b/18-41/data/timber/functions/algorithm/tree/search_1.mcfunction deleted file mode 100644 index 020d7eb..0000000 --- a/18-41/data/timber/functions/algorithm/tree/search_1.mcfunction +++ /dev/null @@ -1,24 +0,0 @@ -# search for next log -execute positioned ~ ~1 ~ run function timber:algorithm/tree/search_2 -execute positioned ~ ~1 ~1 run function timber:algorithm/tree/search_2 -execute positioned ~ ~1 ~-1 run function timber:algorithm/tree/search_2 -execute positioned ~1 ~1 ~ run function timber:algorithm/tree/search_2 -execute positioned ~1 ~1 ~1 run function timber:algorithm/tree/search_2 -execute positioned ~1 ~1 ~-1 run function timber:algorithm/tree/search_2 -execute positioned ~-1 ~1 ~ run function timber:algorithm/tree/search_2 -execute positioned ~-1 ~1 ~1 run function timber:algorithm/tree/search_2 -execute positioned ~-1 ~1 ~-1 run function timber:algorithm/tree/search_2 - -execute positioned ~ ~ ~1 run function timber:algorithm/tree/search_2 -execute positioned ~ ~ ~-1 run function timber:algorithm/tree/search_2 -execute positioned ~1 ~ ~ run function timber:algorithm/tree/search_2 -execute positioned ~1 ~ ~1 run function timber:algorithm/tree/search_2 -execute positioned ~1 ~ ~-1 run function timber:algorithm/tree/search_2 -execute positioned ~-1 ~ ~ run function timber:algorithm/tree/search_2 -execute positioned ~-1 ~ ~1 run function timber:algorithm/tree/search_2 -execute positioned ~-1 ~ ~-1 run function timber:algorithm/tree/search_2 - -# search for next log downwards -execute if score chop_down timber matches 1.. run function timber:algorithm/tree/search_down -# search for roots downwards -execute unless score chop_down timber matches 1.. if score destroy_roots timber matches 1.. if entity @e[type=minecraft:marker,tag=timber_root,distance=...1,sort=arbitrary,limit=1] run function timber:algorithm/tree/search_down diff --git a/18-41/data/timber/functions/algorithm/tree/search_2.mcfunction b/18-41/data/timber/functions/algorithm/tree/search_2.mcfunction deleted file mode 100644 index 7f48c20..0000000 --- a/18-41/data/timber/functions/algorithm/tree/search_2.mcfunction +++ /dev/null @@ -1,4 +0,0 @@ -# if log -execute if predicate timber:block/log unless entity @e[type=minecraft:marker,tag=timber_log,distance=...1,sort=arbitrary,limit=1] run function timber:algorithm/tree/chop -# if root -execute if block ~ ~ ~ minecraft:mangrove_roots unless entity @e[type=minecraft:marker,tag=timber_root,distance=...1,sort=arbitrary,limit=1] run function timber:algorithm/tree/chop_roots diff --git a/18-41/data/timber/functions/algorithm/tree/search_down.mcfunction b/18-41/data/timber/functions/algorithm/tree/search_down.mcfunction deleted file mode 100644 index aee97f5..0000000 --- a/18-41/data/timber/functions/algorithm/tree/search_down.mcfunction +++ /dev/null @@ -1,10 +0,0 @@ -# search for next log downwards -execute positioned ~ ~-1 ~ run function timber:algorithm/tree/search_2 -execute positioned ~ ~-1 ~1 run function timber:algorithm/tree/search_2 -execute positioned ~ ~-1 ~-1 run function timber:algorithm/tree/search_2 -execute positioned ~1 ~-1 ~ run function timber:algorithm/tree/search_2 -execute positioned ~1 ~-1 ~1 run function timber:algorithm/tree/search_2 -execute positioned ~1 ~-1 ~-1 run function timber:algorithm/tree/search_2 -execute positioned ~-1 ~-1 ~ run function timber:algorithm/tree/search_2 -execute positioned ~-1 ~-1 ~1 run function timber:algorithm/tree/search_2 -execute positioned ~-1 ~-1 ~-1 run function timber:algorithm/tree/search_2 \ No newline at end of file diff --git a/18-41/data/timber/functions/autoplant/loop.mcfunction b/18-41/data/timber/functions/autoplant/loop.mcfunction deleted file mode 100644 index f765e10..0000000 --- a/18-41/data/timber/functions/autoplant/loop.mcfunction +++ /dev/null @@ -1,5 +0,0 @@ -# Loop -execute if score plant_sapling timber matches 1.. run schedule function timber:autoplant/loop 2s replace - -# plant sapling process -execute as @e[type=minecraft:item,tag=!timber_checked,tag=!global.ignore,tag=!global.ignore.kill,sort=random,limit=20,nbt={OnGround:1b}] at @s if block ~ ~-0.5 ~ #minecraft:dirt if block ~ ~0.5 ~ minecraft:air at @s run function timber:autoplant/validate \ No newline at end of file diff --git a/18-41/data/timber/functions/autoplant/mud_fix.mcfunction b/18-41/data/timber/functions/autoplant/mud_fix.mcfunction deleted file mode 100644 index cffee47..0000000 --- a/18-41/data/timber/functions/autoplant/mud_fix.mcfunction +++ /dev/null @@ -1,2 +0,0 @@ -execute at @e[type=minecraft:marker,tag=timber_mud] run setblock ~ ~ ~ minecraft:mud -kill @e[type=minecraft:marker,tag=timber_mud] \ No newline at end of file diff --git a/18-41/data/timber/functions/autoplant/plant.mcfunction b/18-41/data/timber/functions/autoplant/plant.mcfunction deleted file mode 100644 index d701739..0000000 --- a/18-41/data/timber/functions/autoplant/plant.mcfunction +++ /dev/null @@ -1,18 +0,0 @@ -# replace item-sapling with block-sapling (special case for mud, because fallingblock get destroyed. 0.125 is the height when you sink into the mud) -execute unless block ~ ~ ~ minecraft:air run summon marker ~ ~ ~ {Tags:["timber_mud","global.ignore"]} -execute unless block ~ ~ ~ minecraft:air run schedule function timber:autoplant/mud_fix 1t -execute unless block ~ ~ ~ minecraft:air run setblock ~ ~ ~ minecraft:muddy_mangrove_roots -summon minecraft:falling_block ~ ~0.125 ~ {BlockState:{Name:"minecraft:barrier"},Time:1,DropItem:0b,Tags:["timber_item_to_block"]} -execute positioned ~ ~0.125 ~ run data modify entity @e[type=minecraft:falling_block,tag=timber_item_to_block,distance=...1,sort=arbitrary,limit=1] BlockState.Name set from entity @s Item.id - -# on stacks -1 -execute store result score @s timber run data get entity @s Item.count -scoreboard players remove @s timber 1 -execute if score @s timber matches ..0 run kill @s -execute if score @s timber matches 1.. store result entity @s Item.count byte 1 run scoreboard players get @s timber -scoreboard players reset @s timber -# cheap custom server fix -execute if score not_vanilla timber matches 1 run kill @s - -# sapling will be checked every time -tag @s remove timber_checked \ No newline at end of file diff --git a/18-41/data/timber/functions/autoplant/validate.mcfunction b/18-41/data/timber/functions/autoplant/validate.mcfunction deleted file mode 100644 index e84bccf..0000000 --- a/18-41/data/timber/functions/autoplant/validate.mcfunction +++ /dev/null @@ -1,8 +0,0 @@ -# don't check items twice (except saplings, look in plant.mcfunction) -tag @s add timber_checked - -# check if item is in tag #minecraft:sapling -summon minecraft:armor_stand ~ ~ ~ {Silent:1b,Invulnerable:1b,Marker:1b,Invisible:1b,Tags:["timber_item_check"]} -data modify entity @e[type=minecraft:armor_stand,tag=timber_item_check,distance=...1,sort=arbitrary,limit=1] HandItems[0] set from entity @s Item -execute if entity @e[type=minecraft:armor_stand,tag=timber_item_check,distance=...1,sort=arbitrary,limit=1,predicate=timber:item/sapling] run function timber:autoplant/plant -kill @e[type=minecraft:armor_stand,tag=timber_item_check,distance=...1,sort=arbitrary,limit=1] \ No newline at end of file diff --git a/18-41/data/timber/functions/help.mcfunction b/18-41/data/timber/functions/help.mcfunction deleted file mode 100644 index 8f04f36..0000000 --- a/18-41/data/timber/functions/help.mcfunction +++ /dev/null @@ -1,25 +0,0 @@ -tellraw @s ["",{"text":"\u00A7m ","color":"dark_gray"}] - -tellraw @s ["",{"text":" Timber Datapack"}] - -tellraw @s ["",{"text":"\u00A7m ","color":"dark_gray"}] - -tellraw @s ["",{"text":"The Timber Datapack allows you to instantly chop down a tree just by breaking one log with any axe."}] - -tellraw @s ["",{"text":"By default, sneaking while breaking will not chop the tree."}] - -tellraw @s [""] - -tellraw @s ["",{"text":"Every player can use "},{"text":"/trigger TimberToggle","color":"blue","clickEvent":{"action":"suggest_command","value":"/trigger TimberToggle"}},{"text":" to individually turn the datapack on or off."}] - -tellraw @s [""] - -tellraw @s [""," ",{"text":"[click here to check for new updates]","color":"green","clickEvent":{"action":"open_url","value":"https://github.com/Moggla/Timber-Datapack/releases"}}] - -tellraw @s [""] - -tellraw @s [""," ",{"text":"[click here to see the settings]","color":"gold","clickEvent":{"action":"run_command","value":"/function timber:settings/settings1_click"}}] - -tellraw @s ["",{"text":"\u00A7m ","color":"dark_gray"}] - -function timber:settings/end_of_message \ No newline at end of file diff --git a/18-41/data/timber/functions/init.mcfunction b/18-41/data/timber/functions/init.mcfunction deleted file mode 100644 index 1d2cbf0..0000000 --- a/18-41/data/timber/functions/init.mcfunction +++ /dev/null @@ -1,39 +0,0 @@ -# longer maxCommandChainLength -gamerule maxCommandChainLength 1000000000 - -# create scoreboards -scoreboard objectives add timber_w_axe minecraft.used:minecraft.wooden_axe -scoreboard objectives add timber_s_axe minecraft.used:minecraft.stone_axe -scoreboard objectives add timber_i_axe minecraft.used:minecraft.iron_axe -scoreboard objectives add timber_g_axe minecraft.used:minecraft.golden_axe -scoreboard objectives add timber_d_axe minecraft.used:minecraft.diamond_axe -scoreboard objectives add timber_n_axe minecraft.used:minecraft.netherite_axe -scoreboard objectives add timber dummy -scoreboard objectives add TimberToggle trigger {"text":"Timber Toggle","color":"#724E21"} -scoreboard objectives add timber_disabled dummy -scoreboard objectives add timber_prsistent dummy - -# non-overriding default values -function timber:settings/default_values -function timber:tool/durability_max -scoreboard players set running timber 0 - -# start optional loops -execute if score plant_sapling timber matches 1.. run function timber:autoplant/loop -execute if score slow_chop timber matches 1.. run function timber:slow_chop/loop - -# check loottable compatibility of mushroom stem -setblock ~ 255 ~ minecraft:chest -setblock ~ 255 ~1 minecraft:mushroom_stem -loot insert ~ 255 ~ mine ~ 255 ~1 minecraft:diamond_axe -execute unless data block ~ 255 ~ Items[{id:"minecraft:knowledge_book",components:{"minecraft:custom_data":{Tags:["timber_location"]}}}] run tellraw @a[tag=!noTimberWarning] ["",{"text":"Timber Datapack Warning: ","color":"red"},{"text":"Incompatibility with the mushroom_stem loottable of another datapack!"}] -fill ~-1 255 ~-1 ~1 255 ~1 minecraft:air -execute store result score doTileDrops timber run gamerule doTileDrops -execute if score doTileDrops timber matches 0 run tellraw @a[tag=!noTimberWarning] ["",{"text":"Timber Datapack Warning: ","color":"red"},{"text":"This datapack only works when gamerule doTileDrops is set to true!"}] - -# Getting the game version and checking if it is compatible with the datapack https://minecraft.fandom.com/wiki/Data_version -execute store result score game_version timber run data get entity @r DataVersion -execute if score game_version timber matches ..3442 run tellraw @a[tag=!noTimberWarning] ["",{"text":"Timber Datapack Warning: ","color":"red"},{"text":"This datapack is not compatible with all the versions before 1.20!"}] - -# Checking if the server uses a different jar from the vanilla one -function timber:utils/check_server \ No newline at end of file diff --git a/18-41/data/timber/functions/main.mcfunction b/18-41/data/timber/functions/main.mcfunction deleted file mode 100644 index 02ef309..0000000 --- a/18-41/data/timber/functions/main.mcfunction +++ /dev/null @@ -1,11 +0,0 @@ -# loop (not in minecraft:tick in order to stop it after uninstall) -schedule function timber:main 1t - -# if any kind of axe is used -execute as @a[predicate=timber:used_axe,tag=!global.ignore] at @s run function timber:utils/check_max_command_chain_length - -# toggle timber datapack per player -execute as @a[scores={TimberToggle=1..},tag=!global.ignore] run function timber:settings/toggle/timber - -# reset -scoreboard players enable @a TimberToggle \ No newline at end of file diff --git a/18-41/data/timber/functions/run.mcfunction b/18-41/data/timber/functions/run.mcfunction deleted file mode 100644 index 23149f8..0000000 --- a/18-41/data/timber/functions/run.mcfunction +++ /dev/null @@ -1,46 +0,0 @@ -# reset -scoreboard players set leaves_found timber 0 -scoreboard players set tree_size timber 0 -scoreboard players set tree_type timber 0 - -# load settings to other scoreboard (leaves persistent) -execute unless score persistent timber matches 1.. run scoreboard players set @s timber_prsistent 0 -execute if score persistent timber matches 1.. run scoreboard players set @s timber_prsistent 1 - -# search last broken item (place of tree) and set a marker (limit=1 removed, because carpet on log breaks this) -execute at @e[type=minecraft:item,distance=..7,nbt={Age:0s}] run summon marker ~ ~ ~ {Tags:["timber_tree","global.ignore"]} - -# Enchantments randomizer -scoreboard players set unbreaking timber 0 -execute if entity @s[nbt={SelectedItem:{components:{"minecraft:enchantments":{levels:{"minecraft:unbreaking": 1}}}}}] run scoreboard players set unbreaking timber 1 -execute if entity @s[nbt={SelectedItem:{components:{"minecraft:enchantments":{levels:{"minecraft:unbreaking": 2}}}}}] run scoreboard players set unbreaking timber 2 -execute if entity @s[nbt={SelectedItem:{components:{"minecraft:enchantments":{levels:{"minecraft:unbreaking": 3}}}}}] run scoreboard players set unbreaking timber 3 - -# get durability -function timber:tool/durability_get - -# scan through tree - # tree (limit=1,sort=arbitrary removed, because carpet on log breaks this) - execute if score chop_trees timber matches 1.. at @e[type=minecraft:marker,tag=timber_tree,tag=!timber_slow_chop,distance=..7] run function timber:algorithm/tree/run - execute store result score leaves_found timber if entity @e[type=minecraft:marker,tag=timber_leaves_found] - # if tree is valid - execute if score leaves_found timber >= min_leaves_found timber unless score tree_size timber matches 0 run scoreboard players set tree_type timber 1 - - # fungi (only if not tree already) - execute if score tree_type timber matches 0 if score chop_fungi timber matches 1.. run function timber:run_fungi - -# if tree or fungi is valid (tree = 1 | fungus = 2) -execute unless score tree_type timber matches 0 if score tree_size timber <= max_tree_size timber run function timber:validated - -# remove markers -execute if score chop_fungi timber matches 1.. run kill @e[type=minecraft:item,nbt={Item:{components:{"minecraft:custom_data":{Tags:["timber_location"]}}}}] -execute if score chop_fungi timber matches 1.. run clear @s knowledge_book[minecraft:custom_data={Tags:["timber_location"]}] -kill @e[type=minecraft:marker,tag=timber_tree,tag=!timber_slow_chop] -kill @e[type=minecraft:marker,tag=timber_log,tag=!timber_destroy] -kill @e[type=minecraft:marker,tag=timber_leaf,tag=!timber_destroy] -kill @e[type=minecraft:marker,tag=timber_root,tag=!timber_destroy] -kill @e[type=minecraft:marker,tag=timber_stem,tag=!timber_destroy] -kill @e[type=minecraft:marker,tag=timber_cap,tag=!timber_destroy] -kill @e[type=minecraft:marker,tag=timber_leaves_found] -kill @e[type=minecraft:marker,tag=timber_leaf_distance] -kill @e[type=minecraft:marker,tag=timber_other_stem] \ No newline at end of file diff --git a/18-41/data/timber/functions/run_fungi.mcfunction b/18-41/data/timber/functions/run_fungi.mcfunction deleted file mode 100644 index ff8a737..0000000 --- a/18-41/data/timber/functions/run_fungi.mcfunction +++ /dev/null @@ -1,18 +0,0 @@ -# reset -scoreboard players set tree_size timber 0 -kill @e[type=minecraft:marker,tag=timber_leaves_found] -kill @e[type=minecraft:marker,tag=timber_log,tag=!timber_destroy] -kill @e[type=minecraft:marker,tag=timber_leaf,tag=!timber_destroy] - -# get durability -function timber:tool/durability_get - -# fungi -execute at @e[type=minecraft:marker,tag=timber_tree,tag=!timber_slow_chop,distance=..7,sort=arbitrary,limit=1] run function timber:algorithm/fungus/run -execute store result score leaves_found timber if entity @e[type=minecraft:marker,tag=timber_leaves_found] -# if fungi is valid -execute if score leaves_found timber >= min_leaves_found timber unless score tree_size timber matches 0 run scoreboard players set tree_type timber 2 - -# don't destroy the blocks in a radius of 5 blocks from other stems -execute if score tree_type timber matches 2 run function timber:algorithm/fungus/leaves/find_other_stems -execute if score tree_type timber matches 2 at @e[type=minecraft:marker,tag=timber_other_stem] run kill @e[type=minecraft:marker,tag=timber_cap,distance=..5] \ No newline at end of file diff --git a/18-41/data/timber/functions/settings/default_values.mcfunction b/18-41/data/timber/functions/settings/default_values.mcfunction deleted file mode 100644 index 8800ffc..0000000 --- a/18-41/data/timber/functions/settings/default_values.mcfunction +++ /dev/null @@ -1,28 +0,0 @@ -# non-overriding default values -execute unless score standing timber = standing timber run scoreboard players set standing timber 1 -execute unless score sneaking timber = sneaking timber run scoreboard players set sneaking timber 0 -execute unless score destroy_leaves timber = destroy_leaves timber run scoreboard players set destroy_leaves timber 1 -execute unless score plant_sapling timber = plant_sapling timber run scoreboard players set plant_sapling timber 0 -execute unless score destroy_roots timber = destroy_roots timber run scoreboard players set destroy_roots timber 1 -execute unless score start_chop_on_root timber = start_chop_on_root timber run scoreboard players set start_chop_on_root timber 1 -execute unless score slow_chop timber = slow_chop timber run scoreboard players set slow_chop timber 0 -execute unless score chop_down timber = chop_down timber run scoreboard players set chop_down timber 0 -execute unless score stop_chopping timber = stop_chopping timber run scoreboard players set stop_chopping timber 0 -execute unless score wear_out timber = wear_out timber run scoreboard players set wear_out timber 1 -execute unless score drop_loot timber = drop_loot timber run scoreboard players set drop_loot timber 0 -execute unless score hunger timber = hunger timber run scoreboard players set hunger timber 0 -execute unless score stopsound timber = stopsound timber run scoreboard players set stopsound timber 0 - -execute unless score wooden_axe timber = wooden_axe timber run scoreboard players set wooden_axe timber 1 -execute unless score stone_axe timber = stone_axe timber run scoreboard players set stone_axe timber 1 -execute unless score iron_axe timber = iron_axe timber run scoreboard players set iron_axe timber 1 -execute unless score golden_axe timber = golden_axe timber run scoreboard players set golden_axe timber 1 -execute unless score diamond_axe timber = diamond_axe timber run scoreboard players set diamond_axe timber 1 -execute unless score netherite_axe timber = netherite_axe timber run scoreboard players set netherite_axe timber 1 -execute unless score chop_trees timber = chop_trees timber run scoreboard players set chop_trees timber 1 -execute unless score chop_fungi timber = chop_fungi timber run scoreboard players set chop_fungi timber 0 -execute unless score persistent timber = persistent timber run scoreboard players set persistent timber 0 -execute unless score blocks_per_chop timber = blocks_per_chop timber run scoreboard players set blocks_per_chop timber 1 -execute unless score time_between_chops timber = time_between_chops timber run scoreboard players set time_between_chops timber 1 -execute unless score max_tree_size timber = max_tree_size timber run scoreboard players set max_tree_size timber 555 -execute unless score min_leaves_found timber = min_leaves_found timber run scoreboard players set min_leaves_found timber 5 diff --git a/18-41/data/timber/functions/settings/end_of_message.mcfunction b/18-41/data/timber/functions/settings/end_of_message.mcfunction deleted file mode 100644 index 1d5e211..0000000 --- a/18-41/data/timber/functions/settings/end_of_message.mcfunction +++ /dev/null @@ -1,3 +0,0 @@ -execute store result score sendCommandFeedback timber run gamerule sendCommandFeedback -execute if score sendCommandFeedback timber matches 1 run schedule function timber:settings/reset_gamerule 1t -gamerule sendCommandFeedback false \ No newline at end of file diff --git a/18-41/data/timber/functions/settings/reset_gamerule.mcfunction b/18-41/data/timber/functions/settings/reset_gamerule.mcfunction deleted file mode 100644 index b466492..0000000 --- a/18-41/data/timber/functions/settings/reset_gamerule.mcfunction +++ /dev/null @@ -1 +0,0 @@ -gamerule sendCommandFeedback true \ No newline at end of file diff --git a/18-41/data/timber/functions/settings/settings.mcfunction b/18-41/data/timber/functions/settings/settings.mcfunction deleted file mode 100644 index 42d2588..0000000 --- a/18-41/data/timber/functions/settings/settings.mcfunction +++ /dev/null @@ -1 +0,0 @@ -function timber:settings/settings1 \ No newline at end of file diff --git a/18-41/data/timber/functions/settings/settings1.mcfunction b/18-41/data/timber/functions/settings/settings1.mcfunction deleted file mode 100644 index 140256c..0000000 --- a/18-41/data/timber/functions/settings/settings1.mcfunction +++ /dev/null @@ -1,57 +0,0 @@ -tellraw @s ["",{"text":" "}] -tellraw @s ["",{"text":" "}] -tellraw @s ["",{"text":" "}] -tellraw @s ["",{"text":" "}] - -tellraw @s ["",{"text":"\u00A7m ","color":"dark_gray"}] - -tellraw @s ["",{"text":" Timber "},{"text":"/","color":"gray"},{"text":" Global Settings "},{"text":" < ","clickEvent":{"action":"run_command","value":"/function timber:settings/settings1_click"}},{"text":"1/2"},{"text":" > ","clickEvent":{"action":"run_command","value":"/function timber:settings/settings2_click"}}] - -tellraw @s ["",{"text":"\u00A7m ","color":"dark_gray"}] - -execute if score standing timber matches 1.. run tellraw @s ["",{"text":"[ ✔ ]","color":"green","clickEvent":{"action":"run_command","value":"/function timber:settings/toggle/standing"}},{"text":" Works When Standing"}] -execute unless score standing timber matches 1.. run tellraw @s ["",{"text":"[ ❌ ]","color":"red","clickEvent":{"action":"run_command","value":"/function timber:settings/toggle/standing"}},{"text":" Works When Standing"}] - -execute if score sneaking timber matches 1.. run tellraw @s ["",{"text":"[ ✔ ]","color":"green","clickEvent":{"action":"run_command","value":"/function timber:settings/toggle/sneaking"}},{"text":" Works When Sneaking"}] -execute unless score sneaking timber matches 1.. run tellraw @s ["",{"text":"[ ❌ ]","color":"red","clickEvent":{"action":"run_command","value":"/function timber:settings/toggle/sneaking"}},{"text":" Works When Sneaking"}] - -execute if score destroy_leaves timber matches 1.. run tellraw @s ["",{"text":"[ ✔ ]","color":"green","clickEvent":{"action":"run_command","value":"/function timber:settings/toggle/destroy_leaves"}},{"text":" Destroy Leaves"}] -execute unless score destroy_leaves timber matches 1.. run tellraw @s ["",{"text":"[ ❌ ]","color":"red","clickEvent":{"action":"run_command","value":"/function timber:settings/toggle/destroy_leaves"}},{"text":" Destroy Leaves"}] - -execute if score plant_sapling timber matches 1.. run tellraw @s ["",{"text":"[ ✔ ]","color":"green","clickEvent":{"action":"run_command","value":"/function timber:settings/toggle/plant_sapling"}},{"text":" Auto Plant Saplings","hoverEvent":{"action":"show_text","value":["",{"text":"All kind of saplings laying on the ground will get planted every 2 seconds."},{"text":"\n\nWhen a sapling get placed on mud, it turns into muddy mangrove roots for a fraction of a second due to datapack limitations.","color":"gray"}]}}] -execute unless score plant_sapling timber matches 1.. run tellraw @s ["",{"text":"[ ❌ ]","color":"red","clickEvent":{"action":"run_command","value":"/function timber:settings/toggle/plant_sapling"}},{"text":" Auto Plant Saplings","hoverEvent":{"action":"show_text","value":["",{"text":"All kind of saplings laying on the ground will get planted every 2 seconds."},{"text":"\n\nWhen a sapling get placed on mud, it turns into muddy mangrove roots for a fraction of a second due to datapack limitations.","color":"gray"}]}}] - -execute if score destroy_roots timber matches 1.. run tellraw @s ["",{"text":"[ ✔ ]","color":"green","clickEvent":{"action":"run_command","value":"/function timber:settings/toggle/destroy_roots"}},{"text":" Destroy Roots","hoverEvent":{"action":"show_text","value":["",{"text":"Only root blocks which are not in the ground count."}]}}] -execute unless score destroy_roots timber matches 1.. run tellraw @s ["",{"text":"[ ❌ ]","color":"red","clickEvent":{"action":"run_command","value":"/function timber:settings/toggle/destroy_roots"}},{"text":" Destroy Roots","hoverEvent":{"action":"show_text","value":["",{"text":"Only root blocks which are not in the ground count."}]}}] - -execute if score start_chop_on_root timber matches 1.. run tellraw @s ["",{"text":"[ ✔ ]","color":"green","clickEvent":{"action":"run_command","value":"/function timber:settings/toggle/start_chop_on_root"}},{"text":" Chop Tree When Roots Get Destroyed","hoverEvent":{"action":"show_text","value":["",{"text":"The datapack will chop the tree if you break its root blocks.\nOnly root blocks which are not in the ground count."}]}}] -execute unless score start_chop_on_root timber matches 1.. run tellraw @s ["",{"text":"[ ❌ ]","color":"red","clickEvent":{"action":"run_command","value":"/function timber:settings/toggle/start_chop_on_root"}},{"text":" Chop Tree When Roots Get Destroyed","hoverEvent":{"action":"show_text","value":["",{"text":"The datapack will chop the tree if you break its root blocks.\nOnly root blocks which are not in the ground count."}]}}] - -execute if score slow_chop timber matches 1.. run tellraw @s ["",{"text":"[ ✔ ]","color":"green","clickEvent":{"action":"run_command","value":"/function timber:settings/toggle/slow_chop"}},{"text":" Chop Slowly","hoverEvent":{"action":"show_text","value":["",{"text":"The tree won't be chopped instantly anymore. Additional options to change the speed of the chopping process can be changed at the next page."},{"text":"\n\nThis option can increase performance.","color":"gray"}]}}] -execute unless score slow_chop timber matches 1.. unless score drop_loot timber matches 1.. run tellraw @s ["",{"text":"[ ❌ ]","color":"red","clickEvent":{"action":"run_command","value":"/function timber:settings/toggle/slow_chop"}},{"text":" Chop Slowly","hoverEvent":{"action":"show_text","value":["",{"text":"The tree won't be chopped instantly anymore. Additional options to change the speed of the chopping process can be changed at the next page."},{"text":"\n\nThis option can increase performance.","color":"gray"}]}}] -execute unless score slow_chop timber matches 1.. if score drop_loot timber matches 1.. run tellraw @s ["",{"text":"[ ❌ ]","color":"#7F2B2B","hoverEvent":{"action":"show_text","value":"Can't be enabled when \"Drop Loot Straight into Inventory\" is enabled."}},{"text":" Chop Slowly","hoverEvent":{"action":"show_text","value":["",{"text":"The tree won't be chopped instantly anymore. Additional options to change the speed of the chopping process can be changed at the next page."},{"text":"\n\nThis option can increase performance.","color":"gray"}]}}] - -execute if score chop_down timber matches 1.. run tellraw @s ["",{"text":"[ ✔ ]","color":"green","clickEvent":{"action":"run_command","value":"/function timber:settings/toggle/chop_down"}},{"text":" Enable Chopping Down","hoverEvent":{"action":"show_text","value":"Normally when you cut a tree in the middle only the top part of the tree gets destroyed. But if this option is enabled the bottom part will get destroyed as well."}}] -execute unless score chop_down timber matches 1.. run tellraw @s ["",{"text":"[ ❌ ]","color":"red","clickEvent":{"action":"run_command","value":"/function timber:settings/toggle/chop_down"}},{"text":" Enable Chopping Down","hoverEvent":{"action":"show_text","value":"Normally when you cut a tree in the middle only the top part of the tree gets destroyed. But if this option is enabled the bottom part will get destroyed as well."}}] - -execute if score stop_chopping timber matches 1.. run tellraw @s ["",{"text":"[ ✔ ]","color":"green","clickEvent":{"action":"run_command","value":"/function timber:settings/toggle/stop_chopping"}},{"text":" Stop Chopping Once Axe Breaks","hoverEvent":{"action":"show_text","value":"Stops the process of chopping the tree as soon as your axe doesn't have any durability left for the whole tree. When disabled, the tree will always be chopped finish."}}] -execute unless score stop_chopping timber matches 1.. if score wear_out timber matches 1.. run tellraw @s ["",{"text":"[ ❌ ]","color":"red","clickEvent":{"action":"run_command","value":"/function timber:settings/toggle/stop_chopping"}},{"text":" Stop Chopping Once Axe Breaks","hoverEvent":{"action":"show_text","value":"Stops the process of chopping the tree as soon as your axe doesn't have any durability left for the whole tree. When disabled, the tree will always be chopped finish."}}] -execute unless score stop_chopping timber matches 1.. unless score wear_out timber matches 1.. run tellraw @s ["",{"text":"[ ❌ ]","color":"#7F2B2B","hoverEvent":{"action":"show_text","value":"Can't be enabled when \"Additionally Wear out Tool Depending on Tree Size\" is disabled."}},{"text":" Stop Chopping Once Axe Breaks","hoverEvent":{"action":"show_text","value":"Stops the process of chopping the tree as soon as your axe doesn't have any durability left for the whole tree. When disabled, the tree will always be chopped finish."}}] - -execute if score wear_out timber matches 1.. unless score stop_chopping timber matches 1.. run tellraw @s ["",{"text":"[ ✔ ]","color":"green","clickEvent":{"action":"run_command","value":"/function timber:settings/toggle/wear_out"}},{"text":" Additionally Wear out Tool Depending on Tree Size","hoverEvent":{"action":"show_text","value":"The tool's durability will get decreased by the amount of destroyed logs (or stems). When disabled, only one durability gets deducted."}}] -execute unless score wear_out timber matches 1.. run tellraw @s ["",{"text":"[ ❌ ]","color":"red","clickEvent":{"action":"run_command","value":"/function timber:settings/toggle/wear_out"}},{"text":" Additionally Wear out Tool Depending on Tree Size","hoverEvent":{"action":"show_text","value":"The tool's durability will get decreased by the amount of destroyed logs (or stems). When disabled, only one durability gets deducted."}}] -execute if score wear_out timber matches 1.. if score stop_chopping timber matches 1.. run tellraw @s ["",{"text":"[ ✔ ]","color":"#2B7F2B","hoverEvent":{"action":"show_text","value":"Can't be disabled when \"Stop Chopping Once Axe Breaks\" is enabled."}},{"text":" Additionally Wear out Tool Depending on Tree Size","hoverEvent":{"action":"show_text","value":"The tool's durability will get decreased by the amount of destroyed logs (or stems). When disabled, only one durability gets deducted."}}] - -execute if score drop_loot timber matches 1.. run tellraw @s ["",{"text":"[ ✔ ]","color":"green","clickEvent":{"action":"run_command","value":"/function timber:settings/toggle/drop_loot"}},{"text":" Drop Loot Straight into Inventory","hoverEvent":{"action":"show_text","value":["",{"text":"Lets the dropped items of the tree teleport straight into your own inventory. As soon as you have a full inventory the loot gets dropped on the ground."},{"text":"\n\nThis option can increase performance.","color":"gray"}]}}] -execute unless score drop_loot timber matches 1.. unless score slow_chop timber matches 1.. run tellraw @s ["",{"text":"[ ❌ ]","color":"red","clickEvent":{"action":"run_command","value":"/function timber:settings/toggle/drop_loot"}},{"text":" Drop Loot Straight into Inventory","hoverEvent":{"action":"show_text","value":["",{"text":"Lets the dropped items of the tree teleport straight into your own inventory. As soon as you have a full inventory the loot gets dropped on the ground."},{"text":"\n\nThis option can increase performance.","color":"gray"}]}}] -execute unless score drop_loot timber matches 1.. if score slow_chop timber matches 1.. run tellraw @s ["",{"text":"[ ❌ ]","color":"#7F2B2B","hoverEvent":{"action":"show_text","value":"Can't be enabled when \"Chop Slowly\" is enabled."}},{"text":" Drop Loot Straight into Inventory","hoverEvent":{"action":"show_text","value":["",{"text":"Lets the dropped items of the tree teleport straight into your own inventory. As soon as you have a full inventory the loot gets dropped on the ground."},{"text":"\n\nThis option can increase performance.","color":"gray"}]}}] - -execute if score hunger timber matches 1.. run tellraw @s ["",{"text":"[ ✔ ]","color":"green","clickEvent":{"action":"run_command","value":"/function timber:settings/toggle/hunger"}},{"text":" Give Additional Hunger Effect","hoverEvent":{"action":"show_text","value":"Gives a hunger effect for 1 second with the same level as the size of the chopped tree."}}] -execute unless score hunger timber matches 1.. run tellraw @s ["",{"text":"[ ❌ ]","color":"red","clickEvent":{"action":"run_command","value":"/function timber:settings/toggle/hunger"}},{"text":" Give Additional Hunger Effect","hoverEvent":{"action":"show_text","value":"Gives a hunger effect for 1 second with the same level as the size of the chopped tree."}}] - -execute if score stopsound timber matches 1.. run tellraw @s ["",{"text":"[ ✔ ]","color":"green","clickEvent":{"action":"run_command","value":"/function timber:settings/toggle/stopsound"}},{"text":" Stop Loud Breaking Noises","hoverEvent":{"action":"show_text","value":["",{"text":"Suppresses loud breaking noises when chopping a tree."},{"text":"\n\nThis option is","color":"gray"},{"text":" experimental","color":"dark_red"},{"text":" because sometimes it still sounds loud for a fraction of a second.","color":"gray"}]}}] -execute unless score stopsound timber matches 1.. run tellraw @s ["",{"text":"[ ❌ ]","color":"red","clickEvent":{"action":"run_command","value":"/function timber:settings/toggle/stopsound"}},{"text":" Stop Loud Breaking Noises","hoverEvent":{"action":"show_text","value":["",{"text":"Suppresses loud breaking noises when chopping a tree."},{"text":"\n\nThis option is","color":"gray"},{"text":" experimental","color":"dark_red"},{"text":" because sometimes it still sounds loud for a fraction of a second.","color":"gray"}]}}] - -tellraw @s ["",{"text":"\u00A7m ","color":"dark_gray"}] - -function timber:settings/end_of_message \ No newline at end of file diff --git a/18-41/data/timber/functions/settings/settings1_click.mcfunction b/18-41/data/timber/functions/settings/settings1_click.mcfunction deleted file mode 100644 index 64625b3..0000000 --- a/18-41/data/timber/functions/settings/settings1_click.mcfunction +++ /dev/null @@ -1,2 +0,0 @@ -function timber:settings/settings -playsound minecraft:ui.button.click master @s ~ ~ ~ .2 1.6 .2 \ No newline at end of file diff --git a/18-41/data/timber/functions/settings/settings2.mcfunction b/18-41/data/timber/functions/settings/settings2.mcfunction deleted file mode 100644 index 6f1a745..0000000 --- a/18-41/data/timber/functions/settings/settings2.mcfunction +++ /dev/null @@ -1,55 +0,0 @@ -tellraw @s ["",{"text":" "}] -tellraw @s ["",{"text":" "}] -tellraw @s ["",{"text":" "}] -tellraw @s ["",{"text":" "}] - -tellraw @s ["",{"text":"\u00A7m ","color":"dark_gray"}] - -tellraw @s ["",{"text":" Timber "},{"text":"/","color":"gray"},{"text":" Global Settings "},{"text":" < ","clickEvent":{"action":"run_command","value":"/function timber:settings/settings1_click"}},{"text":"2/2"},{"text":" > ","clickEvent":{"action":"run_command","value":"/function timber:settings/settings2_click"}}] - -tellraw @s ["",{"text":"\u00A7m ","color":"dark_gray"}] - -execute if score wooden_axe timber matches 1.. run tellraw @s ["",{"text":"[ ✔ ]","color":"green","clickEvent":{"action":"run_command","value":"/function timber:settings/toggle/wooden_axe"}},{"text":" Enable Wooden Axe"}] -execute unless score wooden_axe timber matches 1.. run tellraw @s ["",{"text":"[ ❌ ]","color":"red","clickEvent":{"action":"run_command","value":"/function timber:settings/toggle/wooden_axe"}},{"text":" Enable Wooden Axe"}] - -execute if score stone_axe timber matches 1.. run tellraw @s ["",{"text":"[ ✔ ]","color":"green","clickEvent":{"action":"run_command","value":"/function timber:settings/toggle/stone_axe"}},{"text":" Enable Stone Axe"}] -execute unless score stone_axe timber matches 1.. run tellraw @s ["",{"text":"[ ❌ ]","color":"red","clickEvent":{"action":"run_command","value":"/function timber:settings/toggle/stone_axe"}},{"text":" Enable Stone Axe"}] - -execute if score iron_axe timber matches 1.. run tellraw @s ["",{"text":"[ ✔ ]","color":"green","clickEvent":{"action":"run_command","value":"/function timber:settings/toggle/iron_axe"}},{"text":" Enable Iron Axe"}] -execute unless score iron_axe timber matches 1.. run tellraw @s ["",{"text":"[ ❌ ]","color":"red","clickEvent":{"action":"run_command","value":"/function timber:settings/toggle/iron_axe"}},{"text":" Enable Iron Axe"}] - -execute if score golden_axe timber matches 1.. run tellraw @s ["",{"text":"[ ✔ ]","color":"green","clickEvent":{"action":"run_command","value":"/function timber:settings/toggle/golden_axe"}},{"text":" Enable Golden Axe"}] -execute unless score golden_axe timber matches 1.. run tellraw @s ["",{"text":"[ ❌ ]","color":"red","clickEvent":{"action":"run_command","value":"/function timber:settings/toggle/golden_axe"}},{"text":" Enable Golden Axe"}] - -execute if score diamond_axe timber matches 1.. run tellraw @s ["",{"text":"[ ✔ ]","color":"green","clickEvent":{"action":"run_command","value":"/function timber:settings/toggle/diamond_axe"}},{"text":" Enable Diamond Axe"}] -execute unless score diamond_axe timber matches 1.. run tellraw @s ["",{"text":"[ ❌ ]","color":"red","clickEvent":{"action":"run_command","value":"/function timber:settings/toggle/diamond_axe"}},{"text":" Enable Diamond Axe"}] - -execute if score netherite_axe timber matches 1.. run tellraw @s ["",{"text":"[ ✔ ]","color":"green","clickEvent":{"action":"run_command","value":"/function timber:settings/toggle/netherite_axe"}},{"text":" Enable Netherite Axe"}] -execute unless score netherite_axe timber matches 1.. run tellraw @s ["",{"text":"[ ❌ ]","color":"red","clickEvent":{"action":"run_command","value":"/function timber:settings/toggle/netherite_axe"}},{"text":" Enable Netherite Axe"}] - -execute if score chop_trees timber matches 1.. run tellraw @s ["",{"text":"[ ✔ ]","color":"green","clickEvent":{"action":"run_command","value":"/function timber:settings/toggle/chop_trees"}},{"text":" Chop Trees","hoverEvent":{"action":"show_text","value":"All kind of trees will get chopped."}}] -execute unless score chop_trees timber matches 1.. run tellraw @s ["",{"text":"[ ❌ ]","color":"red","clickEvent":{"action":"run_command","value":"/function timber:settings/toggle/chop_trees"}},{"text":" Chop Trees","hoverEvent":{"action":"show_text","value":"All kind of trees will get chopped."}}] - -execute if score chop_fungi timber matches 1.. run tellraw @s ["",{"text":"[ ✔ ]","color":"green","clickEvent":{"action":"run_command","value":"/function timber:settings/toggle/chop_fungi"}},{"text":" Chop Fungi","hoverEvent":{"action":"show_text","value":["",{"text":"Huge fungi (nether trees) as well as huge mushrooms will get chopped."},{"text":"\n\nUse it on your own risk!\nWhen enabled, this datapack can't differentiate between generated fungi and player-placed fungi and therefore can potentially destroy your buildings.","color":"dark_red"}]}}] -execute unless score chop_fungi timber matches 1.. run tellraw @s ["",{"text":"[ ❌ ]","color":"red","clickEvent":{"action":"run_command","value":"/function timber:settings/toggle/chop_fungi"}},{"text":" Chop Fungi","hoverEvent":{"action":"show_text","value":["",{"text":"Huge fungi (nether trees) as well as huge mushrooms will get chopped."},{"text":"\n\nUse it on your own risk!\nWhen enabled, this datapack can't differentiate between generated fungi and player-placed fungi and therefore can potentially destroy your buildings.","color":"dark_red"}]}}] - -execute if score persistent timber matches 1.. run tellraw @s ["",{"text":"[ ✔ ]","color":"green","clickEvent":{"action":"run_command","value":"/function timber:settings/toggle/persistent"}},{"text":" Destroy Player-Placed Trees","hoverEvent":{"action":"show_text","value":["",{"text":"Player-placed trees are trees made out of player-placed leaves (Look at leaf block with F3 debug screen: persistent = true)."},{"text":"\n\nUse it on your own risk!\nWhen enabled, this datapack can't differentiate between generated trees and player-placed trees anymore and therefore can potentially destroy your buildings.","color":"dark_red"}]}}] -execute unless score persistent timber matches 1.. run tellraw @s ["",{"text":"[ ❌ ]","color":"red","clickEvent":{"action":"run_command","value":"/function timber:settings/toggle/persistent"}},{"text":" Destroy Player-Placed Trees","hoverEvent":{"action":"show_text","value":["",{"text":"Player-placed trees are trees made out of player-placed leaves (Look at leaf block with F3 debug screen: persistent = true)."},{"text":"\n\nUse it on your own risk!\nWhen enabled, this datapack can't differentiate between generated trees and player-placed trees anymore and therefore can potentially destroy your buildings.","color":"dark_red"}]}}] - -execute if score blocks_per_chop timber matches 1 if score slow_chop timber matches 1.. run tellraw @s ["",{"text":"[ ✎ ]","color":"gray","clickEvent":{"action":"suggest_command","value":"/scoreboard players set blocks_per_chop timber "},"hoverEvent":{"action":"show_text","value":"Default: 1"}},{"text":" Set Amount of Destroyed Blocks per Chop"},{"text":" (Current: ","color":"gray"},{"score":{"name":"blocks_per_chop","objective":"timber"},"color":"gray"},{"text": ")","color":"gray"}] -execute unless score blocks_per_chop timber matches 1 if score slow_chop timber matches 1.. run tellraw @s ["",{"text":"[ ✎ ]","color":"gray","clickEvent":{"action":"suggest_command","value":"/scoreboard players set blocks_per_chop timber "},"hoverEvent":{"action":"show_text","value":"Default: 1"}},{"text":" Set Amount of Destroyed Blocks per Chop"},{"text":" (Current: ","color":"gray"},{"score":{"name":"blocks_per_chop","objective":"timber"},"color":"gray"},{"text": ")","color":"gray"}] -execute unless score slow_chop timber matches 1.. run tellraw @s ["",{"text":"[ ✎ ]","color":"dark_gray","hoverEvent":{"action":"show_text","value":"Not active when \"Chop Slowly\" is disabled."}},{"text":" Set Amount of Destroyed Blocks per Chop"}] - -execute if score time_between_chops timber matches 1 if score slow_chop timber matches 1.. run tellraw @s ["",{"text":"[ ✎ ]","color":"gray","clickEvent":{"action":"suggest_command","value":"/scoreboard players set time_between_chops timber "},"hoverEvent":{"action":"show_text","value":"Default: 1"}},{"text":" Set Time in Ticks Between Chops"},{"text":" (Current: ","color":"gray"},{"score":{"name":"time_between_chops","objective":"timber"},"color":"gray"},{"text": ")","color":"gray"}] -execute unless score time_between_chops timber matches 1 if score slow_chop timber matches 1.. run tellraw @s ["",{"text":"[ ✎ ]","color":"gray","clickEvent":{"action":"suggest_command","value":"/scoreboard players set time_between_chops timber "},"hoverEvent":{"action":"show_text","value":"Default: 1"}},{"text":" Set Time in Ticks Between Chops"},{"text":" (Current: ","color":"gray"},{"score":{"name":"time_between_chops","objective":"timber"},"color":"gray"},{"text": ")","color":"gray"}] -execute unless score slow_chop timber matches 1.. run tellraw @s ["",{"text":"[ ✎ ]","color":"dark_gray","hoverEvent":{"action":"show_text","value":"Not active when \"Chop Slowly\" is disabled."}},{"text":" Set Time in Ticks Between Chops"}] - -execute if score max_tree_size timber matches 555 run tellraw @s ["",{"text":"[ ✎ ]","color":"gray","clickEvent":{"action":"suggest_command","value":"/scoreboard players set max_tree_size timber "},"hoverEvent":{"action":"show_text","value":"Default: 555"}},{"text":" Set Max. Tree Size","hoverEvent":{"action":"show_text","value":"Trees bigger than this set value won't get further processed."}},{"text":" (Currently: ","color":"gray"},{"score":{"name":"max_tree_size","objective":"timber"},"color":"gray"},{"text": ")","color":"gray"}] -execute unless score max_tree_size timber matches 555 run tellraw @s ["",{"text":"[ ✎ ]","color":"gray","clickEvent":{"action":"suggest_command","value":"/scoreboard players set max_tree_size timber "},"hoverEvent":{"action":"show_text","value":"Default: 555"}},{"text":" Set Max. Tree Size","hoverEvent":{"action":"show_text","value":"Trees bigger than this set value won't get further processed."}},{"text":" (Currently: ","color":"gray"},{"score":{"name":"max_tree_size","objective":"timber"},"color":"gray"},{"text": ")","color":"gray"}] - -execute if score min_leaves_found timber matches 5 run tellraw @s ["",{"text":"[ ✎ ]","color":"gray","clickEvent":{"action":"suggest_command","value":"/scoreboard players set min_leaves_found timber "},"hoverEvent":{"action":"show_text","value":"Default: 5"}},{"text":" Set Min. Leaves to Valid a Tree","hoverEvent":{"action":"show_text","value":"This datapack considers a tree only if it has this set value amount of naturally generated leaves at its trunk.\nFungi will get checked by the amount of cap blocks and additionally a 3×3 big cross on top of the stem."}},{"text":" (Current: ","color":"gray"},{"score":{"name":"min_leaves_found","objective":"timber"},"color":"gray"},{"text": ")","color":"gray"}] -execute unless score min_leaves_found timber matches 5 run tellraw @s ["",{"text":"[ ✎ ]","color":"gray","clickEvent":{"action":"suggest_command","value":"/scoreboard players set min_leaves_found timber "},"hoverEvent":{"action":"show_text","value":"Default: 5"}},{"text":" Set Min. Leaves to Valid a Tree","hoverEvent":{"action":"show_text","value":"This datapack considers a tree only if it has this set value amount of naturally generated leaves at its trunk.\nFungi will get checked by the amount of cap blocks and additionally a 3×3 big cross on top of the stem."}},{"text":" (Current: ","color":"gray"},{"score":{"name":"min_leaves_found","objective":"timber"},"color":"gray"},{"text": ")","color":"gray"}] - -tellraw @s ["",{"text":"\u00A7m ","color":"dark_gray"}] - -function timber:settings/end_of_message \ No newline at end of file diff --git a/18-41/data/timber/functions/settings/settings2_click.mcfunction b/18-41/data/timber/functions/settings/settings2_click.mcfunction deleted file mode 100644 index 44b2ce4..0000000 --- a/18-41/data/timber/functions/settings/settings2_click.mcfunction +++ /dev/null @@ -1,2 +0,0 @@ -function timber:settings/settings2 -playsound minecraft:ui.button.click master @s ~ ~ ~ .2 1.6 .2 \ No newline at end of file diff --git a/18-41/data/timber/functions/settings/toggle/chop_down.mcfunction b/18-41/data/timber/functions/settings/toggle/chop_down.mcfunction deleted file mode 100644 index e601c0c..0000000 --- a/18-41/data/timber/functions/settings/toggle/chop_down.mcfunction +++ /dev/null @@ -1,7 +0,0 @@ -execute if score chop_down timber matches 1.. run scoreboard players set chop_down timber 2 -execute unless score chop_down timber matches 1.. run scoreboard players set chop_down timber 1 -execute if score chop_down timber matches 2.. run scoreboard players set chop_down timber 0 -execute if score chop_down timber matches 1 run playsound minecraft:ui.button.click master @s ~ ~ ~ .2 1.9 .2 -execute if score chop_down timber matches 0 run playsound minecraft:ui.button.click master @s ~ ~ ~ .2 1.3 .2 -function timber:settings/settings -function timber:settings/end_of_message \ No newline at end of file diff --git a/18-41/data/timber/functions/settings/toggle/chop_fungi.mcfunction b/18-41/data/timber/functions/settings/toggle/chop_fungi.mcfunction deleted file mode 100644 index 22614b8..0000000 --- a/18-41/data/timber/functions/settings/toggle/chop_fungi.mcfunction +++ /dev/null @@ -1,7 +0,0 @@ -execute if score chop_fungi timber matches 1.. run scoreboard players set chop_fungi timber 2 -execute unless score chop_fungi timber matches 1.. run scoreboard players set chop_fungi timber 1 -execute if score chop_fungi timber matches 2.. run scoreboard players set chop_fungi timber 0 -execute if score chop_fungi timber matches 1 run playsound minecraft:ui.button.click master @s ~ ~ ~ .2 1.9 .2 -execute if score chop_fungi timber matches 0 run playsound minecraft:ui.button.click master @s ~ ~ ~ .2 1.3 .2 -function timber:settings/settings2 -function timber:settings/end_of_message \ No newline at end of file diff --git a/18-41/data/timber/functions/settings/toggle/chop_trees.mcfunction b/18-41/data/timber/functions/settings/toggle/chop_trees.mcfunction deleted file mode 100644 index 19fe627..0000000 --- a/18-41/data/timber/functions/settings/toggle/chop_trees.mcfunction +++ /dev/null @@ -1,7 +0,0 @@ -execute if score chop_trees timber matches 1.. run scoreboard players set chop_trees timber 2 -execute unless score chop_trees timber matches 1.. run scoreboard players set chop_trees timber 1 -execute if score chop_trees timber matches 2.. run scoreboard players set chop_trees timber 0 -execute if score chop_trees timber matches 1 run playsound minecraft:ui.button.click master @s ~ ~ ~ .2 1.9 .2 -execute if score chop_trees timber matches 0 run playsound minecraft:ui.button.click master @s ~ ~ ~ .2 1.3 .2 -function timber:settings/settings2 -function timber:settings/end_of_message \ No newline at end of file diff --git a/18-41/data/timber/functions/settings/toggle/destroy_leaves.mcfunction b/18-41/data/timber/functions/settings/toggle/destroy_leaves.mcfunction deleted file mode 100644 index 346bced..0000000 --- a/18-41/data/timber/functions/settings/toggle/destroy_leaves.mcfunction +++ /dev/null @@ -1,7 +0,0 @@ -execute if score destroy_leaves timber matches 1.. run scoreboard players set destroy_leaves timber 2 -execute unless score destroy_leaves timber matches 1.. run scoreboard players set destroy_leaves timber 1 -execute if score destroy_leaves timber matches 2.. run scoreboard players set destroy_leaves timber 0 -execute if score destroy_leaves timber matches 1 run playsound minecraft:ui.button.click master @s ~ ~ ~ .2 1.9 .2 -execute if score destroy_leaves timber matches 0 run playsound minecraft:ui.button.click master @s ~ ~ ~ .2 1.3 .2 -function timber:settings/settings -function timber:settings/end_of_message \ No newline at end of file diff --git a/18-41/data/timber/functions/settings/toggle/destroy_roots.mcfunction b/18-41/data/timber/functions/settings/toggle/destroy_roots.mcfunction deleted file mode 100644 index 87a6906..0000000 --- a/18-41/data/timber/functions/settings/toggle/destroy_roots.mcfunction +++ /dev/null @@ -1,7 +0,0 @@ -execute if score destroy_roots timber matches 1.. run scoreboard players set destroy_roots timber 2 -execute unless score destroy_roots timber matches 1.. run scoreboard players set destroy_roots timber 1 -execute if score destroy_roots timber matches 2.. run scoreboard players set destroy_roots timber 0 -execute if score destroy_roots timber matches 1 run playsound minecraft:ui.button.click master @s ~ ~ ~ .2 1.9 .2 -execute if score destroy_roots timber matches 0 run playsound minecraft:ui.button.click master @s ~ ~ ~ .2 1.3 .2 -function timber:settings/settings -function timber:settings/end_of_message \ No newline at end of file diff --git a/18-41/data/timber/functions/settings/toggle/diamond_axe.mcfunction b/18-41/data/timber/functions/settings/toggle/diamond_axe.mcfunction deleted file mode 100644 index 83e45d8..0000000 --- a/18-41/data/timber/functions/settings/toggle/diamond_axe.mcfunction +++ /dev/null @@ -1,7 +0,0 @@ -execute if score diamond_axe timber matches 1.. run scoreboard players set diamond_axe timber 2 -execute unless score diamond_axe timber matches 1.. run scoreboard players set diamond_axe timber 1 -execute if score diamond_axe timber matches 2.. run scoreboard players set diamond_axe timber 0 -execute if score diamond_axe timber matches 1 run playsound minecraft:ui.button.click master @s ~ ~ ~ .2 1.9 .2 -execute if score diamond_axe timber matches 0 run playsound minecraft:ui.button.click master @s ~ ~ ~ .2 1.3 .2 -function timber:settings/settings2 -function timber:settings/end_of_message \ No newline at end of file diff --git a/18-41/data/timber/functions/settings/toggle/drop_loot.mcfunction b/18-41/data/timber/functions/settings/toggle/drop_loot.mcfunction deleted file mode 100644 index dc35415..0000000 --- a/18-41/data/timber/functions/settings/toggle/drop_loot.mcfunction +++ /dev/null @@ -1,7 +0,0 @@ -execute if score drop_loot timber matches 1.. run scoreboard players set drop_loot timber 2 -execute unless score drop_loot timber matches 1.. run scoreboard players set drop_loot timber 1 -execute if score drop_loot timber matches 2.. run scoreboard players set drop_loot timber 0 -execute if score drop_loot timber matches 1 run playsound minecraft:ui.button.click master @s ~ ~ ~ .2 1.9 .2 -execute if score drop_loot timber matches 0 run playsound minecraft:ui.button.click master @s ~ ~ ~ .2 1.3 .2 -function timber:settings/settings -function timber:settings/end_of_message \ No newline at end of file diff --git a/18-41/data/timber/functions/settings/toggle/golden_axe.mcfunction b/18-41/data/timber/functions/settings/toggle/golden_axe.mcfunction deleted file mode 100644 index f21f5b8..0000000 --- a/18-41/data/timber/functions/settings/toggle/golden_axe.mcfunction +++ /dev/null @@ -1,7 +0,0 @@ -execute if score golden_axe timber matches 1.. run scoreboard players set golden_axe timber 2 -execute unless score golden_axe timber matches 1.. run scoreboard players set golden_axe timber 1 -execute if score golden_axe timber matches 2.. run scoreboard players set golden_axe timber 0 -execute if score golden_axe timber matches 1 run playsound minecraft:ui.button.click master @s ~ ~ ~ .2 1.9 .2 -execute if score golden_axe timber matches 0 run playsound minecraft:ui.button.click master @s ~ ~ ~ .2 1.3 .2 -function timber:settings/settings2 -function timber:settings/end_of_message \ No newline at end of file diff --git a/18-41/data/timber/functions/settings/toggle/hunger.mcfunction b/18-41/data/timber/functions/settings/toggle/hunger.mcfunction deleted file mode 100644 index b1e9543..0000000 --- a/18-41/data/timber/functions/settings/toggle/hunger.mcfunction +++ /dev/null @@ -1,7 +0,0 @@ -execute if score hunger timber matches 1.. run scoreboard players set hunger timber 2 -execute unless score hunger timber matches 1.. run scoreboard players set hunger timber 1 -execute if score hunger timber matches 2.. run scoreboard players set hunger timber 0 -execute if score hunger timber matches 1 run playsound minecraft:ui.button.click master @s ~ ~ ~ .2 1.9 .2 -execute if score hunger timber matches 0 run playsound minecraft:ui.button.click master @s ~ ~ ~ .2 1.3 .2 -function timber:settings/settings1 -function timber:settings/end_of_message \ No newline at end of file diff --git a/18-41/data/timber/functions/settings/toggle/interfere.mcfunction b/18-41/data/timber/functions/settings/toggle/interfere.mcfunction deleted file mode 100644 index b1270d0..0000000 --- a/18-41/data/timber/functions/settings/toggle/interfere.mcfunction +++ /dev/null @@ -1,7 +0,0 @@ -execute if score interfere timber matches 1.. run scoreboard players set interfere timber 2 -execute unless score interfere timber matches 1.. run scoreboard players set interfere timber 1 -execute if score interfere timber matches 2.. run scoreboard players set interfere timber 0 -execute if score interfere timber matches 1 run playsound minecraft:ui.button.click master @s ~ ~ ~ .2 1.9 .2 -execute if score interfere timber matches 0 run playsound minecraft:ui.button.click master @s ~ ~ ~ .2 1.3 .2 -function timber:settings/settings -function timber:settings/end_of_message \ No newline at end of file diff --git a/18-41/data/timber/functions/settings/toggle/iron_axe.mcfunction b/18-41/data/timber/functions/settings/toggle/iron_axe.mcfunction deleted file mode 100644 index bf08c1f..0000000 --- a/18-41/data/timber/functions/settings/toggle/iron_axe.mcfunction +++ /dev/null @@ -1,7 +0,0 @@ -execute if score iron_axe timber matches 1.. run scoreboard players set iron_axe timber 2 -execute unless score iron_axe timber matches 1.. run scoreboard players set iron_axe timber 1 -execute if score iron_axe timber matches 2.. run scoreboard players set iron_axe timber 0 -execute if score iron_axe timber matches 1 run playsound minecraft:ui.button.click master @s ~ ~ ~ .2 1.9 .2 -execute if score iron_axe timber matches 0 run playsound minecraft:ui.button.click master @s ~ ~ ~ .2 1.3 .2 -function timber:settings/settings2 -function timber:settings/end_of_message \ No newline at end of file diff --git a/18-41/data/timber/functions/settings/toggle/netherite_axe.mcfunction b/18-41/data/timber/functions/settings/toggle/netherite_axe.mcfunction deleted file mode 100644 index 17f6528..0000000 --- a/18-41/data/timber/functions/settings/toggle/netherite_axe.mcfunction +++ /dev/null @@ -1,7 +0,0 @@ -execute if score netherite_axe timber matches 1.. run scoreboard players set netherite_axe timber 2 -execute unless score netherite_axe timber matches 1.. run scoreboard players set netherite_axe timber 1 -execute if score netherite_axe timber matches 2.. run scoreboard players set netherite_axe timber 0 -execute if score netherite_axe timber matches 1 run playsound minecraft:ui.button.click master @s ~ ~ ~ .2 1.9 .2 -execute if score netherite_axe timber matches 0 run playsound minecraft:ui.button.click master @s ~ ~ ~ .2 1.3 .2 -function timber:settings/settings2 -function timber:settings/end_of_message \ No newline at end of file diff --git a/18-41/data/timber/functions/settings/toggle/persistent.mcfunction b/18-41/data/timber/functions/settings/toggle/persistent.mcfunction deleted file mode 100644 index 58bad84..0000000 --- a/18-41/data/timber/functions/settings/toggle/persistent.mcfunction +++ /dev/null @@ -1,7 +0,0 @@ -execute if score persistent timber matches 1.. run scoreboard players set persistent timber 2 -execute unless score persistent timber matches 1.. run scoreboard players set persistent timber 1 -execute if score persistent timber matches 2.. run scoreboard players set persistent timber 0 -execute if score persistent timber matches 1 run playsound minecraft:ui.button.click master @s ~ ~ ~ .2 1.9 .2 -execute if score persistent timber matches 0 run playsound minecraft:ui.button.click master @s ~ ~ ~ .2 1.3 .2 -function timber:settings/settings2 -function timber:settings/end_of_message \ No newline at end of file diff --git a/18-41/data/timber/functions/settings/toggle/plant_sapling.mcfunction b/18-41/data/timber/functions/settings/toggle/plant_sapling.mcfunction deleted file mode 100644 index a6efdc3..0000000 --- a/18-41/data/timber/functions/settings/toggle/plant_sapling.mcfunction +++ /dev/null @@ -1,8 +0,0 @@ -execute if score plant_sapling timber matches 1.. run scoreboard players set plant_sapling timber 2 -execute unless score plant_sapling timber matches 1.. run scoreboard players set plant_sapling timber 1 -execute if score plant_sapling timber matches 2.. run scoreboard players set plant_sapling timber 0 -execute if score plant_sapling timber matches 1 run playsound minecraft:ui.button.click master @s ~ ~ ~ .2 1.9 .2 -execute if score plant_sapling timber matches 1 run function timber:autoplant/loop -execute if score plant_sapling timber matches 0 run playsound minecraft:ui.button.click master @s ~ ~ ~ .2 1.3 .2 -function timber:settings/settings1 -function timber:settings/end_of_message \ No newline at end of file diff --git a/18-41/data/timber/functions/settings/toggle/slow_chop.mcfunction b/18-41/data/timber/functions/settings/toggle/slow_chop.mcfunction deleted file mode 100644 index 0a0989c..0000000 --- a/18-41/data/timber/functions/settings/toggle/slow_chop.mcfunction +++ /dev/null @@ -1,8 +0,0 @@ -execute if score slow_chop timber matches 1.. run scoreboard players set slow_chop timber 2 -execute unless score slow_chop timber matches 1.. run scoreboard players set slow_chop timber 1 -execute if score slow_chop timber matches 2.. run scoreboard players set slow_chop timber 0 -execute if score slow_chop timber matches 1 run playsound minecraft:ui.button.click master @s ~ ~ ~ .2 1.9 .2 -execute if score slow_chop timber matches 1 run function timber:slow_chop/loop -execute if score slow_chop timber matches 0 run playsound minecraft:ui.button.click master @s ~ ~ ~ .2 1.3 .2 -function timber:settings/settings1 -function timber:settings/end_of_message \ No newline at end of file diff --git a/18-41/data/timber/functions/settings/toggle/sneaking.mcfunction b/18-41/data/timber/functions/settings/toggle/sneaking.mcfunction deleted file mode 100644 index 53f5141..0000000 --- a/18-41/data/timber/functions/settings/toggle/sneaking.mcfunction +++ /dev/null @@ -1,7 +0,0 @@ -execute if score sneaking timber matches 1.. run scoreboard players set sneaking timber 2 -execute unless score sneaking timber matches 1.. run scoreboard players set sneaking timber 1 -execute if score sneaking timber matches 2.. run scoreboard players set sneaking timber 0 -execute if score sneaking timber matches 1 run playsound minecraft:ui.button.click master @s ~ ~ ~ .2 1.9 .2 -execute if score sneaking timber matches 0 run playsound minecraft:ui.button.click master @s ~ ~ ~ .2 1.3 .2 -function timber:settings/settings -function timber:settings/end_of_message \ No newline at end of file diff --git a/18-41/data/timber/functions/settings/toggle/standing.mcfunction b/18-41/data/timber/functions/settings/toggle/standing.mcfunction deleted file mode 100644 index 08c661d..0000000 --- a/18-41/data/timber/functions/settings/toggle/standing.mcfunction +++ /dev/null @@ -1,7 +0,0 @@ -execute if score standing timber matches 1.. run scoreboard players set standing timber 2 -execute unless score standing timber matches 1.. run scoreboard players set standing timber 1 -execute if score standing timber matches 2.. run scoreboard players set standing timber 0 -execute if score standing timber matches 1 run playsound minecraft:ui.button.click master @s ~ ~ ~ .2 1.9 .2 -execute if score standing timber matches 0 run playsound minecraft:ui.button.click master @s ~ ~ ~ .2 1.3 .2 -function timber:settings/settings -function timber:settings/end_of_message \ No newline at end of file diff --git a/18-41/data/timber/functions/settings/toggle/start_chop_on_root.mcfunction b/18-41/data/timber/functions/settings/toggle/start_chop_on_root.mcfunction deleted file mode 100644 index e04a2b7..0000000 --- a/18-41/data/timber/functions/settings/toggle/start_chop_on_root.mcfunction +++ /dev/null @@ -1,7 +0,0 @@ -execute if score start_chop_on_root timber matches 1.. run scoreboard players set start_chop_on_root timber 2 -execute unless score start_chop_on_root timber matches 1.. run scoreboard players set start_chop_on_root timber 1 -execute if score start_chop_on_root timber matches 2.. run scoreboard players set start_chop_on_root timber 0 -execute if score start_chop_on_root timber matches 1 run playsound minecraft:ui.button.click master @s ~ ~ ~ .2 1.9 .2 -execute if score start_chop_on_root timber matches 0 run playsound minecraft:ui.button.click master @s ~ ~ ~ .2 1.3 .2 -function timber:settings/settings -function timber:settings/end_of_message \ No newline at end of file diff --git a/18-41/data/timber/functions/settings/toggle/stone_axe.mcfunction b/18-41/data/timber/functions/settings/toggle/stone_axe.mcfunction deleted file mode 100644 index 641459d..0000000 --- a/18-41/data/timber/functions/settings/toggle/stone_axe.mcfunction +++ /dev/null @@ -1,7 +0,0 @@ -execute if score stone_axe timber matches 1.. run scoreboard players set stone_axe timber 2 -execute unless score stone_axe timber matches 1.. run scoreboard players set stone_axe timber 1 -execute if score stone_axe timber matches 2.. run scoreboard players set stone_axe timber 0 -execute if score stone_axe timber matches 1 run playsound minecraft:ui.button.click master @s ~ ~ ~ .2 1.9 .2 -execute if score stone_axe timber matches 0 run playsound minecraft:ui.button.click master @s ~ ~ ~ .2 1.3 .2 -function timber:settings/settings2 -function timber:settings/end_of_message \ No newline at end of file diff --git a/18-41/data/timber/functions/settings/toggle/stop_chopping.mcfunction b/18-41/data/timber/functions/settings/toggle/stop_chopping.mcfunction deleted file mode 100644 index b13140f..0000000 --- a/18-41/data/timber/functions/settings/toggle/stop_chopping.mcfunction +++ /dev/null @@ -1,7 +0,0 @@ -execute if score stop_chopping timber matches 1.. run scoreboard players set stop_chopping timber 2 -execute unless score stop_chopping timber matches 1.. run scoreboard players set stop_chopping timber 1 -execute if score stop_chopping timber matches 2.. run scoreboard players set stop_chopping timber 0 -execute if score stop_chopping timber matches 1 run playsound minecraft:ui.button.click master @s ~ ~ ~ .2 1.9 .2 -execute if score stop_chopping timber matches 0 run playsound minecraft:ui.button.click master @s ~ ~ ~ .2 1.3 .2 -function timber:settings/settings -function timber:settings/end_of_message \ No newline at end of file diff --git a/18-41/data/timber/functions/settings/toggle/stopsound.mcfunction b/18-41/data/timber/functions/settings/toggle/stopsound.mcfunction deleted file mode 100644 index 9418b18..0000000 --- a/18-41/data/timber/functions/settings/toggle/stopsound.mcfunction +++ /dev/null @@ -1,7 +0,0 @@ -execute if score stopsound timber matches 1.. run scoreboard players set stopsound timber 2 -execute unless score stopsound timber matches 1.. run scoreboard players set stopsound timber 1 -execute if score stopsound timber matches 2.. run scoreboard players set stopsound timber 0 -execute if score stopsound timber matches 1 run playsound minecraft:ui.button.click master @s ~ ~ ~ .2 1.9 .2 -execute if score stopsound timber matches 0 run playsound minecraft:ui.button.click master @s ~ ~ ~ .2 1.3 .2 -function timber:settings/settings -function timber:settings/end_of_message \ No newline at end of file diff --git a/18-41/data/timber/functions/settings/toggle/timber.mcfunction b/18-41/data/timber/functions/settings/toggle/timber.mcfunction deleted file mode 100644 index 0a26b1d..0000000 --- a/18-41/data/timber/functions/settings/toggle/timber.mcfunction +++ /dev/null @@ -1,9 +0,0 @@ -# reset -scoreboard players set @s TimberToggle 0 -# toggle -execute unless score @s timber_disabled matches 1.. run scoreboard players set @s timber_disabled 3 -execute if score @s timber_disabled matches 1 run scoreboard players set @s timber_disabled 0 -execute if score @s timber_disabled matches 3 run scoreboard players set @s timber_disabled 1 -# display on/off status -execute unless score @s[tag=!global.ignore.gui] timber_disabled matches 1.. run tellraw @s ["",{"text":"<< ","color":"dark_gray"},{"text":"✔","color":"green"},{"text":" Timber is now on"},{"text":" >>","color":"dark_gray"}] -execute if score @s[tag=!global.ignore.gui] timber_disabled matches 1.. run tellraw @s ["",{"text":"<< ","color":"dark_gray"},{"text":"❌","color":"red"},{"text":" Timber is now off"},{"text":" >>","color":"dark_gray"}] \ No newline at end of file diff --git a/18-41/data/timber/functions/settings/toggle/wear_out.mcfunction b/18-41/data/timber/functions/settings/toggle/wear_out.mcfunction deleted file mode 100644 index 0bad5ec..0000000 --- a/18-41/data/timber/functions/settings/toggle/wear_out.mcfunction +++ /dev/null @@ -1,7 +0,0 @@ -execute if score wear_out timber matches 1.. run scoreboard players set wear_out timber 2 -execute unless score wear_out timber matches 1.. run scoreboard players set wear_out timber 1 -execute if score wear_out timber matches 2.. run scoreboard players set wear_out timber 0 -execute if score wear_out timber matches 1 run playsound minecraft:ui.button.click master @s ~ ~ ~ .2 1.9 .2 -execute if score wear_out timber matches 0 run playsound minecraft:ui.button.click master @s ~ ~ ~ .2 1.3 .2 -function timber:settings/settings -function timber:settings/end_of_message \ No newline at end of file diff --git a/18-41/data/timber/functions/settings/toggle/wooden_axe.mcfunction b/18-41/data/timber/functions/settings/toggle/wooden_axe.mcfunction deleted file mode 100644 index cb82456..0000000 --- a/18-41/data/timber/functions/settings/toggle/wooden_axe.mcfunction +++ /dev/null @@ -1,7 +0,0 @@ -execute if score wooden_axe timber matches 1.. run scoreboard players set wooden_axe timber 2 -execute unless score wooden_axe timber matches 1.. run scoreboard players set wooden_axe timber 1 -execute if score wooden_axe timber matches 2.. run scoreboard players set wooden_axe timber 0 -execute if score wooden_axe timber matches 1 run playsound minecraft:ui.button.click master @s ~ ~ ~ .2 1.9 .2 -execute if score wooden_axe timber matches 0 run playsound minecraft:ui.button.click master @s ~ ~ ~ .2 1.3 .2 -function timber:settings/settings2 -function timber:settings/end_of_message \ No newline at end of file diff --git a/18-41/data/timber/functions/slow_chop/api.mcfunction b/18-41/data/timber/functions/slow_chop/api.mcfunction deleted file mode 100644 index d27c681..0000000 --- a/18-41/data/timber/functions/slow_chop/api.mcfunction +++ /dev/null @@ -1,6 +0,0 @@ -# api -execute if entity @s[tag=timber_log] run function #timber:api/break_log -execute if entity @s[tag=timber_leaf] run function #timber:api/break_leaf -execute if entity @s[tag=timber_root] run function #timber:api/break_root -execute if entity @s[tag=timber_stem] run function #timber:api/break_stem -execute if entity @s[tag=timber_cap] run function #timber:api/break_cap \ No newline at end of file diff --git a/18-41/data/timber/functions/slow_chop/delete_markers.mcfunction b/18-41/data/timber/functions/slow_chop/delete_markers.mcfunction deleted file mode 100644 index c3375d6..0000000 --- a/18-41/data/timber/functions/slow_chop/delete_markers.mcfunction +++ /dev/null @@ -1,3 +0,0 @@ -# delete tree markers after chopping -kill @e[type=minecraft:marker,tag=timber_slow_chop] -kill @e[type=minecraft:armor_stand,tag=timber_tool] \ No newline at end of file diff --git a/18-41/data/timber/functions/slow_chop/destroy_loop.mcfunction b/18-41/data/timber/functions/slow_chop/destroy_loop.mcfunction deleted file mode 100644 index db43fbd..0000000 --- a/18-41/data/timber/functions/slow_chop/destroy_loop.mcfunction +++ /dev/null @@ -1,25 +0,0 @@ -# loop -$schedule function timber:slow_chop/loop $(time_between_chops)t replace - -# api -$execute at @e[type=minecraft:marker,tag=timber_slow_chop] as @e[type=minecraft:marker,tag=timber_destroy,sort=nearest,limit=$(blocks_per_chop)] at @s run function timber:slow_chop/api - -# destroy n block -$execute at @e[type=minecraft:marker,tag=timber_slow_chop] as @e[type=minecraft:armor_stand,tag=timber_tool,y=-64,distance=...1,sort=arbitrary,limit=1] at @e[type=minecraft:marker,tag=timber_destroy,sort=nearest,limit=$(blocks_per_chop)] run loot spawn ~ ~ ~ mine ~ ~ ~ mainhand - -# destroy animation (doTileDrops can be changed, because datapack wouldn't get to this point otherwise) -gamerule doTileDrops false -$execute at @e[type=minecraft:marker,tag=timber_slow_chop] at @e[type=minecraft:marker,tag=timber_destroy,sort=nearest,limit=$(blocks_per_chop)] run setblock ~ ~ ~ minecraft:air destroy -gamerule doTileDrops true - -# stop sound -$execute at @e[type=minecraft:marker,tag=timber_slow_chop] if score stopsound timber matches 1.. at @e[type=minecraft:marker,tag=timber_destroy,sort=nearest,limit=$(blocks_per_chop)] as @a[distance=..20,tag=!global.ignore.gui] run function timber:utils/stopsound - -# delete location item -$execute at @e[type=minecraft:marker,tag=timber_slow_chop] at @e[type=minecraft:marker,tag=timber_destroy,sort=nearest,limit=$(blocks_per_chop)] run kill @e[type=minecraft:item,distance=..1,nbt={Item:{components:{"minecraft:custom_data":{Tags:["timber_location"]}}}}] - -# remove marker of processed blocks -$execute at @e[type=minecraft:marker,tag=timber_slow_chop] run kill @e[type=minecraft:marker,tag=timber_destroy,sort=nearest,limit=$(blocks_per_chop)] - -# delete tree markers after chopping -execute unless entity @e[type=minecraft:marker,tag=timber_destroy] run function timber:slow_chop/delete_markers \ No newline at end of file diff --git a/18-41/data/timber/functions/slow_chop/loop.mcfunction b/18-41/data/timber/functions/slow_chop/loop.mcfunction deleted file mode 100644 index e6a33b5..0000000 --- a/18-41/data/timber/functions/slow_chop/loop.mcfunction +++ /dev/null @@ -1,4 +0,0 @@ -# destroy loop -execute store result storage timber:slow_chop blocks_per_chop int 1 run scoreboard players get blocks_per_chop timber -execute store result storage timber:slow_chop time_between_chops int 1 run scoreboard players get time_between_chops timber -execute if score slow_chop timber matches 1.. run function timber:slow_chop/destroy_loop with storage timber:slow_chop diff --git a/18-41/data/timber/functions/tool/durability_check.mcfunction b/18-41/data/timber/functions/tool/durability_check.mcfunction deleted file mode 100644 index d6607bf..0000000 --- a/18-41/data/timber/functions/tool/durability_check.mcfunction +++ /dev/null @@ -1,7 +0,0 @@ -# check if axe is broken -execute if score @s timber_w_axe matches 1.. unless score durability timber <= #wooden_axe_max_durability timber run scoreboard players set durability_okay timber 0 -execute if score @s timber_s_axe matches 1.. unless score durability timber <= #stone_axe_max_durability timber run scoreboard players set durability_okay timber 0 -execute if score @s timber_i_axe matches 1.. unless score durability timber <= #iron_axe_max_durability timber run scoreboard players set durability_okay timber 0 -execute if score @s timber_g_axe matches 1.. unless score durability timber <= #golden_axe_max_durability timber run scoreboard players set durability_okay timber 0 -execute if score @s timber_d_axe matches 1.. unless score durability timber <= #diamond_axe_max_durability timber run scoreboard players set durability_okay timber 0 -execute if score @s timber_n_axe matches 1.. unless score durability timber <= #netherite_axe_max_durability timber run scoreboard players set durability_okay timber 0 \ No newline at end of file diff --git a/18-41/data/timber/functions/tool/durability_count.mcfunction b/18-41/data/timber/functions/tool/durability_count.mcfunction deleted file mode 100644 index 118f8c3..0000000 --- a/18-41/data/timber/functions/tool/durability_count.mcfunction +++ /dev/null @@ -1,5 +0,0 @@ -# count wear out of tool depending on enchantment -execute if score unbreaking timber matches 0 run scoreboard players add durability timber 1 -execute if score unbreaking timber matches 1 if predicate timber:random_chance/0.5 run scoreboard players add durability timber 1 -execute if score unbreaking timber matches 2 if predicate timber:random_chance/0.333 run scoreboard players add durability timber 1 -execute if score unbreaking timber matches 3.. if predicate timber:random_chance/0.25 run scoreboard players add durability timber 1 \ No newline at end of file diff --git a/18-41/data/timber/functions/tool/durability_get.mcfunction b/18-41/data/timber/functions/tool/durability_get.mcfunction deleted file mode 100644 index d4505c4..0000000 --- a/18-41/data/timber/functions/tool/durability_get.mcfunction +++ /dev/null @@ -1,5 +0,0 @@ -scoreboard players set unbreakable timber 0 -execute store result score durability timber run data get entity @s SelectedItem.components."minecraft:damage" -scoreboard players remove durability timber 1 -execute if entity @s[nbt=!{SelectedItem:{}}] run scoreboard players set durability timber 2147483647 -execute if data entity @s SelectedItem.components."minecraft:unbreakable" run scoreboard players set unbreakable timber 1 \ No newline at end of file diff --git a/18-41/data/timber/functions/tool/durability_max.mcfunction b/18-41/data/timber/functions/tool/durability_max.mcfunction deleted file mode 100644 index 3342e7b..0000000 --- a/18-41/data/timber/functions/tool/durability_max.mcfunction +++ /dev/null @@ -1,7 +0,0 @@ -# non-overriding max durability for axes -execute unless score #wooden_axe_max_durability timber = #wooden_axe_max_durability timber run scoreboard players set #wooden_axe_max_durability timber 59 -execute unless score #stone_axe_max_durability timber = #stone_axe_max_durability timber run scoreboard players set #stone_axe_max_durability timber 131 -execute unless score #iron_axe_max_durability timber = #iron_axe_max_durability timber run scoreboard players set #iron_axe_max_durability timber 250 -execute unless score #golden_axe_max_durability timber = #golden_axe_max_durability timber run scoreboard players set #golden_axe_max_durability timber 32 -execute unless score #diamond_axe_max_durability timber = #diamond_axe_max_durability timber run scoreboard players set #diamond_axe_max_durability timber 1561 -execute unless score #netherite_axe_max_durability timber = #netherite_axe_max_durability timber run scoreboard players set #netherite_axe_max_durability timber 2031 \ No newline at end of file diff --git a/18-41/data/timber/functions/tool/wear_out.mcfunction b/18-41/data/timber/functions/tool/wear_out.mcfunction deleted file mode 100644 index c9a6224..0000000 --- a/18-41/data/timber/functions/tool/wear_out.mcfunction +++ /dev/null @@ -1,9 +0,0 @@ -# wear out tool -execute if score @s timber_w_axe matches 1.. run scoreboard players operation damage timber = #wooden_axe_max_durability timber -execute if score @s timber_s_axe matches 1.. run scoreboard players operation damage timber = #stone_axe_max_durability timber -execute if score @s timber_i_axe matches 1.. run scoreboard players operation damage timber = #iron_axe_max_durability timber -execute if score @s timber_g_axe matches 1.. run scoreboard players operation damage timber = #golden_axe_max_durability timber -execute if score @s timber_d_axe matches 1.. run scoreboard players operation damage timber = #diamond_axe_max_durability timber -execute if score @s timber_n_axe matches 1.. run scoreboard players operation damage timber = #netherite_axe_max_durability timber -scoreboard players operation damage timber -= durability timber -item modify entity @s weapon.mainhand timber:wear_out \ No newline at end of file diff --git a/18-41/data/timber/functions/tool/worn_out.mcfunction b/18-41/data/timber/functions/tool/worn_out.mcfunction deleted file mode 100644 index 545717d..0000000 --- a/18-41/data/timber/functions/tool/worn_out.mcfunction +++ /dev/null @@ -1,13 +0,0 @@ -# break axe if worn out -execute if score @s timber_w_axe matches 1.. if score durability timber >= #wooden_axe_max_durability timber run item replace entity @s weapon.mainhand with minecraft:air -execute if score @s timber_w_axe matches 1.. if score durability timber >= #wooden_axe_max_durability timber run playsound minecraft:entity.item.break player @a ~ ~ ~ -execute if score @s timber_s_axe matches 1.. if score durability timber >= #stone_axe_max_durability timber run item replace entity @s weapon.mainhand with minecraft:air -execute if score @s timber_s_axe matches 1.. if score durability timber >= #stone_axe_max_durability timber run playsound minecraft:entity.item.break player @a ~ ~ ~ -execute if score @s timber_i_axe matches 1.. if score durability timber >= #iron_axe_max_durability timber run item replace entity @s weapon.mainhand with minecraft:air -execute if score @s timber_i_axe matches 1.. if score durability timber >= #iron_axe_max_durability timber run playsound minecraft:entity.item.break player @a ~ ~ ~ -execute if score @s timber_g_axe matches 1.. if score durability timber >= #golden_axe_max_durability timber run item replace entity @s weapon.mainhand with minecraft:air -execute if score @s timber_g_axe matches 1.. if score durability timber >= #golden_axe_max_durability timber run playsound minecraft:entity.item.break player @a ~ ~ ~ -execute if score @s timber_d_axe matches 1.. if score durability timber >= #diamond_axe_max_durability timber run item replace entity @s weapon.mainhand with minecraft:air -execute if score @s timber_d_axe matches 1.. if score durability timber >= #diamond_axe_max_durability timber run playsound minecraft:entity.item.break player @a ~ ~ ~ -execute if score @s timber_n_axe matches 1.. if score durability timber >= #netherite_axe_max_durability timber run item replace entity @s weapon.mainhand with minecraft:air -execute if score @s timber_n_axe matches 1.. if score durability timber >= #netherite_axe_max_durability timber run playsound minecraft:entity.item.break player @a ~ ~ ~ \ No newline at end of file diff --git a/18-41/data/timber/functions/uninstall.mcfunction b/18-41/data/timber/functions/uninstall.mcfunction deleted file mode 100644 index 96a2656..0000000 --- a/18-41/data/timber/functions/uninstall.mcfunction +++ /dev/null @@ -1,19 +0,0 @@ -# stop main functions -schedule clear timber:main - -# remove scoreboards -scoreboard objectives remove timber_w_axe -scoreboard objectives remove timber_s_axe -scoreboard objectives remove timber_i_axe -scoreboard objectives remove timber_g_axe -scoreboard objectives remove timber_d_axe -scoreboard objectives remove timber_n_axe -scoreboard objectives remove timber -scoreboard objectives remove TimberToggle -scoreboard objectives remove timber_disabled -scoreboard objectives remove timber_prsistent - -# remove markers -kill @e[type=minecraft:marker,tag=timber_slow_chop] -kill @e[type=minecraft:marker,tag=timber_destroy] -kill @e[type=minecraft:armor_stand,tag=timber_tool] \ No newline at end of file diff --git a/18-41/data/timber/functions/utils/check_max_command_chain_length.mcfunction b/18-41/data/timber/functions/utils/check_max_command_chain_length.mcfunction deleted file mode 100644 index 6f32c3e..0000000 --- a/18-41/data/timber/functions/utils/check_max_command_chain_length.mcfunction +++ /dev/null @@ -1,13 +0,0 @@ -# function didn't end successfully -execute if score running timber matches 1 run scoreboard players set running timber 2 -# normal behavior -execute if score running timber matches 0 run scoreboard players set running timber 1 -execute if score running timber matches 1 run function timber:utils/used_axe -# function didn't end successfully -execute if score running timber matches 2 run execute store result storage timber:max_command_chain_length value int 1 run gamerule maxCommandChainLength -execute if score running timber matches 2 run tellraw @a[tag=!noTimberWarning] ["",{"text":"Timber Datapack Warning: ","color":"red"},{"text":"The datapack wasn't able to finish its functionality to work properly!"},{"text":"\n ─ Please either decrease setting \"Max. Tree Size\" with "},{"text":"\n [ ✎ ]","color":"gray","clickEvent":{"action":"suggest_command","value":"/scoreboard players set max_tree_size timber "},"hoverEvent":{"action":"show_text","value":"Default: 555"}},{"text":" (Currently: ","color":"gray"},{"score":{"name":"max_tree_size","objective":"timber"},"color":"gray"},{"text": ")","color":"gray"},{"text":"."},{"text":"\n ─ Or increase the gamerule \"maxCommandChainLength\" with "},{"text":"\n [ ✎ ]","color":"gray","clickEvent":{"action":"suggest_command","value":"/gamerule maxCommandChainLength "},"hoverEvent":{"action":"show_text","value":"Default: 65536"}},{"text":" (Currently: ","color":"gray"},{"nbt":"value","storage":"timber:max_command_chain_length","color":"gray"},{"text": ")","color":"gray"},{"text":"."}] -execute if score running timber matches 2 run schedule function timber:utils/reset 10t -execute if score running timber matches 2 run scoreboard players set running timber 3 - -# function ended successfully -execute if score running timber matches 1 run scoreboard players set running timber 0 \ No newline at end of file diff --git a/18-41/data/timber/functions/utils/check_server.mcfunction b/18-41/data/timber/functions/utils/check_server.mcfunction deleted file mode 100644 index 7d70177..0000000 --- a/18-41/data/timber/functions/utils/check_server.mcfunction +++ /dev/null @@ -1,8 +0,0 @@ -# load until someone is in the server -execute unless entity @r run schedule function timber:utils/check_server 1s - -# Checking if the server uses a different jar from the vanilla one -execute unless score not_vanilla timber matches 1.. store success score not_vanilla timber run data get entity @r "Spigot.ticksLived" -execute unless score not_vanilla timber matches 1.. store success score not_vanilla timber run data get entity @r "Bukkit.updateLevel" -execute unless score not_vanilla timber matches 1.. store success score not_vanilla timber run data get entity @r "Paper.SpawnReason" -execute if score not_vanilla timber matches 1 run tellraw @a[tag=!noTimberWarning] ["",{"text":"Timber Datapack Warning: ","color":"red"},{"text":"Compatibility in non-vanilla servers is not guaranteed! For more information please visit official download site.","clickEvent":{"action":"open_url","value":"https://github.com/Moggla/Timber-Datapack"}}] \ No newline at end of file diff --git a/18-41/data/timber/functions/utils/hunger.mcfunction b/18-41/data/timber/functions/utils/hunger.mcfunction deleted file mode 100644 index 3d9e3de..0000000 --- a/18-41/data/timber/functions/utils/hunger.mcfunction +++ /dev/null @@ -1,255 +0,0 @@ -execute if score tree_size timber matches 1 run effect give @s minecraft:hunger 1 1 true -execute if score tree_size timber matches 2 run effect give @s minecraft:hunger 1 2 true -execute if score tree_size timber matches 3 run effect give @s minecraft:hunger 1 3 true -execute if score tree_size timber matches 4 run effect give @s minecraft:hunger 1 4 true -execute if score tree_size timber matches 5 run effect give @s minecraft:hunger 1 5 true -execute if score tree_size timber matches 6 run effect give @s minecraft:hunger 1 6 true -execute if score tree_size timber matches 7 run effect give @s minecraft:hunger 1 7 true -execute if score tree_size timber matches 8 run effect give @s minecraft:hunger 1 8 true -execute if score tree_size timber matches 9 run effect give @s minecraft:hunger 1 9 true -execute if score tree_size timber matches 10 run effect give @s minecraft:hunger 1 10 true -execute if score tree_size timber matches 11 run effect give @s minecraft:hunger 1 11 true -execute if score tree_size timber matches 12 run effect give @s minecraft:hunger 1 12 true -execute if score tree_size timber matches 13 run effect give @s minecraft:hunger 1 13 true -execute if score tree_size timber matches 14 run effect give @s minecraft:hunger 1 14 true -execute if score tree_size timber matches 15 run effect give @s minecraft:hunger 1 15 true -execute if score tree_size timber matches 16 run effect give @s minecraft:hunger 1 16 true -execute if score tree_size timber matches 17 run effect give @s minecraft:hunger 1 17 true -execute if score tree_size timber matches 18 run effect give @s minecraft:hunger 1 18 true -execute if score tree_size timber matches 19 run effect give @s minecraft:hunger 1 19 true -execute if score tree_size timber matches 20 run effect give @s minecraft:hunger 1 20 true -execute if score tree_size timber matches 21 run effect give @s minecraft:hunger 1 21 true -execute if score tree_size timber matches 22 run effect give @s minecraft:hunger 1 22 true -execute if score tree_size timber matches 23 run effect give @s minecraft:hunger 1 23 true -execute if score tree_size timber matches 24 run effect give @s minecraft:hunger 1 24 true -execute if score tree_size timber matches 25 run effect give @s minecraft:hunger 1 25 true -execute if score tree_size timber matches 26 run effect give @s minecraft:hunger 1 26 true -execute if score tree_size timber matches 27 run effect give @s minecraft:hunger 1 27 true -execute if score tree_size timber matches 28 run effect give @s minecraft:hunger 1 28 true -execute if score tree_size timber matches 29 run effect give @s minecraft:hunger 1 29 true -execute if score tree_size timber matches 30 run effect give @s minecraft:hunger 1 30 true -execute if score tree_size timber matches 31 run effect give @s minecraft:hunger 1 31 true -execute if score tree_size timber matches 32 run effect give @s minecraft:hunger 1 32 true -execute if score tree_size timber matches 33 run effect give @s minecraft:hunger 1 33 true -execute if score tree_size timber matches 34 run effect give @s minecraft:hunger 1 34 true -execute if score tree_size timber matches 35 run effect give @s minecraft:hunger 1 35 true -execute if score tree_size timber matches 36 run effect give @s minecraft:hunger 1 36 true -execute if score tree_size timber matches 37 run effect give @s minecraft:hunger 1 37 true -execute if score tree_size timber matches 38 run effect give @s minecraft:hunger 1 38 true -execute if score tree_size timber matches 39 run effect give @s minecraft:hunger 1 39 true -execute if score tree_size timber matches 40 run effect give @s minecraft:hunger 1 40 true -execute if score tree_size timber matches 41 run effect give @s minecraft:hunger 1 41 true -execute if score tree_size timber matches 42 run effect give @s minecraft:hunger 1 42 true -execute if score tree_size timber matches 43 run effect give @s minecraft:hunger 1 43 true -execute if score tree_size timber matches 44 run effect give @s minecraft:hunger 1 44 true -execute if score tree_size timber matches 45 run effect give @s minecraft:hunger 1 45 true -execute if score tree_size timber matches 46 run effect give @s minecraft:hunger 1 46 true -execute if score tree_size timber matches 47 run effect give @s minecraft:hunger 1 47 true -execute if score tree_size timber matches 48 run effect give @s minecraft:hunger 1 48 true -execute if score tree_size timber matches 49 run effect give @s minecraft:hunger 1 49 true -execute if score tree_size timber matches 50 run effect give @s minecraft:hunger 1 50 true -execute if score tree_size timber matches 51 run effect give @s minecraft:hunger 1 51 true -execute if score tree_size timber matches 52 run effect give @s minecraft:hunger 1 52 true -execute if score tree_size timber matches 53 run effect give @s minecraft:hunger 1 53 true -execute if score tree_size timber matches 54 run effect give @s minecraft:hunger 1 54 true -execute if score tree_size timber matches 55 run effect give @s minecraft:hunger 1 55 true -execute if score tree_size timber matches 56 run effect give @s minecraft:hunger 1 56 true -execute if score tree_size timber matches 57 run effect give @s minecraft:hunger 1 57 true -execute if score tree_size timber matches 58 run effect give @s minecraft:hunger 1 58 true -execute if score tree_size timber matches 59 run effect give @s minecraft:hunger 1 59 true -execute if score tree_size timber matches 60 run effect give @s minecraft:hunger 1 60 true -execute if score tree_size timber matches 61 run effect give @s minecraft:hunger 1 61 true -execute if score tree_size timber matches 62 run effect give @s minecraft:hunger 1 62 true -execute if score tree_size timber matches 63 run effect give @s minecraft:hunger 1 63 true -execute if score tree_size timber matches 64 run effect give @s minecraft:hunger 1 64 true -execute if score tree_size timber matches 65 run effect give @s minecraft:hunger 1 65 true -execute if score tree_size timber matches 66 run effect give @s minecraft:hunger 1 66 true -execute if score tree_size timber matches 67 run effect give @s minecraft:hunger 1 67 true -execute if score tree_size timber matches 68 run effect give @s minecraft:hunger 1 68 true -execute if score tree_size timber matches 69 run effect give @s minecraft:hunger 1 69 true -execute if score tree_size timber matches 70 run effect give @s minecraft:hunger 1 70 true -execute if score tree_size timber matches 71 run effect give @s minecraft:hunger 1 71 true -execute if score tree_size timber matches 72 run effect give @s minecraft:hunger 1 72 true -execute if score tree_size timber matches 73 run effect give @s minecraft:hunger 1 73 true -execute if score tree_size timber matches 74 run effect give @s minecraft:hunger 1 74 true -execute if score tree_size timber matches 75 run effect give @s minecraft:hunger 1 75 true -execute if score tree_size timber matches 76 run effect give @s minecraft:hunger 1 76 true -execute if score tree_size timber matches 77 run effect give @s minecraft:hunger 1 77 true -execute if score tree_size timber matches 78 run effect give @s minecraft:hunger 1 78 true -execute if score tree_size timber matches 79 run effect give @s minecraft:hunger 1 79 true -execute if score tree_size timber matches 80 run effect give @s minecraft:hunger 1 80 true -execute if score tree_size timber matches 81 run effect give @s minecraft:hunger 1 81 true -execute if score tree_size timber matches 82 run effect give @s minecraft:hunger 1 82 true -execute if score tree_size timber matches 83 run effect give @s minecraft:hunger 1 83 true -execute if score tree_size timber matches 84 run effect give @s minecraft:hunger 1 84 true -execute if score tree_size timber matches 85 run effect give @s minecraft:hunger 1 85 true -execute if score tree_size timber matches 86 run effect give @s minecraft:hunger 1 86 true -execute if score tree_size timber matches 87 run effect give @s minecraft:hunger 1 87 true -execute if score tree_size timber matches 88 run effect give @s minecraft:hunger 1 88 true -execute if score tree_size timber matches 89 run effect give @s minecraft:hunger 1 89 true -execute if score tree_size timber matches 90 run effect give @s minecraft:hunger 1 90 true -execute if score tree_size timber matches 91 run effect give @s minecraft:hunger 1 91 true -execute if score tree_size timber matches 92 run effect give @s minecraft:hunger 1 92 true -execute if score tree_size timber matches 93 run effect give @s minecraft:hunger 1 93 true -execute if score tree_size timber matches 94 run effect give @s minecraft:hunger 1 94 true -execute if score tree_size timber matches 95 run effect give @s minecraft:hunger 1 95 true -execute if score tree_size timber matches 96 run effect give @s minecraft:hunger 1 96 true -execute if score tree_size timber matches 97 run effect give @s minecraft:hunger 1 97 true -execute if score tree_size timber matches 98 run effect give @s minecraft:hunger 1 98 true -execute if score tree_size timber matches 99 run effect give @s minecraft:hunger 1 99 true -execute if score tree_size timber matches 100 run effect give @s minecraft:hunger 1 100 true -execute if score tree_size timber matches 101 run effect give @s minecraft:hunger 1 101 true -execute if score tree_size timber matches 102 run effect give @s minecraft:hunger 1 102 true -execute if score tree_size timber matches 103 run effect give @s minecraft:hunger 1 103 true -execute if score tree_size timber matches 104 run effect give @s minecraft:hunger 1 104 true -execute if score tree_size timber matches 105 run effect give @s minecraft:hunger 1 105 true -execute if score tree_size timber matches 106 run effect give @s minecraft:hunger 1 106 true -execute if score tree_size timber matches 107 run effect give @s minecraft:hunger 1 107 true -execute if score tree_size timber matches 108 run effect give @s minecraft:hunger 1 108 true -execute if score tree_size timber matches 109 run effect give @s minecraft:hunger 1 109 true -execute if score tree_size timber matches 110 run effect give @s minecraft:hunger 1 110 true -execute if score tree_size timber matches 111 run effect give @s minecraft:hunger 1 111 true -execute if score tree_size timber matches 112 run effect give @s minecraft:hunger 1 112 true -execute if score tree_size timber matches 113 run effect give @s minecraft:hunger 1 113 true -execute if score tree_size timber matches 114 run effect give @s minecraft:hunger 1 114 true -execute if score tree_size timber matches 115 run effect give @s minecraft:hunger 1 115 true -execute if score tree_size timber matches 116 run effect give @s minecraft:hunger 1 116 true -execute if score tree_size timber matches 117 run effect give @s minecraft:hunger 1 117 true -execute if score tree_size timber matches 118 run effect give @s minecraft:hunger 1 118 true -execute if score tree_size timber matches 119 run effect give @s minecraft:hunger 1 119 true -execute if score tree_size timber matches 120 run effect give @s minecraft:hunger 1 120 true -execute if score tree_size timber matches 121 run effect give @s minecraft:hunger 1 121 true -execute if score tree_size timber matches 122 run effect give @s minecraft:hunger 1 122 true -execute if score tree_size timber matches 123 run effect give @s minecraft:hunger 1 123 true -execute if score tree_size timber matches 124 run effect give @s minecraft:hunger 1 124 true -execute if score tree_size timber matches 125 run effect give @s minecraft:hunger 1 125 true -execute if score tree_size timber matches 126 run effect give @s minecraft:hunger 1 126 true -execute if score tree_size timber matches 127 run effect give @s minecraft:hunger 1 127 true -execute if score tree_size timber matches 128 run effect give @s minecraft:hunger 1 128 true -execute if score tree_size timber matches 129 run effect give @s minecraft:hunger 1 129 true -execute if score tree_size timber matches 130 run effect give @s minecraft:hunger 1 130 true -execute if score tree_size timber matches 131 run effect give @s minecraft:hunger 1 131 true -execute if score tree_size timber matches 132 run effect give @s minecraft:hunger 1 132 true -execute if score tree_size timber matches 133 run effect give @s minecraft:hunger 1 133 true -execute if score tree_size timber matches 134 run effect give @s minecraft:hunger 1 134 true -execute if score tree_size timber matches 135 run effect give @s minecraft:hunger 1 135 true -execute if score tree_size timber matches 136 run effect give @s minecraft:hunger 1 136 true -execute if score tree_size timber matches 137 run effect give @s minecraft:hunger 1 137 true -execute if score tree_size timber matches 138 run effect give @s minecraft:hunger 1 138 true -execute if score tree_size timber matches 139 run effect give @s minecraft:hunger 1 139 true -execute if score tree_size timber matches 140 run effect give @s minecraft:hunger 1 140 true -execute if score tree_size timber matches 141 run effect give @s minecraft:hunger 1 141 true -execute if score tree_size timber matches 142 run effect give @s minecraft:hunger 1 142 true -execute if score tree_size timber matches 143 run effect give @s minecraft:hunger 1 143 true -execute if score tree_size timber matches 144 run effect give @s minecraft:hunger 1 144 true -execute if score tree_size timber matches 145 run effect give @s minecraft:hunger 1 145 true -execute if score tree_size timber matches 146 run effect give @s minecraft:hunger 1 146 true -execute if score tree_size timber matches 147 run effect give @s minecraft:hunger 1 147 true -execute if score tree_size timber matches 148 run effect give @s minecraft:hunger 1 148 true -execute if score tree_size timber matches 149 run effect give @s minecraft:hunger 1 149 true -execute if score tree_size timber matches 150 run effect give @s minecraft:hunger 1 150 true -execute if score tree_size timber matches 151 run effect give @s minecraft:hunger 1 151 true -execute if score tree_size timber matches 152 run effect give @s minecraft:hunger 1 152 true -execute if score tree_size timber matches 153 run effect give @s minecraft:hunger 1 153 true -execute if score tree_size timber matches 154 run effect give @s minecraft:hunger 1 154 true -execute if score tree_size timber matches 155 run effect give @s minecraft:hunger 1 155 true -execute if score tree_size timber matches 156 run effect give @s minecraft:hunger 1 156 true -execute if score tree_size timber matches 157 run effect give @s minecraft:hunger 1 157 true -execute if score tree_size timber matches 158 run effect give @s minecraft:hunger 1 158 true -execute if score tree_size timber matches 159 run effect give @s minecraft:hunger 1 159 true -execute if score tree_size timber matches 160 run effect give @s minecraft:hunger 1 160 true -execute if score tree_size timber matches 161 run effect give @s minecraft:hunger 1 161 true -execute if score tree_size timber matches 162 run effect give @s minecraft:hunger 1 162 true -execute if score tree_size timber matches 163 run effect give @s minecraft:hunger 1 163 true -execute if score tree_size timber matches 164 run effect give @s minecraft:hunger 1 164 true -execute if score tree_size timber matches 165 run effect give @s minecraft:hunger 1 165 true -execute if score tree_size timber matches 166 run effect give @s minecraft:hunger 1 166 true -execute if score tree_size timber matches 167 run effect give @s minecraft:hunger 1 167 true -execute if score tree_size timber matches 168 run effect give @s minecraft:hunger 1 168 true -execute if score tree_size timber matches 169 run effect give @s minecraft:hunger 1 169 true -execute if score tree_size timber matches 170 run effect give @s minecraft:hunger 1 170 true -execute if score tree_size timber matches 171 run effect give @s minecraft:hunger 1 171 true -execute if score tree_size timber matches 172 run effect give @s minecraft:hunger 1 172 true -execute if score tree_size timber matches 173 run effect give @s minecraft:hunger 1 173 true -execute if score tree_size timber matches 174 run effect give @s minecraft:hunger 1 174 true -execute if score tree_size timber matches 175 run effect give @s minecraft:hunger 1 175 true -execute if score tree_size timber matches 176 run effect give @s minecraft:hunger 1 176 true -execute if score tree_size timber matches 177 run effect give @s minecraft:hunger 1 177 true -execute if score tree_size timber matches 178 run effect give @s minecraft:hunger 1 178 true -execute if score tree_size timber matches 179 run effect give @s minecraft:hunger 1 179 true -execute if score tree_size timber matches 180 run effect give @s minecraft:hunger 1 180 true -execute if score tree_size timber matches 181 run effect give @s minecraft:hunger 1 181 true -execute if score tree_size timber matches 182 run effect give @s minecraft:hunger 1 182 true -execute if score tree_size timber matches 183 run effect give @s minecraft:hunger 1 183 true -execute if score tree_size timber matches 184 run effect give @s minecraft:hunger 1 184 true -execute if score tree_size timber matches 185 run effect give @s minecraft:hunger 1 185 true -execute if score tree_size timber matches 186 run effect give @s minecraft:hunger 1 186 true -execute if score tree_size timber matches 187 run effect give @s minecraft:hunger 1 187 true -execute if score tree_size timber matches 188 run effect give @s minecraft:hunger 1 188 true -execute if score tree_size timber matches 189 run effect give @s minecraft:hunger 1 189 true -execute if score tree_size timber matches 190 run effect give @s minecraft:hunger 1 190 true -execute if score tree_size timber matches 191 run effect give @s minecraft:hunger 1 191 true -execute if score tree_size timber matches 192 run effect give @s minecraft:hunger 1 192 true -execute if score tree_size timber matches 193 run effect give @s minecraft:hunger 1 193 true -execute if score tree_size timber matches 194 run effect give @s minecraft:hunger 1 194 true -execute if score tree_size timber matches 195 run effect give @s minecraft:hunger 1 195 true -execute if score tree_size timber matches 196 run effect give @s minecraft:hunger 1 196 true -execute if score tree_size timber matches 197 run effect give @s minecraft:hunger 1 197 true -execute if score tree_size timber matches 198 run effect give @s minecraft:hunger 1 198 true -execute if score tree_size timber matches 199 run effect give @s minecraft:hunger 1 199 true -execute if score tree_size timber matches 200 run effect give @s minecraft:hunger 1 200 true -execute if score tree_size timber matches 201 run effect give @s minecraft:hunger 1 201 true -execute if score tree_size timber matches 202 run effect give @s minecraft:hunger 1 202 true -execute if score tree_size timber matches 203 run effect give @s minecraft:hunger 1 203 true -execute if score tree_size timber matches 204 run effect give @s minecraft:hunger 1 204 true -execute if score tree_size timber matches 205 run effect give @s minecraft:hunger 1 205 true -execute if score tree_size timber matches 206 run effect give @s minecraft:hunger 1 206 true -execute if score tree_size timber matches 207 run effect give @s minecraft:hunger 1 207 true -execute if score tree_size timber matches 208 run effect give @s minecraft:hunger 1 208 true -execute if score tree_size timber matches 209 run effect give @s minecraft:hunger 1 209 true -execute if score tree_size timber matches 210 run effect give @s minecraft:hunger 1 210 true -execute if score tree_size timber matches 211 run effect give @s minecraft:hunger 1 211 true -execute if score tree_size timber matches 212 run effect give @s minecraft:hunger 1 212 true -execute if score tree_size timber matches 213 run effect give @s minecraft:hunger 1 213 true -execute if score tree_size timber matches 214 run effect give @s minecraft:hunger 1 214 true -execute if score tree_size timber matches 215 run effect give @s minecraft:hunger 1 215 true -execute if score tree_size timber matches 216 run effect give @s minecraft:hunger 1 216 true -execute if score tree_size timber matches 217 run effect give @s minecraft:hunger 1 217 true -execute if score tree_size timber matches 218 run effect give @s minecraft:hunger 1 218 true -execute if score tree_size timber matches 219 run effect give @s minecraft:hunger 1 219 true -execute if score tree_size timber matches 220 run effect give @s minecraft:hunger 1 220 true -execute if score tree_size timber matches 221 run effect give @s minecraft:hunger 1 221 true -execute if score tree_size timber matches 222 run effect give @s minecraft:hunger 1 222 true -execute if score tree_size timber matches 223 run effect give @s minecraft:hunger 1 223 true -execute if score tree_size timber matches 224 run effect give @s minecraft:hunger 1 224 true -execute if score tree_size timber matches 225 run effect give @s minecraft:hunger 1 225 true -execute if score tree_size timber matches 226 run effect give @s minecraft:hunger 1 226 true -execute if score tree_size timber matches 227 run effect give @s minecraft:hunger 1 227 true -execute if score tree_size timber matches 228 run effect give @s minecraft:hunger 1 228 true -execute if score tree_size timber matches 229 run effect give @s minecraft:hunger 1 229 true -execute if score tree_size timber matches 230 run effect give @s minecraft:hunger 1 230 true -execute if score tree_size timber matches 231 run effect give @s minecraft:hunger 1 231 true -execute if score tree_size timber matches 232 run effect give @s minecraft:hunger 1 232 true -execute if score tree_size timber matches 233 run effect give @s minecraft:hunger 1 233 true -execute if score tree_size timber matches 234 run effect give @s minecraft:hunger 1 234 true -execute if score tree_size timber matches 235 run effect give @s minecraft:hunger 1 235 true -execute if score tree_size timber matches 236 run effect give @s minecraft:hunger 1 236 true -execute if score tree_size timber matches 237 run effect give @s minecraft:hunger 1 237 true -execute if score tree_size timber matches 238 run effect give @s minecraft:hunger 1 238 true -execute if score tree_size timber matches 239 run effect give @s minecraft:hunger 1 239 true -execute if score tree_size timber matches 240 run effect give @s minecraft:hunger 1 240 true -execute if score tree_size timber matches 241 run effect give @s minecraft:hunger 1 241 true -execute if score tree_size timber matches 242 run effect give @s minecraft:hunger 1 242 true -execute if score tree_size timber matches 243 run effect give @s minecraft:hunger 1 243 true -execute if score tree_size timber matches 244 run effect give @s minecraft:hunger 1 244 true -execute if score tree_size timber matches 245 run effect give @s minecraft:hunger 1 245 true -execute if score tree_size timber matches 246 run effect give @s minecraft:hunger 1 246 true -execute if score tree_size timber matches 247 run effect give @s minecraft:hunger 1 247 true -execute if score tree_size timber matches 248 run effect give @s minecraft:hunger 1 248 true -execute if score tree_size timber matches 249 run effect give @s minecraft:hunger 1 249 true -execute if score tree_size timber matches 250 run effect give @s minecraft:hunger 1 250 true -execute if score tree_size timber matches 251 run effect give @s minecraft:hunger 1 251 true -execute if score tree_size timber matches 252 run effect give @s minecraft:hunger 1 252 true -execute if score tree_size timber matches 253 run effect give @s minecraft:hunger 1 253 true -execute if score tree_size timber matches 254 run effect give @s minecraft:hunger 1 254 true -execute if score tree_size timber matches 255.. run effect give @s minecraft:hunger 1 255 true \ No newline at end of file diff --git a/18-41/data/timber/functions/utils/reset.mcfunction b/18-41/data/timber/functions/utils/reset.mcfunction deleted file mode 100644 index 3b6df1c..0000000 --- a/18-41/data/timber/functions/utils/reset.mcfunction +++ /dev/null @@ -1,24 +0,0 @@ -scoreboard players set running timber 0 - -# reset scores -scoreboard players set @s timber_w_axe 0 -scoreboard players set @s timber_s_axe 0 -scoreboard players set @s timber_i_axe 0 -scoreboard players set @s timber_g_axe 0 -scoreboard players set @s timber_d_axe 0 -scoreboard players set @s timber_n_axe 0 - -# remove markers -execute if score chop_fungi timber matches 1.. run kill @e[type=minecraft:item,nbt={Item:{components:{"minecraft:custom_data":{Tags:["timber_location"]}}}}] -#execute if score chop_fungi timber matches 1.. run clear @s knowledge_book{Tags:[timber_location]} -kill @e[type=minecraft:marker,tag=timber_tree,tag=!timber_slow_chop] -kill @e[type=minecraft:marker,tag=timber_log,tag=!timber_destroy] -kill @e[type=minecraft:marker,tag=timber_leaf,tag=!timber_destroy] -kill @e[type=minecraft:marker,tag=timber_root,tag=!timber_destroy] -kill @e[type=minecraft:marker,tag=timber_stem,tag=!timber_destroy] -kill @e[type=minecraft:marker,tag=timber_cap,tag=!timber_destroy] -kill @e[type=minecraft:marker,tag=timber_leaves_found] -kill @e[type=minecraft:marker,tag=timber_leaf_distance] -kill @e[type=minecraft:marker,tag=timber_other_stem] - -kill @e[type=minecraft:armor_stand,tag=timber_item_check] \ No newline at end of file diff --git a/18-41/data/timber/functions/utils/sneaking.mcfunction b/18-41/data/timber/functions/utils/sneaking.mcfunction deleted file mode 100644 index 1a6478b..0000000 --- a/18-41/data/timber/functions/utils/sneaking.mcfunction +++ /dev/null @@ -1,3 +0,0 @@ -# standing or sneaking enabled? -execute if score standing timber matches 1.. unless predicate timber:sneaking run function timber:run -execute if score sneaking timber matches 1.. if predicate timber:sneaking run function timber:run \ No newline at end of file diff --git a/18-41/data/timber/functions/utils/stopsound.mcfunction b/18-41/data/timber/functions/utils/stopsound.mcfunction deleted file mode 100644 index b9d5f78..0000000 --- a/18-41/data/timber/functions/utils/stopsound.mcfunction +++ /dev/null @@ -1,6 +0,0 @@ -stopsound @s block minecraft:block.grass.break -stopsound @s block minecraft:block.wood.break -stopsound @s block minecraft:block.wart_block.break -stopsound @s block minecraft:block.shroomlight.break -stopsound @s block minecraft:block.nether_wart.break -stopsound @s block minecraft:block.stem.break \ No newline at end of file diff --git a/18-41/data/timber/functions/utils/tp_item.mcfunction b/18-41/data/timber/functions/utils/tp_item.mcfunction deleted file mode 100644 index a01d4e1..0000000 --- a/18-41/data/timber/functions/utils/tp_item.mcfunction +++ /dev/null @@ -1,9 +0,0 @@ -# tp hand-broken loot into inventory - -tp @e[type=minecraft:item,sort=nearest,limit=1] @s - -#setblock ~ 255 ~ minecraft:yellow_shulker_box -#data modify block ~ 255 ~ Items append from entity @e[type=minecraft:item,sort=nearest,limit=1] Item -#kill @e[type=minecraft:item,sort=nearest,limit=1] -#loot give @s mine ~ 255 ~ minecraft:air{drop_contents:1b} -#setblock ~ 255 ~ minecraft:air \ No newline at end of file diff --git a/18-41/data/timber/functions/utils/used_axe.mcfunction b/18-41/data/timber/functions/utils/used_axe.mcfunction deleted file mode 100644 index 5e7f9b6..0000000 --- a/18-41/data/timber/functions/utils/used_axe.mcfunction +++ /dev/null @@ -1,18 +0,0 @@ -# is this axe enabled? -execute unless score @s timber_disabled matches 1.. if score @s timber_w_axe matches 1.. if score wooden_axe timber matches 1.. run function timber:utils/sneaking -execute unless score @s timber_disabled matches 1.. if score @s timber_s_axe matches 1.. if score stone_axe timber matches 1.. run function timber:utils/sneaking -execute unless score @s timber_disabled matches 1.. if score @s timber_i_axe matches 1.. if score iron_axe timber matches 1.. run function timber:utils/sneaking -execute unless score @s timber_disabled matches 1.. if score @s timber_g_axe matches 1.. if score golden_axe timber matches 1.. run function timber:utils/sneaking -execute unless score @s timber_disabled matches 1.. if score @s timber_d_axe matches 1.. if score diamond_axe timber matches 1.. run function timber:utils/sneaking -execute unless score @s timber_disabled matches 1.. if score @s timber_n_axe matches 1.. if score netherite_axe timber matches 1.. run function timber:utils/sneaking - -# remove mushroom_stem marker -kill @e[type=minecraft:item,distance=..7,nbt={Item:{components:{"minecraft:custom_data":{Tags:["timber_location"]}}}}] - -# reset scores -scoreboard players set @s timber_w_axe 0 -scoreboard players set @s timber_s_axe 0 -scoreboard players set @s timber_i_axe 0 -scoreboard players set @s timber_g_axe 0 -scoreboard players set @s timber_d_axe 0 -scoreboard players set @s timber_n_axe 0 \ No newline at end of file diff --git a/18-41/data/timber/functions/validated.mcfunction b/18-41/data/timber/functions/validated.mcfunction deleted file mode 100644 index b00df5e..0000000 --- a/18-41/data/timber/functions/validated.mcfunction +++ /dev/null @@ -1,51 +0,0 @@ -# when full inventory fix -execute if score drop_loot timber matches 1.. store result score inventory timber run data get entity @s Inventory -execute if score drop_loot timber matches 1.. if entity @s[nbt={Inventory:[{Slot:100b}]}] run scoreboard players remove inventory timber 1 -execute if score drop_loot timber matches 1.. if entity @s[nbt={Inventory:[{Slot:101b}]}] run scoreboard players remove inventory timber 1 -execute if score drop_loot timber matches 1.. if entity @s[nbt={Inventory:[{Slot:102b}]}] run scoreboard players remove inventory timber 1 -execute if score drop_loot timber matches 1.. if entity @s[nbt={Inventory:[{Slot:103b}]}] run scoreboard players remove inventory timber 1 -execute if score drop_loot timber matches 1.. if entity @s[nbt={Inventory:[{Slot:-106b}]}] run scoreboard players remove inventory timber 1 - -# destroy blocks - # mark blocks that need to be destroyed - tag @e[type=minecraft:marker,tag=timber_log] add timber_destroy - execute if score destroy_leaves timber matches 1.. run tag @e[type=minecraft:marker,tag=timber_leaf] add timber_destroy - execute if score destroy_roots timber matches 1.. run tag @e[type=minecraft:marker,tag=timber_root] add timber_destroy - tag @e[type=minecraft:marker,tag=timber_stem] add timber_destroy - tag @e[type=minecraft:marker,tag=timber_cap] add timber_destroy - # api - execute unless score slow_chop timber matches 1.. at @e[type=minecraft:marker,tag=timber_log] run function #timber:api/break_log - execute unless score slow_chop timber matches 1.. at @e[type=minecraft:marker,tag=timber_leaf] run function #timber:api/break_leaf - execute unless score slow_chop timber matches 1.. at @e[type=minecraft:marker,tag=timber_root] run function #timber:api/break_root - execute unless score slow_chop timber matches 1.. at @e[type=minecraft:marker,tag=timber_stem] run function #timber:api/break_stem - execute unless score slow_chop timber matches 1.. at @e[type=minecraft:marker,tag=timber_cap] run function #timber:api/break_cap - # loot - execute unless score slow_chop timber matches 1.. unless score drop_loot timber matches 1.. at @e[type=minecraft:marker,tag=timber_destroy] run loot spawn ~ ~ ~ mine ~ ~ ~ mainhand - execute unless score slow_chop timber matches 1.. if score drop_loot timber matches 1.. unless score inventory timber matches 36.. at @e[type=minecraft:marker,tag=timber_destroy] run loot give @s mine ~ ~ ~ mainhand - execute unless score slow_chop timber matches 1.. if score drop_loot timber matches 1.. if score inventory timber matches 36.. at @e[type=minecraft:marker,tag=timber_destroy] run loot spawn ~ ~ ~ mine ~ ~ ~ mainhand - # destroy animation (doTileDrops can be changed, because datapack wouldn't get to this point otherwise) - gamerule doTileDrops false - execute unless score slow_chop timber matches 1.. at @e[type=minecraft:marker,tag=timber_destroy] run setblock ~ ~ ~ minecraft:air destroy - gamerule doTileDrops true - # remove destroy marker - execute unless score slow_chop timber matches 1.. run kill @e[type=minecraft:marker,tag=timber_destroy] - -# stop sound -execute if score stopsound timber matches 1.. as @a[distance=..20,tag=!global.ignore.gui] run function timber:utils/stopsound - -# save tool for slow chopping process -execute if score slow_chop timber matches 1.. at @e[type=minecraft:marker,tag=timber_tree,tag=!timber_slow_chop,distance=..7,sort=arbitrary,limit=1] run summon minecraft:armor_stand ~ -64 ~ {Silent:1b,Invulnerable:1b,Marker:1b,Invisible:1b,Tags:["timber_tool"],Rotation:[45f],Pose:{RightArm:[0f,270f,0f]}} -execute if score slow_chop timber matches 1.. at @e[type=minecraft:marker,tag=timber_tree,tag=!timber_slow_chop,distance=..7,sort=arbitrary,limit=1] run data modify entity @e[type=minecraft:armor_stand,tag=timber_tool,y=-64,distance=...1,sort=arbitrary,limit=1] HandItems[0] merge from entity @s SelectedItem -execute if score slow_chop timber matches 1.. run tag @e[type=minecraft:marker,tag=timber_tree,tag=!timber_slow_chop,distance=..7,sort=arbitrary,limit=1] add timber_slow_chop - -# tp hand-broken loot into inventory -execute if score drop_loot timber matches 1.. unless score inventory timber matches 36.. at @e[type=minecraft:marker,tag=timber_tree,tag=!timber_slow_chop,distance=..7,sort=arbitrary,limit=1] run function timber:utils/tp_item - -# wear out tool -execute if score wear_out timber matches 1.. unless score unbreakable timber matches 1 run function timber:tool/wear_out - -# break axe if worn out -execute if score wear_out timber matches 1.. unless score unbreakable timber matches 1 run function timber:tool/worn_out - -# give hunger effect -execute if score hunger timber matches 1.. run function timber:utils/hunger \ No newline at end of file diff --git a/18-41/data/timber/item_modifiers/wear_out.json b/18-41/data/timber/item_modifiers/wear_out.json deleted file mode 100644 index 63fd89d..0000000 --- a/18-41/data/timber/item_modifiers/wear_out.json +++ /dev/null @@ -1,152 +0,0 @@ -[ - { - "function": "minecraft:set_damage", - "damage": { - "type": "minecraft:score", - "target": { - "type": "minecraft:fixed", - "name": "damage" - }, - "score": "timber", - "scale": 0.01694915254237288 - }, - "conditions": [ - { - "condition": "minecraft:entity_properties", - "entity": "this", - "predicate": { - "equipment": { - "mainhand": { - "items": "minecraft:wooden_axe" - } - } - } - } - ] - }, - { - "function": "minecraft:set_damage", - "damage": { - "type": "minecraft:score", - "target": { - "type": "minecraft:fixed", - "name": "damage" - }, - "score": "timber", - "scale": 0.007633587786259542 - }, - "conditions": [ - { - "condition": "minecraft:entity_properties", - "entity": "this", - "predicate": { - "equipment": { - "mainhand": { - "items": "minecraft:stone_axe" - } - } - } - } - ] - }, - { - "function": "minecraft:set_damage", - "damage": { - "type": "minecraft:score", - "target": { - "type": "minecraft:fixed", - "name": "damage" - }, - "score": "timber", - "scale": 0.004 - }, - "conditions": [ - { - "condition": "minecraft:entity_properties", - "entity": "this", - "predicate": { - "equipment": { - "mainhand": { - "items": "minecraft:iron_axe" - } - } - } - } - ] - }, - { - "function": "minecraft:set_damage", - "damage": { - "type": "minecraft:score", - "target": { - "type": "minecraft:fixed", - "name": "damage" - }, - "score": "timber", - "scale": 0.03125 - }, - "conditions": [ - { - "condition": "minecraft:entity_properties", - "entity": "this", - "predicate": { - "equipment": { - "mainhand": { - "items": "minecraft:golden_axe" - } - } - } - } - ] - }, - { - "function": "minecraft:set_damage", - "damage": { - "type": "minecraft:score", - "target": { - "type": "minecraft:fixed", - "name": "damage" - }, - "score": "timber", - "scale": 0.0006393861892583121 - }, - "conditions": [ - { - "condition": "minecraft:entity_properties", - "entity": "this", - "predicate": { - "equipment": { - "mainhand": { - "items": "minecraft:diamond_axe" - } - } - } - } - ] - }, - { - "function": "minecraft:set_damage", - "damage": { - "type": "minecraft:score", - "target": { - "type": "minecraft:fixed", - "name": "damage" - }, - "score": "timber", - "scale": 0.0004923682914820286 - }, - "conditions": [ - { - "condition": "minecraft:entity_properties", - "entity": "this", - "predicate": { - "equipment": { - "mainhand": { - "items": "minecraft:netherite_axe" - } - } - } - } - ] - } -] \ No newline at end of file diff --git a/18-41/data/timber/predicates/block/cap.json b/18-41/data/timber/predicates/block/cap.json deleted file mode 100644 index 807ada7..0000000 --- a/18-41/data/timber/predicates/block/cap.json +++ /dev/null @@ -1,37 +0,0 @@ -{ - "condition": "minecraft:any_of", - "terms": [ - { - "condition": "minecraft:location_check", - "predicate": { - "block": { - "blocks": "#minecraft:wart_blocks" - } - } - }, - { - "condition": "minecraft:location_check", - "predicate": { - "block": { - "blocks": "minecraft:shroomlight" - } - } - }, - { - "condition": "minecraft:location_check", - "predicate": { - "block": { - "blocks": "minecraft:brown_mushroom_block" - } - } - }, - { - "condition": "minecraft:location_check", - "predicate": { - "block": { - "blocks": "minecraft:red_mushroom_block" - } - } - } - ] -} \ No newline at end of file diff --git a/18-41/data/timber/predicates/block/leaf.json b/18-41/data/timber/predicates/block/leaf.json deleted file mode 100644 index 14d5368..0000000 --- a/18-41/data/timber/predicates/block/leaf.json +++ /dev/null @@ -1,24 +0,0 @@ -{ - "condition": "minecraft:any_of", - "terms": [ - { - "condition": "minecraft:location_check", - "predicate": { - "block": { - "blocks": "#minecraft:leaves" - } - } - }, - { - "condition": "minecraft:location_check", - "predicate": { - "block": { - "blocks": "minecraft:mangrove_propagule", - "state": { - "hanging": "true" - } - } - } - } - ] -} \ No newline at end of file diff --git a/18-41/data/timber/predicates/block/log.json b/18-41/data/timber/predicates/block/log.json deleted file mode 100644 index 3b960aa..0000000 --- a/18-41/data/timber/predicates/block/log.json +++ /dev/null @@ -1,8 +0,0 @@ -{ - "condition": "minecraft:location_check", - "predicate": { - "block": { - "blocks": "#minecraft:logs" - } - } -} diff --git a/18-41/data/timber/predicates/block/stem.json b/18-41/data/timber/predicates/block/stem.json deleted file mode 100644 index 591f3db..0000000 --- a/18-41/data/timber/predicates/block/stem.json +++ /dev/null @@ -1,21 +0,0 @@ -{ - "condition": "minecraft:any_of", - "terms": [ - { - "condition": "minecraft:location_check", - "predicate": { - "block": { - "blocks": "#minecraft:logs" - } - } - }, - { - "condition": "minecraft:location_check", - "predicate": { - "block": { - "blocks": "minecraft:mushroom_stem" - } - } - } - ] -} \ No newline at end of file diff --git a/18-41/data/timber/predicates/item/log.json b/18-41/data/timber/predicates/item/log.json deleted file mode 100644 index 7fea675..0000000 --- a/18-41/data/timber/predicates/item/log.json +++ /dev/null @@ -1,11 +0,0 @@ -{ - "condition": "minecraft:entity_properties", - "entity": "this", - "predicate": { - "equipment": { - "mainhand": { - "items": "#minecraft:logs" - } - } - } -} \ No newline at end of file diff --git a/18-41/data/timber/predicates/item/root.json b/18-41/data/timber/predicates/item/root.json deleted file mode 100644 index f746554..0000000 --- a/18-41/data/timber/predicates/item/root.json +++ /dev/null @@ -1,11 +0,0 @@ -{ - "condition": "minecraft:entity_properties", - "entity": "this", - "predicate": { - "equipment": { - "mainhand": { - "items": "minecraft:mangrove_roots" - } - } - } -} \ No newline at end of file diff --git a/18-41/data/timber/predicates/item/sapling.json b/18-41/data/timber/predicates/item/sapling.json deleted file mode 100644 index 31bd5c7..0000000 --- a/18-41/data/timber/predicates/item/sapling.json +++ /dev/null @@ -1,11 +0,0 @@ -{ - "condition": "minecraft:entity_properties", - "entity": "this", - "predicate": { - "equipment": { - "mainhand": { - "items": "#minecraft:saplings" - } - } - } -} \ No newline at end of file diff --git a/18-41/data/timber/predicates/item/stem.json b/18-41/data/timber/predicates/item/stem.json deleted file mode 100644 index 43b5e29..0000000 --- a/18-41/data/timber/predicates/item/stem.json +++ /dev/null @@ -1,45 +0,0 @@ -{ - "condition": "minecraft:any_of", - "terms": [ - { - "condition": "minecraft:entity_properties", - "entity": "this", - "predicate": { - "equipment": { - "mainhand": { - "items": "#minecraft:logs" - } - } - } - }, - { - "condition": "minecraft:entity_properties", - "entity": "this", - "predicate": { - "equipment": { - "mainhand": { - "items": "minecraft:mushroom_stem" - } - } - } - }, - { - "condition": "minecraft:entity_properties", - "entity": "this", - "predicate": { - "equipment": { - "mainhand": { - "items": "minecraft:knowledge_book", - "components": { - "minecraft:custom_data": { - "Tags": [ - "timber_location" - ] - } - } - } - } - } - } - ] -} \ No newline at end of file diff --git a/18-41/data/timber/predicates/random_chance/0.25.json b/18-41/data/timber/predicates/random_chance/0.25.json deleted file mode 100644 index 9740f91..0000000 --- a/18-41/data/timber/predicates/random_chance/0.25.json +++ /dev/null @@ -1,4 +0,0 @@ -{ - "condition": "minecraft:random_chance", - "chance": 0.25 - } \ No newline at end of file diff --git a/18-41/data/timber/predicates/random_chance/0.333.json b/18-41/data/timber/predicates/random_chance/0.333.json deleted file mode 100644 index 52e5ecf..0000000 --- a/18-41/data/timber/predicates/random_chance/0.333.json +++ /dev/null @@ -1,4 +0,0 @@ -{ - "condition": "minecraft:random_chance", - "chance": 0.333 - } \ No newline at end of file diff --git a/18-41/data/timber/predicates/random_chance/0.5.json b/18-41/data/timber/predicates/random_chance/0.5.json deleted file mode 100644 index 66c2b14..0000000 --- a/18-41/data/timber/predicates/random_chance/0.5.json +++ /dev/null @@ -1,4 +0,0 @@ -{ - "condition": "minecraft:random_chance", - "chance": 0.5 - } \ No newline at end of file diff --git a/18-41/data/timber/predicates/sneaking.json b/18-41/data/timber/predicates/sneaking.json deleted file mode 100644 index a41c89c..0000000 --- a/18-41/data/timber/predicates/sneaking.json +++ /dev/null @@ -1,9 +0,0 @@ -{ - "condition": "minecraft:entity_properties", - "entity": "this", - "predicate": { - "flags": { - "is_sneaking": true - } - } -} \ No newline at end of file diff --git a/18-41/data/timber/predicates/used_axe.json b/18-41/data/timber/predicates/used_axe.json deleted file mode 100644 index ac00bc4..0000000 --- a/18-41/data/timber/predicates/used_axe.json +++ /dev/null @@ -1,59 +0,0 @@ -{ - "condition": "minecraft:any_of", - "terms": [ - { - "condition": "minecraft:entity_scores", - "entity": "this", - "scores": { - "timber_w_axe": { - "min": 1 - } - } - }, - { - "condition": "minecraft:entity_scores", - "entity": "this", - "scores": { - "timber_s_axe": { - "min": 1 - } - } - }, - { - "condition": "minecraft:entity_scores", - "entity": "this", - "scores": { - "timber_i_axe": { - "min": 1 - } - } - }, - { - "condition": "minecraft:entity_scores", - "entity": "this", - "scores": { - "timber_g_axe": { - "min": 1 - } - } - }, - { - "condition": "minecraft:entity_scores", - "entity": "this", - "scores": { - "timber_d_axe": { - "min": 1 - } - } - }, - { - "condition": "minecraft:entity_scores", - "entity": "this", - "scores": { - "timber_n_axe": { - "min": 1 - } - } - } - ] -} \ No newline at end of file diff --git a/18-41/data/timber/tags/functions/api/break_cap.json b/18-41/data/timber/tags/functions/api/break_cap.json deleted file mode 100644 index ab3fce9..0000000 --- a/18-41/data/timber/tags/functions/api/break_cap.json +++ /dev/null @@ -1,4 +0,0 @@ -{ - "values":[ - ] -} \ No newline at end of file diff --git a/18-41/data/timber/tags/functions/api/break_leaf.json b/18-41/data/timber/tags/functions/api/break_leaf.json deleted file mode 100644 index ab3fce9..0000000 --- a/18-41/data/timber/tags/functions/api/break_leaf.json +++ /dev/null @@ -1,4 +0,0 @@ -{ - "values":[ - ] -} \ No newline at end of file diff --git a/18-41/data/timber/tags/functions/api/break_log.json b/18-41/data/timber/tags/functions/api/break_log.json deleted file mode 100644 index ab3fce9..0000000 --- a/18-41/data/timber/tags/functions/api/break_log.json +++ /dev/null @@ -1,4 +0,0 @@ -{ - "values":[ - ] -} \ No newline at end of file diff --git a/18-41/data/timber/tags/functions/api/break_root.json b/18-41/data/timber/tags/functions/api/break_root.json deleted file mode 100644 index ab3fce9..0000000 --- a/18-41/data/timber/tags/functions/api/break_root.json +++ /dev/null @@ -1,4 +0,0 @@ -{ - "values":[ - ] -} \ No newline at end of file diff --git a/18-41/data/timber/tags/functions/api/break_stem.json b/18-41/data/timber/tags/functions/api/break_stem.json deleted file mode 100644 index ab3fce9..0000000 --- a/18-41/data/timber/tags/functions/api/break_stem.json +++ /dev/null @@ -1,4 +0,0 @@ -{ - "values":[ - ] -} \ No newline at end of file diff --git a/18-41/data/timber/tags/functions/help.json b/18-41/data/timber/tags/functions/help.json deleted file mode 100644 index 082ff6b..0000000 --- a/18-41/data/timber/tags/functions/help.json +++ /dev/null @@ -1,5 +0,0 @@ -{ - "values":[ - "timber:help" - ] -} \ No newline at end of file diff --git a/18-41/data/timber/tags/items/axes.json b/18-41/data/timber/tags/items/axes.json deleted file mode 100644 index c496215..0000000 --- a/18-41/data/timber/tags/items/axes.json +++ /dev/null @@ -1,10 +0,0 @@ -{ - "values":[ - "minecraft:wooden_axe", - "minecraft:stone_axe", - "minecraft:iron_axe", - "minecraft:golden_axe", - "minecraft:diamond_axe", - "minecraft:netherite_axe" - ] -} \ No newline at end of file diff --git a/18-61/data/timber/function/algorithm/fungus/run.mcfunction b/18-61/data/timber/function/algorithm/fungus/run.mcfunction deleted file mode 100644 index 6db2dbe..0000000 --- a/18-61/data/timber/function/algorithm/fungus/run.mcfunction +++ /dev/null @@ -1,5 +0,0 @@ -# check if item is a stem -summon minecraft:armor_stand ~ ~ ~ {Silent:1b,Invulnerable:1b,Marker:1b,Invisible:1b,Tags:["timber_item_check"]} -data modify entity @e[type=minecraft:armor_stand,tag=timber_item_check,distance=...1,sort=arbitrary,limit=1] HandItems[0] set from entity @e[distance=...1,type=minecraft:item,sort=nearest,limit=1,nbt={Age:0s}] Item -execute if entity @e[type=minecraft:armor_stand,tag=timber_item_check,distance=...1,sort=arbitrary,limit=1,predicate=timber:item/stem] run function timber:algorithm/fungus/chop -kill @e[type=minecraft:armor_stand,tag=timber_item_check,distance=...1,sort=arbitrary,limit=1] \ No newline at end of file diff --git a/18-61/data/timber/function/algorithm/tree/run.mcfunction b/18-61/data/timber/function/algorithm/tree/run.mcfunction deleted file mode 100644 index 172c583..0000000 --- a/18-61/data/timber/function/algorithm/tree/run.mcfunction +++ /dev/null @@ -1,6 +0,0 @@ -# check if item is in tag #minecraft:logs -summon minecraft:armor_stand ~ ~ ~ {Silent:1b,Invulnerable:1b,Marker:1b,Invisible:1b,Tags:["timber_item_check"]} -data modify entity @e[type=minecraft:armor_stand,tag=timber_item_check,distance=...1,sort=arbitrary,limit=1] HandItems[0] set from entity @e[type=minecraft:item,distance=...1,sort=nearest,limit=1,nbt={Age:0s}] Item -execute if entity @e[type=minecraft:armor_stand,tag=timber_item_check,distance=...1,sort=arbitrary,limit=1,predicate=timber:item/log] run function timber:algorithm/tree/chop -execute if score start_chop_on_root timber matches 1.. if entity @e[type=minecraft:armor_stand,tag=timber_item_check,distance=...1,sort=arbitrary,limit=1,predicate=timber:item/root] run function timber:algorithm/tree/chop_roots -kill @e[type=minecraft:armor_stand,tag=timber_item_check,distance=...1,sort=arbitrary,limit=1] diff --git a/18-61/data/timber/function/autoplant/validate.mcfunction b/18-61/data/timber/function/autoplant/validate.mcfunction deleted file mode 100644 index e84bccf..0000000 --- a/18-61/data/timber/function/autoplant/validate.mcfunction +++ /dev/null @@ -1,8 +0,0 @@ -# don't check items twice (except saplings, look in plant.mcfunction) -tag @s add timber_checked - -# check if item is in tag #minecraft:sapling -summon minecraft:armor_stand ~ ~ ~ {Silent:1b,Invulnerable:1b,Marker:1b,Invisible:1b,Tags:["timber_item_check"]} -data modify entity @e[type=minecraft:armor_stand,tag=timber_item_check,distance=...1,sort=arbitrary,limit=1] HandItems[0] set from entity @s Item -execute if entity @e[type=minecraft:armor_stand,tag=timber_item_check,distance=...1,sort=arbitrary,limit=1,predicate=timber:item/sapling] run function timber:autoplant/plant -kill @e[type=minecraft:armor_stand,tag=timber_item_check,distance=...1,sort=arbitrary,limit=1] \ No newline at end of file diff --git a/18-61/data/timber/function/help.mcfunction b/18-61/data/timber/function/help.mcfunction deleted file mode 100644 index 6051b57..0000000 --- a/18-61/data/timber/function/help.mcfunction +++ /dev/null @@ -1,25 +0,0 @@ -tellraw @s ["",{"text":"\u00A7m ","color":"dark_gray"}] - -tellraw @s ["",{"text":" Timber Datapack"}] - -tellraw @s ["",{"text":"\u00A7m ","color":"dark_gray"}] - -tellraw @s ["",{"text":"The Timber Datapack allows you to instantly chop down a tree just by breaking one log with any axe."}] - -tellraw @s ["",{"text":"By default, sneaking while breaking will not chop the tree."}] - -tellraw @s [""] - -tellraw @s ["",{"text":"Every player can use "},{"text":"/trigger TimberToggle","color":"blue","clickEvent":{"action":"suggest_command","value":"/trigger TimberToggle"}},{"text":" to individually turn the datapack on or off."}] - -tellraw @s [""] - -tellraw @s ["",{"text":"Snapshot (work in progress) version"}] - -tellraw @s [""] - -tellraw @s [""," ",{"text":"[click here to see the settings]","color":"gold","clickEvent":{"action":"run_command","value":"/function timber:settings/settings1_click"}}] - -tellraw @s ["",{"text":"\u00A7m ","color":"dark_gray"}] - -function timber:settings/end_of_message \ No newline at end of file diff --git a/18-61/data/timber/function/init.mcfunction b/18-61/data/timber/function/init.mcfunction deleted file mode 100644 index 1d2cbf0..0000000 --- a/18-61/data/timber/function/init.mcfunction +++ /dev/null @@ -1,39 +0,0 @@ -# longer maxCommandChainLength -gamerule maxCommandChainLength 1000000000 - -# create scoreboards -scoreboard objectives add timber_w_axe minecraft.used:minecraft.wooden_axe -scoreboard objectives add timber_s_axe minecraft.used:minecraft.stone_axe -scoreboard objectives add timber_i_axe minecraft.used:minecraft.iron_axe -scoreboard objectives add timber_g_axe minecraft.used:minecraft.golden_axe -scoreboard objectives add timber_d_axe minecraft.used:minecraft.diamond_axe -scoreboard objectives add timber_n_axe minecraft.used:minecraft.netherite_axe -scoreboard objectives add timber dummy -scoreboard objectives add TimberToggle trigger {"text":"Timber Toggle","color":"#724E21"} -scoreboard objectives add timber_disabled dummy -scoreboard objectives add timber_prsistent dummy - -# non-overriding default values -function timber:settings/default_values -function timber:tool/durability_max -scoreboard players set running timber 0 - -# start optional loops -execute if score plant_sapling timber matches 1.. run function timber:autoplant/loop -execute if score slow_chop timber matches 1.. run function timber:slow_chop/loop - -# check loottable compatibility of mushroom stem -setblock ~ 255 ~ minecraft:chest -setblock ~ 255 ~1 minecraft:mushroom_stem -loot insert ~ 255 ~ mine ~ 255 ~1 minecraft:diamond_axe -execute unless data block ~ 255 ~ Items[{id:"minecraft:knowledge_book",components:{"minecraft:custom_data":{Tags:["timber_location"]}}}] run tellraw @a[tag=!noTimberWarning] ["",{"text":"Timber Datapack Warning: ","color":"red"},{"text":"Incompatibility with the mushroom_stem loottable of another datapack!"}] -fill ~-1 255 ~-1 ~1 255 ~1 minecraft:air -execute store result score doTileDrops timber run gamerule doTileDrops -execute if score doTileDrops timber matches 0 run tellraw @a[tag=!noTimberWarning] ["",{"text":"Timber Datapack Warning: ","color":"red"},{"text":"This datapack only works when gamerule doTileDrops is set to true!"}] - -# Getting the game version and checking if it is compatible with the datapack https://minecraft.fandom.com/wiki/Data_version -execute store result score game_version timber run data get entity @r DataVersion -execute if score game_version timber matches ..3442 run tellraw @a[tag=!noTimberWarning] ["",{"text":"Timber Datapack Warning: ","color":"red"},{"text":"This datapack is not compatible with all the versions before 1.20!"}] - -# Checking if the server uses a different jar from the vanilla one -function timber:utils/check_server \ No newline at end of file diff --git a/18-61/data/timber/function/settings/settings1.mcfunction b/18-61/data/timber/function/settings/settings1.mcfunction deleted file mode 100644 index 140256c..0000000 --- a/18-61/data/timber/function/settings/settings1.mcfunction +++ /dev/null @@ -1,57 +0,0 @@ -tellraw @s ["",{"text":" "}] -tellraw @s ["",{"text":" "}] -tellraw @s ["",{"text":" "}] -tellraw @s ["",{"text":" "}] - -tellraw @s ["",{"text":"\u00A7m ","color":"dark_gray"}] - -tellraw @s ["",{"text":" Timber "},{"text":"/","color":"gray"},{"text":" Global Settings "},{"text":" < ","clickEvent":{"action":"run_command","value":"/function timber:settings/settings1_click"}},{"text":"1/2"},{"text":" > ","clickEvent":{"action":"run_command","value":"/function timber:settings/settings2_click"}}] - -tellraw @s ["",{"text":"\u00A7m ","color":"dark_gray"}] - -execute if score standing timber matches 1.. run tellraw @s ["",{"text":"[ ✔ ]","color":"green","clickEvent":{"action":"run_command","value":"/function timber:settings/toggle/standing"}},{"text":" Works When Standing"}] -execute unless score standing timber matches 1.. run tellraw @s ["",{"text":"[ ❌ ]","color":"red","clickEvent":{"action":"run_command","value":"/function timber:settings/toggle/standing"}},{"text":" Works When Standing"}] - -execute if score sneaking timber matches 1.. run tellraw @s ["",{"text":"[ ✔ ]","color":"green","clickEvent":{"action":"run_command","value":"/function timber:settings/toggle/sneaking"}},{"text":" Works When Sneaking"}] -execute unless score sneaking timber matches 1.. run tellraw @s ["",{"text":"[ ❌ ]","color":"red","clickEvent":{"action":"run_command","value":"/function timber:settings/toggle/sneaking"}},{"text":" Works When Sneaking"}] - -execute if score destroy_leaves timber matches 1.. run tellraw @s ["",{"text":"[ ✔ ]","color":"green","clickEvent":{"action":"run_command","value":"/function timber:settings/toggle/destroy_leaves"}},{"text":" Destroy Leaves"}] -execute unless score destroy_leaves timber matches 1.. run tellraw @s ["",{"text":"[ ❌ ]","color":"red","clickEvent":{"action":"run_command","value":"/function timber:settings/toggle/destroy_leaves"}},{"text":" Destroy Leaves"}] - -execute if score plant_sapling timber matches 1.. run tellraw @s ["",{"text":"[ ✔ ]","color":"green","clickEvent":{"action":"run_command","value":"/function timber:settings/toggle/plant_sapling"}},{"text":" Auto Plant Saplings","hoverEvent":{"action":"show_text","value":["",{"text":"All kind of saplings laying on the ground will get planted every 2 seconds."},{"text":"\n\nWhen a sapling get placed on mud, it turns into muddy mangrove roots for a fraction of a second due to datapack limitations.","color":"gray"}]}}] -execute unless score plant_sapling timber matches 1.. run tellraw @s ["",{"text":"[ ❌ ]","color":"red","clickEvent":{"action":"run_command","value":"/function timber:settings/toggle/plant_sapling"}},{"text":" Auto Plant Saplings","hoverEvent":{"action":"show_text","value":["",{"text":"All kind of saplings laying on the ground will get planted every 2 seconds."},{"text":"\n\nWhen a sapling get placed on mud, it turns into muddy mangrove roots for a fraction of a second due to datapack limitations.","color":"gray"}]}}] - -execute if score destroy_roots timber matches 1.. run tellraw @s ["",{"text":"[ ✔ ]","color":"green","clickEvent":{"action":"run_command","value":"/function timber:settings/toggle/destroy_roots"}},{"text":" Destroy Roots","hoverEvent":{"action":"show_text","value":["",{"text":"Only root blocks which are not in the ground count."}]}}] -execute unless score destroy_roots timber matches 1.. run tellraw @s ["",{"text":"[ ❌ ]","color":"red","clickEvent":{"action":"run_command","value":"/function timber:settings/toggle/destroy_roots"}},{"text":" Destroy Roots","hoverEvent":{"action":"show_text","value":["",{"text":"Only root blocks which are not in the ground count."}]}}] - -execute if score start_chop_on_root timber matches 1.. run tellraw @s ["",{"text":"[ ✔ ]","color":"green","clickEvent":{"action":"run_command","value":"/function timber:settings/toggle/start_chop_on_root"}},{"text":" Chop Tree When Roots Get Destroyed","hoverEvent":{"action":"show_text","value":["",{"text":"The datapack will chop the tree if you break its root blocks.\nOnly root blocks which are not in the ground count."}]}}] -execute unless score start_chop_on_root timber matches 1.. run tellraw @s ["",{"text":"[ ❌ ]","color":"red","clickEvent":{"action":"run_command","value":"/function timber:settings/toggle/start_chop_on_root"}},{"text":" Chop Tree When Roots Get Destroyed","hoverEvent":{"action":"show_text","value":["",{"text":"The datapack will chop the tree if you break its root blocks.\nOnly root blocks which are not in the ground count."}]}}] - -execute if score slow_chop timber matches 1.. run tellraw @s ["",{"text":"[ ✔ ]","color":"green","clickEvent":{"action":"run_command","value":"/function timber:settings/toggle/slow_chop"}},{"text":" Chop Slowly","hoverEvent":{"action":"show_text","value":["",{"text":"The tree won't be chopped instantly anymore. Additional options to change the speed of the chopping process can be changed at the next page."},{"text":"\n\nThis option can increase performance.","color":"gray"}]}}] -execute unless score slow_chop timber matches 1.. unless score drop_loot timber matches 1.. run tellraw @s ["",{"text":"[ ❌ ]","color":"red","clickEvent":{"action":"run_command","value":"/function timber:settings/toggle/slow_chop"}},{"text":" Chop Slowly","hoverEvent":{"action":"show_text","value":["",{"text":"The tree won't be chopped instantly anymore. Additional options to change the speed of the chopping process can be changed at the next page."},{"text":"\n\nThis option can increase performance.","color":"gray"}]}}] -execute unless score slow_chop timber matches 1.. if score drop_loot timber matches 1.. run tellraw @s ["",{"text":"[ ❌ ]","color":"#7F2B2B","hoverEvent":{"action":"show_text","value":"Can't be enabled when \"Drop Loot Straight into Inventory\" is enabled."}},{"text":" Chop Slowly","hoverEvent":{"action":"show_text","value":["",{"text":"The tree won't be chopped instantly anymore. Additional options to change the speed of the chopping process can be changed at the next page."},{"text":"\n\nThis option can increase performance.","color":"gray"}]}}] - -execute if score chop_down timber matches 1.. run tellraw @s ["",{"text":"[ ✔ ]","color":"green","clickEvent":{"action":"run_command","value":"/function timber:settings/toggle/chop_down"}},{"text":" Enable Chopping Down","hoverEvent":{"action":"show_text","value":"Normally when you cut a tree in the middle only the top part of the tree gets destroyed. But if this option is enabled the bottom part will get destroyed as well."}}] -execute unless score chop_down timber matches 1.. run tellraw @s ["",{"text":"[ ❌ ]","color":"red","clickEvent":{"action":"run_command","value":"/function timber:settings/toggle/chop_down"}},{"text":" Enable Chopping Down","hoverEvent":{"action":"show_text","value":"Normally when you cut a tree in the middle only the top part of the tree gets destroyed. But if this option is enabled the bottom part will get destroyed as well."}}] - -execute if score stop_chopping timber matches 1.. run tellraw @s ["",{"text":"[ ✔ ]","color":"green","clickEvent":{"action":"run_command","value":"/function timber:settings/toggle/stop_chopping"}},{"text":" Stop Chopping Once Axe Breaks","hoverEvent":{"action":"show_text","value":"Stops the process of chopping the tree as soon as your axe doesn't have any durability left for the whole tree. When disabled, the tree will always be chopped finish."}}] -execute unless score stop_chopping timber matches 1.. if score wear_out timber matches 1.. run tellraw @s ["",{"text":"[ ❌ ]","color":"red","clickEvent":{"action":"run_command","value":"/function timber:settings/toggle/stop_chopping"}},{"text":" Stop Chopping Once Axe Breaks","hoverEvent":{"action":"show_text","value":"Stops the process of chopping the tree as soon as your axe doesn't have any durability left for the whole tree. When disabled, the tree will always be chopped finish."}}] -execute unless score stop_chopping timber matches 1.. unless score wear_out timber matches 1.. run tellraw @s ["",{"text":"[ ❌ ]","color":"#7F2B2B","hoverEvent":{"action":"show_text","value":"Can't be enabled when \"Additionally Wear out Tool Depending on Tree Size\" is disabled."}},{"text":" Stop Chopping Once Axe Breaks","hoverEvent":{"action":"show_text","value":"Stops the process of chopping the tree as soon as your axe doesn't have any durability left for the whole tree. When disabled, the tree will always be chopped finish."}}] - -execute if score wear_out timber matches 1.. unless score stop_chopping timber matches 1.. run tellraw @s ["",{"text":"[ ✔ ]","color":"green","clickEvent":{"action":"run_command","value":"/function timber:settings/toggle/wear_out"}},{"text":" Additionally Wear out Tool Depending on Tree Size","hoverEvent":{"action":"show_text","value":"The tool's durability will get decreased by the amount of destroyed logs (or stems). When disabled, only one durability gets deducted."}}] -execute unless score wear_out timber matches 1.. run tellraw @s ["",{"text":"[ ❌ ]","color":"red","clickEvent":{"action":"run_command","value":"/function timber:settings/toggle/wear_out"}},{"text":" Additionally Wear out Tool Depending on Tree Size","hoverEvent":{"action":"show_text","value":"The tool's durability will get decreased by the amount of destroyed logs (or stems). When disabled, only one durability gets deducted."}}] -execute if score wear_out timber matches 1.. if score stop_chopping timber matches 1.. run tellraw @s ["",{"text":"[ ✔ ]","color":"#2B7F2B","hoverEvent":{"action":"show_text","value":"Can't be disabled when \"Stop Chopping Once Axe Breaks\" is enabled."}},{"text":" Additionally Wear out Tool Depending on Tree Size","hoverEvent":{"action":"show_text","value":"The tool's durability will get decreased by the amount of destroyed logs (or stems). When disabled, only one durability gets deducted."}}] - -execute if score drop_loot timber matches 1.. run tellraw @s ["",{"text":"[ ✔ ]","color":"green","clickEvent":{"action":"run_command","value":"/function timber:settings/toggle/drop_loot"}},{"text":" Drop Loot Straight into Inventory","hoverEvent":{"action":"show_text","value":["",{"text":"Lets the dropped items of the tree teleport straight into your own inventory. As soon as you have a full inventory the loot gets dropped on the ground."},{"text":"\n\nThis option can increase performance.","color":"gray"}]}}] -execute unless score drop_loot timber matches 1.. unless score slow_chop timber matches 1.. run tellraw @s ["",{"text":"[ ❌ ]","color":"red","clickEvent":{"action":"run_command","value":"/function timber:settings/toggle/drop_loot"}},{"text":" Drop Loot Straight into Inventory","hoverEvent":{"action":"show_text","value":["",{"text":"Lets the dropped items of the tree teleport straight into your own inventory. As soon as you have a full inventory the loot gets dropped on the ground."},{"text":"\n\nThis option can increase performance.","color":"gray"}]}}] -execute unless score drop_loot timber matches 1.. if score slow_chop timber matches 1.. run tellraw @s ["",{"text":"[ ❌ ]","color":"#7F2B2B","hoverEvent":{"action":"show_text","value":"Can't be enabled when \"Chop Slowly\" is enabled."}},{"text":" Drop Loot Straight into Inventory","hoverEvent":{"action":"show_text","value":["",{"text":"Lets the dropped items of the tree teleport straight into your own inventory. As soon as you have a full inventory the loot gets dropped on the ground."},{"text":"\n\nThis option can increase performance.","color":"gray"}]}}] - -execute if score hunger timber matches 1.. run tellraw @s ["",{"text":"[ ✔ ]","color":"green","clickEvent":{"action":"run_command","value":"/function timber:settings/toggle/hunger"}},{"text":" Give Additional Hunger Effect","hoverEvent":{"action":"show_text","value":"Gives a hunger effect for 1 second with the same level as the size of the chopped tree."}}] -execute unless score hunger timber matches 1.. run tellraw @s ["",{"text":"[ ❌ ]","color":"red","clickEvent":{"action":"run_command","value":"/function timber:settings/toggle/hunger"}},{"text":" Give Additional Hunger Effect","hoverEvent":{"action":"show_text","value":"Gives a hunger effect for 1 second with the same level as the size of the chopped tree."}}] - -execute if score stopsound timber matches 1.. run tellraw @s ["",{"text":"[ ✔ ]","color":"green","clickEvent":{"action":"run_command","value":"/function timber:settings/toggle/stopsound"}},{"text":" Stop Loud Breaking Noises","hoverEvent":{"action":"show_text","value":["",{"text":"Suppresses loud breaking noises when chopping a tree."},{"text":"\n\nThis option is","color":"gray"},{"text":" experimental","color":"dark_red"},{"text":" because sometimes it still sounds loud for a fraction of a second.","color":"gray"}]}}] -execute unless score stopsound timber matches 1.. run tellraw @s ["",{"text":"[ ❌ ]","color":"red","clickEvent":{"action":"run_command","value":"/function timber:settings/toggle/stopsound"}},{"text":" Stop Loud Breaking Noises","hoverEvent":{"action":"show_text","value":["",{"text":"Suppresses loud breaking noises when chopping a tree."},{"text":"\n\nThis option is","color":"gray"},{"text":" experimental","color":"dark_red"},{"text":" because sometimes it still sounds loud for a fraction of a second.","color":"gray"}]}}] - -tellraw @s ["",{"text":"\u00A7m ","color":"dark_gray"}] - -function timber:settings/end_of_message \ No newline at end of file diff --git a/18-61/data/timber/function/settings/settings2.mcfunction b/18-61/data/timber/function/settings/settings2.mcfunction deleted file mode 100644 index 6f1a745..0000000 --- a/18-61/data/timber/function/settings/settings2.mcfunction +++ /dev/null @@ -1,55 +0,0 @@ -tellraw @s ["",{"text":" "}] -tellraw @s ["",{"text":" "}] -tellraw @s ["",{"text":" "}] -tellraw @s ["",{"text":" "}] - -tellraw @s ["",{"text":"\u00A7m ","color":"dark_gray"}] - -tellraw @s ["",{"text":" Timber "},{"text":"/","color":"gray"},{"text":" Global Settings "},{"text":" < ","clickEvent":{"action":"run_command","value":"/function timber:settings/settings1_click"}},{"text":"2/2"},{"text":" > ","clickEvent":{"action":"run_command","value":"/function timber:settings/settings2_click"}}] - -tellraw @s ["",{"text":"\u00A7m ","color":"dark_gray"}] - -execute if score wooden_axe timber matches 1.. run tellraw @s ["",{"text":"[ ✔ ]","color":"green","clickEvent":{"action":"run_command","value":"/function timber:settings/toggle/wooden_axe"}},{"text":" Enable Wooden Axe"}] -execute unless score wooden_axe timber matches 1.. run tellraw @s ["",{"text":"[ ❌ ]","color":"red","clickEvent":{"action":"run_command","value":"/function timber:settings/toggle/wooden_axe"}},{"text":" Enable Wooden Axe"}] - -execute if score stone_axe timber matches 1.. run tellraw @s ["",{"text":"[ ✔ ]","color":"green","clickEvent":{"action":"run_command","value":"/function timber:settings/toggle/stone_axe"}},{"text":" Enable Stone Axe"}] -execute unless score stone_axe timber matches 1.. run tellraw @s ["",{"text":"[ ❌ ]","color":"red","clickEvent":{"action":"run_command","value":"/function timber:settings/toggle/stone_axe"}},{"text":" Enable Stone Axe"}] - -execute if score iron_axe timber matches 1.. run tellraw @s ["",{"text":"[ ✔ ]","color":"green","clickEvent":{"action":"run_command","value":"/function timber:settings/toggle/iron_axe"}},{"text":" Enable Iron Axe"}] -execute unless score iron_axe timber matches 1.. run tellraw @s ["",{"text":"[ ❌ ]","color":"red","clickEvent":{"action":"run_command","value":"/function timber:settings/toggle/iron_axe"}},{"text":" Enable Iron Axe"}] - -execute if score golden_axe timber matches 1.. run tellraw @s ["",{"text":"[ ✔ ]","color":"green","clickEvent":{"action":"run_command","value":"/function timber:settings/toggle/golden_axe"}},{"text":" Enable Golden Axe"}] -execute unless score golden_axe timber matches 1.. run tellraw @s ["",{"text":"[ ❌ ]","color":"red","clickEvent":{"action":"run_command","value":"/function timber:settings/toggle/golden_axe"}},{"text":" Enable Golden Axe"}] - -execute if score diamond_axe timber matches 1.. run tellraw @s ["",{"text":"[ ✔ ]","color":"green","clickEvent":{"action":"run_command","value":"/function timber:settings/toggle/diamond_axe"}},{"text":" Enable Diamond Axe"}] -execute unless score diamond_axe timber matches 1.. run tellraw @s ["",{"text":"[ ❌ ]","color":"red","clickEvent":{"action":"run_command","value":"/function timber:settings/toggle/diamond_axe"}},{"text":" Enable Diamond Axe"}] - -execute if score netherite_axe timber matches 1.. run tellraw @s ["",{"text":"[ ✔ ]","color":"green","clickEvent":{"action":"run_command","value":"/function timber:settings/toggle/netherite_axe"}},{"text":" Enable Netherite Axe"}] -execute unless score netherite_axe timber matches 1.. run tellraw @s ["",{"text":"[ ❌ ]","color":"red","clickEvent":{"action":"run_command","value":"/function timber:settings/toggle/netherite_axe"}},{"text":" Enable Netherite Axe"}] - -execute if score chop_trees timber matches 1.. run tellraw @s ["",{"text":"[ ✔ ]","color":"green","clickEvent":{"action":"run_command","value":"/function timber:settings/toggle/chop_trees"}},{"text":" Chop Trees","hoverEvent":{"action":"show_text","value":"All kind of trees will get chopped."}}] -execute unless score chop_trees timber matches 1.. run tellraw @s ["",{"text":"[ ❌ ]","color":"red","clickEvent":{"action":"run_command","value":"/function timber:settings/toggle/chop_trees"}},{"text":" Chop Trees","hoverEvent":{"action":"show_text","value":"All kind of trees will get chopped."}}] - -execute if score chop_fungi timber matches 1.. run tellraw @s ["",{"text":"[ ✔ ]","color":"green","clickEvent":{"action":"run_command","value":"/function timber:settings/toggle/chop_fungi"}},{"text":" Chop Fungi","hoverEvent":{"action":"show_text","value":["",{"text":"Huge fungi (nether trees) as well as huge mushrooms will get chopped."},{"text":"\n\nUse it on your own risk!\nWhen enabled, this datapack can't differentiate between generated fungi and player-placed fungi and therefore can potentially destroy your buildings.","color":"dark_red"}]}}] -execute unless score chop_fungi timber matches 1.. run tellraw @s ["",{"text":"[ ❌ ]","color":"red","clickEvent":{"action":"run_command","value":"/function timber:settings/toggle/chop_fungi"}},{"text":" Chop Fungi","hoverEvent":{"action":"show_text","value":["",{"text":"Huge fungi (nether trees) as well as huge mushrooms will get chopped."},{"text":"\n\nUse it on your own risk!\nWhen enabled, this datapack can't differentiate between generated fungi and player-placed fungi and therefore can potentially destroy your buildings.","color":"dark_red"}]}}] - -execute if score persistent timber matches 1.. run tellraw @s ["",{"text":"[ ✔ ]","color":"green","clickEvent":{"action":"run_command","value":"/function timber:settings/toggle/persistent"}},{"text":" Destroy Player-Placed Trees","hoverEvent":{"action":"show_text","value":["",{"text":"Player-placed trees are trees made out of player-placed leaves (Look at leaf block with F3 debug screen: persistent = true)."},{"text":"\n\nUse it on your own risk!\nWhen enabled, this datapack can't differentiate between generated trees and player-placed trees anymore and therefore can potentially destroy your buildings.","color":"dark_red"}]}}] -execute unless score persistent timber matches 1.. run tellraw @s ["",{"text":"[ ❌ ]","color":"red","clickEvent":{"action":"run_command","value":"/function timber:settings/toggle/persistent"}},{"text":" Destroy Player-Placed Trees","hoverEvent":{"action":"show_text","value":["",{"text":"Player-placed trees are trees made out of player-placed leaves (Look at leaf block with F3 debug screen: persistent = true)."},{"text":"\n\nUse it on your own risk!\nWhen enabled, this datapack can't differentiate between generated trees and player-placed trees anymore and therefore can potentially destroy your buildings.","color":"dark_red"}]}}] - -execute if score blocks_per_chop timber matches 1 if score slow_chop timber matches 1.. run tellraw @s ["",{"text":"[ ✎ ]","color":"gray","clickEvent":{"action":"suggest_command","value":"/scoreboard players set blocks_per_chop timber "},"hoverEvent":{"action":"show_text","value":"Default: 1"}},{"text":" Set Amount of Destroyed Blocks per Chop"},{"text":" (Current: ","color":"gray"},{"score":{"name":"blocks_per_chop","objective":"timber"},"color":"gray"},{"text": ")","color":"gray"}] -execute unless score blocks_per_chop timber matches 1 if score slow_chop timber matches 1.. run tellraw @s ["",{"text":"[ ✎ ]","color":"gray","clickEvent":{"action":"suggest_command","value":"/scoreboard players set blocks_per_chop timber "},"hoverEvent":{"action":"show_text","value":"Default: 1"}},{"text":" Set Amount of Destroyed Blocks per Chop"},{"text":" (Current: ","color":"gray"},{"score":{"name":"blocks_per_chop","objective":"timber"},"color":"gray"},{"text": ")","color":"gray"}] -execute unless score slow_chop timber matches 1.. run tellraw @s ["",{"text":"[ ✎ ]","color":"dark_gray","hoverEvent":{"action":"show_text","value":"Not active when \"Chop Slowly\" is disabled."}},{"text":" Set Amount of Destroyed Blocks per Chop"}] - -execute if score time_between_chops timber matches 1 if score slow_chop timber matches 1.. run tellraw @s ["",{"text":"[ ✎ ]","color":"gray","clickEvent":{"action":"suggest_command","value":"/scoreboard players set time_between_chops timber "},"hoverEvent":{"action":"show_text","value":"Default: 1"}},{"text":" Set Time in Ticks Between Chops"},{"text":" (Current: ","color":"gray"},{"score":{"name":"time_between_chops","objective":"timber"},"color":"gray"},{"text": ")","color":"gray"}] -execute unless score time_between_chops timber matches 1 if score slow_chop timber matches 1.. run tellraw @s ["",{"text":"[ ✎ ]","color":"gray","clickEvent":{"action":"suggest_command","value":"/scoreboard players set time_between_chops timber "},"hoverEvent":{"action":"show_text","value":"Default: 1"}},{"text":" Set Time in Ticks Between Chops"},{"text":" (Current: ","color":"gray"},{"score":{"name":"time_between_chops","objective":"timber"},"color":"gray"},{"text": ")","color":"gray"}] -execute unless score slow_chop timber matches 1.. run tellraw @s ["",{"text":"[ ✎ ]","color":"dark_gray","hoverEvent":{"action":"show_text","value":"Not active when \"Chop Slowly\" is disabled."}},{"text":" Set Time in Ticks Between Chops"}] - -execute if score max_tree_size timber matches 555 run tellraw @s ["",{"text":"[ ✎ ]","color":"gray","clickEvent":{"action":"suggest_command","value":"/scoreboard players set max_tree_size timber "},"hoverEvent":{"action":"show_text","value":"Default: 555"}},{"text":" Set Max. Tree Size","hoverEvent":{"action":"show_text","value":"Trees bigger than this set value won't get further processed."}},{"text":" (Currently: ","color":"gray"},{"score":{"name":"max_tree_size","objective":"timber"},"color":"gray"},{"text": ")","color":"gray"}] -execute unless score max_tree_size timber matches 555 run tellraw @s ["",{"text":"[ ✎ ]","color":"gray","clickEvent":{"action":"suggest_command","value":"/scoreboard players set max_tree_size timber "},"hoverEvent":{"action":"show_text","value":"Default: 555"}},{"text":" Set Max. Tree Size","hoverEvent":{"action":"show_text","value":"Trees bigger than this set value won't get further processed."}},{"text":" (Currently: ","color":"gray"},{"score":{"name":"max_tree_size","objective":"timber"},"color":"gray"},{"text": ")","color":"gray"}] - -execute if score min_leaves_found timber matches 5 run tellraw @s ["",{"text":"[ ✎ ]","color":"gray","clickEvent":{"action":"suggest_command","value":"/scoreboard players set min_leaves_found timber "},"hoverEvent":{"action":"show_text","value":"Default: 5"}},{"text":" Set Min. Leaves to Valid a Tree","hoverEvent":{"action":"show_text","value":"This datapack considers a tree only if it has this set value amount of naturally generated leaves at its trunk.\nFungi will get checked by the amount of cap blocks and additionally a 3×3 big cross on top of the stem."}},{"text":" (Current: ","color":"gray"},{"score":{"name":"min_leaves_found","objective":"timber"},"color":"gray"},{"text": ")","color":"gray"}] -execute unless score min_leaves_found timber matches 5 run tellraw @s ["",{"text":"[ ✎ ]","color":"gray","clickEvent":{"action":"suggest_command","value":"/scoreboard players set min_leaves_found timber "},"hoverEvent":{"action":"show_text","value":"Default: 5"}},{"text":" Set Min. Leaves to Valid a Tree","hoverEvent":{"action":"show_text","value":"This datapack considers a tree only if it has this set value amount of naturally generated leaves at its trunk.\nFungi will get checked by the amount of cap blocks and additionally a 3×3 big cross on top of the stem."}},{"text":" (Current: ","color":"gray"},{"score":{"name":"min_leaves_found","objective":"timber"},"color":"gray"},{"text": ")","color":"gray"}] - -tellraw @s ["",{"text":"\u00A7m ","color":"dark_gray"}] - -function timber:settings/end_of_message \ No newline at end of file diff --git a/18-61/data/timber/function/settings/toggle/timber.mcfunction b/18-61/data/timber/function/settings/toggle/timber.mcfunction deleted file mode 100644 index 0a26b1d..0000000 --- a/18-61/data/timber/function/settings/toggle/timber.mcfunction +++ /dev/null @@ -1,9 +0,0 @@ -# reset -scoreboard players set @s TimberToggle 0 -# toggle -execute unless score @s timber_disabled matches 1.. run scoreboard players set @s timber_disabled 3 -execute if score @s timber_disabled matches 1 run scoreboard players set @s timber_disabled 0 -execute if score @s timber_disabled matches 3 run scoreboard players set @s timber_disabled 1 -# display on/off status -execute unless score @s[tag=!global.ignore.gui] timber_disabled matches 1.. run tellraw @s ["",{"text":"<< ","color":"dark_gray"},{"text":"✔","color":"green"},{"text":" Timber is now on"},{"text":" >>","color":"dark_gray"}] -execute if score @s[tag=!global.ignore.gui] timber_disabled matches 1.. run tellraw @s ["",{"text":"<< ","color":"dark_gray"},{"text":"❌","color":"red"},{"text":" Timber is now off"},{"text":" >>","color":"dark_gray"}] \ No newline at end of file diff --git a/18-61/data/timber/function/utils/check_max_command_chain_length.mcfunction b/18-61/data/timber/function/utils/check_max_command_chain_length.mcfunction deleted file mode 100644 index 6f32c3e..0000000 --- a/18-61/data/timber/function/utils/check_max_command_chain_length.mcfunction +++ /dev/null @@ -1,13 +0,0 @@ -# function didn't end successfully -execute if score running timber matches 1 run scoreboard players set running timber 2 -# normal behavior -execute if score running timber matches 0 run scoreboard players set running timber 1 -execute if score running timber matches 1 run function timber:utils/used_axe -# function didn't end successfully -execute if score running timber matches 2 run execute store result storage timber:max_command_chain_length value int 1 run gamerule maxCommandChainLength -execute if score running timber matches 2 run tellraw @a[tag=!noTimberWarning] ["",{"text":"Timber Datapack Warning: ","color":"red"},{"text":"The datapack wasn't able to finish its functionality to work properly!"},{"text":"\n ─ Please either decrease setting \"Max. Tree Size\" with "},{"text":"\n [ ✎ ]","color":"gray","clickEvent":{"action":"suggest_command","value":"/scoreboard players set max_tree_size timber "},"hoverEvent":{"action":"show_text","value":"Default: 555"}},{"text":" (Currently: ","color":"gray"},{"score":{"name":"max_tree_size","objective":"timber"},"color":"gray"},{"text": ")","color":"gray"},{"text":"."},{"text":"\n ─ Or increase the gamerule \"maxCommandChainLength\" with "},{"text":"\n [ ✎ ]","color":"gray","clickEvent":{"action":"suggest_command","value":"/gamerule maxCommandChainLength "},"hoverEvent":{"action":"show_text","value":"Default: 65536"}},{"text":" (Currently: ","color":"gray"},{"nbt":"value","storage":"timber:max_command_chain_length","color":"gray"},{"text": ")","color":"gray"},{"text":"."}] -execute if score running timber matches 2 run schedule function timber:utils/reset 10t -execute if score running timber matches 2 run scoreboard players set running timber 3 - -# function ended successfully -execute if score running timber matches 1 run scoreboard players set running timber 0 \ No newline at end of file diff --git a/18-61/data/timber/function/utils/check_server.mcfunction b/18-61/data/timber/function/utils/check_server.mcfunction deleted file mode 100644 index 7d70177..0000000 --- a/18-61/data/timber/function/utils/check_server.mcfunction +++ /dev/null @@ -1,8 +0,0 @@ -# load until someone is in the server -execute unless entity @r run schedule function timber:utils/check_server 1s - -# Checking if the server uses a different jar from the vanilla one -execute unless score not_vanilla timber matches 1.. store success score not_vanilla timber run data get entity @r "Spigot.ticksLived" -execute unless score not_vanilla timber matches 1.. store success score not_vanilla timber run data get entity @r "Bukkit.updateLevel" -execute unless score not_vanilla timber matches 1.. store success score not_vanilla timber run data get entity @r "Paper.SpawnReason" -execute if score not_vanilla timber matches 1 run tellraw @a[tag=!noTimberWarning] ["",{"text":"Timber Datapack Warning: ","color":"red"},{"text":"Compatibility in non-vanilla servers is not guaranteed! For more information please visit official download site.","clickEvent":{"action":"open_url","value":"https://github.com/Moggla/Timber-Datapack"}}] \ No newline at end of file diff --git a/18-61/data/timber/function/validated.mcfunction b/18-61/data/timber/function/validated.mcfunction deleted file mode 100644 index b00df5e..0000000 --- a/18-61/data/timber/function/validated.mcfunction +++ /dev/null @@ -1,51 +0,0 @@ -# when full inventory fix -execute if score drop_loot timber matches 1.. store result score inventory timber run data get entity @s Inventory -execute if score drop_loot timber matches 1.. if entity @s[nbt={Inventory:[{Slot:100b}]}] run scoreboard players remove inventory timber 1 -execute if score drop_loot timber matches 1.. if entity @s[nbt={Inventory:[{Slot:101b}]}] run scoreboard players remove inventory timber 1 -execute if score drop_loot timber matches 1.. if entity @s[nbt={Inventory:[{Slot:102b}]}] run scoreboard players remove inventory timber 1 -execute if score drop_loot timber matches 1.. if entity @s[nbt={Inventory:[{Slot:103b}]}] run scoreboard players remove inventory timber 1 -execute if score drop_loot timber matches 1.. if entity @s[nbt={Inventory:[{Slot:-106b}]}] run scoreboard players remove inventory timber 1 - -# destroy blocks - # mark blocks that need to be destroyed - tag @e[type=minecraft:marker,tag=timber_log] add timber_destroy - execute if score destroy_leaves timber matches 1.. run tag @e[type=minecraft:marker,tag=timber_leaf] add timber_destroy - execute if score destroy_roots timber matches 1.. run tag @e[type=minecraft:marker,tag=timber_root] add timber_destroy - tag @e[type=minecraft:marker,tag=timber_stem] add timber_destroy - tag @e[type=minecraft:marker,tag=timber_cap] add timber_destroy - # api - execute unless score slow_chop timber matches 1.. at @e[type=minecraft:marker,tag=timber_log] run function #timber:api/break_log - execute unless score slow_chop timber matches 1.. at @e[type=minecraft:marker,tag=timber_leaf] run function #timber:api/break_leaf - execute unless score slow_chop timber matches 1.. at @e[type=minecraft:marker,tag=timber_root] run function #timber:api/break_root - execute unless score slow_chop timber matches 1.. at @e[type=minecraft:marker,tag=timber_stem] run function #timber:api/break_stem - execute unless score slow_chop timber matches 1.. at @e[type=minecraft:marker,tag=timber_cap] run function #timber:api/break_cap - # loot - execute unless score slow_chop timber matches 1.. unless score drop_loot timber matches 1.. at @e[type=minecraft:marker,tag=timber_destroy] run loot spawn ~ ~ ~ mine ~ ~ ~ mainhand - execute unless score slow_chop timber matches 1.. if score drop_loot timber matches 1.. unless score inventory timber matches 36.. at @e[type=minecraft:marker,tag=timber_destroy] run loot give @s mine ~ ~ ~ mainhand - execute unless score slow_chop timber matches 1.. if score drop_loot timber matches 1.. if score inventory timber matches 36.. at @e[type=minecraft:marker,tag=timber_destroy] run loot spawn ~ ~ ~ mine ~ ~ ~ mainhand - # destroy animation (doTileDrops can be changed, because datapack wouldn't get to this point otherwise) - gamerule doTileDrops false - execute unless score slow_chop timber matches 1.. at @e[type=minecraft:marker,tag=timber_destroy] run setblock ~ ~ ~ minecraft:air destroy - gamerule doTileDrops true - # remove destroy marker - execute unless score slow_chop timber matches 1.. run kill @e[type=minecraft:marker,tag=timber_destroy] - -# stop sound -execute if score stopsound timber matches 1.. as @a[distance=..20,tag=!global.ignore.gui] run function timber:utils/stopsound - -# save tool for slow chopping process -execute if score slow_chop timber matches 1.. at @e[type=minecraft:marker,tag=timber_tree,tag=!timber_slow_chop,distance=..7,sort=arbitrary,limit=1] run summon minecraft:armor_stand ~ -64 ~ {Silent:1b,Invulnerable:1b,Marker:1b,Invisible:1b,Tags:["timber_tool"],Rotation:[45f],Pose:{RightArm:[0f,270f,0f]}} -execute if score slow_chop timber matches 1.. at @e[type=minecraft:marker,tag=timber_tree,tag=!timber_slow_chop,distance=..7,sort=arbitrary,limit=1] run data modify entity @e[type=minecraft:armor_stand,tag=timber_tool,y=-64,distance=...1,sort=arbitrary,limit=1] HandItems[0] merge from entity @s SelectedItem -execute if score slow_chop timber matches 1.. run tag @e[type=minecraft:marker,tag=timber_tree,tag=!timber_slow_chop,distance=..7,sort=arbitrary,limit=1] add timber_slow_chop - -# tp hand-broken loot into inventory -execute if score drop_loot timber matches 1.. unless score inventory timber matches 36.. at @e[type=minecraft:marker,tag=timber_tree,tag=!timber_slow_chop,distance=..7,sort=arbitrary,limit=1] run function timber:utils/tp_item - -# wear out tool -execute if score wear_out timber matches 1.. unless score unbreakable timber matches 1 run function timber:tool/wear_out - -# break axe if worn out -execute if score wear_out timber matches 1.. unless score unbreakable timber matches 1 run function timber:tool/worn_out - -# give hunger effect -execute if score hunger timber matches 1.. run function timber:utils/hunger \ No newline at end of file diff --git a/18-81/data/timber/function/init.mcfunction b/18-81/data/timber/function/init.mcfunction deleted file mode 100644 index 3bfd75d..0000000 --- a/18-81/data/timber/function/init.mcfunction +++ /dev/null @@ -1,39 +0,0 @@ -# longer maxCommandChainLength -gamerule maxCommandChainLength 1000000000 - -# create scoreboards -scoreboard objectives add timber_w_axe minecraft.used:minecraft.wooden_axe -scoreboard objectives add timber_s_axe minecraft.used:minecraft.stone_axe -scoreboard objectives add timber_i_axe minecraft.used:minecraft.iron_axe -scoreboard objectives add timber_g_axe minecraft.used:minecraft.golden_axe -scoreboard objectives add timber_d_axe minecraft.used:minecraft.diamond_axe -scoreboard objectives add timber_n_axe minecraft.used:minecraft.netherite_axe -scoreboard objectives add timber dummy -scoreboard objectives add TimberToggle trigger {text:"Timber Toggle",color:"#724E21"} -scoreboard objectives add timber_disabled dummy -scoreboard objectives add timber_prsistent dummy - -# non-overriding default values -function timber:settings/default_values -function timber:tool/durability_max -scoreboard players set running timber 0 - -# start optional loops -execute if score plant_sapling timber matches 1.. run function timber:autoplant/loop -execute if score slow_chop timber matches 1.. run function timber:slow_chop/loop - -# check loottable compatibility of mushroom stem -setblock ~ 255 ~ minecraft:chest -setblock ~ 255 ~1 minecraft:mushroom_stem -loot insert ~ 255 ~ mine ~ 255 ~1 minecraft:diamond_axe -execute unless data block ~ 255 ~ Items[{id:"minecraft:knowledge_book",components:{"minecraft:custom_data":{Tags:["timber_location"]}}}] run tellraw @a[tag=!noTimberWarning] ["",{text:"Timber Datapack Warning: ",color:"red"},{text:"Incompatibility with the mushroom_stem loottable of another datapack!"}] -fill ~-1 255 ~-1 ~1 255 ~1 minecraft:air -execute store result score doTileDrops timber run gamerule doTileDrops -execute if score doTileDrops timber matches 0 run tellraw @a[tag=!noTimberWarning] ["",{text:"Timber Datapack Warning: ",color:"red"},{text:"This datapack only works when gamerule doTileDrops is set to true!"}] - -# Getting the game version and checking if it is compatible with the datapack https://minecraft.fandom.com/wiki/Data_version -execute store result score game_version timber run data get entity @r DataVersion -execute if score game_version timber matches ..3442 run tellraw @a[tag=!noTimberWarning] ["",{text:"Timber Datapack Warning: ",color:"red"},{text:"This datapack is not compatible with all the versions before 1.20!"}] - -# Checking if the server uses a different jar from the vanilla one -function timber:utils/check_server \ No newline at end of file diff --git a/18-81/data/timber/function/main.mcfunction b/18-81/data/timber/function/main.mcfunction deleted file mode 100644 index 02ef309..0000000 --- a/18-81/data/timber/function/main.mcfunction +++ /dev/null @@ -1,11 +0,0 @@ -# loop (not in minecraft:tick in order to stop it after uninstall) -schedule function timber:main 1t - -# if any kind of axe is used -execute as @a[predicate=timber:used_axe,tag=!global.ignore] at @s run function timber:utils/check_max_command_chain_length - -# toggle timber datapack per player -execute as @a[scores={TimberToggle=1..},tag=!global.ignore] run function timber:settings/toggle/timber - -# reset -scoreboard players enable @a TimberToggle \ No newline at end of file diff --git a/18-81/data/timber/function/settings/end_of_message.mcfunction b/18-81/data/timber/function/settings/end_of_message.mcfunction deleted file mode 100644 index 1d5e211..0000000 --- a/18-81/data/timber/function/settings/end_of_message.mcfunction +++ /dev/null @@ -1,3 +0,0 @@ -execute store result score sendCommandFeedback timber run gamerule sendCommandFeedback -execute if score sendCommandFeedback timber matches 1 run schedule function timber:settings/reset_gamerule 1t -gamerule sendCommandFeedback false \ No newline at end of file diff --git a/18-81/data/timber/function/settings/reset_gamerule.mcfunction b/18-81/data/timber/function/settings/reset_gamerule.mcfunction deleted file mode 100644 index b466492..0000000 --- a/18-81/data/timber/function/settings/reset_gamerule.mcfunction +++ /dev/null @@ -1 +0,0 @@ -gamerule sendCommandFeedback true \ No newline at end of file diff --git a/18-81/data/timber/function/settings/settings2.mcfunction b/18-81/data/timber/function/settings/settings2.mcfunction deleted file mode 100644 index 6f1a745..0000000 --- a/18-81/data/timber/function/settings/settings2.mcfunction +++ /dev/null @@ -1,55 +0,0 @@ -tellraw @s ["",{"text":" "}] -tellraw @s ["",{"text":" "}] -tellraw @s ["",{"text":" "}] -tellraw @s ["",{"text":" "}] - -tellraw @s ["",{"text":"\u00A7m ","color":"dark_gray"}] - -tellraw @s ["",{"text":" Timber "},{"text":"/","color":"gray"},{"text":" Global Settings "},{"text":" < ","clickEvent":{"action":"run_command","value":"/function timber:settings/settings1_click"}},{"text":"2/2"},{"text":" > ","clickEvent":{"action":"run_command","value":"/function timber:settings/settings2_click"}}] - -tellraw @s ["",{"text":"\u00A7m ","color":"dark_gray"}] - -execute if score wooden_axe timber matches 1.. run tellraw @s ["",{"text":"[ ✔ ]","color":"green","clickEvent":{"action":"run_command","value":"/function timber:settings/toggle/wooden_axe"}},{"text":" Enable Wooden Axe"}] -execute unless score wooden_axe timber matches 1.. run tellraw @s ["",{"text":"[ ❌ ]","color":"red","clickEvent":{"action":"run_command","value":"/function timber:settings/toggle/wooden_axe"}},{"text":" Enable Wooden Axe"}] - -execute if score stone_axe timber matches 1.. run tellraw @s ["",{"text":"[ ✔ ]","color":"green","clickEvent":{"action":"run_command","value":"/function timber:settings/toggle/stone_axe"}},{"text":" Enable Stone Axe"}] -execute unless score stone_axe timber matches 1.. run tellraw @s ["",{"text":"[ ❌ ]","color":"red","clickEvent":{"action":"run_command","value":"/function timber:settings/toggle/stone_axe"}},{"text":" Enable Stone Axe"}] - -execute if score iron_axe timber matches 1.. run tellraw @s ["",{"text":"[ ✔ ]","color":"green","clickEvent":{"action":"run_command","value":"/function timber:settings/toggle/iron_axe"}},{"text":" Enable Iron Axe"}] -execute unless score iron_axe timber matches 1.. run tellraw @s ["",{"text":"[ ❌ ]","color":"red","clickEvent":{"action":"run_command","value":"/function timber:settings/toggle/iron_axe"}},{"text":" Enable Iron Axe"}] - -execute if score golden_axe timber matches 1.. run tellraw @s ["",{"text":"[ ✔ ]","color":"green","clickEvent":{"action":"run_command","value":"/function timber:settings/toggle/golden_axe"}},{"text":" Enable Golden Axe"}] -execute unless score golden_axe timber matches 1.. run tellraw @s ["",{"text":"[ ❌ ]","color":"red","clickEvent":{"action":"run_command","value":"/function timber:settings/toggle/golden_axe"}},{"text":" Enable Golden Axe"}] - -execute if score diamond_axe timber matches 1.. run tellraw @s ["",{"text":"[ ✔ ]","color":"green","clickEvent":{"action":"run_command","value":"/function timber:settings/toggle/diamond_axe"}},{"text":" Enable Diamond Axe"}] -execute unless score diamond_axe timber matches 1.. run tellraw @s ["",{"text":"[ ❌ ]","color":"red","clickEvent":{"action":"run_command","value":"/function timber:settings/toggle/diamond_axe"}},{"text":" Enable Diamond Axe"}] - -execute if score netherite_axe timber matches 1.. run tellraw @s ["",{"text":"[ ✔ ]","color":"green","clickEvent":{"action":"run_command","value":"/function timber:settings/toggle/netherite_axe"}},{"text":" Enable Netherite Axe"}] -execute unless score netherite_axe timber matches 1.. run tellraw @s ["",{"text":"[ ❌ ]","color":"red","clickEvent":{"action":"run_command","value":"/function timber:settings/toggle/netherite_axe"}},{"text":" Enable Netherite Axe"}] - -execute if score chop_trees timber matches 1.. run tellraw @s ["",{"text":"[ ✔ ]","color":"green","clickEvent":{"action":"run_command","value":"/function timber:settings/toggle/chop_trees"}},{"text":" Chop Trees","hoverEvent":{"action":"show_text","value":"All kind of trees will get chopped."}}] -execute unless score chop_trees timber matches 1.. run tellraw @s ["",{"text":"[ ❌ ]","color":"red","clickEvent":{"action":"run_command","value":"/function timber:settings/toggle/chop_trees"}},{"text":" Chop Trees","hoverEvent":{"action":"show_text","value":"All kind of trees will get chopped."}}] - -execute if score chop_fungi timber matches 1.. run tellraw @s ["",{"text":"[ ✔ ]","color":"green","clickEvent":{"action":"run_command","value":"/function timber:settings/toggle/chop_fungi"}},{"text":" Chop Fungi","hoverEvent":{"action":"show_text","value":["",{"text":"Huge fungi (nether trees) as well as huge mushrooms will get chopped."},{"text":"\n\nUse it on your own risk!\nWhen enabled, this datapack can't differentiate between generated fungi and player-placed fungi and therefore can potentially destroy your buildings.","color":"dark_red"}]}}] -execute unless score chop_fungi timber matches 1.. run tellraw @s ["",{"text":"[ ❌ ]","color":"red","clickEvent":{"action":"run_command","value":"/function timber:settings/toggle/chop_fungi"}},{"text":" Chop Fungi","hoverEvent":{"action":"show_text","value":["",{"text":"Huge fungi (nether trees) as well as huge mushrooms will get chopped."},{"text":"\n\nUse it on your own risk!\nWhen enabled, this datapack can't differentiate between generated fungi and player-placed fungi and therefore can potentially destroy your buildings.","color":"dark_red"}]}}] - -execute if score persistent timber matches 1.. run tellraw @s ["",{"text":"[ ✔ ]","color":"green","clickEvent":{"action":"run_command","value":"/function timber:settings/toggle/persistent"}},{"text":" Destroy Player-Placed Trees","hoverEvent":{"action":"show_text","value":["",{"text":"Player-placed trees are trees made out of player-placed leaves (Look at leaf block with F3 debug screen: persistent = true)."},{"text":"\n\nUse it on your own risk!\nWhen enabled, this datapack can't differentiate between generated trees and player-placed trees anymore and therefore can potentially destroy your buildings.","color":"dark_red"}]}}] -execute unless score persistent timber matches 1.. run tellraw @s ["",{"text":"[ ❌ ]","color":"red","clickEvent":{"action":"run_command","value":"/function timber:settings/toggle/persistent"}},{"text":" Destroy Player-Placed Trees","hoverEvent":{"action":"show_text","value":["",{"text":"Player-placed trees are trees made out of player-placed leaves (Look at leaf block with F3 debug screen: persistent = true)."},{"text":"\n\nUse it on your own risk!\nWhen enabled, this datapack can't differentiate between generated trees and player-placed trees anymore and therefore can potentially destroy your buildings.","color":"dark_red"}]}}] - -execute if score blocks_per_chop timber matches 1 if score slow_chop timber matches 1.. run tellraw @s ["",{"text":"[ ✎ ]","color":"gray","clickEvent":{"action":"suggest_command","value":"/scoreboard players set blocks_per_chop timber "},"hoverEvent":{"action":"show_text","value":"Default: 1"}},{"text":" Set Amount of Destroyed Blocks per Chop"},{"text":" (Current: ","color":"gray"},{"score":{"name":"blocks_per_chop","objective":"timber"},"color":"gray"},{"text": ")","color":"gray"}] -execute unless score blocks_per_chop timber matches 1 if score slow_chop timber matches 1.. run tellraw @s ["",{"text":"[ ✎ ]","color":"gray","clickEvent":{"action":"suggest_command","value":"/scoreboard players set blocks_per_chop timber "},"hoverEvent":{"action":"show_text","value":"Default: 1"}},{"text":" Set Amount of Destroyed Blocks per Chop"},{"text":" (Current: ","color":"gray"},{"score":{"name":"blocks_per_chop","objective":"timber"},"color":"gray"},{"text": ")","color":"gray"}] -execute unless score slow_chop timber matches 1.. run tellraw @s ["",{"text":"[ ✎ ]","color":"dark_gray","hoverEvent":{"action":"show_text","value":"Not active when \"Chop Slowly\" is disabled."}},{"text":" Set Amount of Destroyed Blocks per Chop"}] - -execute if score time_between_chops timber matches 1 if score slow_chop timber matches 1.. run tellraw @s ["",{"text":"[ ✎ ]","color":"gray","clickEvent":{"action":"suggest_command","value":"/scoreboard players set time_between_chops timber "},"hoverEvent":{"action":"show_text","value":"Default: 1"}},{"text":" Set Time in Ticks Between Chops"},{"text":" (Current: ","color":"gray"},{"score":{"name":"time_between_chops","objective":"timber"},"color":"gray"},{"text": ")","color":"gray"}] -execute unless score time_between_chops timber matches 1 if score slow_chop timber matches 1.. run tellraw @s ["",{"text":"[ ✎ ]","color":"gray","clickEvent":{"action":"suggest_command","value":"/scoreboard players set time_between_chops timber "},"hoverEvent":{"action":"show_text","value":"Default: 1"}},{"text":" Set Time in Ticks Between Chops"},{"text":" (Current: ","color":"gray"},{"score":{"name":"time_between_chops","objective":"timber"},"color":"gray"},{"text": ")","color":"gray"}] -execute unless score slow_chop timber matches 1.. run tellraw @s ["",{"text":"[ ✎ ]","color":"dark_gray","hoverEvent":{"action":"show_text","value":"Not active when \"Chop Slowly\" is disabled."}},{"text":" Set Time in Ticks Between Chops"}] - -execute if score max_tree_size timber matches 555 run tellraw @s ["",{"text":"[ ✎ ]","color":"gray","clickEvent":{"action":"suggest_command","value":"/scoreboard players set max_tree_size timber "},"hoverEvent":{"action":"show_text","value":"Default: 555"}},{"text":" Set Max. Tree Size","hoverEvent":{"action":"show_text","value":"Trees bigger than this set value won't get further processed."}},{"text":" (Currently: ","color":"gray"},{"score":{"name":"max_tree_size","objective":"timber"},"color":"gray"},{"text": ")","color":"gray"}] -execute unless score max_tree_size timber matches 555 run tellraw @s ["",{"text":"[ ✎ ]","color":"gray","clickEvent":{"action":"suggest_command","value":"/scoreboard players set max_tree_size timber "},"hoverEvent":{"action":"show_text","value":"Default: 555"}},{"text":" Set Max. Tree Size","hoverEvent":{"action":"show_text","value":"Trees bigger than this set value won't get further processed."}},{"text":" (Currently: ","color":"gray"},{"score":{"name":"max_tree_size","objective":"timber"},"color":"gray"},{"text": ")","color":"gray"}] - -execute if score min_leaves_found timber matches 5 run tellraw @s ["",{"text":"[ ✎ ]","color":"gray","clickEvent":{"action":"suggest_command","value":"/scoreboard players set min_leaves_found timber "},"hoverEvent":{"action":"show_text","value":"Default: 5"}},{"text":" Set Min. Leaves to Valid a Tree","hoverEvent":{"action":"show_text","value":"This datapack considers a tree only if it has this set value amount of naturally generated leaves at its trunk.\nFungi will get checked by the amount of cap blocks and additionally a 3×3 big cross on top of the stem."}},{"text":" (Current: ","color":"gray"},{"score":{"name":"min_leaves_found","objective":"timber"},"color":"gray"},{"text": ")","color":"gray"}] -execute unless score min_leaves_found timber matches 5 run tellraw @s ["",{"text":"[ ✎ ]","color":"gray","clickEvent":{"action":"suggest_command","value":"/scoreboard players set min_leaves_found timber "},"hoverEvent":{"action":"show_text","value":"Default: 5"}},{"text":" Set Min. Leaves to Valid a Tree","hoverEvent":{"action":"show_text","value":"This datapack considers a tree only if it has this set value amount of naturally generated leaves at its trunk.\nFungi will get checked by the amount of cap blocks and additionally a 3×3 big cross on top of the stem."}},{"text":" (Current: ","color":"gray"},{"score":{"name":"min_leaves_found","objective":"timber"},"color":"gray"},{"text": ")","color":"gray"}] - -tellraw @s ["",{"text":"\u00A7m ","color":"dark_gray"}] - -function timber:settings/end_of_message \ No newline at end of file diff --git a/18-81/data/timber/function/slow_chop/destroy_loop.mcfunction b/18-81/data/timber/function/slow_chop/destroy_loop.mcfunction deleted file mode 100644 index db43fbd..0000000 --- a/18-81/data/timber/function/slow_chop/destroy_loop.mcfunction +++ /dev/null @@ -1,25 +0,0 @@ -# loop -$schedule function timber:slow_chop/loop $(time_between_chops)t replace - -# api -$execute at @e[type=minecraft:marker,tag=timber_slow_chop] as @e[type=minecraft:marker,tag=timber_destroy,sort=nearest,limit=$(blocks_per_chop)] at @s run function timber:slow_chop/api - -# destroy n block -$execute at @e[type=minecraft:marker,tag=timber_slow_chop] as @e[type=minecraft:armor_stand,tag=timber_tool,y=-64,distance=...1,sort=arbitrary,limit=1] at @e[type=minecraft:marker,tag=timber_destroy,sort=nearest,limit=$(blocks_per_chop)] run loot spawn ~ ~ ~ mine ~ ~ ~ mainhand - -# destroy animation (doTileDrops can be changed, because datapack wouldn't get to this point otherwise) -gamerule doTileDrops false -$execute at @e[type=minecraft:marker,tag=timber_slow_chop] at @e[type=minecraft:marker,tag=timber_destroy,sort=nearest,limit=$(blocks_per_chop)] run setblock ~ ~ ~ minecraft:air destroy -gamerule doTileDrops true - -# stop sound -$execute at @e[type=minecraft:marker,tag=timber_slow_chop] if score stopsound timber matches 1.. at @e[type=minecraft:marker,tag=timber_destroy,sort=nearest,limit=$(blocks_per_chop)] as @a[distance=..20,tag=!global.ignore.gui] run function timber:utils/stopsound - -# delete location item -$execute at @e[type=minecraft:marker,tag=timber_slow_chop] at @e[type=minecraft:marker,tag=timber_destroy,sort=nearest,limit=$(blocks_per_chop)] run kill @e[type=minecraft:item,distance=..1,nbt={Item:{components:{"minecraft:custom_data":{Tags:["timber_location"]}}}}] - -# remove marker of processed blocks -$execute at @e[type=minecraft:marker,tag=timber_slow_chop] run kill @e[type=minecraft:marker,tag=timber_destroy,sort=nearest,limit=$(blocks_per_chop)] - -# delete tree markers after chopping -execute unless entity @e[type=minecraft:marker,tag=timber_destroy] run function timber:slow_chop/delete_markers \ No newline at end of file diff --git a/18-81/data/timber/function/utils/check_max_command_chain_length.mcfunction b/18-81/data/timber/function/utils/check_max_command_chain_length.mcfunction deleted file mode 100644 index 6f32c3e..0000000 --- a/18-81/data/timber/function/utils/check_max_command_chain_length.mcfunction +++ /dev/null @@ -1,13 +0,0 @@ -# function didn't end successfully -execute if score running timber matches 1 run scoreboard players set running timber 2 -# normal behavior -execute if score running timber matches 0 run scoreboard players set running timber 1 -execute if score running timber matches 1 run function timber:utils/used_axe -# function didn't end successfully -execute if score running timber matches 2 run execute store result storage timber:max_command_chain_length value int 1 run gamerule maxCommandChainLength -execute if score running timber matches 2 run tellraw @a[tag=!noTimberWarning] ["",{"text":"Timber Datapack Warning: ","color":"red"},{"text":"The datapack wasn't able to finish its functionality to work properly!"},{"text":"\n ─ Please either decrease setting \"Max. Tree Size\" with "},{"text":"\n [ ✎ ]","color":"gray","clickEvent":{"action":"suggest_command","value":"/scoreboard players set max_tree_size timber "},"hoverEvent":{"action":"show_text","value":"Default: 555"}},{"text":" (Currently: ","color":"gray"},{"score":{"name":"max_tree_size","objective":"timber"},"color":"gray"},{"text": ")","color":"gray"},{"text":"."},{"text":"\n ─ Or increase the gamerule \"maxCommandChainLength\" with "},{"text":"\n [ ✎ ]","color":"gray","clickEvent":{"action":"suggest_command","value":"/gamerule maxCommandChainLength "},"hoverEvent":{"action":"show_text","value":"Default: 65536"}},{"text":" (Currently: ","color":"gray"},{"nbt":"value","storage":"timber:max_command_chain_length","color":"gray"},{"text": ")","color":"gray"},{"text":"."}] -execute if score running timber matches 2 run schedule function timber:utils/reset 10t -execute if score running timber matches 2 run scoreboard players set running timber 3 - -# function ended successfully -execute if score running timber matches 1 run scoreboard players set running timber 0 \ No newline at end of file diff --git a/18-81/data/timber/function/utils/check_max_command_sequence_length.mcfunction b/18-81/data/timber/function/utils/check_max_command_sequence_length.mcfunction deleted file mode 100644 index e69de29..0000000 diff --git a/18-81/data/timber/function/validated.mcfunction b/18-81/data/timber/function/validated.mcfunction deleted file mode 100644 index 9617429..0000000 --- a/18-81/data/timber/function/validated.mcfunction +++ /dev/null @@ -1,51 +0,0 @@ -# when full inventory fix -execute if score drop_loot timber matches 1.. store result score inventory timber run data get entity @s Inventory -execute if score drop_loot timber matches 1.. if entity @s[nbt={Inventory:[{Slot:100b}]}] run scoreboard players remove inventory timber 1 -execute if score drop_loot timber matches 1.. if entity @s[nbt={Inventory:[{Slot:101b}]}] run scoreboard players remove inventory timber 1 -execute if score drop_loot timber matches 1.. if entity @s[nbt={Inventory:[{Slot:102b}]}] run scoreboard players remove inventory timber 1 -execute if score drop_loot timber matches 1.. if entity @s[nbt={Inventory:[{Slot:103b}]}] run scoreboard players remove inventory timber 1 -execute if score drop_loot timber matches 1.. if entity @s[nbt={Inventory:[{Slot:-106b}]}] run scoreboard players remove inventory timber 1 - -# destroy blocks - # mark blocks that need to be destroyed - tag @e[type=minecraft:marker,tag=timber_log] add timber_destroy - execute if score destroy_leaves timber matches 1.. run tag @e[type=minecraft:marker,tag=timber_leaf] add timber_destroy - execute if score destroy_roots timber matches 1.. run tag @e[type=minecraft:marker,tag=timber_root] add timber_destroy - tag @e[type=minecraft:marker,tag=timber_stem] add timber_destroy - tag @e[type=minecraft:marker,tag=timber_cap] add timber_destroy - # api - execute unless score slow_chop timber matches 1.. at @e[type=minecraft:marker,tag=timber_log] run function #timber:api/break_log - execute unless score slow_chop timber matches 1.. at @e[type=minecraft:marker,tag=timber_leaf] run function #timber:api/break_leaf - execute unless score slow_chop timber matches 1.. at @e[type=minecraft:marker,tag=timber_root] run function #timber:api/break_root - execute unless score slow_chop timber matches 1.. at @e[type=minecraft:marker,tag=timber_stem] run function #timber:api/break_stem - execute unless score slow_chop timber matches 1.. at @e[type=minecraft:marker,tag=timber_cap] run function #timber:api/break_cap - # loot - execute unless score slow_chop timber matches 1.. unless score drop_loot timber matches 1.. at @e[type=minecraft:marker,tag=timber_destroy] run loot spawn ~ ~ ~ mine ~ ~ ~ mainhand - execute unless score slow_chop timber matches 1.. if score drop_loot timber matches 1.. unless score inventory timber matches 36.. at @e[type=minecraft:marker,tag=timber_destroy] run loot give @s mine ~ ~ ~ mainhand - execute unless score slow_chop timber matches 1.. if score drop_loot timber matches 1.. if score inventory timber matches 36.. at @e[type=minecraft:marker,tag=timber_destroy] run loot spawn ~ ~ ~ mine ~ ~ ~ mainhand - # destroy animation (doTileDrops can be changed, because datapack wouldn't get to this point otherwise) - gamerule doTileDrops false - execute unless score slow_chop timber matches 1.. at @e[type=minecraft:marker,tag=timber_destroy] run setblock ~ ~ ~ minecraft:air destroy - gamerule doTileDrops true - # remove destroy marker - execute unless score slow_chop timber matches 1.. run kill @e[type=minecraft:marker,tag=timber_destroy] - -# stop sound -execute if score stopsound timber matches 1.. as @a[distance=..20,tag=!global.ignore.gui] run function timber:utils/stopsound - -# save tool for slow chopping process -execute if score slow_chop timber matches 1.. at @e[type=minecraft:marker,tag=timber_tree,tag=!timber_slow_chop,distance=..7,sort=arbitrary,limit=1] run summon minecraft:armor_stand ~ -64 ~ {Silent:1b,Invulnerable:1b,Marker:1b,Invisible:1b,Tags:["timber_tool"],Rotation:[45f],Pose:{RightArm:[0f,270f,0f]}} -execute if score slow_chop timber matches 1.. at @e[type=minecraft:marker,tag=timber_tree,tag=!timber_slow_chop,distance=..7,sort=arbitrary,limit=1] run data modify entity @e[type=minecraft:armor_stand,tag=timber_tool,y=-64,distance=...1,sort=arbitrary,limit=1] equipment.mainhand merge from entity @s SelectedItem -execute if score slow_chop timber matches 1.. run tag @e[type=minecraft:marker,tag=timber_tree,tag=!timber_slow_chop,distance=..7,sort=arbitrary,limit=1] add timber_slow_chop - -# tp hand-broken loot into inventory -execute if score drop_loot timber matches 1.. unless score inventory timber matches 36.. at @e[type=minecraft:marker,tag=timber_tree,tag=!timber_slow_chop,distance=..7,sort=arbitrary,limit=1] run function timber:utils/tp_item - -# wear out tool -execute if score wear_out timber matches 1.. unless score unbreakable timber matches 1 run function timber:tool/wear_out - -# break axe if worn out -execute if score wear_out timber matches 1.. unless score unbreakable timber matches 1 run function timber:tool/worn_out - -# give hunger effect -execute if score hunger timber matches 1.. run function timber:utils/hunger \ No newline at end of file diff --git a/18-81/data/timber/item_modifier/wear_out.json b/18-81/data/timber/item_modifier/wear_out.json deleted file mode 100644 index 63fd89d..0000000 --- a/18-81/data/timber/item_modifier/wear_out.json +++ /dev/null @@ -1,152 +0,0 @@ -[ - { - "function": "minecraft:set_damage", - "damage": { - "type": "minecraft:score", - "target": { - "type": "minecraft:fixed", - "name": "damage" - }, - "score": "timber", - "scale": 0.01694915254237288 - }, - "conditions": [ - { - "condition": "minecraft:entity_properties", - "entity": "this", - "predicate": { - "equipment": { - "mainhand": { - "items": "minecraft:wooden_axe" - } - } - } - } - ] - }, - { - "function": "minecraft:set_damage", - "damage": { - "type": "minecraft:score", - "target": { - "type": "minecraft:fixed", - "name": "damage" - }, - "score": "timber", - "scale": 0.007633587786259542 - }, - "conditions": [ - { - "condition": "minecraft:entity_properties", - "entity": "this", - "predicate": { - "equipment": { - "mainhand": { - "items": "minecraft:stone_axe" - } - } - } - } - ] - }, - { - "function": "minecraft:set_damage", - "damage": { - "type": "minecraft:score", - "target": { - "type": "minecraft:fixed", - "name": "damage" - }, - "score": "timber", - "scale": 0.004 - }, - "conditions": [ - { - "condition": "minecraft:entity_properties", - "entity": "this", - "predicate": { - "equipment": { - "mainhand": { - "items": "minecraft:iron_axe" - } - } - } - } - ] - }, - { - "function": "minecraft:set_damage", - "damage": { - "type": "minecraft:score", - "target": { - "type": "minecraft:fixed", - "name": "damage" - }, - "score": "timber", - "scale": 0.03125 - }, - "conditions": [ - { - "condition": "minecraft:entity_properties", - "entity": "this", - "predicate": { - "equipment": { - "mainhand": { - "items": "minecraft:golden_axe" - } - } - } - } - ] - }, - { - "function": "minecraft:set_damage", - "damage": { - "type": "minecraft:score", - "target": { - "type": "minecraft:fixed", - "name": "damage" - }, - "score": "timber", - "scale": 0.0006393861892583121 - }, - "conditions": [ - { - "condition": "minecraft:entity_properties", - "entity": "this", - "predicate": { - "equipment": { - "mainhand": { - "items": "minecraft:diamond_axe" - } - } - } - } - ] - }, - { - "function": "minecraft:set_damage", - "damage": { - "type": "minecraft:score", - "target": { - "type": "minecraft:fixed", - "name": "damage" - }, - "score": "timber", - "scale": 0.0004923682914820286 - }, - "conditions": [ - { - "condition": "minecraft:entity_properties", - "entity": "this", - "predicate": { - "equipment": { - "mainhand": { - "items": "minecraft:netherite_axe" - } - } - } - } - ] - } -] \ No newline at end of file diff --git a/18-81/data/timber/predicate/used_axe.json b/18-81/data/timber/predicate/used_axe.json deleted file mode 100644 index ac00bc4..0000000 --- a/18-81/data/timber/predicate/used_axe.json +++ /dev/null @@ -1,59 +0,0 @@ -{ - "condition": "minecraft:any_of", - "terms": [ - { - "condition": "minecraft:entity_scores", - "entity": "this", - "scores": { - "timber_w_axe": { - "min": 1 - } - } - }, - { - "condition": "minecraft:entity_scores", - "entity": "this", - "scores": { - "timber_s_axe": { - "min": 1 - } - } - }, - { - "condition": "minecraft:entity_scores", - "entity": "this", - "scores": { - "timber_i_axe": { - "min": 1 - } - } - }, - { - "condition": "minecraft:entity_scores", - "entity": "this", - "scores": { - "timber_g_axe": { - "min": 1 - } - } - }, - { - "condition": "minecraft:entity_scores", - "entity": "this", - "scores": { - "timber_d_axe": { - "min": 1 - } - } - }, - { - "condition": "minecraft:entity_scores", - "entity": "this", - "scores": { - "timber_n_axe": { - "min": 1 - } - } - } - ] -} \ No newline at end of file diff --git a/18-81/data/timber/tags/item/axes.json b/18-81/data/timber/tags/item/axes.json deleted file mode 100644 index c496215..0000000 --- a/18-81/data/timber/tags/item/axes.json +++ /dev/null @@ -1,10 +0,0 @@ -{ - "values":[ - "minecraft:wooden_axe", - "minecraft:stone_axe", - "minecraft:iron_axe", - "minecraft:golden_axe", - "minecraft:diamond_axe", - "minecraft:netherite_axe" - ] -} \ No newline at end of file diff --git a/82-88/data/timber/function/init.mcfunction b/82-88/data/timber/function/init.mcfunction deleted file mode 100644 index 9bfeada..0000000 --- a/82-88/data/timber/function/init.mcfunction +++ /dev/null @@ -1,40 +0,0 @@ -# longer maxCommandChainLength -gamerule maxCommandChainLength 1000000000 - -# create scoreboards -scoreboard objectives add timber_w_axe minecraft.used:minecraft.wooden_axe -scoreboard objectives add timber_s_axe minecraft.used:minecraft.stone_axe -scoreboard objectives add timber_c_axe minecraft.used:minecraft.copper_axe -scoreboard objectives add timber_i_axe minecraft.used:minecraft.iron_axe -scoreboard objectives add timber_g_axe minecraft.used:minecraft.golden_axe -scoreboard objectives add timber_d_axe minecraft.used:minecraft.diamond_axe -scoreboard objectives add timber_n_axe minecraft.used:minecraft.netherite_axe -scoreboard objectives add timber dummy -scoreboard objectives add TimberToggle trigger {text:"Timber Toggle",color:"#724E21"} -scoreboard objectives add timber_disabled dummy -scoreboard objectives add timber_prsistent dummy - -# non-overriding default values -function timber:settings/default_values -function timber:tool/durability_max -scoreboard players set running timber 0 - -# start optional loops -execute if score plant_sapling timber matches 1.. run function timber:autoplant/loop -execute if score slow_chop timber matches 1.. run function timber:slow_chop/loop - -# check loottable compatibility of mushroom stem -setblock ~ 255 ~ minecraft:chest -setblock ~ 255 ~1 minecraft:mushroom_stem -loot insert ~ 255 ~ mine ~ 255 ~1 minecraft:diamond_axe -execute unless data block ~ 255 ~ Items[{id:"minecraft:knowledge_book",components:{"minecraft:custom_data":{Tags:["timber_location"]}}}] run tellraw @a[tag=!noTimberWarning] ["",{text:"Timber Datapack Warning: ",color:"red"},{text:"Incompatibility with the mushroom_stem loottable of another datapack!"}] -fill ~-1 255 ~-1 ~1 255 ~1 minecraft:air -execute store result score doTileDrops timber run gamerule doTileDrops -execute if score doTileDrops timber matches 0 run tellraw @a[tag=!noTimberWarning] ["",{text:"Timber Datapack Warning: ",color:"red"},{text:"This datapack only works when gamerule doTileDrops is set to true!"}] - -# Getting the game version and checking if it is compatible with the datapack https://minecraft.fandom.com/wiki/Data_version -execute store result score game_version timber run data get entity @r DataVersion -execute if score game_version timber matches ..3442 run tellraw @a[tag=!noTimberWarning] ["",{text:"Timber Datapack Warning: ",color:"red"},{text:"This datapack is not compatible with all the versions before 1.20!"}] - -# Checking if the server uses a different jar from the vanilla one -function timber:utils/check_server \ No newline at end of file diff --git a/82-88/data/timber/function/main.mcfunction b/82-88/data/timber/function/main.mcfunction deleted file mode 100644 index 02ef309..0000000 --- a/82-88/data/timber/function/main.mcfunction +++ /dev/null @@ -1,11 +0,0 @@ -# loop (not in minecraft:tick in order to stop it after uninstall) -schedule function timber:main 1t - -# if any kind of axe is used -execute as @a[predicate=timber:used_axe,tag=!global.ignore] at @s run function timber:utils/check_max_command_chain_length - -# toggle timber datapack per player -execute as @a[scores={TimberToggle=1..},tag=!global.ignore] run function timber:settings/toggle/timber - -# reset -scoreboard players enable @a TimberToggle \ No newline at end of file diff --git a/82-88/data/timber/function/settings/end_of_message.mcfunction b/82-88/data/timber/function/settings/end_of_message.mcfunction deleted file mode 100644 index 1d5e211..0000000 --- a/82-88/data/timber/function/settings/end_of_message.mcfunction +++ /dev/null @@ -1,3 +0,0 @@ -execute store result score sendCommandFeedback timber run gamerule sendCommandFeedback -execute if score sendCommandFeedback timber matches 1 run schedule function timber:settings/reset_gamerule 1t -gamerule sendCommandFeedback false \ No newline at end of file diff --git a/82-88/data/timber/function/settings/reset_gamerule.mcfunction b/82-88/data/timber/function/settings/reset_gamerule.mcfunction deleted file mode 100644 index b466492..0000000 --- a/82-88/data/timber/function/settings/reset_gamerule.mcfunction +++ /dev/null @@ -1 +0,0 @@ -gamerule sendCommandFeedback true \ No newline at end of file diff --git a/82-88/data/timber/function/slow_chop/destroy_loop.mcfunction b/82-88/data/timber/function/slow_chop/destroy_loop.mcfunction deleted file mode 100644 index db43fbd..0000000 --- a/82-88/data/timber/function/slow_chop/destroy_loop.mcfunction +++ /dev/null @@ -1,25 +0,0 @@ -# loop -$schedule function timber:slow_chop/loop $(time_between_chops)t replace - -# api -$execute at @e[type=minecraft:marker,tag=timber_slow_chop] as @e[type=minecraft:marker,tag=timber_destroy,sort=nearest,limit=$(blocks_per_chop)] at @s run function timber:slow_chop/api - -# destroy n block -$execute at @e[type=minecraft:marker,tag=timber_slow_chop] as @e[type=minecraft:armor_stand,tag=timber_tool,y=-64,distance=...1,sort=arbitrary,limit=1] at @e[type=minecraft:marker,tag=timber_destroy,sort=nearest,limit=$(blocks_per_chop)] run loot spawn ~ ~ ~ mine ~ ~ ~ mainhand - -# destroy animation (doTileDrops can be changed, because datapack wouldn't get to this point otherwise) -gamerule doTileDrops false -$execute at @e[type=minecraft:marker,tag=timber_slow_chop] at @e[type=minecraft:marker,tag=timber_destroy,sort=nearest,limit=$(blocks_per_chop)] run setblock ~ ~ ~ minecraft:air destroy -gamerule doTileDrops true - -# stop sound -$execute at @e[type=minecraft:marker,tag=timber_slow_chop] if score stopsound timber matches 1.. at @e[type=minecraft:marker,tag=timber_destroy,sort=nearest,limit=$(blocks_per_chop)] as @a[distance=..20,tag=!global.ignore.gui] run function timber:utils/stopsound - -# delete location item -$execute at @e[type=minecraft:marker,tag=timber_slow_chop] at @e[type=minecraft:marker,tag=timber_destroy,sort=nearest,limit=$(blocks_per_chop)] run kill @e[type=minecraft:item,distance=..1,nbt={Item:{components:{"minecraft:custom_data":{Tags:["timber_location"]}}}}] - -# remove marker of processed blocks -$execute at @e[type=minecraft:marker,tag=timber_slow_chop] run kill @e[type=minecraft:marker,tag=timber_destroy,sort=nearest,limit=$(blocks_per_chop)] - -# delete tree markers after chopping -execute unless entity @e[type=minecraft:marker,tag=timber_destroy] run function timber:slow_chop/delete_markers \ No newline at end of file diff --git a/82-88/data/timber/function/utils/check_max_command_chain_length.mcfunction b/82-88/data/timber/function/utils/check_max_command_chain_length.mcfunction deleted file mode 100644 index 6f32c3e..0000000 --- a/82-88/data/timber/function/utils/check_max_command_chain_length.mcfunction +++ /dev/null @@ -1,13 +0,0 @@ -# function didn't end successfully -execute if score running timber matches 1 run scoreboard players set running timber 2 -# normal behavior -execute if score running timber matches 0 run scoreboard players set running timber 1 -execute if score running timber matches 1 run function timber:utils/used_axe -# function didn't end successfully -execute if score running timber matches 2 run execute store result storage timber:max_command_chain_length value int 1 run gamerule maxCommandChainLength -execute if score running timber matches 2 run tellraw @a[tag=!noTimberWarning] ["",{"text":"Timber Datapack Warning: ","color":"red"},{"text":"The datapack wasn't able to finish its functionality to work properly!"},{"text":"\n ─ Please either decrease setting \"Max. Tree Size\" with "},{"text":"\n [ ✎ ]","color":"gray","clickEvent":{"action":"suggest_command","value":"/scoreboard players set max_tree_size timber "},"hoverEvent":{"action":"show_text","value":"Default: 555"}},{"text":" (Currently: ","color":"gray"},{"score":{"name":"max_tree_size","objective":"timber"},"color":"gray"},{"text": ")","color":"gray"},{"text":"."},{"text":"\n ─ Or increase the gamerule \"maxCommandChainLength\" with "},{"text":"\n [ ✎ ]","color":"gray","clickEvent":{"action":"suggest_command","value":"/gamerule maxCommandChainLength "},"hoverEvent":{"action":"show_text","value":"Default: 65536"}},{"text":" (Currently: ","color":"gray"},{"nbt":"value","storage":"timber:max_command_chain_length","color":"gray"},{"text": ")","color":"gray"},{"text":"."}] -execute if score running timber matches 2 run schedule function timber:utils/reset 10t -execute if score running timber matches 2 run scoreboard players set running timber 3 - -# function ended successfully -execute if score running timber matches 1 run scoreboard players set running timber 0 \ No newline at end of file diff --git a/82-88/data/timber/function/utils/check_max_command_sequence_length.mcfunction b/82-88/data/timber/function/utils/check_max_command_sequence_length.mcfunction deleted file mode 100644 index e69de29..0000000 diff --git a/82-88/data/timber/function/validated.mcfunction b/82-88/data/timber/function/validated.mcfunction deleted file mode 100644 index 9617429..0000000 --- a/82-88/data/timber/function/validated.mcfunction +++ /dev/null @@ -1,51 +0,0 @@ -# when full inventory fix -execute if score drop_loot timber matches 1.. store result score inventory timber run data get entity @s Inventory -execute if score drop_loot timber matches 1.. if entity @s[nbt={Inventory:[{Slot:100b}]}] run scoreboard players remove inventory timber 1 -execute if score drop_loot timber matches 1.. if entity @s[nbt={Inventory:[{Slot:101b}]}] run scoreboard players remove inventory timber 1 -execute if score drop_loot timber matches 1.. if entity @s[nbt={Inventory:[{Slot:102b}]}] run scoreboard players remove inventory timber 1 -execute if score drop_loot timber matches 1.. if entity @s[nbt={Inventory:[{Slot:103b}]}] run scoreboard players remove inventory timber 1 -execute if score drop_loot timber matches 1.. if entity @s[nbt={Inventory:[{Slot:-106b}]}] run scoreboard players remove inventory timber 1 - -# destroy blocks - # mark blocks that need to be destroyed - tag @e[type=minecraft:marker,tag=timber_log] add timber_destroy - execute if score destroy_leaves timber matches 1.. run tag @e[type=minecraft:marker,tag=timber_leaf] add timber_destroy - execute if score destroy_roots timber matches 1.. run tag @e[type=minecraft:marker,tag=timber_root] add timber_destroy - tag @e[type=minecraft:marker,tag=timber_stem] add timber_destroy - tag @e[type=minecraft:marker,tag=timber_cap] add timber_destroy - # api - execute unless score slow_chop timber matches 1.. at @e[type=minecraft:marker,tag=timber_log] run function #timber:api/break_log - execute unless score slow_chop timber matches 1.. at @e[type=minecraft:marker,tag=timber_leaf] run function #timber:api/break_leaf - execute unless score slow_chop timber matches 1.. at @e[type=minecraft:marker,tag=timber_root] run function #timber:api/break_root - execute unless score slow_chop timber matches 1.. at @e[type=minecraft:marker,tag=timber_stem] run function #timber:api/break_stem - execute unless score slow_chop timber matches 1.. at @e[type=minecraft:marker,tag=timber_cap] run function #timber:api/break_cap - # loot - execute unless score slow_chop timber matches 1.. unless score drop_loot timber matches 1.. at @e[type=minecraft:marker,tag=timber_destroy] run loot spawn ~ ~ ~ mine ~ ~ ~ mainhand - execute unless score slow_chop timber matches 1.. if score drop_loot timber matches 1.. unless score inventory timber matches 36.. at @e[type=minecraft:marker,tag=timber_destroy] run loot give @s mine ~ ~ ~ mainhand - execute unless score slow_chop timber matches 1.. if score drop_loot timber matches 1.. if score inventory timber matches 36.. at @e[type=minecraft:marker,tag=timber_destroy] run loot spawn ~ ~ ~ mine ~ ~ ~ mainhand - # destroy animation (doTileDrops can be changed, because datapack wouldn't get to this point otherwise) - gamerule doTileDrops false - execute unless score slow_chop timber matches 1.. at @e[type=minecraft:marker,tag=timber_destroy] run setblock ~ ~ ~ minecraft:air destroy - gamerule doTileDrops true - # remove destroy marker - execute unless score slow_chop timber matches 1.. run kill @e[type=minecraft:marker,tag=timber_destroy] - -# stop sound -execute if score stopsound timber matches 1.. as @a[distance=..20,tag=!global.ignore.gui] run function timber:utils/stopsound - -# save tool for slow chopping process -execute if score slow_chop timber matches 1.. at @e[type=minecraft:marker,tag=timber_tree,tag=!timber_slow_chop,distance=..7,sort=arbitrary,limit=1] run summon minecraft:armor_stand ~ -64 ~ {Silent:1b,Invulnerable:1b,Marker:1b,Invisible:1b,Tags:["timber_tool"],Rotation:[45f],Pose:{RightArm:[0f,270f,0f]}} -execute if score slow_chop timber matches 1.. at @e[type=minecraft:marker,tag=timber_tree,tag=!timber_slow_chop,distance=..7,sort=arbitrary,limit=1] run data modify entity @e[type=minecraft:armor_stand,tag=timber_tool,y=-64,distance=...1,sort=arbitrary,limit=1] equipment.mainhand merge from entity @s SelectedItem -execute if score slow_chop timber matches 1.. run tag @e[type=minecraft:marker,tag=timber_tree,tag=!timber_slow_chop,distance=..7,sort=arbitrary,limit=1] add timber_slow_chop - -# tp hand-broken loot into inventory -execute if score drop_loot timber matches 1.. unless score inventory timber matches 36.. at @e[type=minecraft:marker,tag=timber_tree,tag=!timber_slow_chop,distance=..7,sort=arbitrary,limit=1] run function timber:utils/tp_item - -# wear out tool -execute if score wear_out timber matches 1.. unless score unbreakable timber matches 1 run function timber:tool/wear_out - -# break axe if worn out -execute if score wear_out timber matches 1.. unless score unbreakable timber matches 1 run function timber:tool/worn_out - -# give hunger effect -execute if score hunger timber matches 1.. run function timber:utils/hunger \ No newline at end of file diff --git a/README.md b/README.md index 54272e7..aab7bc6 100644 --- a/README.md +++ b/README.md @@ -1,5 +1,8 @@ ![logo](.github/resources/logo.png) +[![Test](https://github.com/Moggla/Timber-Datapack/actions/workflows/test.yml/badge.svg?branch=main)](https://github.com/Moggla/Timber-Datapack/actions/workflows/test.yml) [![Latest Minecraft](https://img.shields.io/endpoint?url=https%3A%2F%2Fraw.githubusercontent.com%2FMoggla/Timber-Datapack%2Fbadges%2Flatest.json)](https://github.com/Moggla/Timber-Datapack/actions/workflows/latest.yml) [![Last check](https://img.shields.io/github/last-commit/Moggla/Timber-Datapack/badges?path=latest.json&label=last%20check)](https://github.com/Moggla/Timber-Datapack/actions/workflows/latest.yml) + + This is a really useful addition for those who don't want to spend expensive time on gathering resources! After installing, the Timber Datapack allows you to instantly chop down a tree just by breaking one log with any axe. By default, sneaking while breaking will not chop the tree. Optionally, you can adjust everything as you wish. @@ -17,12 +20,12 @@ Optionally, you can adjust everything as you wish. ³ All kind of custom trees like from **BiomesO'Plenty**, **The Biome Overhaul**, **Terrestria and Traverse**. # Preview - + - - + -*Enable the option "Chop Fungi" +> [!NOTE] +> Enable the option `Chop Fungi` # Settings To get descriptions and settings for this datapack use: @@ -36,9 +39,10 @@ To get descriptions and settings for this datapack use: If you don't have access to commands in your singleplayer world 1. Pause the game -2. Click on Open to LAN -3. In the options, change **Allow Cheats**: OFF to ON -4. Click on Start LAN World +2. Click on `World Options...` +3. Toggle `LAN` to `ON` +4. Toggle `Command Access` to `ON` +5. Click on `Apply Changes`
@@ -60,13 +64,14 @@ Every player can individually turn the datapack ON or OFF by using: ## About This Advanced Manual will help you to add or change certain elements of this datapack which require editing of your side. -> [!IMPORTANT] -> In order to add or change the following you have to put the content of the datapack (Timber.zip) in a folder called "Timber". + +> [!IMPORTANT] +> In order to add or change the following you have to put the content of the datapack (`Timber.zip`) in a folder called `Timber`. > There are directories to different type of files. Open them with any kind of text editor. Below the directories is the code which you have to insert or replace (it's stated which one of these). ## Debugging -If you have difficulties or errors in trying to change the timber datapack, then please enable the output log (Minecraft Launcher → Settings → General → Enable "Open output log when Minecraft: Java Edition starts"). +If you have difficulties or errors in trying to change the timber datapack, then please enable the output log (Minecraft Launcher → Settings → General → Enable `Open output log when Minecraft: Java Edition starts`). ## Add modded axes @@ -74,14 +79,14 @@ If you have difficulties or errors in trying to change the timber datapack, then (Small note: Your modded axe will break after or below zero durability. This shouldn't be a problem. It's not really worth to implement a fix, because you're only able to chop a few more logs) Get the name of your modded axe: -Go ingame and type "/scoreboard objectives add x minecraft.used:" in chat. Now search for your modded axe there. -In my example it's called "**supertools.emeraldaxe**". +Go ingame and type `/scoreboard objectives add x minecraft.used:` in chat. Now search for your modded axe there. +In my example it's called `supertools.emeraldaxe`. Give your modded axe a nickname: -In my case a gave him the name "**timber_emera_axe**". +In my case a gave him the name `timber_emera_axe`. This is technically the name of your axe used by the datapack. You can name it however you like just look that you write it everywhere the same and that you follow these points: -Always use the prefix "timber_" -The max. length of the nickname is "timber_123456789" +Always use the prefix `timber_` +The max. length of the nickname is `timber_123456789` Don't use names twice for other axes! `Timber/data/timber/functions/init.mcfunctions` @@ -134,7 +139,7 @@ The content of the upper part of this file should look like this. `Timber/data/timber/tags/items/axes.json` -The content should look like this. Don't forget to add the "," after the netherite_axe and to change the ":" between supertools and emeraldaxe! +The content should look like this. Don't forget to add the `,` after the `netherite_axe` and to change the `:` between `supertools` and `emeraldaxe`! ```json {   "values":[ @@ -154,15 +159,16 @@ The content should look like this. Don't forget to add the "," after the netheri # Installation instructions - Download the Datapack - Start Minecraft (Java Edition) -- Click on "Singleplayer" +- Click on `Singleplayer` - Select your world in which to install this Datapack (Don't click on play!) -- Click on "Edit" -- Click on "Open World Folder" -- Place the .zip file inside the **datapacks** folder (Don't unzip it!) -- Join/Rejoin the world or use /reload +- Click on `Edit` +- Click on `Open World Folder` +- Place the `.zip` file inside the `datapacks` folder (Don't unzip it!) +- Join/Rejoin the world or use `/reload` - Finished! Enjoy! -Note: It does not work in creative mode! +> [!NOTE] +> It does not work in creative mode! # Server Compatibility Other Minecraft servers, unlike Vanilla or Realm, often do not fully support Datapacks. diff --git a/18-26/data/timber/tags/functions/help.json b/data/minecraft/tags/dialog/pause_screen_additions.json similarity index 64% rename from 18-26/data/timber/tags/functions/help.json rename to data/minecraft/tags/dialog/pause_screen_additions.json index 082ff6b..54d298d 100644 --- a/18-26/data/timber/tags/functions/help.json +++ b/data/minecraft/tags/dialog/pause_screen_additions.json @@ -1,5 +1,5 @@ { - "values":[ + "values": [ "timber:help" ] } \ No newline at end of file diff --git a/data/timber/dialog/help.json b/data/timber/dialog/help.json new file mode 100644 index 0000000..7a4bdb0 --- /dev/null +++ b/data/timber/dialog/help.json @@ -0,0 +1,75 @@ +{ + "type": "minecraft:multi_action", + "title": "Timber Datapack", + "external_title": "Timber", + "body": { + "type": "minecraft:plain_message", + "contents": [ + "", + { + "text": "The Timber Datapack allows you to instantly chop down a tree just by breaking one log with any axe." + }, + "\n\n", + { + "text": "By default, sneaking while breaking will not chop the tree." + }, + "\n\n", + { + "text": "Every player can use " + }, + { + "text": "/trigger TimberToggle", + "color": "blue", + "click_event": { + "action": "suggest_command", + "command": "/trigger TimberToggle" + } + }, + { + "text": " or the button below to individually turn the datapack on or off." + } + ], + "width": 300 + }, + "inputs": [], + "can_close_with_escape": true, + "pause": false, + "actions": [ + { + "label": "Check for New Updates", + "action": { + "type": "minecraft:open_url", + "url": "https://github.com/Moggla/Timber-Datapack/releases" + } + }, + { + "label": "Settings", + "tooltip": { + "text": "Requires the tag timber_admin.", + "color": "gray" + }, + "action": { + "type": "minecraft:run_command", + "command": "trigger TimberToggle set 2" + } + }, + { + "label": "Toggle Timber for Me", + "tooltip": "Turns the datapack on or off for you only.", + "action": { + "type": "minecraft:run_command", + "command": "trigger TimberToggle set 3" + } + } + ], + "after_action": "none", + "exit_action": { + "label": { + "translate": "gui.back" + }, + "action": { + "type": "minecraft:run_command", + "command": "trigger TimberToggle set 4" + } + } +} \ No newline at end of file diff --git a/data/timber/function/help.mcfunction b/data/timber/function/help.mcfunction index daa8cab..21452a5 100644 --- a/data/timber/function/help.mcfunction +++ b/data/timber/function/help.mcfunction @@ -1,25 +1 @@ -tellraw @s ["",{text:"\u00A7m ",color:"dark_gray"}] - -tellraw @s ["",{text:" Timber Datapack"}] - -tellraw @s ["",{text:"\u00A7m ",color:"dark_gray"}] - -tellraw @s ["",{text:"The Timber Datapack allows you to instantly chop down a tree just by breaking one log with any axe."}] - -tellraw @s ["",{text:"By default, sneaking while breaking will not chop the tree."}] - -tellraw @s [""] - -tellraw @s ["",{text:"Every player can use "},{text:"/trigger TimberToggle",color:"blue",click_event:{action:"suggest_command",command:"/trigger TimberToggle"}},{text:" to individually turn the datapack on or off."}] - -tellraw @s [""] - -tellraw @s [""," ",{text:"[click here to check for new updates]",color:"green",click_event:{action:"open_url",url:"https://github.com/Moggla/Timber-Datapack/releases"}}] - -tellraw @s [""] - -tellraw @s [""," ",{text:"[click here to see the settings]",color:"gold",click_event:{action:"run_command",command:"/function timber:settings/settings1_click"}}] - -tellraw @s ["",{text:"\u00A7m ",color:"dark_gray"}] - -function timber:settings/end_of_message \ No newline at end of file +function timber:settings/open/help diff --git a/data/timber/function/init.mcfunction b/data/timber/function/init.mcfunction index 6cf85e8..7f36fe3 100644 --- a/data/timber/function/init.mcfunction +++ b/data/timber/function/init.mcfunction @@ -11,9 +11,21 @@ scoreboard objectives add timber_d_axe minecraft.used:minecraft.diamond_axe scoreboard objectives add timber_n_axe minecraft.used:minecraft.netherite_axe scoreboard objectives add timber dummy scoreboard objectives add TimberToggle trigger {text:"Timber Toggle",color:"#724E21"} +scoreboard objectives add TimberSettings trigger {text:"Timber Settings",color:"#724E21"} +scoreboard objectives add TimberSetBlocks trigger +scoreboard objectives add TimberSetTicks trigger +scoreboard objectives add TimberSetTreeSize trigger +scoreboard objectives add TimberSetLeaves trigger +scoreboard objectives add timber_menu dummy scoreboard objectives add timber_disabled dummy scoreboard objectives add timber_prsistent dummy +scoreboard players reset * TimberSettings +scoreboard players reset * TimberSetBlocks +scoreboard players reset * TimberSetTicks +scoreboard players reset * TimberSetTreeSize +scoreboard players reset * TimberSetLeaves + # non-overriding default values function timber:settings/default_values function timber:tool/durability_max @@ -34,7 +46,7 @@ execute if score block_drops timber matches 0 run tellraw @a[tag=!noTimberWarnin # Getting the game version and checking if it is compatible with the datapack https://minecraft.fandom.com/wiki/Data_version execute store result score game_version timber run data get entity @r DataVersion -execute if score game_version timber matches ..3442 run tellraw @a[tag=!noTimberWarning] ["",{text:"Timber Datapack Warning: ",color:"red"},{text:"This datapack is not compatible with all the versions before 1.20!"}] +execute if score game_version timber matches ..4785 run tellraw @a[tag=!noTimberWarning] ["",{text:"Timber Datapack Warning: ",color:"red"},{text:"This datapack is not compatible with all the versions before 26.1!"}] # Checking if the server uses a different jar from the vanilla one function timber:utils/check_server diff --git a/data/timber/function/main.mcfunction b/data/timber/function/main.mcfunction index 70b5108..82139cc 100644 --- a/data/timber/function/main.mcfunction +++ b/data/timber/function/main.mcfunction @@ -5,7 +5,20 @@ schedule function timber:main 1t execute as @a[predicate=timber:used_axe,tag=!global.ignore] at @s run function timber:utils/check_max_command_sequence_length # toggle timber datapack per player -execute as @a[scores={TimberToggle=1..},tag=!global.ignore] run function timber:settings/toggle/timber +execute as @a[scores={TimberToggle=1},tag=!global.ignore] run function timber:settings/toggle/timber +execute as @a[scores={TimberToggle=2..},tag=!global.ignore] run function timber:settings/menu_request + +# open the settings dialog (the dialog button can only run /trigger without a confirmation screen) +execute as @a[scores={TimberSettings=1..},tag=!global.ignore] run function timber:settings/request +execute as @a[scores={TimberSetBlocks=1..},tag=!global.ignore] run function timber:settings/apply/blocks +execute as @a[scores={TimberSetTicks=1..},tag=!global.ignore] run function timber:settings/apply/ticks +execute as @a[scores={TimberSetTreeSize=1..},tag=!global.ignore] run function timber:settings/apply/treesize +execute as @a[scores={TimberSetLeaves=1..},tag=!global.ignore] run function timber:settings/apply/leaves + +# the triggers of the settings menu are only enabled while the menu is used +scoreboard players add @a[scores={timber_menu=1..}] timber_menu 1 +execute as @a[scores={timber_menu=6000..}] run function timber:settings/disable_triggers + # reset scoreboard players enable @a TimberToggle \ No newline at end of file diff --git a/data/timber/function/run.mcfunction b/data/timber/function/run.mcfunction index 23149f8..0811087 100644 --- a/data/timber/function/run.mcfunction +++ b/data/timber/function/run.mcfunction @@ -10,11 +10,11 @@ execute if score persistent timber matches 1.. run scoreboard players set @s tim # search last broken item (place of tree) and set a marker (limit=1 removed, because carpet on log breaks this) execute at @e[type=minecraft:item,distance=..7,nbt={Age:0s}] run summon marker ~ ~ ~ {Tags:["timber_tree","global.ignore"]} -# Enchantments randomizer +# Enchantments randomizer (the enchantments component has no "levels" wrapper since 1.21.5) scoreboard players set unbreaking timber 0 -execute if entity @s[nbt={SelectedItem:{components:{"minecraft:enchantments":{levels:{"minecraft:unbreaking": 1}}}}}] run scoreboard players set unbreaking timber 1 -execute if entity @s[nbt={SelectedItem:{components:{"minecraft:enchantments":{levels:{"minecraft:unbreaking": 2}}}}}] run scoreboard players set unbreaking timber 2 -execute if entity @s[nbt={SelectedItem:{components:{"minecraft:enchantments":{levels:{"minecraft:unbreaking": 3}}}}}] run scoreboard players set unbreaking timber 3 +execute if entity @s[nbt={SelectedItem:{components:{"minecraft:enchantments":{"minecraft:unbreaking": 1}}}}] run scoreboard players set unbreaking timber 1 +execute if entity @s[nbt={SelectedItem:{components:{"minecraft:enchantments":{"minecraft:unbreaking": 2}}}}] run scoreboard players set unbreaking timber 2 +execute if entity @s[nbt={SelectedItem:{components:{"minecraft:enchantments":{"minecraft:unbreaking": 3}}}}] run scoreboard players set unbreaking timber 3 # get durability function timber:tool/durability_get diff --git a/data/timber/function/settings/after_set.mcfunction b/data/timber/function/settings/after_set.mcfunction new file mode 100644 index 0000000..24cb9b6 --- /dev/null +++ b/data/timber/function/settings/after_set.mcfunction @@ -0,0 +1,8 @@ +# options which exclude each other: the one that was just enabled wins +execute if score slow_chop timber matches 1 if score drop_loot timber matches 1 if score #old_drop_loot timber matches 1 run scoreboard players set drop_loot timber 0 +execute if score slow_chop timber matches 1 if score drop_loot timber matches 1 unless score #old_drop_loot timber matches 1 run scoreboard players set slow_chop timber 0 +execute if score stop_chopping timber matches 1 run scoreboard players set wear_out timber 1 + +# start optional loops +execute if score slow_chop timber matches 1 unless score #old_slow_chop timber matches 1 run function timber:slow_chop/loop +execute if score plant_sapling timber matches 1 unless score #old_plant_sapling timber matches 1 run function timber:autoplant/loop diff --git a/data/timber/function/settings/apply/blocks.mcfunction b/data/timber/function/settings/apply/blocks.mcfunction new file mode 100644 index 0000000..ce3ed53 --- /dev/null +++ b/data/timber/function/settings/apply/blocks.mcfunction @@ -0,0 +1,13 @@ +# applies the value of the "Blocks per Chop" slider: 1 followed by the value +scoreboard players operation #x timber = @s TimberSetBlocks +scoreboard players reset @s TimberSetBlocks +scoreboard players set #p timber 1 +execute if score #x timber matches 10..19 run scoreboard players set #p timber 10 +execute if score #x timber matches 100..199 run scoreboard players set #p timber 100 +execute if score #x timber matches 1000..1999 run scoreboard players set #p timber 1000 +execute if score #x timber matches 10000..19999 run scoreboard players set #p timber 10000 +scoreboard players operation #x timber -= #p timber +scoreboard players operation blocks_per_chop timber = #x timber +function timber:settings/after_set +function timber:settings/arm +function timber:settings/open/menu diff --git a/data/timber/function/settings/apply/leaves.mcfunction b/data/timber/function/settings/apply/leaves.mcfunction new file mode 100644 index 0000000..a4c17c2 --- /dev/null +++ b/data/timber/function/settings/apply/leaves.mcfunction @@ -0,0 +1,13 @@ +# applies the value of the "Min. Leaves" slider: 1 followed by the value +scoreboard players operation #x timber = @s TimberSetLeaves +scoreboard players reset @s TimberSetLeaves +scoreboard players set #p timber 1 +execute if score #x timber matches 10..19 run scoreboard players set #p timber 10 +execute if score #x timber matches 100..199 run scoreboard players set #p timber 100 +execute if score #x timber matches 1000..1999 run scoreboard players set #p timber 1000 +execute if score #x timber matches 10000..19999 run scoreboard players set #p timber 10000 +scoreboard players operation #x timber -= #p timber +scoreboard players operation min_leaves_found timber = #x timber +function timber:settings/after_set +function timber:settings/arm +function timber:settings/open/menu diff --git a/data/timber/function/settings/apply/ticks.mcfunction b/data/timber/function/settings/apply/ticks.mcfunction new file mode 100644 index 0000000..1e3d97a --- /dev/null +++ b/data/timber/function/settings/apply/ticks.mcfunction @@ -0,0 +1,13 @@ +# applies the value of the "Ticks Between Chops" slider: 1 followed by the value +scoreboard players operation #x timber = @s TimberSetTicks +scoreboard players reset @s TimberSetTicks +scoreboard players set #p timber 1 +execute if score #x timber matches 10..19 run scoreboard players set #p timber 10 +execute if score #x timber matches 100..199 run scoreboard players set #p timber 100 +execute if score #x timber matches 1000..1999 run scoreboard players set #p timber 1000 +execute if score #x timber matches 10000..19999 run scoreboard players set #p timber 10000 +scoreboard players operation #x timber -= #p timber +scoreboard players operation time_between_chops timber = #x timber +function timber:settings/after_set +function timber:settings/arm +function timber:settings/open/menu diff --git a/data/timber/function/settings/apply/treesize.mcfunction b/data/timber/function/settings/apply/treesize.mcfunction new file mode 100644 index 0000000..b40d653 --- /dev/null +++ b/data/timber/function/settings/apply/treesize.mcfunction @@ -0,0 +1,13 @@ +# applies the value of the "Max. Tree Size" slider: 1 followed by the value +scoreboard players operation #x timber = @s TimberSetTreeSize +scoreboard players reset @s TimberSetTreeSize +scoreboard players set #p timber 1 +execute if score #x timber matches 10..19 run scoreboard players set #p timber 10 +execute if score #x timber matches 100..199 run scoreboard players set #p timber 100 +execute if score #x timber matches 1000..1999 run scoreboard players set #p timber 1000 +execute if score #x timber matches 10000..19999 run scoreboard players set #p timber 10000 +scoreboard players operation #x timber -= #p timber +scoreboard players operation max_tree_size timber = #x timber +function timber:settings/after_set +function timber:settings/arm +function timber:settings/open/menu diff --git a/data/timber/function/settings/arm.mcfunction b/data/timber/function/settings/arm.mcfunction new file mode 100644 index 0000000..5627222 --- /dev/null +++ b/data/timber/function/settings/arm.mcfunction @@ -0,0 +1,3 @@ +# enable the triggers of the settings menu and start the inactivity timer +scoreboard players enable @s TimberSettings +scoreboard players set @s timber_menu 1 diff --git a/data/timber/function/settings/before_set.mcfunction b/data/timber/function/settings/before_set.mcfunction new file mode 100644 index 0000000..d0bfc54 --- /dev/null +++ b/data/timber/function/settings/before_set.mcfunction @@ -0,0 +1,4 @@ +# remember values which trigger something when they change +scoreboard players operation #old_slow_chop timber = slow_chop timber +scoreboard players operation #old_plant_sapling timber = plant_sapling timber +scoreboard players operation #old_drop_loot timber = drop_loot timber diff --git a/data/timber/function/settings/denied.mcfunction b/data/timber/function/settings/denied.mcfunction new file mode 100644 index 0000000..8cec250 --- /dev/null +++ b/data/timber/function/settings/denied.mcfunction @@ -0,0 +1,2 @@ +tellraw @s ["",{text:"Timber: ",color:"red"},{text:"Only Timber admins can change the settings. Operators can click "},{text:"[ /tag @s add timber_admin ]",color:"gray",click_event:{action:"suggest_command",command:"/tag @s add timber_admin"},hover_event:{action:"show_text",value:"Click to put the command into the chat. Only operators are allowed to run it."}},{text:" to become a Timber admin."}] +dialog clear @s diff --git a/data/timber/function/settings/disable_triggers.mcfunction b/data/timber/function/settings/disable_triggers.mcfunction new file mode 100644 index 0000000..e12aca4 --- /dev/null +++ b/data/timber/function/settings/disable_triggers.mcfunction @@ -0,0 +1,7 @@ +# disable the triggers of the settings menu again +scoreboard players reset @s TimberSettings +scoreboard players reset @s TimberSetBlocks +scoreboard players reset @s TimberSetTicks +scoreboard players reset @s TimberSetTreeSize +scoreboard players reset @s TimberSetLeaves +scoreboard players reset @s timber_menu diff --git a/data/timber/function/settings/dispatch.mcfunction b/data/timber/function/settings/dispatch.mcfunction new file mode 100644 index 0000000..a1f5f4b --- /dev/null +++ b/data/timber/function/settings/dispatch.mcfunction @@ -0,0 +1,37 @@ +# #req: 1 = menu, 2-4 = page, 6-9 = slider, 98 = back to the help, 100+ = toggle a setting (only for admins with the tag timber_admin) +execute unless entity @s[tag=timber_admin] run return run function timber:settings/denied + +execute if score #req timber matches 98 run return run function timber:settings/leave + +# the triggers stay enabled while the menu is used +function timber:settings/arm + +execute if score #req timber matches 1..2 run function timber:settings/open/menu +execute if score #req timber matches 3 run function timber:settings/open/tools +execute if score #req timber matches 6 run function timber:settings/open/blocks +execute if score #req timber matches 7 run function timber:settings/open/ticks +execute if score #req timber matches 8 run function timber:settings/open/treesize +execute if score #req timber matches 9 run function timber:settings/open/leaves +execute if score #req timber matches 100 run function timber:settings/flip/standing +execute if score #req timber matches 101 run function timber:settings/flip/sneaking +execute if score #req timber matches 102 run function timber:settings/flip/destroy_leaves +execute if score #req timber matches 103 run function timber:settings/flip/plant_sapling +execute if score #req timber matches 104 run function timber:settings/flip/destroy_roots +execute if score #req timber matches 105 run function timber:settings/flip/start_chop_on_root +execute if score #req timber matches 106 run function timber:settings/flip/slow_chop +execute if score #req timber matches 107 run function timber:settings/flip/chop_down +execute if score #req timber matches 108 run function timber:settings/flip/stop_chopping +execute if score #req timber matches 109 run function timber:settings/flip/wear_out +execute if score #req timber matches 110 run function timber:settings/flip/drop_loot +execute if score #req timber matches 111 run function timber:settings/flip/hunger +execute if score #req timber matches 112 run function timber:settings/flip/stopsound +execute if score #req timber matches 113 run function timber:settings/flip/chop_trees +execute if score #req timber matches 114 run function timber:settings/flip/chop_fungi +execute if score #req timber matches 115 run function timber:settings/flip/persistent +execute if score #req timber matches 116 run function timber:settings/flip/wooden_axe +execute if score #req timber matches 117 run function timber:settings/flip/golden_axe +execute if score #req timber matches 118 run function timber:settings/flip/stone_axe +execute if score #req timber matches 119 run function timber:settings/flip/copper_axe +execute if score #req timber matches 120 run function timber:settings/flip/iron_axe +execute if score #req timber matches 121 run function timber:settings/flip/diamond_axe +execute if score #req timber matches 122 run function timber:settings/flip/netherite_axe diff --git a/data/timber/function/settings/flip/chop_down.mcfunction b/data/timber/function/settings/flip/chop_down.mcfunction new file mode 100644 index 0000000..0af8acd --- /dev/null +++ b/data/timber/function/settings/flip/chop_down.mcfunction @@ -0,0 +1,5 @@ +# toggles "Chop Down" +function timber:settings/before_set +execute store success score chop_down timber unless score chop_down timber matches 1 +function timber:settings/after_set +function timber:settings/open/menu diff --git a/data/timber/function/settings/flip/chop_fungi.mcfunction b/data/timber/function/settings/flip/chop_fungi.mcfunction new file mode 100644 index 0000000..c30fee6 --- /dev/null +++ b/data/timber/function/settings/flip/chop_fungi.mcfunction @@ -0,0 +1,5 @@ +# toggles "Chop Fungi" +function timber:settings/before_set +execute store success score chop_fungi timber unless score chop_fungi timber matches 1 +function timber:settings/after_set +function timber:settings/open/menu diff --git a/data/timber/function/settings/flip/chop_trees.mcfunction b/data/timber/function/settings/flip/chop_trees.mcfunction new file mode 100644 index 0000000..3a399d0 --- /dev/null +++ b/data/timber/function/settings/flip/chop_trees.mcfunction @@ -0,0 +1,5 @@ +# toggles "Chop Trees" +function timber:settings/before_set +execute store success score chop_trees timber unless score chop_trees timber matches 1 +function timber:settings/after_set +function timber:settings/open/menu diff --git a/data/timber/function/settings/flip/copper_axe.mcfunction b/data/timber/function/settings/flip/copper_axe.mcfunction new file mode 100644 index 0000000..79235e9 --- /dev/null +++ b/data/timber/function/settings/flip/copper_axe.mcfunction @@ -0,0 +1,5 @@ +# toggles "Enable Copper Axe" +function timber:settings/before_set +execute store success score copper_axe timber unless score copper_axe timber matches 1 +function timber:settings/after_set +function timber:settings/open/tools diff --git a/data/timber/function/settings/flip/destroy_leaves.mcfunction b/data/timber/function/settings/flip/destroy_leaves.mcfunction new file mode 100644 index 0000000..2e7b70b --- /dev/null +++ b/data/timber/function/settings/flip/destroy_leaves.mcfunction @@ -0,0 +1,5 @@ +# toggles "Destroy Leaves" +function timber:settings/before_set +execute store success score destroy_leaves timber unless score destroy_leaves timber matches 1 +function timber:settings/after_set +function timber:settings/open/menu diff --git a/data/timber/function/settings/flip/destroy_roots.mcfunction b/data/timber/function/settings/flip/destroy_roots.mcfunction new file mode 100644 index 0000000..f8aa6e3 --- /dev/null +++ b/data/timber/function/settings/flip/destroy_roots.mcfunction @@ -0,0 +1,5 @@ +# toggles "Destroy Roots" +function timber:settings/before_set +execute store success score destroy_roots timber unless score destroy_roots timber matches 1 +function timber:settings/after_set +function timber:settings/open/menu diff --git a/data/timber/function/settings/flip/diamond_axe.mcfunction b/data/timber/function/settings/flip/diamond_axe.mcfunction new file mode 100644 index 0000000..f38a48f --- /dev/null +++ b/data/timber/function/settings/flip/diamond_axe.mcfunction @@ -0,0 +1,5 @@ +# toggles "Enable Diamond Axe" +function timber:settings/before_set +execute store success score diamond_axe timber unless score diamond_axe timber matches 1 +function timber:settings/after_set +function timber:settings/open/tools diff --git a/data/timber/function/settings/flip/drop_loot.mcfunction b/data/timber/function/settings/flip/drop_loot.mcfunction new file mode 100644 index 0000000..f35b11b --- /dev/null +++ b/data/timber/function/settings/flip/drop_loot.mcfunction @@ -0,0 +1,6 @@ +# toggles "Loot to Inventory" +execute if score slow_chop timber matches 1 run return run function timber:settings/open/menu +function timber:settings/before_set +execute store success score drop_loot timber unless score drop_loot timber matches 1 +function timber:settings/after_set +function timber:settings/open/menu diff --git a/data/timber/function/settings/flip/golden_axe.mcfunction b/data/timber/function/settings/flip/golden_axe.mcfunction new file mode 100644 index 0000000..f3fc533 --- /dev/null +++ b/data/timber/function/settings/flip/golden_axe.mcfunction @@ -0,0 +1,5 @@ +# toggles "Enable Golden Axe" +function timber:settings/before_set +execute store success score golden_axe timber unless score golden_axe timber matches 1 +function timber:settings/after_set +function timber:settings/open/tools diff --git a/data/timber/function/settings/flip/hunger.mcfunction b/data/timber/function/settings/flip/hunger.mcfunction new file mode 100644 index 0000000..cfb0f77 --- /dev/null +++ b/data/timber/function/settings/flip/hunger.mcfunction @@ -0,0 +1,5 @@ +# toggles "Hunger Effect" +function timber:settings/before_set +execute store success score hunger timber unless score hunger timber matches 1 +function timber:settings/after_set +function timber:settings/open/menu diff --git a/data/timber/function/settings/flip/iron_axe.mcfunction b/data/timber/function/settings/flip/iron_axe.mcfunction new file mode 100644 index 0000000..79c589a --- /dev/null +++ b/data/timber/function/settings/flip/iron_axe.mcfunction @@ -0,0 +1,5 @@ +# toggles "Enable Iron Axe" +function timber:settings/before_set +execute store success score iron_axe timber unless score iron_axe timber matches 1 +function timber:settings/after_set +function timber:settings/open/tools diff --git a/data/timber/function/settings/flip/netherite_axe.mcfunction b/data/timber/function/settings/flip/netherite_axe.mcfunction new file mode 100644 index 0000000..c01cac9 --- /dev/null +++ b/data/timber/function/settings/flip/netherite_axe.mcfunction @@ -0,0 +1,5 @@ +# toggles "Enable Netherite Axe" +function timber:settings/before_set +execute store success score netherite_axe timber unless score netherite_axe timber matches 1 +function timber:settings/after_set +function timber:settings/open/tools diff --git a/data/timber/function/settings/flip/persistent.mcfunction b/data/timber/function/settings/flip/persistent.mcfunction new file mode 100644 index 0000000..97139a1 --- /dev/null +++ b/data/timber/function/settings/flip/persistent.mcfunction @@ -0,0 +1,5 @@ +# toggles "Player-Placed Trees" +function timber:settings/before_set +execute store success score persistent timber unless score persistent timber matches 1 +function timber:settings/after_set +function timber:settings/open/menu diff --git a/data/timber/function/settings/flip/plant_sapling.mcfunction b/data/timber/function/settings/flip/plant_sapling.mcfunction new file mode 100644 index 0000000..d0fd46b --- /dev/null +++ b/data/timber/function/settings/flip/plant_sapling.mcfunction @@ -0,0 +1,5 @@ +# toggles "Auto Plant Saplings" +function timber:settings/before_set +execute store success score plant_sapling timber unless score plant_sapling timber matches 1 +function timber:settings/after_set +function timber:settings/open/menu diff --git a/data/timber/function/settings/flip/slow_chop.mcfunction b/data/timber/function/settings/flip/slow_chop.mcfunction new file mode 100644 index 0000000..c8da263 --- /dev/null +++ b/data/timber/function/settings/flip/slow_chop.mcfunction @@ -0,0 +1,6 @@ +# toggles "Chop Slowly" +execute if score drop_loot timber matches 1 run return run function timber:settings/open/menu +function timber:settings/before_set +execute store success score slow_chop timber unless score slow_chop timber matches 1 +function timber:settings/after_set +function timber:settings/open/menu diff --git a/data/timber/function/settings/flip/sneaking.mcfunction b/data/timber/function/settings/flip/sneaking.mcfunction new file mode 100644 index 0000000..bf0902f --- /dev/null +++ b/data/timber/function/settings/flip/sneaking.mcfunction @@ -0,0 +1,5 @@ +# toggles "Works When Sneaking" +function timber:settings/before_set +execute store success score sneaking timber unless score sneaking timber matches 1 +function timber:settings/after_set +function timber:settings/open/menu diff --git a/data/timber/function/settings/flip/standing.mcfunction b/data/timber/function/settings/flip/standing.mcfunction new file mode 100644 index 0000000..8a05b44 --- /dev/null +++ b/data/timber/function/settings/flip/standing.mcfunction @@ -0,0 +1,5 @@ +# toggles "Works When Standing" +function timber:settings/before_set +execute store success score standing timber unless score standing timber matches 1 +function timber:settings/after_set +function timber:settings/open/menu diff --git a/data/timber/function/settings/flip/start_chop_on_root.mcfunction b/data/timber/function/settings/flip/start_chop_on_root.mcfunction new file mode 100644 index 0000000..f64b133 --- /dev/null +++ b/data/timber/function/settings/flip/start_chop_on_root.mcfunction @@ -0,0 +1,5 @@ +# toggles "Chop on Root Break" +function timber:settings/before_set +execute store success score start_chop_on_root timber unless score start_chop_on_root timber matches 1 +function timber:settings/after_set +function timber:settings/open/menu diff --git a/data/timber/function/settings/flip/stone_axe.mcfunction b/data/timber/function/settings/flip/stone_axe.mcfunction new file mode 100644 index 0000000..75fea06 --- /dev/null +++ b/data/timber/function/settings/flip/stone_axe.mcfunction @@ -0,0 +1,5 @@ +# toggles "Enable Stone Axe" +function timber:settings/before_set +execute store success score stone_axe timber unless score stone_axe timber matches 1 +function timber:settings/after_set +function timber:settings/open/tools diff --git a/data/timber/function/settings/flip/stop_chopping.mcfunction b/data/timber/function/settings/flip/stop_chopping.mcfunction new file mode 100644 index 0000000..0cb5f7c --- /dev/null +++ b/data/timber/function/settings/flip/stop_chopping.mcfunction @@ -0,0 +1,6 @@ +# toggles "Stop on Axe Break" +execute unless score wear_out timber matches 1 run return run function timber:settings/open/menu +function timber:settings/before_set +execute store success score stop_chopping timber unless score stop_chopping timber matches 1 +function timber:settings/after_set +function timber:settings/open/menu diff --git a/data/timber/function/settings/flip/stopsound.mcfunction b/data/timber/function/settings/flip/stopsound.mcfunction new file mode 100644 index 0000000..73ad6f5 --- /dev/null +++ b/data/timber/function/settings/flip/stopsound.mcfunction @@ -0,0 +1,5 @@ +# toggles "Mute Breaking Sounds" +function timber:settings/before_set +execute store success score stopsound timber unless score stopsound timber matches 1 +function timber:settings/after_set +function timber:settings/open/menu diff --git a/data/timber/function/settings/flip/wear_out.mcfunction b/data/timber/function/settings/flip/wear_out.mcfunction new file mode 100644 index 0000000..065e63e --- /dev/null +++ b/data/timber/function/settings/flip/wear_out.mcfunction @@ -0,0 +1,6 @@ +# toggles "Wear Out Tool More" +execute if score stop_chopping timber matches 1 run return run function timber:settings/open/menu +function timber:settings/before_set +execute store success score wear_out timber unless score wear_out timber matches 1 +function timber:settings/after_set +function timber:settings/open/menu diff --git a/data/timber/function/settings/flip/wooden_axe.mcfunction b/data/timber/function/settings/flip/wooden_axe.mcfunction new file mode 100644 index 0000000..d2ecbae --- /dev/null +++ b/data/timber/function/settings/flip/wooden_axe.mcfunction @@ -0,0 +1,5 @@ +# toggles "Enable Wooden Axe" +function timber:settings/before_set +execute store success score wooden_axe timber unless score wooden_axe timber matches 1 +function timber:settings/after_set +function timber:settings/open/tools diff --git a/data/timber/function/settings/leave.mcfunction b/data/timber/function/settings/leave.mcfunction new file mode 100644 index 0000000..f34f935 --- /dev/null +++ b/data/timber/function/settings/leave.mcfunction @@ -0,0 +1,3 @@ +# back to the help dialog +function timber:settings/disable_triggers +function timber:settings/open/help diff --git a/data/timber/function/settings/leave_close.mcfunction b/data/timber/function/settings/leave_close.mcfunction new file mode 100644 index 0000000..edba3eb --- /dev/null +++ b/data/timber/function/settings/leave_close.mcfunction @@ -0,0 +1,3 @@ +# close the dialog +function timber:settings/disable_triggers +dialog clear @s diff --git a/data/timber/function/settings/locked/blocks.mcfunction b/data/timber/function/settings/locked/blocks.mcfunction new file mode 100644 index 0000000..9d811d6 --- /dev/null +++ b/data/timber/function/settings/locked/blocks.mcfunction @@ -0,0 +1,3 @@ +# shown instead of the slider while Chop Slowly is disabled +data modify storage timber:settings dialog set value {"type":"minecraft:multi_action","title":"Timber Settings / Blocks per Chop","external_title":"Timber Blocks per Chop","inputs":[],"can_close_with_escape":true,"pause":false,"after_action":"none","columns":1,"actions":[{"label":{"translate":"options.generic_value","with":[{"text":"Set Amount of Destroyed Blocks per Chop"},{"translate":"filled_map.locked","color":"gray"}]},"width":300,"tooltip":["",{"text":"Only used when \"Chop Slowly\" is enabled.","color":"red"}]}],"exit_action":{"label":{"translate":"gui.back"},"width":300,"action":{"type":"minecraft:run_command","command":"trigger TimberSettings set 1"}}} +function timber:settings/show with storage timber:settings diff --git a/data/timber/function/settings/locked/ticks.mcfunction b/data/timber/function/settings/locked/ticks.mcfunction new file mode 100644 index 0000000..dbc5779 --- /dev/null +++ b/data/timber/function/settings/locked/ticks.mcfunction @@ -0,0 +1,3 @@ +# shown instead of the slider while Chop Slowly is disabled +data modify storage timber:settings dialog set value {"type":"minecraft:multi_action","title":"Timber Settings / Ticks Between Chops","external_title":"Timber Ticks Between Chops","inputs":[],"can_close_with_escape":true,"pause":false,"after_action":"none","columns":1,"actions":[{"label":{"translate":"options.generic_value","with":[{"text":"Set Time in Ticks Between Chops"},{"translate":"filled_map.locked","color":"gray"}]},"width":300,"tooltip":["",{"text":"Only used when \"Chop Slowly\" is enabled.","color":"red"}]}],"exit_action":{"label":{"translate":"gui.back"},"width":300,"action":{"type":"minecraft:run_command","command":"trigger TimberSettings set 1"}}} +function timber:settings/show with storage timber:settings diff --git a/data/timber/function/settings/menu_request.mcfunction b/data/timber/function/settings/menu_request.mcfunction new file mode 100644 index 0000000..b9adc50 --- /dev/null +++ b/data/timber/function/settings/menu_request.mcfunction @@ -0,0 +1,6 @@ +# trigger TimberToggle with a value > 1 (buttons of the help dialog) +scoreboard players operation #req timber = @s TimberToggle +scoreboard players set @s TimberToggle 0 +execute if score #req timber matches 3 run return run function timber:settings/toggle_self +execute if score #req timber matches 4 run return run function timber:settings/leave_close +execute if score #req timber matches 2 run function timber:settings/dispatch diff --git a/data/timber/function/settings/open/blocks.mcfunction b/data/timber/function/settings/open/blocks.mcfunction new file mode 100644 index 0000000..41138b4 --- /dev/null +++ b/data/timber/function/settings/open/blocks.mcfunction @@ -0,0 +1,7 @@ +# opens the "Blocks per Chop" slider with the current value +# only reachable for admins, so the trigger gets enabled only for them +execute unless score slow_chop timber matches 1 run return run function timber:settings/locked/blocks +scoreboard players enable @s TimberSetBlocks +data modify storage timber:settings dialog set value {"type":"minecraft:multi_action","title":"Timber Settings / Blocks per Chop","external_title":"Timber Blocks per Chop","body":{"type":"minecraft:plain_message","contents":["",{"text":"Amount of blocks which get destroyed per chop.\nOnly used when \"Chop Slowly\" is enabled."},"\n\n",{"text":"Default: 1","color":"gray"}],"width":300},"inputs":[{"type":"minecraft:number_range","key":"blocks_per_chop","width":300,"label":["",{"text":"Set Amount of Destroyed Blocks per Chop","hover_event":{"action":"show_text","value":"Only used when \"Chop Slowly\" is enabled."}}],"start":1,"end":100,"step":1,"initial":1}],"can_close_with_escape":true,"pause":false,"after_action":"none","columns":1,"actions":[{"label":"Save","width":300,"action":{"type":"minecraft:dynamic/run_command","template":"trigger TimberSetBlocks set 1$(blocks_per_chop)"}}],"exit_action":{"label":{"translate":"gui.back"},"width":300,"action":{"type":"minecraft:run_command","command":"trigger TimberSettings set 1"}}} +execute store result storage timber:settings dialog.inputs[0].initial float 1 run scoreboard players get blocks_per_chop timber +function timber:settings/show with storage timber:settings diff --git a/data/timber/function/settings/open/help.mcfunction b/data/timber/function/settings/open/help.mcfunction new file mode 100644 index 0000000..2c3ee5f --- /dev/null +++ b/data/timber/function/settings/open/help.mcfunction @@ -0,0 +1,5 @@ +# opens the help dialog; the last button shows whether Timber is on or off for the player +data modify storage timber:settings dialog set value {"type":"minecraft:multi_action","title":"Timber Datapack","external_title":"Timber","body":{"type":"minecraft:plain_message","contents":["",{"text":"The Timber Datapack allows you to instantly chop down a tree just by breaking one log with any axe."},"\n\n",{"text":"By default, sneaking while breaking will not chop the tree."},"\n\n",{"text":"Every player can use "},{"text":"/trigger TimberToggle","color":"blue","click_event":{"action":"suggest_command","command":"/trigger TimberToggle"}},{"text":" or the button below to individually turn the datapack on or off."}],"width":300},"inputs":[],"can_close_with_escape":true,"pause":false,"actions":[{"label":"Check for New Updates","action":{"type":"minecraft:open_url","url":"https://github.com/Moggla/Timber-Datapack/releases"}},{"label":"Settings","tooltip":{"text":"Requires the tag timber_admin.","color":"gray"},"action":{"type":"minecraft:run_command","command":"trigger TimberToggle set 2"}}],"after_action":"none","exit_action":{"label":{"translate":"gui.back"},"action":{"type":"minecraft:run_command","command":"trigger TimberToggle set 4"}}} +execute unless score @s timber_disabled matches 1.. run data modify storage timber:settings dialog.actions append value {"label":{"translate":"options.generic_value","with":[{"text":"Timber"},{"translate":"options.on","color":"green"}]},"tooltip":"Turns the datapack on or off for you only.","action":{"type":"minecraft:run_command","command":"trigger TimberToggle set 3"}} +execute if score @s timber_disabled matches 1.. run data modify storage timber:settings dialog.actions append value {"label":{"translate":"options.generic_value","with":[{"text":"Timber"},{"translate":"options.off","color":"red"}]},"tooltip":"Turns the datapack on or off for you only.","action":{"type":"minecraft:run_command","command":"trigger TimberToggle set 3"}} +function timber:settings/show with storage timber:settings diff --git a/data/timber/function/settings/open/leaves.mcfunction b/data/timber/function/settings/open/leaves.mcfunction new file mode 100644 index 0000000..468e806 --- /dev/null +++ b/data/timber/function/settings/open/leaves.mcfunction @@ -0,0 +1,6 @@ +# opens the "Min. Leaves" slider with the current value +# only reachable for admins, so the trigger gets enabled only for them +scoreboard players enable @s TimberSetLeaves +data modify storage timber:settings dialog set value {"type":"minecraft:multi_action","title":"Timber Settings / Min. Leaves","external_title":"Timber Min. Leaves","body":{"type":"minecraft:plain_message","contents":["",{"text":"This datapack considers a tree only if it has this set value amount of naturally generated leaves at its trunk.\nFungi will get checked by the amount of cap blocks and additionally a 3×3 big cross on top of the stem."},"\n\n",{"text":"Default: 5","color":"gray"}],"width":300},"inputs":[{"type":"minecraft:number_range","key":"min_leaves_found","width":300,"label":["",{"text":"Set Min. Leaves to Valid a Tree","hover_event":{"action":"show_text","value":["",{"text":"Default: 5"},{"text":"\n\nThis datapack considers a tree only if it has this set value amount of naturally generated leaves at its trunk.\nFungi will get checked by the amount of cap blocks and additionally a 3×3 big cross on top of the stem."}]}}],"start":0,"end":10,"step":1,"initial":0}],"can_close_with_escape":true,"pause":false,"after_action":"none","columns":1,"actions":[{"label":"Save","width":300,"action":{"type":"minecraft:dynamic/run_command","template":"trigger TimberSetLeaves set 1$(min_leaves_found)"}}],"exit_action":{"label":{"translate":"gui.back"},"width":300,"action":{"type":"minecraft:run_command","command":"trigger TimberSettings set 1"}}} +execute store result storage timber:settings dialog.inputs[0].initial float 1 run scoreboard players get min_leaves_found timber +function timber:settings/show with storage timber:settings diff --git a/data/timber/function/settings/open/menu.mcfunction b/data/timber/function/settings/open/menu.mcfunction new file mode 100644 index 0000000..b27b578 --- /dev/null +++ b/data/timber/function/settings/open/menu.mcfunction @@ -0,0 +1,45 @@ +# opens the "Settings" settings page with the current values +# only reachable for admins +data modify storage timber:settings dialog set value {"type":"minecraft:multi_action","title":"Timber Settings","external_title":"Timber Settings","body":{"type":"minecraft:plain_message","contents":"Changes are saved for the whole server.","width":300},"inputs":[],"can_close_with_escape":true,"pause":false,"after_action":"none","columns":2,"actions":[],"exit_action":{"label":{"translate":"gui.back"},"width":150,"action":{"type":"minecraft:run_command","command":"trigger TimberSettings set 98"}}} +execute if score standing timber matches 1 run data modify storage timber:settings dialog.actions append value {"label":{"translate":"options.generic_value","with":[{"text":"Works When Standing"},{"translate":"options.on","color":"green"}]},"width":150,"action":{"type":"minecraft:run_command","command":"trigger TimberSettings set 100"}} +execute unless score standing timber matches 1 run data modify storage timber:settings dialog.actions append value {"label":{"translate":"options.generic_value","with":[{"text":"Works When Standing"},{"translate":"options.off","color":"red"}]},"width":150,"action":{"type":"minecraft:run_command","command":"trigger TimberSettings set 100"}} +execute if score sneaking timber matches 1 run data modify storage timber:settings dialog.actions append value {"label":{"translate":"options.generic_value","with":[{"text":"Works When Sneaking"},{"translate":"options.on","color":"green"}]},"width":150,"action":{"type":"minecraft:run_command","command":"trigger TimberSettings set 101"}} +execute unless score sneaking timber matches 1 run data modify storage timber:settings dialog.actions append value {"label":{"translate":"options.generic_value","with":[{"text":"Works When Sneaking"},{"translate":"options.off","color":"red"}]},"width":150,"action":{"type":"minecraft:run_command","command":"trigger TimberSettings set 101"}} +execute if score destroy_leaves timber matches 1 run data modify storage timber:settings dialog.actions append value {"label":{"translate":"options.generic_value","with":[{"text":"Destroy Leaves"},{"translate":"options.on","color":"green"}]},"width":150,"action":{"type":"minecraft:run_command","command":"trigger TimberSettings set 102"}} +execute unless score destroy_leaves timber matches 1 run data modify storage timber:settings dialog.actions append value {"label":{"translate":"options.generic_value","with":[{"text":"Destroy Leaves"},{"translate":"options.off","color":"red"}]},"width":150,"action":{"type":"minecraft:run_command","command":"trigger TimberSettings set 102"}} +execute if score plant_sapling timber matches 1 run data modify storage timber:settings dialog.actions append value {"label":{"translate":"options.generic_value","with":[{"text":"Auto Plant Saplings"},{"translate":"options.on","color":"green"}]},"width":150,"action":{"type":"minecraft:run_command","command":"trigger TimberSettings set 103"},"tooltip":["",{"text":"All kind of saplings laying on the ground will get planted every 2 seconds."},{"text":"\n\nWhen a sapling get placed on mud, it turns into muddy mangrove roots for a fraction of a second due to datapack limitations.","color":"gray"}]} +execute unless score plant_sapling timber matches 1 run data modify storage timber:settings dialog.actions append value {"label":{"translate":"options.generic_value","with":[{"text":"Auto Plant Saplings"},{"translate":"options.off","color":"red"}]},"width":150,"action":{"type":"minecraft:run_command","command":"trigger TimberSettings set 103"},"tooltip":["",{"text":"All kind of saplings laying on the ground will get planted every 2 seconds."},{"text":"\n\nWhen a sapling get placed on mud, it turns into muddy mangrove roots for a fraction of a second due to datapack limitations.","color":"gray"}]} +execute if score destroy_roots timber matches 1 run data modify storage timber:settings dialog.actions append value {"label":{"translate":"options.generic_value","with":[{"text":"Destroy Roots"},{"translate":"options.on","color":"green"}]},"width":150,"action":{"type":"minecraft:run_command","command":"trigger TimberSettings set 104"},"tooltip":["",{"text":"Only root blocks which are not in the ground count."}]} +execute unless score destroy_roots timber matches 1 run data modify storage timber:settings dialog.actions append value {"label":{"translate":"options.generic_value","with":[{"text":"Destroy Roots"},{"translate":"options.off","color":"red"}]},"width":150,"action":{"type":"minecraft:run_command","command":"trigger TimberSettings set 104"},"tooltip":["",{"text":"Only root blocks which are not in the ground count."}]} +execute if score start_chop_on_root timber matches 1 run data modify storage timber:settings dialog.actions append value {"label":{"translate":"options.generic_value","with":[{"text":"Chop on Root Break"},{"translate":"options.on","color":"green"}]},"width":150,"action":{"type":"minecraft:run_command","command":"trigger TimberSettings set 105"},"tooltip":["",{"text":"The datapack will chop the tree if you break its root blocks.\nOnly root blocks which are not in the ground count."}]} +execute unless score start_chop_on_root timber matches 1 run data modify storage timber:settings dialog.actions append value {"label":{"translate":"options.generic_value","with":[{"text":"Chop on Root Break"},{"translate":"options.off","color":"red"}]},"width":150,"action":{"type":"minecraft:run_command","command":"trigger TimberSettings set 105"},"tooltip":["",{"text":"The datapack will chop the tree if you break its root blocks.\nOnly root blocks which are not in the ground count."}]} +execute if score drop_loot timber matches 1 run data modify storage timber:settings dialog.actions append value {"label":{"translate":"options.generic_value","with":[{"text":"Chop Slowly"},{"translate":"filled_map.locked","color":"gray"}]},"width":150,"tooltip":["",{"text":"Can't be enabled when \"Loot to Inventory\" is enabled.","color":"red"}]} +execute unless score drop_loot timber matches 1 if score slow_chop timber matches 1 run data modify storage timber:settings dialog.actions append value {"label":{"translate":"options.generic_value","with":[{"text":"Chop Slowly"},{"translate":"options.on","color":"green"}]},"width":150,"action":{"type":"minecraft:run_command","command":"trigger TimberSettings set 106"},"tooltip":["",{"text":"The tree won't be chopped instantly anymore."},{"text":"\n\nThis option can increase performance.","color":"gray"}]} +execute unless score drop_loot timber matches 1 unless score slow_chop timber matches 1 run data modify storage timber:settings dialog.actions append value {"label":{"translate":"options.generic_value","with":[{"text":"Chop Slowly"},{"translate":"options.off","color":"red"}]},"width":150,"action":{"type":"minecraft:run_command","command":"trigger TimberSettings set 106"},"tooltip":["",{"text":"The tree won't be chopped instantly anymore."},{"text":"\n\nThis option can increase performance.","color":"gray"}]} +execute if score chop_down timber matches 1 run data modify storage timber:settings dialog.actions append value {"label":{"translate":"options.generic_value","with":[{"text":"Chop Down"},{"translate":"options.on","color":"green"}]},"width":150,"action":{"type":"minecraft:run_command","command":"trigger TimberSettings set 107"},"tooltip":"Normally when you cut a tree in the middle only the top part of the tree gets destroyed. But if this option is enabled the bottom part will get destroyed as well."} +execute unless score chop_down timber matches 1 run data modify storage timber:settings dialog.actions append value {"label":{"translate":"options.generic_value","with":[{"text":"Chop Down"},{"translate":"options.off","color":"red"}]},"width":150,"action":{"type":"minecraft:run_command","command":"trigger TimberSettings set 107"},"tooltip":"Normally when you cut a tree in the middle only the top part of the tree gets destroyed. But if this option is enabled the bottom part will get destroyed as well."} +execute unless score wear_out timber matches 1 run data modify storage timber:settings dialog.actions append value {"label":{"translate":"options.generic_value","with":[{"text":"Stop on Axe Break"},{"translate":"filled_map.locked","color":"gray"}]},"width":150,"tooltip":["",{"text":"Can't be enabled when \"Wear Out Tool More\" is disabled.","color":"red"}]} +execute if score wear_out timber matches 1 if score stop_chopping timber matches 1 run data modify storage timber:settings dialog.actions append value {"label":{"translate":"options.generic_value","with":[{"text":"Stop on Axe Break"},{"translate":"options.on","color":"green"}]},"width":150,"action":{"type":"minecraft:run_command","command":"trigger TimberSettings set 108"},"tooltip":"Stops the process of chopping the tree as soon as your axe doesn't have any durability left for the whole tree. When disabled, the tree will always be chopped finish."} +execute if score wear_out timber matches 1 unless score stop_chopping timber matches 1 run data modify storage timber:settings dialog.actions append value {"label":{"translate":"options.generic_value","with":[{"text":"Stop on Axe Break"},{"translate":"options.off","color":"red"}]},"width":150,"action":{"type":"minecraft:run_command","command":"trigger TimberSettings set 108"},"tooltip":"Stops the process of chopping the tree as soon as your axe doesn't have any durability left for the whole tree. When disabled, the tree will always be chopped finish."} +execute if score stop_chopping timber matches 1 run data modify storage timber:settings dialog.actions append value {"label":{"translate":"options.generic_value","with":[{"text":"Wear Out Tool More"},{"translate":"filled_map.locked","color":"gray"}]},"width":150,"tooltip":["",{"text":"Can't be disabled when \"Stop on Axe Break\" is enabled.","color":"red"}]} +execute unless score stop_chopping timber matches 1 if score wear_out timber matches 1 run data modify storage timber:settings dialog.actions append value {"label":{"translate":"options.generic_value","with":[{"text":"Wear Out Tool More"},{"translate":"options.on","color":"green"}]},"width":150,"action":{"type":"minecraft:run_command","command":"trigger TimberSettings set 109"},"tooltip":"The tool's durability will get decreased by the amount of destroyed logs (or stems). When disabled, only one durability gets deducted."} +execute unless score stop_chopping timber matches 1 unless score wear_out timber matches 1 run data modify storage timber:settings dialog.actions append value {"label":{"translate":"options.generic_value","with":[{"text":"Wear Out Tool More"},{"translate":"options.off","color":"red"}]},"width":150,"action":{"type":"minecraft:run_command","command":"trigger TimberSettings set 109"},"tooltip":"The tool's durability will get decreased by the amount of destroyed logs (or stems). When disabled, only one durability gets deducted."} +execute if score slow_chop timber matches 1 run data modify storage timber:settings dialog.actions append value {"label":{"translate":"options.generic_value","with":[{"text":"Loot to Inventory"},{"translate":"filled_map.locked","color":"gray"}]},"width":150,"tooltip":["",{"text":"Can't be enabled when \"Chop Slowly\" is enabled.","color":"red"}]} +execute unless score slow_chop timber matches 1 if score drop_loot timber matches 1 run data modify storage timber:settings dialog.actions append value {"label":{"translate":"options.generic_value","with":[{"text":"Loot to Inventory"},{"translate":"options.on","color":"green"}]},"width":150,"action":{"type":"minecraft:run_command","command":"trigger TimberSettings set 110"},"tooltip":["",{"text":"Lets the dropped items of the tree teleport straight into your own inventory. As soon as you have a full inventory the loot gets dropped on the ground."},{"text":"\n\nThis option can increase performance.","color":"gray"}]} +execute unless score slow_chop timber matches 1 unless score drop_loot timber matches 1 run data modify storage timber:settings dialog.actions append value {"label":{"translate":"options.generic_value","with":[{"text":"Loot to Inventory"},{"translate":"options.off","color":"red"}]},"width":150,"action":{"type":"minecraft:run_command","command":"trigger TimberSettings set 110"},"tooltip":["",{"text":"Lets the dropped items of the tree teleport straight into your own inventory. As soon as you have a full inventory the loot gets dropped on the ground."},{"text":"\n\nThis option can increase performance.","color":"gray"}]} +execute if score hunger timber matches 1 run data modify storage timber:settings dialog.actions append value {"label":{"translate":"options.generic_value","with":[{"text":"Hunger Effect"},{"translate":"options.on","color":"green"}]},"width":150,"action":{"type":"minecraft:run_command","command":"trigger TimberSettings set 111"},"tooltip":"Gives a hunger effect for 1 second with the same level as the size of the chopped tree."} +execute unless score hunger timber matches 1 run data modify storage timber:settings dialog.actions append value {"label":{"translate":"options.generic_value","with":[{"text":"Hunger Effect"},{"translate":"options.off","color":"red"}]},"width":150,"action":{"type":"minecraft:run_command","command":"trigger TimberSettings set 111"},"tooltip":"Gives a hunger effect for 1 second with the same level as the size of the chopped tree."} +execute if score stopsound timber matches 1 run data modify storage timber:settings dialog.actions append value {"label":{"translate":"options.generic_value","with":[{"text":"Mute Breaking Sounds"},{"translate":"options.on","color":"green"}]},"width":150,"action":{"type":"minecraft:run_command","command":"trigger TimberSettings set 112"},"tooltip":["",{"text":"Suppresses loud breaking noises when chopping a tree."},{"text":"\n\nThis option is","color":"gray"},{"text":" experimental","color":"dark_red"},{"text":" because sometimes it still sounds loud for a fraction of a second.","color":"gray"}]} +execute unless score stopsound timber matches 1 run data modify storage timber:settings dialog.actions append value {"label":{"translate":"options.generic_value","with":[{"text":"Mute Breaking Sounds"},{"translate":"options.off","color":"red"}]},"width":150,"action":{"type":"minecraft:run_command","command":"trigger TimberSettings set 112"},"tooltip":["",{"text":"Suppresses loud breaking noises when chopping a tree."},{"text":"\n\nThis option is","color":"gray"},{"text":" experimental","color":"dark_red"},{"text":" because sometimes it still sounds loud for a fraction of a second.","color":"gray"}]} +execute if score persistent timber matches 1 run data modify storage timber:settings dialog.actions append value {"label":{"translate":"options.generic_value","with":[{"text":"Player-Placed Trees"},{"translate":"options.on","color":"green"}]},"width":150,"action":{"type":"minecraft:run_command","command":"trigger TimberSettings set 115"},"tooltip":["",{"text":"Player-placed trees are trees made out of player-placed leaves (Look at leaf block with F3 debug screen: persistent = true. Requires enabling looking_at_block_state via F3+F6)."},{"text":"\n\nUse it on your own risk!\nWhen enabled, this datapack can't differentiate between generated trees and player-placed trees anymore and therefore can potentially destroy your buildings.","color":"dark_red"}]} +execute unless score persistent timber matches 1 run data modify storage timber:settings dialog.actions append value {"label":{"translate":"options.generic_value","with":[{"text":"Player-Placed Trees"},{"translate":"options.off","color":"red"}]},"width":150,"action":{"type":"minecraft:run_command","command":"trigger TimberSettings set 115"},"tooltip":["",{"text":"Player-placed trees are trees made out of player-placed leaves (Look at leaf block with F3 debug screen: persistent = true. Requires enabling looking_at_block_state via F3+F6)."},{"text":"\n\nUse it on your own risk!\nWhen enabled, this datapack can't differentiate between generated trees and player-placed trees anymore and therefore can potentially destroy your buildings.","color":"dark_red"}]} +execute if score chop_trees timber matches 1 run data modify storage timber:settings dialog.actions append value {"label":{"translate":"options.generic_value","with":[{"text":"Chop Trees"},{"translate":"options.on","color":"green"}]},"width":150,"action":{"type":"minecraft:run_command","command":"trigger TimberSettings set 113"},"tooltip":"All kind of trees will get chopped."} +execute unless score chop_trees timber matches 1 run data modify storage timber:settings dialog.actions append value {"label":{"translate":"options.generic_value","with":[{"text":"Chop Trees"},{"translate":"options.off","color":"red"}]},"width":150,"action":{"type":"minecraft:run_command","command":"trigger TimberSettings set 113"},"tooltip":"All kind of trees will get chopped."} +execute if score chop_fungi timber matches 1 run data modify storage timber:settings dialog.actions append value {"label":{"translate":"options.generic_value","with":[{"text":"Chop Fungi"},{"translate":"options.on","color":"green"}]},"width":150,"action":{"type":"minecraft:run_command","command":"trigger TimberSettings set 114"},"tooltip":["",{"text":"Huge fungi (nether trees) as well as huge mushrooms will get chopped."},{"text":"\n\nUse it on your own risk!\nWhen enabled, this datapack can't differentiate between generated fungi and player-placed fungi and therefore can potentially destroy your buildings.","color":"dark_red"}]} +execute unless score chop_fungi timber matches 1 run data modify storage timber:settings dialog.actions append value {"label":{"translate":"options.generic_value","with":[{"text":"Chop Fungi"},{"translate":"options.off","color":"red"}]},"width":150,"action":{"type":"minecraft:run_command","command":"trigger TimberSettings set 114"},"tooltip":["",{"text":"Huge fungi (nether trees) as well as huge mushrooms will get chopped."},{"text":"\n\nUse it on your own risk!\nWhen enabled, this datapack can't differentiate between generated fungi and player-placed fungi and therefore can potentially destroy your buildings.","color":"dark_red"}]} +data modify storage timber:settings dialog.actions append value {"label":"Blocks per Chop","width":150,"action":{"type":"minecraft:run_command","command":"trigger TimberSettings set 6"},"tooltip":"Amount of blocks which get destroyed per chop.\nOnly used when \"Chop Slowly\" is enabled."} +data modify storage timber:settings dialog.actions append value {"label":"Ticks Between Chops","width":150,"action":{"type":"minecraft:run_command","command":"trigger TimberSettings set 7"},"tooltip":"Time in ticks between two chops.\nOnly used when \"Chop Slowly\" is enabled."} +data modify storage timber:settings dialog.actions append value {"label":"Max. Tree Size","width":150,"action":{"type":"minecraft:run_command","command":"trigger TimberSettings set 8"},"tooltip":"Trees bigger than this set value won't get further processed."} +data modify storage timber:settings dialog.actions append value {"label":"Min. Leaves","width":150,"action":{"type":"minecraft:run_command","command":"trigger TimberSettings set 9"},"tooltip":"This datapack considers a tree only if it has this set value amount of naturally generated leaves at its trunk.\nFungi will get checked by the amount of cap blocks and additionally a 3×3 big cross on top of the stem."} +data modify storage timber:settings dialog.actions append value {"label":"Tools","width":150,"action":{"type":"minecraft:run_command","command":"trigger TimberSettings set 3"},"tooltip":"Axes"} +function timber:settings/show with storage timber:settings diff --git a/data/timber/function/settings/open/ticks.mcfunction b/data/timber/function/settings/open/ticks.mcfunction new file mode 100644 index 0000000..c778f8a --- /dev/null +++ b/data/timber/function/settings/open/ticks.mcfunction @@ -0,0 +1,7 @@ +# opens the "Ticks Between Chops" slider with the current value +# only reachable for admins, so the trigger gets enabled only for them +execute unless score slow_chop timber matches 1 run return run function timber:settings/locked/ticks +scoreboard players enable @s TimberSetTicks +data modify storage timber:settings dialog set value {"type":"minecraft:multi_action","title":"Timber Settings / Ticks Between Chops","external_title":"Timber Ticks Between Chops","body":{"type":"minecraft:plain_message","contents":["",{"text":"Time in ticks between two chops.\nOnly used when \"Chop Slowly\" is enabled."},"\n\n",{"text":"Default: 1","color":"gray"}],"width":300},"inputs":[{"type":"minecraft:number_range","key":"time_between_chops","width":300,"label":["",{"text":"Set Time in Ticks Between Chops","hover_event":{"action":"show_text","value":"Only used when \"Chop Slowly\" is enabled."}}],"start":1,"end":100,"step":1,"initial":1}],"can_close_with_escape":true,"pause":false,"after_action":"none","columns":1,"actions":[{"label":"Save","width":300,"action":{"type":"minecraft:dynamic/run_command","template":"trigger TimberSetTicks set 1$(time_between_chops)"}}],"exit_action":{"label":{"translate":"gui.back"},"width":300,"action":{"type":"minecraft:run_command","command":"trigger TimberSettings set 1"}}} +execute store result storage timber:settings dialog.inputs[0].initial float 1 run scoreboard players get time_between_chops timber +function timber:settings/show with storage timber:settings diff --git a/data/timber/function/settings/open/tools.mcfunction b/data/timber/function/settings/open/tools.mcfunction new file mode 100644 index 0000000..611a153 --- /dev/null +++ b/data/timber/function/settings/open/tools.mcfunction @@ -0,0 +1,18 @@ +# opens the "Tools" settings page with the current values +# only reachable for admins +data modify storage timber:settings dialog set value {"type":"minecraft:multi_action","title":"Timber Settings / Tools","external_title":"Timber Tools","inputs":[],"can_close_with_escape":true,"pause":false,"after_action":"none","columns":2,"actions":[],"exit_action":{"label":{"translate":"gui.back"},"width":150,"action":{"type":"minecraft:run_command","command":"trigger TimberSettings set 1"}}} +execute if score wooden_axe timber matches 1 run data modify storage timber:settings dialog.actions append value {"label":{"translate":"options.generic_value","with":[{"text":"Enable Wooden Axe"},{"translate":"options.on","color":"green"}]},"width":150,"action":{"type":"minecraft:run_command","command":"trigger TimberSettings set 116"}} +execute unless score wooden_axe timber matches 1 run data modify storage timber:settings dialog.actions append value {"label":{"translate":"options.generic_value","with":[{"text":"Enable Wooden Axe"},{"translate":"options.off","color":"red"}]},"width":150,"action":{"type":"minecraft:run_command","command":"trigger TimberSettings set 116"}} +execute if score golden_axe timber matches 1 run data modify storage timber:settings dialog.actions append value {"label":{"translate":"options.generic_value","with":[{"text":"Enable Golden Axe"},{"translate":"options.on","color":"green"}]},"width":150,"action":{"type":"minecraft:run_command","command":"trigger TimberSettings set 117"}} +execute unless score golden_axe timber matches 1 run data modify storage timber:settings dialog.actions append value {"label":{"translate":"options.generic_value","with":[{"text":"Enable Golden Axe"},{"translate":"options.off","color":"red"}]},"width":150,"action":{"type":"minecraft:run_command","command":"trigger TimberSettings set 117"}} +execute if score stone_axe timber matches 1 run data modify storage timber:settings dialog.actions append value {"label":{"translate":"options.generic_value","with":[{"text":"Enable Stone Axe"},{"translate":"options.on","color":"green"}]},"width":150,"action":{"type":"minecraft:run_command","command":"trigger TimberSettings set 118"}} +execute unless score stone_axe timber matches 1 run data modify storage timber:settings dialog.actions append value {"label":{"translate":"options.generic_value","with":[{"text":"Enable Stone Axe"},{"translate":"options.off","color":"red"}]},"width":150,"action":{"type":"minecraft:run_command","command":"trigger TimberSettings set 118"}} +execute if score copper_axe timber matches 1 run data modify storage timber:settings dialog.actions append value {"label":{"translate":"options.generic_value","with":[{"text":"Enable Copper Axe"},{"translate":"options.on","color":"green"}]},"width":150,"action":{"type":"minecraft:run_command","command":"trigger TimberSettings set 119"}} +execute unless score copper_axe timber matches 1 run data modify storage timber:settings dialog.actions append value {"label":{"translate":"options.generic_value","with":[{"text":"Enable Copper Axe"},{"translate":"options.off","color":"red"}]},"width":150,"action":{"type":"minecraft:run_command","command":"trigger TimberSettings set 119"}} +execute if score iron_axe timber matches 1 run data modify storage timber:settings dialog.actions append value {"label":{"translate":"options.generic_value","with":[{"text":"Enable Iron Axe"},{"translate":"options.on","color":"green"}]},"width":150,"action":{"type":"minecraft:run_command","command":"trigger TimberSettings set 120"}} +execute unless score iron_axe timber matches 1 run data modify storage timber:settings dialog.actions append value {"label":{"translate":"options.generic_value","with":[{"text":"Enable Iron Axe"},{"translate":"options.off","color":"red"}]},"width":150,"action":{"type":"minecraft:run_command","command":"trigger TimberSettings set 120"}} +execute if score diamond_axe timber matches 1 run data modify storage timber:settings dialog.actions append value {"label":{"translate":"options.generic_value","with":[{"text":"Enable Diamond Axe"},{"translate":"options.on","color":"green"}]},"width":150,"action":{"type":"minecraft:run_command","command":"trigger TimberSettings set 121"}} +execute unless score diamond_axe timber matches 1 run data modify storage timber:settings dialog.actions append value {"label":{"translate":"options.generic_value","with":[{"text":"Enable Diamond Axe"},{"translate":"options.off","color":"red"}]},"width":150,"action":{"type":"minecraft:run_command","command":"trigger TimberSettings set 121"}} +execute if score netherite_axe timber matches 1 run data modify storage timber:settings dialog.actions append value {"label":{"translate":"options.generic_value","with":[{"text":"Enable Netherite Axe"},{"translate":"options.on","color":"green"}]},"width":150,"action":{"type":"minecraft:run_command","command":"trigger TimberSettings set 122"}} +execute unless score netherite_axe timber matches 1 run data modify storage timber:settings dialog.actions append value {"label":{"translate":"options.generic_value","with":[{"text":"Enable Netherite Axe"},{"translate":"options.off","color":"red"}]},"width":150,"action":{"type":"minecraft:run_command","command":"trigger TimberSettings set 122"}} +function timber:settings/show with storage timber:settings diff --git a/data/timber/function/settings/open/treesize.mcfunction b/data/timber/function/settings/open/treesize.mcfunction new file mode 100644 index 0000000..bf16513 --- /dev/null +++ b/data/timber/function/settings/open/treesize.mcfunction @@ -0,0 +1,6 @@ +# opens the "Max. Tree Size" slider with the current value +# only reachable for admins, so the trigger gets enabled only for them +scoreboard players enable @s TimberSetTreeSize +data modify storage timber:settings dialog set value {"type":"minecraft:multi_action","title":"Timber Settings / Max. Tree Size","external_title":"Timber Max. Tree Size","body":{"type":"minecraft:plain_message","contents":["",{"text":"Trees bigger than this set value won't get further processed."},"\n\n",{"text":"Default: 555","color":"gray"}],"width":300},"inputs":[{"type":"minecraft:number_range","key":"max_tree_size","width":300,"label":["",{"text":"Set Max. Tree Size","hover_event":{"action":"show_text","value":["",{"text":"Default: 555"},{"text":"\n\nTrees bigger than this set value won't get further processed."}]}}],"start":0,"end":1000,"step":1,"initial":0}],"can_close_with_escape":true,"pause":false,"after_action":"none","columns":1,"actions":[{"label":"Save","width":300,"action":{"type":"minecraft:dynamic/run_command","template":"trigger TimberSetTreeSize set 1$(max_tree_size)"}}],"exit_action":{"label":{"translate":"gui.back"},"width":300,"action":{"type":"minecraft:run_command","command":"trigger TimberSettings set 1"}}} +execute store result storage timber:settings dialog.inputs[0].initial float 1 run scoreboard players get max_tree_size timber +function timber:settings/show with storage timber:settings diff --git a/data/timber/function/settings/request.mcfunction b/data/timber/function/settings/request.mcfunction new file mode 100644 index 0000000..f57cc3d --- /dev/null +++ b/data/timber/function/settings/request.mcfunction @@ -0,0 +1,4 @@ +# trigger TimberSettings +scoreboard players operation #req timber = @s TimberSettings +scoreboard players reset @s TimberSettings +function timber:settings/dispatch diff --git a/data/timber/function/settings/settings.mcfunction b/data/timber/function/settings/settings.mcfunction deleted file mode 100644 index 42d2588..0000000 --- a/data/timber/function/settings/settings.mcfunction +++ /dev/null @@ -1 +0,0 @@ -function timber:settings/settings1 \ No newline at end of file diff --git a/data/timber/function/settings/settings1.mcfunction b/data/timber/function/settings/settings1.mcfunction deleted file mode 100644 index 3146ddc..0000000 --- a/data/timber/function/settings/settings1.mcfunction +++ /dev/null @@ -1,57 +0,0 @@ -tellraw @s ["",{text:" "}] -tellraw @s ["",{text:" "}] -tellraw @s ["",{text:" "}] -tellraw @s ["",{text:" "}] - -tellraw @s ["",{text:"\u00A7m ",color:"dark_gray"}] - -tellraw @s ["",{text:" Timber "},{text:"/",color:"gray"},{text:" Global Settings "},{text:" < ",click_event:{action:"run_command",command:"/function timber:settings/settings1_click"}},{text:"1/2"},{text:" > ",click_event:{action:"run_command",command:"/function timber:settings/settings2_click"}}] - -tellraw @s ["",{text:"\u00A7m ",color:"dark_gray"}] - -execute if score standing timber matches 1.. run tellraw @s ["",{text:"[ ✔ ]",color:"green",click_event:{action:"run_command",command:"/function timber:settings/toggle/standing"}},{text:" Works When Standing"}] -execute unless score standing timber matches 1.. run tellraw @s ["",{text:"[ ❌ ]",color:"red",click_event:{action:"run_command",command:"/function timber:settings/toggle/standing"}},{text:" Works When Standing"}] - -execute if score sneaking timber matches 1.. run tellraw @s ["",{text:"[ ✔ ]",color:"green",click_event:{action:"run_command",command:"/function timber:settings/toggle/sneaking"}},{text:" Works When Sneaking"}] -execute unless score sneaking timber matches 1.. run tellraw @s ["",{text:"[ ❌ ]",color:"red",click_event:{action:"run_command",command:"/function timber:settings/toggle/sneaking"}},{text:" Works When Sneaking"}] - -execute if score destroy_leaves timber matches 1.. run tellraw @s ["",{text:"[ ✔ ]",color:"green",click_event:{action:"run_command",command:"/function timber:settings/toggle/destroy_leaves"}},{text:" Destroy Leaves"}] -execute unless score destroy_leaves timber matches 1.. run tellraw @s ["",{text:"[ ❌ ]",color:"red",click_event:{action:"run_command",command:"/function timber:settings/toggle/destroy_leaves"}},{text:" Destroy Leaves"}] - -execute if score plant_sapling timber matches 1.. run tellraw @s ["",{text:"[ ✔ ]",color:"green",click_event:{action:"run_command",command:"/function timber:settings/toggle/plant_sapling"}},{text:" Auto Plant Saplings",hover_event:{action:"show_text",value:["",{text:"All kind of saplings laying on the ground will get planted every 2 seconds."},{text:"\n\nWhen a sapling get placed on mud, it turns into muddy mangrove roots for a fraction of a second due to datapack limitations.",color:"gray"}]}}] -execute unless score plant_sapling timber matches 1.. run tellraw @s ["",{text:"[ ❌ ]",color:"red",click_event:{action:"run_command",command:"/function timber:settings/toggle/plant_sapling"}},{text:" Auto Plant Saplings",hover_event:{action:"show_text",value:["",{text:"All kind of saplings laying on the ground will get planted every 2 seconds."},{text:"\n\nWhen a sapling get placed on mud, it turns into muddy mangrove roots for a fraction of a second due to datapack limitations.",color:"gray"}]}}] - -execute if score destroy_roots timber matches 1.. run tellraw @s ["",{text:"[ ✔ ]",color:"green",click_event:{action:"run_command",command:"/function timber:settings/toggle/destroy_roots"}},{text:" Destroy Roots",hover_event:{action:"show_text",value:["",{text:"Only root blocks which are not in the ground count."}]}}] -execute unless score destroy_roots timber matches 1.. run tellraw @s ["",{text:"[ ❌ ]",color:"red",click_event:{action:"run_command",command:"/function timber:settings/toggle/destroy_roots"}},{text:" Destroy Roots",hover_event:{action:"show_text",value:["",{text:"Only root blocks which are not in the ground count."}]}}] - -execute if score start_chop_on_root timber matches 1.. run tellraw @s ["",{text:"[ ✔ ]",color:"green",click_event:{action:"run_command",command:"/function timber:settings/toggle/start_chop_on_root"}},{text:" Chop Tree When Roots Get Destroyed",hover_event:{action:"show_text",value:["",{text:"The datapack will chop the tree if you break its root blocks.\nOnly root blocks which are not in the ground count."}]}}] -execute unless score start_chop_on_root timber matches 1.. run tellraw @s ["",{text:"[ ❌ ]",color:"red",click_event:{action:"run_command",command:"/function timber:settings/toggle/start_chop_on_root"}},{text:" Chop Tree When Roots Get Destroyed",hover_event:{action:"show_text",value:["",{text:"The datapack will chop the tree if you break its root blocks.\nOnly root blocks which are not in the ground count."}]}}] - -execute if score slow_chop timber matches 1.. run tellraw @s ["",{text:"[ ✔ ]",color:"green",click_event:{action:"run_command",command:"/function timber:settings/toggle/slow_chop"}},{text:" Chop Slowly",hover_event:{action:"show_text",value:["",{text:"The tree won't be chopped instantly anymore. Additional options to change the speed of the chopping process can be changed at the next page."},{text:"\n\nThis option can increase performance.",color:"gray"}]}}] -execute unless score slow_chop timber matches 1.. unless score drop_loot timber matches 1.. run tellraw @s ["",{text:"[ ❌ ]",color:"red",click_event:{action:"run_command",command:"/function timber:settings/toggle/slow_chop"}},{text:" Chop Slowly",hover_event:{action:"show_text",value:["",{text:"The tree won't be chopped instantly anymore. Additional options to change the speed of the chopping process can be changed at the next page."},{text:"\n\nThis option can increase performance.",color:"gray"}]}}] -execute unless score slow_chop timber matches 1.. if score drop_loot timber matches 1.. run tellraw @s ["",{text:"[ ❌ ]",color:"#7F2B2B",hover_event:{action:"show_text",value:"Can't be enabled when \"Drop Loot Straight into Inventory\" is enabled."}},{text:" Chop Slowly",hover_event:{action:"show_text",value:["",{text:"The tree won't be chopped instantly anymore. Additional options to change the speed of the chopping process can be changed at the next page."},{text:"\n\nThis option can increase performance.",color:"gray"}]}}] - -execute if score chop_down timber matches 1.. run tellraw @s ["",{text:"[ ✔ ]",color:"green",click_event:{action:"run_command",command:"/function timber:settings/toggle/chop_down"}},{text:" Enable Chopping Down",hover_event:{action:"show_text",value:"Normally when you cut a tree in the middle only the top part of the tree gets destroyed. But if this option is enabled the bottom part will get destroyed as well."}}] -execute unless score chop_down timber matches 1.. run tellraw @s ["",{text:"[ ❌ ]",color:"red",click_event:{action:"run_command",command:"/function timber:settings/toggle/chop_down"}},{text:" Enable Chopping Down",hover_event:{action:"show_text",value:"Normally when you cut a tree in the middle only the top part of the tree gets destroyed. But if this option is enabled the bottom part will get destroyed as well."}}] - -execute if score stop_chopping timber matches 1.. run tellraw @s ["",{text:"[ ✔ ]",color:"green",click_event:{action:"run_command",command:"/function timber:settings/toggle/stop_chopping"}},{text:" Stop Chopping Once Axe Breaks",hover_event:{action:"show_text",value:"Stops the process of chopping the tree as soon as your axe doesn't have any durability left for the whole tree. When disabled, the tree will always be chopped finish."}}] -execute unless score stop_chopping timber matches 1.. if score wear_out timber matches 1.. run tellraw @s ["",{text:"[ ❌ ]",color:"red",click_event:{action:"run_command",command:"/function timber:settings/toggle/stop_chopping"}},{text:" Stop Chopping Once Axe Breaks",hover_event:{action:"show_text",value:"Stops the process of chopping the tree as soon as your axe doesn't have any durability left for the whole tree. When disabled, the tree will always be chopped finish."}}] -execute unless score stop_chopping timber matches 1.. unless score wear_out timber matches 1.. run tellraw @s ["",{text:"[ ❌ ]",color:"#7F2B2B",hover_event:{action:"show_text",value:"Can't be enabled when \"Additionally Wear out Tool Depending on Tree Size\" is disabled."}},{text:" Stop Chopping Once Axe Breaks",hover_event:{action:"show_text",value:"Stops the process of chopping the tree as soon as your axe doesn't have any durability left for the whole tree. When disabled, the tree will always be chopped finish."}}] - -execute if score wear_out timber matches 1.. unless score stop_chopping timber matches 1.. run tellraw @s ["",{text:"[ ✔ ]",color:"green",click_event:{action:"run_command",command:"/function timber:settings/toggle/wear_out"}},{text:" Additionally Wear out Tool Depending on Tree Size",hover_event:{action:"show_text",value:"The tool's durability will get decreased by the amount of destroyed logs (or stems). When disabled, only one durability gets deducted."}}] -execute unless score wear_out timber matches 1.. run tellraw @s ["",{text:"[ ❌ ]",color:"red",click_event:{action:"run_command",command:"/function timber:settings/toggle/wear_out"}},{text:" Additionally Wear out Tool Depending on Tree Size",hover_event:{action:"show_text",value:"The tool's durability will get decreased by the amount of destroyed logs (or stems). When disabled, only one durability gets deducted."}}] -execute if score wear_out timber matches 1.. if score stop_chopping timber matches 1.. run tellraw @s ["",{text:"[ ✔ ]",color:"#2B7F2B",hover_event:{action:"show_text",value:"Can't be disabled when \"Stop Chopping Once Axe Breaks\" is enabled."}},{text:" Additionally Wear out Tool Depending on Tree Size",hover_event:{action:"show_text",value:"The tool's durability will get decreased by the amount of destroyed logs (or stems). When disabled, only one durability gets deducted."}}] - -execute if score drop_loot timber matches 1.. run tellraw @s ["",{text:"[ ✔ ]",color:"green",click_event:{action:"run_command",command:"/function timber:settings/toggle/drop_loot"}},{text:" Drop Loot Straight into Inventory",hover_event:{action:"show_text",value:["",{text:"Lets the dropped items of the tree teleport straight into your own inventory. As soon as you have a full inventory the loot gets dropped on the ground."},{text:"\n\nThis option can increase performance.",color:"gray"}]}}] -execute unless score drop_loot timber matches 1.. unless score slow_chop timber matches 1.. run tellraw @s ["",{text:"[ ❌ ]",color:"red",click_event:{action:"run_command",command:"/function timber:settings/toggle/drop_loot"}},{text:" Drop Loot Straight into Inventory",hover_event:{action:"show_text",value:["",{text:"Lets the dropped items of the tree teleport straight into your own inventory. As soon as you have a full inventory the loot gets dropped on the ground."},{text:"\n\nThis option can increase performance.",color:"gray"}]}}] -execute unless score drop_loot timber matches 1.. if score slow_chop timber matches 1.. run tellraw @s ["",{text:"[ ❌ ]",color:"#7F2B2B",hover_event:{action:"show_text",value:"Can't be enabled when \"Chop Slowly\" is enabled."}},{text:" Drop Loot Straight into Inventory",hover_event:{action:"show_text",value:["",{text:"Lets the dropped items of the tree teleport straight into your own inventory. As soon as you have a full inventory the loot gets dropped on the ground."},{text:"\n\nThis option can increase performance.",color:"gray"}]}}] - -execute if score hunger timber matches 1.. run tellraw @s ["",{text:"[ ✔ ]",color:"green",click_event:{action:"run_command",command:"/function timber:settings/toggle/hunger"}},{text:" Give Additional Hunger Effect",hover_event:{action:"show_text",value:"Gives a hunger effect for 1 second with the same level as the size of the chopped tree."}}] -execute unless score hunger timber matches 1.. run tellraw @s ["",{text:"[ ❌ ]",color:"red",click_event:{action:"run_command",command:"/function timber:settings/toggle/hunger"}},{text:" Give Additional Hunger Effect",hover_event:{action:"show_text",value:"Gives a hunger effect for 1 second with the same level as the size of the chopped tree."}}] - -execute if score stopsound timber matches 1.. run tellraw @s ["",{text:"[ ✔ ]",color:"green",click_event:{action:"run_command",command:"/function timber:settings/toggle/stopsound"}},{text:" Stop Loud Breaking Noises",hover_event:{action:"show_text",value:["",{text:"Suppresses loud breaking noises when chopping a tree."},{text:"\n\nThis option is",color:"gray"},{text:" experimental",color:"dark_red"},{text:" because sometimes it still sounds loud for a fraction of a second.",color:"gray"}]}}] -execute unless score stopsound timber matches 1.. run tellraw @s ["",{text:"[ ❌ ]",color:"red",click_event:{action:"run_command",command:"/function timber:settings/toggle/stopsound"}},{text:" Stop Loud Breaking Noises",hover_event:{action:"show_text",value:["",{text:"Suppresses loud breaking noises when chopping a tree."},{text:"\n\nThis option is",color:"gray"},{text:" experimental",color:"dark_red"},{text:" because sometimes it still sounds loud for a fraction of a second.",color:"gray"}]}}] - -tellraw @s ["",{text:"\u00A7m ",color:"dark_gray"}] - -function timber:settings/end_of_message \ No newline at end of file diff --git a/data/timber/function/settings/settings1_click.mcfunction b/data/timber/function/settings/settings1_click.mcfunction deleted file mode 100644 index 64625b3..0000000 --- a/data/timber/function/settings/settings1_click.mcfunction +++ /dev/null @@ -1,2 +0,0 @@ -function timber:settings/settings -playsound minecraft:ui.button.click master @s ~ ~ ~ .2 1.6 .2 \ No newline at end of file diff --git a/data/timber/function/settings/settings2.mcfunction b/data/timber/function/settings/settings2.mcfunction deleted file mode 100644 index 56ab2ae..0000000 --- a/data/timber/function/settings/settings2.mcfunction +++ /dev/null @@ -1,58 +0,0 @@ -tellraw @s ["",{text:" "}] -tellraw @s ["",{text:" "}] -tellraw @s ["",{text:" "}] -tellraw @s ["",{text:" "}] - -tellraw @s ["",{text:"\u00A7m ",color:"dark_gray"}] - -tellraw @s ["",{text:" Timber "},{text:"/",color:"gray"},{text:" Global Settings "},{text:" < ",click_event:{action:"run_command",command:"/function timber:settings/settings1_click"}},{text:"2/2"},{text:" > ",click_event:{action:"run_command",command:"/function timber:settings/settings2_click"}}] - -tellraw @s ["",{text:"\u00A7m ",color:"dark_gray"}] - -execute if score wooden_axe timber matches 1.. run tellraw @s ["",{text:"[ ✔ ]",color:"green",click_event:{action:"run_command",command:"/function timber:settings/toggle/wooden_axe"}},{text:" Enable Wooden Axe"}] -execute unless score wooden_axe timber matches 1.. run tellraw @s ["",{text:"[ ❌ ]",color:"red",click_event:{action:"run_command",command:"/function timber:settings/toggle/wooden_axe"}},{text:" Enable Wooden Axe"}] - -execute if score stone_axe timber matches 1.. run tellraw @s ["",{text:"[ ✔ ]",color:"green",click_event:{action:"run_command",command:"/function timber:settings/toggle/stone_axe"}},{text:" Enable Stone Axe"}] -execute unless score stone_axe timber matches 1.. run tellraw @s ["",{text:"[ ❌ ]",color:"red",click_event:{action:"run_command",command:"/function timber:settings/toggle/stone_axe"}},{text:" Enable Stone Axe"}] - -execute if score copper_axe timber matches 1.. run tellraw @s ["",{text:"[ ✔ ]",color:"green",click_event:{action:"run_command",command:"/function timber:settings/toggle/copper_axe"}},{text:" Enable Copper Axe"}] -execute unless score copper_axe timber matches 1.. run tellraw @s ["",{text:"[ ❌ ]",color:"red",click_event:{action:"run_command",command:"/function timber:settings/toggle/copper_axe"}},{text:" Enable Copper Axe"}] - -execute if score iron_axe timber matches 1.. run tellraw @s ["",{text:"[ ✔ ]",color:"green",click_event:{action:"run_command",command:"/function timber:settings/toggle/iron_axe"}},{text:" Enable Iron Axe"}] -execute unless score iron_axe timber matches 1.. run tellraw @s ["",{text:"[ ❌ ]",color:"red",click_event:{action:"run_command",command:"/function timber:settings/toggle/iron_axe"}},{text:" Enable Iron Axe"}] - -execute if score golden_axe timber matches 1.. run tellraw @s ["",{text:"[ ✔ ]",color:"green",click_event:{action:"run_command",command:"/function timber:settings/toggle/golden_axe"}},{text:" Enable Golden Axe"}] -execute unless score golden_axe timber matches 1.. run tellraw @s ["",{text:"[ ❌ ]",color:"red",click_event:{action:"run_command",command:"/function timber:settings/toggle/golden_axe"}},{text:" Enable Golden Axe"}] - -execute if score diamond_axe timber matches 1.. run tellraw @s ["",{text:"[ ✔ ]",color:"green",click_event:{action:"run_command",command:"/function timber:settings/toggle/diamond_axe"}},{text:" Enable Diamond Axe"}] -execute unless score diamond_axe timber matches 1.. run tellraw @s ["",{text:"[ ❌ ]",color:"red",click_event:{action:"run_command",command:"/function timber:settings/toggle/diamond_axe"}},{text:" Enable Diamond Axe"}] - -execute if score netherite_axe timber matches 1.. run tellraw @s ["",{text:"[ ✔ ]",color:"green",click_event:{action:"run_command",command:"/function timber:settings/toggle/netherite_axe"}},{text:" Enable Netherite Axe"}] -execute unless score netherite_axe timber matches 1.. run tellraw @s ["",{text:"[ ❌ ]",color:"red",click_event:{action:"run_command",command:"/function timber:settings/toggle/netherite_axe"}},{text:" Enable Netherite Axe"}] - -execute if score chop_trees timber matches 1.. run tellraw @s ["",{text:"[ ✔ ]",color:"green",click_event:{action:"run_command",command:"/function timber:settings/toggle/chop_trees"}},{text:" Chop Trees",hover_event:{action:"show_text",value:"All kind of trees will get chopped."}}] -execute unless score chop_trees timber matches 1.. run tellraw @s ["",{text:"[ ❌ ]",color:"red",click_event:{action:"run_command",command:"/function timber:settings/toggle/chop_trees"}},{text:" Chop Trees",hover_event:{action:"show_text",value:"All kind of trees will get chopped."}}] - -execute if score chop_fungi timber matches 1.. run tellraw @s ["",{text:"[ ✔ ]",color:"green",click_event:{action:"run_command",command:"/function timber:settings/toggle/chop_fungi"}},{text:" Chop Fungi",hover_event:{action:"show_text",value:["",{text:"Huge fungi (nether trees) as well as huge mushrooms will get chopped."},{text:"\n\nUse it on your own risk!\nWhen enabled, this datapack can't differentiate between generated fungi and player-placed fungi and therefore can potentially destroy your buildings.",color:"dark_red"}]}}] -execute unless score chop_fungi timber matches 1.. run tellraw @s ["",{text:"[ ❌ ]",color:"red",click_event:{action:"run_command",command:"/function timber:settings/toggle/chop_fungi"}},{text:" Chop Fungi",hover_event:{action:"show_text",value:["",{text:"Huge fungi (nether trees) as well as huge mushrooms will get chopped."},{text:"\n\nUse it on your own risk!\nWhen enabled, this datapack can't differentiate between generated fungi and player-placed fungi and therefore can potentially destroy your buildings.",color:"dark_red"}]}}] - -execute if score persistent timber matches 1.. run tellraw @s ["",{text:"[ ✔ ]",color:"green",click_event:{action:"run_command",command:"/function timber:settings/toggle/persistent"}},{text:" Destroy Player-Placed Trees",hover_event:{action:"show_text",value:["",{text:"Player-placed trees are trees made out of player-placed leaves (Look at leaf block with F3 debug screen: persistent = true)."},{text:"\n\nUse it on your own risk!\nWhen enabled, this datapack can't differentiate between generated trees and player-placed trees anymore and therefore can potentially destroy your buildings.",color:"dark_red"}]}}] -execute unless score persistent timber matches 1.. run tellraw @s ["",{text:"[ ❌ ]",color:"red",click_event:{action:"run_command",command:"/function timber:settings/toggle/persistent"}},{text:" Destroy Player-Placed Trees",hover_event:{action:"show_text",value:["",{text:"Player-placed trees are trees made out of player-placed leaves (Look at leaf block with F3 debug screen: persistent = true)."},{text:"\n\nUse it on your own risk!\nWhen enabled, this datapack can't differentiate between generated trees and player-placed trees anymore and therefore can potentially destroy your buildings.",color:"dark_red"}]}}] - -execute if score blocks_per_chop timber matches 1 if score slow_chop timber matches 1.. run tellraw @s ["",{text:"[ ✎ ]",color:"gray",click_event:{action:"suggest_command",command:"/scoreboard players set blocks_per_chop timber "},hover_event:{action:"show_text",value:"Default: 1"}},{text:" Set Amount of Destroyed Blocks per Chop"},{text:" (Current: ",color:"gray"},{"score":{"name":"blocks_per_chop","objective":"timber"},color:"gray"},{text: ")",color:"gray"}] -execute unless score blocks_per_chop timber matches 1 if score slow_chop timber matches 1.. run tellraw @s ["",{text:"[ ✎ ]",color:"gray",click_event:{action:"suggest_command",command:"/scoreboard players set blocks_per_chop timber "},hover_event:{action:"show_text",value:"Default: 1"}},{text:" Set Amount of Destroyed Blocks per Chop"},{text:" (Current: ",color:"gray"},{"score":{"name":"blocks_per_chop","objective":"timber"},color:"gray"},{text: ")",color:"gray"}] -execute unless score slow_chop timber matches 1.. run tellraw @s ["",{text:"[ ✎ ]",color:"dark_gray",hover_event:{action:"show_text",value:"Not active when \"Chop Slowly\" is disabled."}},{text:" Set Amount of Destroyed Blocks per Chop"}] - -execute if score time_between_chops timber matches 1 if score slow_chop timber matches 1.. run tellraw @s ["",{text:"[ ✎ ]",color:"gray",click_event:{action:"suggest_command",command:"/scoreboard players set time_between_chops timber "},hover_event:{action:"show_text",value:"Default: 1"}},{text:" Set Time in Ticks Between Chops"},{text:" (Current: ",color:"gray"},{"score":{"name":"time_between_chops","objective":"timber"},color:"gray"},{text: ")",color:"gray"}] -execute unless score time_between_chops timber matches 1 if score slow_chop timber matches 1.. run tellraw @s ["",{text:"[ ✎ ]",color:"gray",click_event:{action:"suggest_command",command:"/scoreboard players set time_between_chops timber "},hover_event:{action:"show_text",value:"Default: 1"}},{text:" Set Time in Ticks Between Chops"},{text:" (Current: ",color:"gray"},{"score":{"name":"time_between_chops","objective":"timber"},color:"gray"},{text: ")",color:"gray"}] -execute unless score slow_chop timber matches 1.. run tellraw @s ["",{text:"[ ✎ ]",color:"dark_gray",hover_event:{action:"show_text",value:"Not active when \"Chop Slowly\" is disabled."}},{text:" Set Time in Ticks Between Chops"}] - -execute if score max_tree_size timber matches 555 run tellraw @s ["",{text:"[ ✎ ]",color:"gray",click_event:{action:"suggest_command",command:"/scoreboard players set max_tree_size timber "},hover_event:{action:"show_text",value:"Default: 555"}},{text:" Set Max. Tree Size",hover_event:{action:"show_text",value:"Trees bigger than this set value won't get further processed."}},{text:" (Currently: ",color:"gray"},{"score":{"name":"max_tree_size","objective":"timber"},color:"gray"},{text: ")",color:"gray"}] -execute unless score max_tree_size timber matches 555 run tellraw @s ["",{text:"[ ✎ ]",color:"gray",click_event:{action:"suggest_command",command:"/scoreboard players set max_tree_size timber "},hover_event:{action:"show_text",value:"Default: 555"}},{text:" Set Max. Tree Size",hover_event:{action:"show_text",value:"Trees bigger than this set value won't get further processed."}},{text:" (Currently: ",color:"gray"},{"score":{"name":"max_tree_size","objective":"timber"},color:"gray"},{text: ")",color:"gray"}] - -execute if score min_leaves_found timber matches 5 run tellraw @s ["",{text:"[ ✎ ]",color:"gray",click_event:{action:"suggest_command",command:"/scoreboard players set min_leaves_found timber "},hover_event:{action:"show_text",value:"Default: 5"}},{text:" Set Min. Leaves to Valid a Tree",hover_event:{action:"show_text",value:"This datapack considers a tree only if it has this set value amount of naturally generated leaves at its trunk.\nFungi will get checked by the amount of cap blocks and additionally a 3×3 big cross on top of the stem."}},{text:" (Current: ",color:"gray"},{"score":{"name":"min_leaves_found","objective":"timber"},color:"gray"},{text: ")",color:"gray"}] -execute unless score min_leaves_found timber matches 5 run tellraw @s ["",{text:"[ ✎ ]",color:"gray",click_event:{action:"suggest_command",command:"/scoreboard players set min_leaves_found timber "},hover_event:{action:"show_text",value:"Default: 5"}},{text:" Set Min. Leaves to Valid a Tree",hover_event:{action:"show_text",value:"This datapack considers a tree only if it has this set value amount of naturally generated leaves at its trunk.\nFungi will get checked by the amount of cap blocks and additionally a 3×3 big cross on top of the stem."}},{text:" (Current: ",color:"gray"},{"score":{"name":"min_leaves_found","objective":"timber"},color:"gray"},{text: ")",color:"gray"}] - -tellraw @s ["",{text:"\u00A7m ",color:"dark_gray"}] - -function timber:settings/end_of_message diff --git a/data/timber/function/settings/settings2_click.mcfunction b/data/timber/function/settings/settings2_click.mcfunction deleted file mode 100644 index 44b2ce4..0000000 --- a/data/timber/function/settings/settings2_click.mcfunction +++ /dev/null @@ -1,2 +0,0 @@ -function timber:settings/settings2 -playsound minecraft:ui.button.click master @s ~ ~ ~ .2 1.6 .2 \ No newline at end of file diff --git a/data/timber/function/settings/show.mcfunction b/data/timber/function/settings/show.mcfunction new file mode 100644 index 0000000..3422c0b --- /dev/null +++ b/data/timber/function/settings/show.mcfunction @@ -0,0 +1 @@ +$dialog show @s $(dialog) diff --git a/data/timber/function/settings/toggle/chop_down.mcfunction b/data/timber/function/settings/toggle/chop_down.mcfunction deleted file mode 100644 index e601c0c..0000000 --- a/data/timber/function/settings/toggle/chop_down.mcfunction +++ /dev/null @@ -1,7 +0,0 @@ -execute if score chop_down timber matches 1.. run scoreboard players set chop_down timber 2 -execute unless score chop_down timber matches 1.. run scoreboard players set chop_down timber 1 -execute if score chop_down timber matches 2.. run scoreboard players set chop_down timber 0 -execute if score chop_down timber matches 1 run playsound minecraft:ui.button.click master @s ~ ~ ~ .2 1.9 .2 -execute if score chop_down timber matches 0 run playsound minecraft:ui.button.click master @s ~ ~ ~ .2 1.3 .2 -function timber:settings/settings -function timber:settings/end_of_message \ No newline at end of file diff --git a/data/timber/function/settings/toggle/chop_fungi.mcfunction b/data/timber/function/settings/toggle/chop_fungi.mcfunction deleted file mode 100644 index 22614b8..0000000 --- a/data/timber/function/settings/toggle/chop_fungi.mcfunction +++ /dev/null @@ -1,7 +0,0 @@ -execute if score chop_fungi timber matches 1.. run scoreboard players set chop_fungi timber 2 -execute unless score chop_fungi timber matches 1.. run scoreboard players set chop_fungi timber 1 -execute if score chop_fungi timber matches 2.. run scoreboard players set chop_fungi timber 0 -execute if score chop_fungi timber matches 1 run playsound minecraft:ui.button.click master @s ~ ~ ~ .2 1.9 .2 -execute if score chop_fungi timber matches 0 run playsound minecraft:ui.button.click master @s ~ ~ ~ .2 1.3 .2 -function timber:settings/settings2 -function timber:settings/end_of_message \ No newline at end of file diff --git a/data/timber/function/settings/toggle/chop_trees.mcfunction b/data/timber/function/settings/toggle/chop_trees.mcfunction deleted file mode 100644 index 19fe627..0000000 --- a/data/timber/function/settings/toggle/chop_trees.mcfunction +++ /dev/null @@ -1,7 +0,0 @@ -execute if score chop_trees timber matches 1.. run scoreboard players set chop_trees timber 2 -execute unless score chop_trees timber matches 1.. run scoreboard players set chop_trees timber 1 -execute if score chop_trees timber matches 2.. run scoreboard players set chop_trees timber 0 -execute if score chop_trees timber matches 1 run playsound minecraft:ui.button.click master @s ~ ~ ~ .2 1.9 .2 -execute if score chop_trees timber matches 0 run playsound minecraft:ui.button.click master @s ~ ~ ~ .2 1.3 .2 -function timber:settings/settings2 -function timber:settings/end_of_message \ No newline at end of file diff --git a/data/timber/function/settings/toggle/copper_axe.mcfunction b/data/timber/function/settings/toggle/copper_axe.mcfunction deleted file mode 100644 index 63fac10..0000000 --- a/data/timber/function/settings/toggle/copper_axe.mcfunction +++ /dev/null @@ -1,7 +0,0 @@ -execute if score copper_axe timber matches 1.. run scoreboard players set copper_axe timber 2 -execute unless score copper_axe timber matches 1.. run scoreboard players set copper_axe timber 1 -execute if score copper_axe timber matches 2.. run scoreboard players set copper_axe timber 0 -execute if score copper_axe timber matches 1 run playsound minecraft:ui.button.click master @s ~ ~ ~ .2 1.9 .2 -execute if score copper_axe timber matches 0 run playsound minecraft:ui.button.click master @s ~ ~ ~ .2 1.3 .2 -function timber:settings/settings2 -function timber:settings/end_of_message diff --git a/data/timber/function/settings/toggle/destroy_leaves.mcfunction b/data/timber/function/settings/toggle/destroy_leaves.mcfunction deleted file mode 100644 index 346bced..0000000 --- a/data/timber/function/settings/toggle/destroy_leaves.mcfunction +++ /dev/null @@ -1,7 +0,0 @@ -execute if score destroy_leaves timber matches 1.. run scoreboard players set destroy_leaves timber 2 -execute unless score destroy_leaves timber matches 1.. run scoreboard players set destroy_leaves timber 1 -execute if score destroy_leaves timber matches 2.. run scoreboard players set destroy_leaves timber 0 -execute if score destroy_leaves timber matches 1 run playsound minecraft:ui.button.click master @s ~ ~ ~ .2 1.9 .2 -execute if score destroy_leaves timber matches 0 run playsound minecraft:ui.button.click master @s ~ ~ ~ .2 1.3 .2 -function timber:settings/settings -function timber:settings/end_of_message \ No newline at end of file diff --git a/data/timber/function/settings/toggle/destroy_roots.mcfunction b/data/timber/function/settings/toggle/destroy_roots.mcfunction deleted file mode 100644 index 87a6906..0000000 --- a/data/timber/function/settings/toggle/destroy_roots.mcfunction +++ /dev/null @@ -1,7 +0,0 @@ -execute if score destroy_roots timber matches 1.. run scoreboard players set destroy_roots timber 2 -execute unless score destroy_roots timber matches 1.. run scoreboard players set destroy_roots timber 1 -execute if score destroy_roots timber matches 2.. run scoreboard players set destroy_roots timber 0 -execute if score destroy_roots timber matches 1 run playsound minecraft:ui.button.click master @s ~ ~ ~ .2 1.9 .2 -execute if score destroy_roots timber matches 0 run playsound minecraft:ui.button.click master @s ~ ~ ~ .2 1.3 .2 -function timber:settings/settings -function timber:settings/end_of_message \ No newline at end of file diff --git a/data/timber/function/settings/toggle/diamond_axe.mcfunction b/data/timber/function/settings/toggle/diamond_axe.mcfunction deleted file mode 100644 index 83e45d8..0000000 --- a/data/timber/function/settings/toggle/diamond_axe.mcfunction +++ /dev/null @@ -1,7 +0,0 @@ -execute if score diamond_axe timber matches 1.. run scoreboard players set diamond_axe timber 2 -execute unless score diamond_axe timber matches 1.. run scoreboard players set diamond_axe timber 1 -execute if score diamond_axe timber matches 2.. run scoreboard players set diamond_axe timber 0 -execute if score diamond_axe timber matches 1 run playsound minecraft:ui.button.click master @s ~ ~ ~ .2 1.9 .2 -execute if score diamond_axe timber matches 0 run playsound minecraft:ui.button.click master @s ~ ~ ~ .2 1.3 .2 -function timber:settings/settings2 -function timber:settings/end_of_message \ No newline at end of file diff --git a/data/timber/function/settings/toggle/drop_loot.mcfunction b/data/timber/function/settings/toggle/drop_loot.mcfunction deleted file mode 100644 index dc35415..0000000 --- a/data/timber/function/settings/toggle/drop_loot.mcfunction +++ /dev/null @@ -1,7 +0,0 @@ -execute if score drop_loot timber matches 1.. run scoreboard players set drop_loot timber 2 -execute unless score drop_loot timber matches 1.. run scoreboard players set drop_loot timber 1 -execute if score drop_loot timber matches 2.. run scoreboard players set drop_loot timber 0 -execute if score drop_loot timber matches 1 run playsound minecraft:ui.button.click master @s ~ ~ ~ .2 1.9 .2 -execute if score drop_loot timber matches 0 run playsound minecraft:ui.button.click master @s ~ ~ ~ .2 1.3 .2 -function timber:settings/settings -function timber:settings/end_of_message \ No newline at end of file diff --git a/data/timber/function/settings/toggle/golden_axe.mcfunction b/data/timber/function/settings/toggle/golden_axe.mcfunction deleted file mode 100644 index f21f5b8..0000000 --- a/data/timber/function/settings/toggle/golden_axe.mcfunction +++ /dev/null @@ -1,7 +0,0 @@ -execute if score golden_axe timber matches 1.. run scoreboard players set golden_axe timber 2 -execute unless score golden_axe timber matches 1.. run scoreboard players set golden_axe timber 1 -execute if score golden_axe timber matches 2.. run scoreboard players set golden_axe timber 0 -execute if score golden_axe timber matches 1 run playsound minecraft:ui.button.click master @s ~ ~ ~ .2 1.9 .2 -execute if score golden_axe timber matches 0 run playsound minecraft:ui.button.click master @s ~ ~ ~ .2 1.3 .2 -function timber:settings/settings2 -function timber:settings/end_of_message \ No newline at end of file diff --git a/data/timber/function/settings/toggle/hunger.mcfunction b/data/timber/function/settings/toggle/hunger.mcfunction deleted file mode 100644 index b1e9543..0000000 --- a/data/timber/function/settings/toggle/hunger.mcfunction +++ /dev/null @@ -1,7 +0,0 @@ -execute if score hunger timber matches 1.. run scoreboard players set hunger timber 2 -execute unless score hunger timber matches 1.. run scoreboard players set hunger timber 1 -execute if score hunger timber matches 2.. run scoreboard players set hunger timber 0 -execute if score hunger timber matches 1 run playsound minecraft:ui.button.click master @s ~ ~ ~ .2 1.9 .2 -execute if score hunger timber matches 0 run playsound minecraft:ui.button.click master @s ~ ~ ~ .2 1.3 .2 -function timber:settings/settings1 -function timber:settings/end_of_message \ No newline at end of file diff --git a/data/timber/function/settings/toggle/interfere.mcfunction b/data/timber/function/settings/toggle/interfere.mcfunction deleted file mode 100644 index b1270d0..0000000 --- a/data/timber/function/settings/toggle/interfere.mcfunction +++ /dev/null @@ -1,7 +0,0 @@ -execute if score interfere timber matches 1.. run scoreboard players set interfere timber 2 -execute unless score interfere timber matches 1.. run scoreboard players set interfere timber 1 -execute if score interfere timber matches 2.. run scoreboard players set interfere timber 0 -execute if score interfere timber matches 1 run playsound minecraft:ui.button.click master @s ~ ~ ~ .2 1.9 .2 -execute if score interfere timber matches 0 run playsound minecraft:ui.button.click master @s ~ ~ ~ .2 1.3 .2 -function timber:settings/settings -function timber:settings/end_of_message \ No newline at end of file diff --git a/data/timber/function/settings/toggle/iron_axe.mcfunction b/data/timber/function/settings/toggle/iron_axe.mcfunction deleted file mode 100644 index bf08c1f..0000000 --- a/data/timber/function/settings/toggle/iron_axe.mcfunction +++ /dev/null @@ -1,7 +0,0 @@ -execute if score iron_axe timber matches 1.. run scoreboard players set iron_axe timber 2 -execute unless score iron_axe timber matches 1.. run scoreboard players set iron_axe timber 1 -execute if score iron_axe timber matches 2.. run scoreboard players set iron_axe timber 0 -execute if score iron_axe timber matches 1 run playsound minecraft:ui.button.click master @s ~ ~ ~ .2 1.9 .2 -execute if score iron_axe timber matches 0 run playsound minecraft:ui.button.click master @s ~ ~ ~ .2 1.3 .2 -function timber:settings/settings2 -function timber:settings/end_of_message \ No newline at end of file diff --git a/data/timber/function/settings/toggle/netherite_axe.mcfunction b/data/timber/function/settings/toggle/netherite_axe.mcfunction deleted file mode 100644 index 17f6528..0000000 --- a/data/timber/function/settings/toggle/netherite_axe.mcfunction +++ /dev/null @@ -1,7 +0,0 @@ -execute if score netherite_axe timber matches 1.. run scoreboard players set netherite_axe timber 2 -execute unless score netherite_axe timber matches 1.. run scoreboard players set netherite_axe timber 1 -execute if score netherite_axe timber matches 2.. run scoreboard players set netherite_axe timber 0 -execute if score netherite_axe timber matches 1 run playsound minecraft:ui.button.click master @s ~ ~ ~ .2 1.9 .2 -execute if score netherite_axe timber matches 0 run playsound minecraft:ui.button.click master @s ~ ~ ~ .2 1.3 .2 -function timber:settings/settings2 -function timber:settings/end_of_message \ No newline at end of file diff --git a/data/timber/function/settings/toggle/persistent.mcfunction b/data/timber/function/settings/toggle/persistent.mcfunction deleted file mode 100644 index 58bad84..0000000 --- a/data/timber/function/settings/toggle/persistent.mcfunction +++ /dev/null @@ -1,7 +0,0 @@ -execute if score persistent timber matches 1.. run scoreboard players set persistent timber 2 -execute unless score persistent timber matches 1.. run scoreboard players set persistent timber 1 -execute if score persistent timber matches 2.. run scoreboard players set persistent timber 0 -execute if score persistent timber matches 1 run playsound minecraft:ui.button.click master @s ~ ~ ~ .2 1.9 .2 -execute if score persistent timber matches 0 run playsound minecraft:ui.button.click master @s ~ ~ ~ .2 1.3 .2 -function timber:settings/settings2 -function timber:settings/end_of_message \ No newline at end of file diff --git a/data/timber/function/settings/toggle/plant_sapling.mcfunction b/data/timber/function/settings/toggle/plant_sapling.mcfunction deleted file mode 100644 index a6efdc3..0000000 --- a/data/timber/function/settings/toggle/plant_sapling.mcfunction +++ /dev/null @@ -1,8 +0,0 @@ -execute if score plant_sapling timber matches 1.. run scoreboard players set plant_sapling timber 2 -execute unless score plant_sapling timber matches 1.. run scoreboard players set plant_sapling timber 1 -execute if score plant_sapling timber matches 2.. run scoreboard players set plant_sapling timber 0 -execute if score plant_sapling timber matches 1 run playsound minecraft:ui.button.click master @s ~ ~ ~ .2 1.9 .2 -execute if score plant_sapling timber matches 1 run function timber:autoplant/loop -execute if score plant_sapling timber matches 0 run playsound minecraft:ui.button.click master @s ~ ~ ~ .2 1.3 .2 -function timber:settings/settings1 -function timber:settings/end_of_message \ No newline at end of file diff --git a/data/timber/function/settings/toggle/slow_chop.mcfunction b/data/timber/function/settings/toggle/slow_chop.mcfunction deleted file mode 100644 index 0a0989c..0000000 --- a/data/timber/function/settings/toggle/slow_chop.mcfunction +++ /dev/null @@ -1,8 +0,0 @@ -execute if score slow_chop timber matches 1.. run scoreboard players set slow_chop timber 2 -execute unless score slow_chop timber matches 1.. run scoreboard players set slow_chop timber 1 -execute if score slow_chop timber matches 2.. run scoreboard players set slow_chop timber 0 -execute if score slow_chop timber matches 1 run playsound minecraft:ui.button.click master @s ~ ~ ~ .2 1.9 .2 -execute if score slow_chop timber matches 1 run function timber:slow_chop/loop -execute if score slow_chop timber matches 0 run playsound minecraft:ui.button.click master @s ~ ~ ~ .2 1.3 .2 -function timber:settings/settings1 -function timber:settings/end_of_message \ No newline at end of file diff --git a/data/timber/function/settings/toggle/sneaking.mcfunction b/data/timber/function/settings/toggle/sneaking.mcfunction deleted file mode 100644 index 53f5141..0000000 --- a/data/timber/function/settings/toggle/sneaking.mcfunction +++ /dev/null @@ -1,7 +0,0 @@ -execute if score sneaking timber matches 1.. run scoreboard players set sneaking timber 2 -execute unless score sneaking timber matches 1.. run scoreboard players set sneaking timber 1 -execute if score sneaking timber matches 2.. run scoreboard players set sneaking timber 0 -execute if score sneaking timber matches 1 run playsound minecraft:ui.button.click master @s ~ ~ ~ .2 1.9 .2 -execute if score sneaking timber matches 0 run playsound minecraft:ui.button.click master @s ~ ~ ~ .2 1.3 .2 -function timber:settings/settings -function timber:settings/end_of_message \ No newline at end of file diff --git a/data/timber/function/settings/toggle/standing.mcfunction b/data/timber/function/settings/toggle/standing.mcfunction deleted file mode 100644 index 08c661d..0000000 --- a/data/timber/function/settings/toggle/standing.mcfunction +++ /dev/null @@ -1,7 +0,0 @@ -execute if score standing timber matches 1.. run scoreboard players set standing timber 2 -execute unless score standing timber matches 1.. run scoreboard players set standing timber 1 -execute if score standing timber matches 2.. run scoreboard players set standing timber 0 -execute if score standing timber matches 1 run playsound minecraft:ui.button.click master @s ~ ~ ~ .2 1.9 .2 -execute if score standing timber matches 0 run playsound minecraft:ui.button.click master @s ~ ~ ~ .2 1.3 .2 -function timber:settings/settings -function timber:settings/end_of_message \ No newline at end of file diff --git a/data/timber/function/settings/toggle/start_chop_on_root.mcfunction b/data/timber/function/settings/toggle/start_chop_on_root.mcfunction deleted file mode 100644 index e04a2b7..0000000 --- a/data/timber/function/settings/toggle/start_chop_on_root.mcfunction +++ /dev/null @@ -1,7 +0,0 @@ -execute if score start_chop_on_root timber matches 1.. run scoreboard players set start_chop_on_root timber 2 -execute unless score start_chop_on_root timber matches 1.. run scoreboard players set start_chop_on_root timber 1 -execute if score start_chop_on_root timber matches 2.. run scoreboard players set start_chop_on_root timber 0 -execute if score start_chop_on_root timber matches 1 run playsound minecraft:ui.button.click master @s ~ ~ ~ .2 1.9 .2 -execute if score start_chop_on_root timber matches 0 run playsound minecraft:ui.button.click master @s ~ ~ ~ .2 1.3 .2 -function timber:settings/settings -function timber:settings/end_of_message \ No newline at end of file diff --git a/data/timber/function/settings/toggle/stone_axe.mcfunction b/data/timber/function/settings/toggle/stone_axe.mcfunction deleted file mode 100644 index 641459d..0000000 --- a/data/timber/function/settings/toggle/stone_axe.mcfunction +++ /dev/null @@ -1,7 +0,0 @@ -execute if score stone_axe timber matches 1.. run scoreboard players set stone_axe timber 2 -execute unless score stone_axe timber matches 1.. run scoreboard players set stone_axe timber 1 -execute if score stone_axe timber matches 2.. run scoreboard players set stone_axe timber 0 -execute if score stone_axe timber matches 1 run playsound minecraft:ui.button.click master @s ~ ~ ~ .2 1.9 .2 -execute if score stone_axe timber matches 0 run playsound minecraft:ui.button.click master @s ~ ~ ~ .2 1.3 .2 -function timber:settings/settings2 -function timber:settings/end_of_message \ No newline at end of file diff --git a/data/timber/function/settings/toggle/stop_chopping.mcfunction b/data/timber/function/settings/toggle/stop_chopping.mcfunction deleted file mode 100644 index b13140f..0000000 --- a/data/timber/function/settings/toggle/stop_chopping.mcfunction +++ /dev/null @@ -1,7 +0,0 @@ -execute if score stop_chopping timber matches 1.. run scoreboard players set stop_chopping timber 2 -execute unless score stop_chopping timber matches 1.. run scoreboard players set stop_chopping timber 1 -execute if score stop_chopping timber matches 2.. run scoreboard players set stop_chopping timber 0 -execute if score stop_chopping timber matches 1 run playsound minecraft:ui.button.click master @s ~ ~ ~ .2 1.9 .2 -execute if score stop_chopping timber matches 0 run playsound minecraft:ui.button.click master @s ~ ~ ~ .2 1.3 .2 -function timber:settings/settings -function timber:settings/end_of_message \ No newline at end of file diff --git a/data/timber/function/settings/toggle/stopsound.mcfunction b/data/timber/function/settings/toggle/stopsound.mcfunction deleted file mode 100644 index 9418b18..0000000 --- a/data/timber/function/settings/toggle/stopsound.mcfunction +++ /dev/null @@ -1,7 +0,0 @@ -execute if score stopsound timber matches 1.. run scoreboard players set stopsound timber 2 -execute unless score stopsound timber matches 1.. run scoreboard players set stopsound timber 1 -execute if score stopsound timber matches 2.. run scoreboard players set stopsound timber 0 -execute if score stopsound timber matches 1 run playsound minecraft:ui.button.click master @s ~ ~ ~ .2 1.9 .2 -execute if score stopsound timber matches 0 run playsound minecraft:ui.button.click master @s ~ ~ ~ .2 1.3 .2 -function timber:settings/settings -function timber:settings/end_of_message \ No newline at end of file diff --git a/data/timber/function/settings/toggle/wear_out.mcfunction b/data/timber/function/settings/toggle/wear_out.mcfunction deleted file mode 100644 index 0bad5ec..0000000 --- a/data/timber/function/settings/toggle/wear_out.mcfunction +++ /dev/null @@ -1,7 +0,0 @@ -execute if score wear_out timber matches 1.. run scoreboard players set wear_out timber 2 -execute unless score wear_out timber matches 1.. run scoreboard players set wear_out timber 1 -execute if score wear_out timber matches 2.. run scoreboard players set wear_out timber 0 -execute if score wear_out timber matches 1 run playsound minecraft:ui.button.click master @s ~ ~ ~ .2 1.9 .2 -execute if score wear_out timber matches 0 run playsound minecraft:ui.button.click master @s ~ ~ ~ .2 1.3 .2 -function timber:settings/settings -function timber:settings/end_of_message \ No newline at end of file diff --git a/data/timber/function/settings/toggle/wooden_axe.mcfunction b/data/timber/function/settings/toggle/wooden_axe.mcfunction deleted file mode 100644 index cb82456..0000000 --- a/data/timber/function/settings/toggle/wooden_axe.mcfunction +++ /dev/null @@ -1,7 +0,0 @@ -execute if score wooden_axe timber matches 1.. run scoreboard players set wooden_axe timber 2 -execute unless score wooden_axe timber matches 1.. run scoreboard players set wooden_axe timber 1 -execute if score wooden_axe timber matches 2.. run scoreboard players set wooden_axe timber 0 -execute if score wooden_axe timber matches 1 run playsound minecraft:ui.button.click master @s ~ ~ ~ .2 1.9 .2 -execute if score wooden_axe timber matches 0 run playsound minecraft:ui.button.click master @s ~ ~ ~ .2 1.3 .2 -function timber:settings/settings2 -function timber:settings/end_of_message \ No newline at end of file diff --git a/data/timber/function/settings/toggle_self.mcfunction b/data/timber/function/settings/toggle_self.mcfunction new file mode 100644 index 0000000..ff98e67 --- /dev/null +++ b/data/timber/function/settings/toggle_self.mcfunction @@ -0,0 +1,3 @@ +# toggles Timber for the player and shows the help dialog again +function timber:settings/toggle/timber +function timber:settings/open/help diff --git a/data/timber/function/uninstall.mcfunction b/data/timber/function/uninstall.mcfunction index a76ceb7..4cbe8b4 100644 --- a/data/timber/function/uninstall.mcfunction +++ b/data/timber/function/uninstall.mcfunction @@ -1,5 +1,17 @@ -# stop main functions +# stop main functions and everything else that reschedules itself schedule clear timber:main +schedule clear timber:autoplant/loop +schedule clear timber:autoplant/mud_fix +schedule clear timber:settings/reset_gamerule +schedule clear timber:slow_chop/loop +schedule clear timber:utils/check_server +schedule clear timber:utils/reset + +# remove stored data +data remove storage timber:settings dialog +data remove storage timber:slow_chop blocks_per_chop +data remove storage timber:slow_chop time_between_chops +data remove storage timber:max_command_sequence_length value # remove scoreboards scoreboard objectives remove timber_w_axe @@ -11,6 +23,12 @@ scoreboard objectives remove timber_d_axe scoreboard objectives remove timber_n_axe scoreboard objectives remove timber scoreboard objectives remove TimberToggle +scoreboard objectives remove TimberSettings +scoreboard objectives remove TimberSetBlocks +scoreboard objectives remove TimberSetTicks +scoreboard objectives remove TimberSetTreeSize +scoreboard objectives remove TimberSetLeaves +scoreboard objectives remove timber_menu scoreboard objectives remove timber_disabled scoreboard objectives remove timber_prsistent diff --git a/data/timber/predicate/block/leaf.json b/data/timber/predicate/block/leaf.json index 14d5368..016c5cb 100644 --- a/data/timber/predicate/block/leaf.json +++ b/data/timber/predicate/block/leaf.json @@ -5,10 +5,35 @@ "condition": "minecraft:location_check", "predicate": { "block": { - "blocks": "#minecraft:leaves" + "blocks": "#minecraft:leaves", + "state": { + "persistent": "false" + } } } }, + { + "condition": "minecraft:all_of", + "terms": [ + { + "condition": "minecraft:location_check", + "predicate": { + "block": { + "blocks": "#minecraft:leaves" + } + } + }, + { + "condition": "minecraft:entity_scores", + "entity": "this", + "scores": { + "timber_prsistent": { + "min": 1 + } + } + } + ] + }, { "condition": "minecraft:location_check", "predicate": { @@ -21,4 +46,4 @@ } } ] -} \ No newline at end of file +} diff --git a/pack.mcmeta b/pack.mcmeta index b436450..c9f3a12 100644 --- a/pack.mcmeta +++ b/pack.mcmeta @@ -2,18 +2,12 @@ "pack": { "description": "Timber Datapack allows you to instantly chop down a tree just by breaking one log", "pack_format": 121.0, - "supported_formats": [18, 121.0], - "min_format": 18, + "min_format": 101.0, "max_format": 121.0 }, "overlays": { "entries": [ - {"formats": [121, 121], "directory": "121", "min_format": 121, "max_format": 121}, - {"formats": [82, 88], "directory": "82-88", "min_format": 82, "max_format": 88}, - {"formats": [18, 81], "directory": "18-81", "min_format": 18, "max_format": 81}, - {"formats": [18, 61], "directory": "18-61"}, - {"formats": [18, 41], "directory": "18-41"}, - {"formats": [18, 26], "directory": "18-26"} + {"directory": "121", "min_format": 121, "max_format": 121} ] } -} \ No newline at end of file +} diff --git a/tests/data/minecraft/tags/function/load.json b/tests/data/minecraft/tags/function/load.json new file mode 100644 index 0000000..19b9c2b --- /dev/null +++ b/tests/data/minecraft/tags/function/load.json @@ -0,0 +1,5 @@ +{ + "values": [ + "timber_test:load" + ] +} diff --git a/tests/data/timber_test/function/assert_logs_gone_leaves_kept.mcfunction b/tests/data/timber_test/function/assert_logs_gone_leaves_kept.mcfunction new file mode 100644 index 0000000..da0c8a2 --- /dev/null +++ b/tests/data/timber_test/function/assert_logs_gone_leaves_kept.mcfunction @@ -0,0 +1,14 @@ +#> Fails the test if a log is left or if a leaf is gone: the tree was chopped but its leaves must stay (destroy_leaves off). +#> Replaces logs with air while counting, so run it last. +#> @param test name of the test, count_leaves has to be called with the same name before mining +scoreboard objectives add timber_test dummy +execute store result score #logs timber_test run fill ~0 ~0 ~0 ~39 ~19 ~39 minecraft:air replace #minecraft:logs +execute store result score #dtmp timber_test run fill ~0 ~20 ~0 ~39 ~39 ~39 minecraft:air replace #minecraft:logs +scoreboard players operation #logs timber_test += #dtmp timber_test +execute store result score #leaves1 timber_test run clone ~0 ~0 ~0 ~39 ~19 ~39 ~0 ~64 ~0 filtered #minecraft:leaves +execute store result score #dtmp timber_test run clone ~0 ~20 ~0 ~39 ~39 ~39 ~0 ~64 ~0 filtered #minecraft:leaves +scoreboard players operation #leaves1 timber_test += #dtmp timber_test +fill ~0 ~64 ~0 ~39 ~83 ~39 minecraft:air +$scoreboard players operation #leaves1 timber_test -= #leaves0_$(test) timber_test +assert score #logs timber_test matches 0 +assert score #leaves1 timber_test matches 0 diff --git a/tests/data/timber_test/function/assert_logs_left.mcfunction b/tests/data/timber_test/function/assert_logs_left.mcfunction new file mode 100644 index 0000000..ae9d6e7 --- /dev/null +++ b/tests/data/timber_test/function/assert_logs_left.mcfunction @@ -0,0 +1,7 @@ +#> Fails the test unless exactly n logs are left in the arena. Replaces logs with air while counting, so run it last. +#> @param n expected number of logs +scoreboard objectives add timber_test dummy +execute store result score #logs timber_test run fill ~0 ~0 ~0 ~39 ~19 ~39 minecraft:air replace #minecraft:logs +execute store result score #dtmp timber_test run fill ~0 ~20 ~0 ~39 ~39 ~39 minecraft:air replace #minecraft:logs +scoreboard players operation #logs timber_test += #dtmp timber_test +$assert score #logs timber_test matches $(n) diff --git a/tests/data/timber_test/function/assert_logs_removed.mcfunction b/tests/data/timber_test/function/assert_logs_removed.mcfunction new file mode 100644 index 0000000..9e1f701 --- /dev/null +++ b/tests/data/timber_test/function/assert_logs_removed.mcfunction @@ -0,0 +1,11 @@ +#> Fails the test unless exactly n logs are gone compared with count_logs (the mined one included). +#> Replaces logs with air while counting, so run it last. +#> @param test name of the test, count_logs has to be called with the same name before mining +#> @param n expected number of removed logs +scoreboard objectives add timber_test dummy +execute store result score #lleft timber_test run fill ~0 ~0 ~0 ~39 ~19 ~39 minecraft:air replace #minecraft:logs +execute store result score #dtmp timber_test run fill ~0 ~20 ~0 ~39 ~39 ~39 minecraft:air replace #minecraft:logs +scoreboard players operation #lleft timber_test += #dtmp timber_test +$scoreboard players operation #lrem timber_test = #logs0_$(test) timber_test +scoreboard players operation #lrem timber_test -= #lleft timber_test +$assert score #lrem timber_test matches $(n) diff --git a/tests/data/timber_test/function/assert_no_fungus.mcfunction b/tests/data/timber_test/function/assert_no_fungus.mcfunction new file mode 100644 index 0000000..ea037a7 --- /dev/null +++ b/tests/data/timber_test/function/assert_no_fungus.mcfunction @@ -0,0 +1,37 @@ +#> Fails the test if a stem of a fungus is left in the arena, cap blocks that are left only warn. +#> Stems: all logs (crimson and warped stems are logs) and mushroom_stem. Caps: warts, shroomlight, red and brown mushroom blocks. +#> Replaces them with air while counting, so run it last. The arena is handled in two slabs, a command may only touch 32768 blocks. +#> @param test name of the test +scoreboard objectives add timber_test dummy +scoreboard players set #stems timber_test 0 +scoreboard players set #caps timber_test 0 +execute store result score #dtmp timber_test run fill ~0 ~0 ~0 ~39 ~19 ~39 minecraft:air replace #minecraft:logs +scoreboard players operation #stems timber_test += #dtmp timber_test +execute store result score #dtmp timber_test run fill ~0 ~20 ~0 ~39 ~39 ~39 minecraft:air replace #minecraft:logs +scoreboard players operation #stems timber_test += #dtmp timber_test +execute store result score #dtmp timber_test run fill ~0 ~0 ~0 ~39 ~19 ~39 minecraft:air replace minecraft:mushroom_stem +scoreboard players operation #stems timber_test += #dtmp timber_test +execute store result score #dtmp timber_test run fill ~0 ~20 ~0 ~39 ~39 ~39 minecraft:air replace minecraft:mushroom_stem +scoreboard players operation #stems timber_test += #dtmp timber_test +execute store result score #dtmp timber_test run fill ~0 ~0 ~0 ~39 ~19 ~39 minecraft:air replace #minecraft:wart_blocks +scoreboard players operation #caps timber_test += #dtmp timber_test +execute store result score #dtmp timber_test run fill ~0 ~20 ~0 ~39 ~39 ~39 minecraft:air replace #minecraft:wart_blocks +scoreboard players operation #caps timber_test += #dtmp timber_test +execute store result score #dtmp timber_test run fill ~0 ~0 ~0 ~39 ~19 ~39 minecraft:air replace minecraft:shroomlight +scoreboard players operation #caps timber_test += #dtmp timber_test +execute store result score #dtmp timber_test run fill ~0 ~20 ~0 ~39 ~39 ~39 minecraft:air replace minecraft:shroomlight +scoreboard players operation #caps timber_test += #dtmp timber_test +execute store result score #dtmp timber_test run fill ~0 ~0 ~0 ~39 ~19 ~39 minecraft:air replace minecraft:red_mushroom_block +scoreboard players operation #caps timber_test += #dtmp timber_test +execute store result score #dtmp timber_test run fill ~0 ~20 ~0 ~39 ~39 ~39 minecraft:air replace minecraft:red_mushroom_block +scoreboard players operation #caps timber_test += #dtmp timber_test +execute store result score #dtmp timber_test run fill ~0 ~0 ~0 ~39 ~19 ~39 minecraft:air replace minecraft:brown_mushroom_block +scoreboard players operation #caps timber_test += #dtmp timber_test +execute store result score #dtmp timber_test run fill ~0 ~20 ~0 ~39 ~39 ~39 minecraft:air replace minecraft:brown_mushroom_block +scoreboard players operation #caps timber_test += #dtmp timber_test + +# cap blocks that are left standing only warn (the goal is to chop everything, this is a gap), stems have to be gone +$data modify storage timber_test:tmp test set value "$(test)" +execute store result storage timber_test:tmp caps int 1 run scoreboard players get #caps timber_test +execute unless score #caps timber_test matches 0 run function timber_test:warn_caps with storage timber_test:tmp +assert score #stems timber_test matches 0 diff --git a/tests/data/timber_test/function/assert_no_logs_warn_leaves.mcfunction b/tests/data/timber_test/function/assert_no_logs_warn_leaves.mcfunction new file mode 100644 index 0000000..98acb17 --- /dev/null +++ b/tests/data/timber_test/function/assert_no_logs_warn_leaves.mcfunction @@ -0,0 +1,28 @@ +#> Like assert_no_tree for trees with a big crown: no log may be left (fails), leaves that are left only warn. +#> The datapack destroys leaves along their distance values from the logs, in rare cases of very wide crowns (2x2 trunks, cherry) a few +#> leaves are not reached: a gap (the goal is to chop every tree), it is reported, not failed. Leaves with distance=7 warn as before. +#> Replaces logs and leaves with air while counting, so run it last. Two slabs, a command may only touch 32768 blocks. +#> @param test name of the test, count_d7 has to be called with the same name +scoreboard objectives add timber_test dummy +execute store result score #d7_after timber_test run clone ~0 ~0 ~0 ~39 ~19 ~39 ~0 ~64 ~0 filtered #minecraft:leaves[distance=7] +execute store result score #dtmp timber_test run clone ~0 ~20 ~0 ~39 ~39 ~39 ~0 ~64 ~0 filtered #minecraft:leaves[distance=7] +scoreboard players operation #d7_after timber_test += #dtmp timber_test +fill ~0 ~64 ~0 ~39 ~83 ~39 minecraft:air +fill ~0 ~0 ~0 ~39 ~19 ~39 minecraft:air replace #minecraft:leaves[distance=7] +fill ~0 ~20 ~0 ~39 ~39 ~39 minecraft:air replace #minecraft:leaves[distance=7] +execute store result score #logs timber_test run fill ~0 ~0 ~0 ~39 ~19 ~39 minecraft:air replace #minecraft:logs +execute store result score #dtmp timber_test run fill ~0 ~20 ~0 ~39 ~39 ~39 minecraft:air replace #minecraft:logs +scoreboard players operation #logs timber_test += #dtmp timber_test +execute store result score #leaves timber_test run fill ~0 ~0 ~0 ~39 ~19 ~39 minecraft:air replace #minecraft:leaves +execute store result score #dtmp timber_test run fill ~0 ~20 ~0 ~39 ~39 ~39 minecraft:air replace #minecraft:leaves +scoreboard players operation #leaves timber_test += #dtmp timber_test + +# warnings +$data modify storage timber_test:tmp test set value "$(test)" +$execute store result storage timber_test:tmp before int 1 run scoreboard players get #d7_$(test) timber_test +execute store result storage timber_test:tmp after int 1 run scoreboard players get #d7_after timber_test +execute if score #d7_after timber_test matches 1.. run function timber_test:warn_d7 with storage timber_test:tmp +execute store result storage timber_test:tmp leaves int 1 run scoreboard players get #leaves timber_test +execute unless score #leaves timber_test matches 0 run function timber_test:warn_leaves_left with storage timber_test:tmp + +assert score #logs timber_test matches 0 diff --git a/tests/data/timber_test/function/assert_no_roots.mcfunction b/tests/data/timber_test/function/assert_no_roots.mcfunction new file mode 100644 index 0000000..9d0ac9d --- /dev/null +++ b/tests/data/timber_test/function/assert_no_roots.mcfunction @@ -0,0 +1,12 @@ +#> Fails the test if any mangrove root is left in the arena. Replaces them with air while counting, so run it last. +#> (#minecraft:mangrove_logs does not contain the roots.) The arena is handled in two slabs, a command may only touch 32768 blocks. +scoreboard objectives add timber_test dummy +execute if score #debug timber_test matches 1 run return 0 +execute store result score #roots timber_test run fill ~0 ~0 ~0 ~39 ~19 ~39 minecraft:air replace minecraft:mangrove_roots +execute store result score #roots_b timber_test run fill ~0 ~20 ~0 ~39 ~39 ~39 minecraft:air replace minecraft:mangrove_roots +scoreboard players operation #roots timber_test += #roots_b timber_test +execute store result score #roots_b timber_test run fill ~0 ~0 ~0 ~39 ~19 ~39 minecraft:air replace minecraft:muddy_mangrove_roots +scoreboard players operation #roots timber_test += #roots_b timber_test +execute store result score #roots_b timber_test run fill ~0 ~20 ~0 ~39 ~39 ~39 minecraft:air replace minecraft:muddy_mangrove_roots +scoreboard players operation #roots timber_test += #roots_b timber_test +assert score #roots timber_test matches 0 diff --git a/tests/data/timber_test/function/assert_no_tree.mcfunction b/tests/data/timber_test/function/assert_no_tree.mcfunction new file mode 100644 index 0000000..2594960 --- /dev/null +++ b/tests/data/timber_test/function/assert_no_tree.mcfunction @@ -0,0 +1,27 @@ +#> Fails the test if any log or normal leaf is left in the arena. Leaves with distance=7 only produce a warning (see count_d7). +#> Replaces logs and leaves with air while counting, so run it last. The arena is handled in two slabs, a command may only touch 32768 blocks. +#> With #debug set (see debug_report) it only reports and leaves everything as it is. +#> @param test name of the test, count_d7 has to be called with the same name +scoreboard objectives add timber_test dummy +execute if score #debug timber_test matches 1 run function timber_test:debug_report +execute store result score #d7_after timber_test run clone ~0 ~0 ~0 ~39 ~19 ~39 ~0 ~64 ~0 filtered #minecraft:leaves[distance=7] +execute store result score #dtmp timber_test run clone ~0 ~20 ~0 ~39 ~39 ~39 ~0 ~64 ~0 filtered #minecraft:leaves[distance=7] +scoreboard players operation #d7_after timber_test += #dtmp timber_test +fill ~0 ~64 ~0 ~39 ~83 ~39 minecraft:air +fill ~0 ~0 ~0 ~39 ~19 ~39 minecraft:air replace #minecraft:leaves[distance=7] +fill ~0 ~20 ~0 ~39 ~39 ~39 minecraft:air replace #minecraft:leaves[distance=7] +execute store result score #logs timber_test run fill ~0 ~0 ~0 ~39 ~19 ~39 minecraft:air replace #minecraft:logs +execute store result score #dtmp timber_test run fill ~0 ~20 ~0 ~39 ~39 ~39 minecraft:air replace #minecraft:logs +scoreboard players operation #logs timber_test += #dtmp timber_test +execute store result score #leaves timber_test run fill ~0 ~0 ~0 ~39 ~19 ~39 minecraft:air replace #minecraft:leaves +execute store result score #dtmp timber_test run fill ~0 ~20 ~0 ~39 ~39 ~39 minecraft:air replace #minecraft:leaves +scoreboard players operation #leaves timber_test += #dtmp timber_test + +# warning: tests still pass, the marker is picked up by the CI workflow +$data modify storage timber_test:tmp test set value "$(test)" +$execute store result storage timber_test:tmp before int 1 run scoreboard players get #d7_$(test) timber_test +execute store result storage timber_test:tmp after int 1 run scoreboard players get #d7_after timber_test +execute if score #d7_after timber_test matches 1.. run function timber_test:warn_d7 with storage timber_test:tmp + +assert score #logs timber_test matches 0 +assert score #leaves timber_test matches 0 diff --git a/tests/data/timber_test/function/assert_not_chopped.mcfunction b/tests/data/timber_test/function/assert_not_chopped.mcfunction new file mode 100644 index 0000000..36a016f --- /dev/null +++ b/tests/data/timber_test/function/assert_not_chopped.mcfunction @@ -0,0 +1,21 @@ +#> For a tree the datapack is not allowed to chop (too few leaves next to the trunk): fails the test if it chopped anyway, +#> i.e. if more than the one mined log is gone. Then warns, because every tree should be choppable, this is a known gap. +#> Replaces logs with air while counting, so run it last. +#> @param test name of the test, count_logs and count_adjacent have to be called with the same name +scoreboard objectives add timber_test dummy +execute store result score #logs1 timber_test run fill ~0 ~0 ~0 ~39 ~19 ~39 minecraft:air replace #minecraft:logs +execute store result score #dtmp timber_test run fill ~0 ~20 ~0 ~39 ~39 ~39 minecraft:air replace #minecraft:logs +scoreboard players operation #logs1 timber_test += #dtmp timber_test + +# warning first, the CI workflow picks it up from the log +$data modify storage timber_test:tmp test set value "$(test)" +$execute store result storage timber_test:tmp adj int 1 run scoreboard players get #adj_$(test) timber_test +execute store result storage timber_test:tmp min int 1 run scoreboard players get min_leaves_found timber +function timber_test:warn_few_leaves with storage timber_test:tmp + +# the one mined log may be gone, nothing else +scoreboard players add #logs1 timber_test 1 +# PackTest's assert doesn't take a comparison of two scores (the parse error inside a macro function is swallowed, the test can't fail): +# subtract and compare with matches +$scoreboard players operation #logs1 timber_test -= #logs0_$(test) timber_test +assert score #logs1 timber_test matches 0.. diff --git a/tests/data/timber_test/function/assert_only_mined_gone.mcfunction b/tests/data/timber_test/function/assert_only_mined_gone.mcfunction new file mode 100644 index 0000000..9f3ddc0 --- /dev/null +++ b/tests/data/timber_test/function/assert_only_mined_gone.mcfunction @@ -0,0 +1,12 @@ +#> For a structure the datapack must not chop: fails the test if more than the one mined log is gone. +#> Replaces logs with air while counting, so run it last. The arena is handled in two slabs, a command may only touch 32768 blocks. +#> @param test name of the test, count_logs has to be called with the same name before mining +scoreboard objectives add timber_test dummy +execute store result score #logs1 timber_test run fill ~0 ~0 ~0 ~39 ~19 ~39 minecraft:air replace #minecraft:logs +execute store result score #dtmp timber_test run fill ~0 ~20 ~0 ~39 ~39 ~39 minecraft:air replace #minecraft:logs +scoreboard players operation #logs1 timber_test += #dtmp timber_test +scoreboard players add #logs1 timber_test 1 +# PackTest's assert doesn't take a comparison of two scores (the parse error inside a macro function is swallowed, the test can't fail): +# subtract and compare with matches +$scoreboard players operation #logs1 timber_test -= #logs0_$(test) timber_test +assert score #logs1 timber_test matches 0.. diff --git a/tests/data/timber_test/function/assert_roots_left.mcfunction b/tests/data/timber_test/function/assert_roots_left.mcfunction new file mode 100644 index 0000000..e4dfcef --- /dev/null +++ b/tests/data/timber_test/function/assert_roots_left.mcfunction @@ -0,0 +1,7 @@ +#> Fails the test unless exactly n mangrove roots are left in the arena. Replaces them with air while counting, so run it last. +#> @param n expected number of roots +scoreboard objectives add timber_test dummy +execute store result score #roots timber_test run fill ~0 ~0 ~0 ~39 ~19 ~39 minecraft:air replace minecraft:mangrove_roots +execute store result score #dtmp timber_test run fill ~0 ~20 ~0 ~39 ~39 ~39 minecraft:air replace minecraft:mangrove_roots +scoreboard players operation #roots timber_test += #dtmp timber_test +$assert score #roots timber_test matches $(n) diff --git a/tests/data/timber_test/function/count_adjacent.mcfunction b/tests/data/timber_test/function/count_adjacent.mcfunction new file mode 100644 index 0000000..b6d1f08 --- /dev/null +++ b/tests/data/timber_test/function/count_adjacent.mcfunction @@ -0,0 +1,38 @@ +#> Counts the leaves (and hanging mangrove propagules, the datapack's leaf predicate counts them too) that touch a log on one of their 6 sides into #adj_, this is the number the datapack compares with min_leaves_found. +#> Doesn't change the tree. The leaves are copied far above the arena, then the logs are copied over them shifted by one block in every +#> direction: every leaf a log lands on is next to a log, what is left of the copy is not (checked against oak: 13, same as the datapack). +#> @param test name of the test +scoreboard objectives add timber_test dummy +fill ~0 ~64 ~0 ~39 ~83 ~39 minecraft:air +fill ~0 ~84 ~0 ~39 ~103 ~39 minecraft:air +execute store result score #ta timber_test run clone ~0 ~0 ~0 ~39 ~19 ~39 ~0 ~64 ~0 filtered #minecraft:leaves +execute store result score #tb timber_test run clone ~0 ~20 ~0 ~39 ~39 ~39 ~0 ~84 ~0 filtered #minecraft:leaves +execute store result score #pa timber_test run clone ~0 ~0 ~0 ~39 ~19 ~39 ~0 ~64 ~0 filtered minecraft:mangrove_propagule[hanging=true] +execute store result score #pb timber_test run clone ~0 ~20 ~0 ~39 ~39 ~39 ~0 ~84 ~0 filtered minecraft:mangrove_propagule[hanging=true] +scoreboard players operation #ta timber_test += #pa timber_test +scoreboard players operation #tb timber_test += #pb timber_test +clone ~0 ~0 ~0 ~39 ~19 ~39 ~1 ~64 ~0 filtered #minecraft:logs +clone ~0 ~20 ~0 ~39 ~39 ~39 ~1 ~84 ~0 filtered #minecraft:logs +clone ~0 ~0 ~0 ~39 ~19 ~39 ~-1 ~64 ~0 filtered #minecraft:logs +clone ~0 ~20 ~0 ~39 ~39 ~39 ~-1 ~84 ~0 filtered #minecraft:logs +clone ~0 ~0 ~0 ~39 ~19 ~39 ~0 ~65 ~0 filtered #minecraft:logs +clone ~0 ~20 ~0 ~39 ~39 ~39 ~0 ~85 ~0 filtered #minecraft:logs +clone ~0 ~0 ~0 ~39 ~19 ~39 ~0 ~63 ~0 filtered #minecraft:logs +clone ~0 ~20 ~0 ~39 ~39 ~39 ~0 ~83 ~0 filtered #minecraft:logs +clone ~0 ~0 ~0 ~39 ~19 ~39 ~0 ~64 ~1 filtered #minecraft:logs +clone ~0 ~20 ~0 ~39 ~39 ~39 ~0 ~84 ~1 filtered #minecraft:logs +clone ~0 ~0 ~0 ~39 ~19 ~39 ~0 ~64 ~-1 filtered #minecraft:logs +clone ~0 ~20 ~0 ~39 ~39 ~39 ~0 ~84 ~-1 filtered #minecraft:logs +execute store result score #ra timber_test run fill ~0 ~64 ~0 ~39 ~83 ~39 minecraft:air replace #minecraft:leaves +execute store result score #rb timber_test run fill ~0 ~84 ~0 ~39 ~103 ~39 minecraft:air replace #minecraft:leaves +execute store result score #pa timber_test run fill ~0 ~64 ~0 ~39 ~83 ~39 minecraft:air replace minecraft:mangrove_propagule[hanging=true] +execute store result score #pb timber_test run fill ~0 ~84 ~0 ~39 ~103 ~39 minecraft:air replace minecraft:mangrove_propagule[hanging=true] +scoreboard players operation #ra timber_test += #pa timber_test +scoreboard players operation #rb timber_test += #pb timber_test +scoreboard players operation #atmp timber_test = #ta timber_test +scoreboard players operation #atmp timber_test += #tb timber_test +scoreboard players operation #atmp timber_test -= #ra timber_test +scoreboard players operation #atmp timber_test -= #rb timber_test +$scoreboard players operation #adj_$(test) timber_test = #atmp timber_test +fill ~0 ~64 ~0 ~39 ~83 ~39 minecraft:air +fill ~0 ~84 ~0 ~39 ~103 ~39 minecraft:air diff --git a/tests/data/timber_test/function/count_d7.mcfunction b/tests/data/timber_test/function/count_d7.mcfunction new file mode 100644 index 0000000..7c351e9 --- /dev/null +++ b/tests/data/timber_test/function/count_d7.mcfunction @@ -0,0 +1,11 @@ +#> Counts the leaves with distance=7 in the arena into #d7_ (call before chopping), doesn't change the tree. +#> Leaves without a log in range show up in the test environment but not in a normal world, the timber datapack ignores them. +#> Counting works by cloning them out of the way (clone reports the number of copied blocks), the copies are removed again. +#> The arena is counted in two slabs, a command may only touch 32768 blocks. +#> The score is named after the test: tests run in parallel and would overwrite a shared one before it is read. +#> @param test name of the test +scoreboard objectives add timber_test dummy +$execute store result score #d7_$(test) timber_test run clone ~0 ~0 ~0 ~39 ~19 ~39 ~0 ~64 ~0 filtered #minecraft:leaves[distance=7] +execute store result score #dtmp timber_test run clone ~0 ~20 ~0 ~39 ~39 ~39 ~0 ~64 ~0 filtered #minecraft:leaves[distance=7] +$scoreboard players operation #d7_$(test) timber_test += #dtmp timber_test +fill ~0 ~64 ~0 ~39 ~83 ~39 minecraft:air diff --git a/tests/data/timber_test/function/count_leaves.mcfunction b/tests/data/timber_test/function/count_leaves.mcfunction new file mode 100644 index 0000000..9be2d6b --- /dev/null +++ b/tests/data/timber_test/function/count_leaves.mcfunction @@ -0,0 +1,7 @@ +#> Counts all leaves in the arena into #leaves0_, doesn't change the tree (see count_d7 for how and why per test). +#> @param test name of the test +scoreboard objectives add timber_test dummy +$execute store result score #leaves0_$(test) timber_test run clone ~0 ~0 ~0 ~39 ~19 ~39 ~0 ~64 ~0 filtered #minecraft:leaves +execute store result score #dtmp timber_test run clone ~0 ~20 ~0 ~39 ~39 ~39 ~0 ~64 ~0 filtered #minecraft:leaves +$scoreboard players operation #leaves0_$(test) timber_test += #dtmp timber_test +fill ~0 ~64 ~0 ~39 ~83 ~39 minecraft:air diff --git a/tests/data/timber_test/function/count_logs.mcfunction b/tests/data/timber_test/function/count_logs.mcfunction new file mode 100644 index 0000000..d6fd469 --- /dev/null +++ b/tests/data/timber_test/function/count_logs.mcfunction @@ -0,0 +1,7 @@ +#> Counts the logs in the arena into #logs0_, doesn't change the tree (see count_d7 for how and why per test). +#> @param test name of the test +scoreboard objectives add timber_test dummy +$execute store result score #logs0_$(test) timber_test run clone ~0 ~0 ~0 ~39 ~19 ~39 ~0 ~64 ~0 filtered #minecraft:logs +execute store result score #dtmp timber_test run clone ~0 ~20 ~0 ~39 ~39 ~39 ~0 ~64 ~0 filtered #minecraft:logs +$scoreboard players operation #logs0_$(test) timber_test += #dtmp timber_test +fill ~0 ~64 ~0 ~39 ~83 ~39 minecraft:air diff --git a/tests/data/timber_test/function/debug_report.mcfunction b/tests/data/timber_test/function/debug_report.mcfunction new file mode 100644 index 0000000..c806684 --- /dev/null +++ b/tests/data/timber_test/function/debug_report.mcfunction @@ -0,0 +1,18 @@ +#> Debug mode: reports what is left and fails the test without touching a single block, so the arena can be looked at. +#> Switch it on with /scoreboard players set #debug timber_test 1 and off with ... 0 (create the objective first: /scoreboard objectives add timber_test dummy). +#> Counting works by cloning the blocks far above the arena (clone reports the number of copied blocks), the copies are removed again. +#> The arena is counted in two slabs, a command may only touch 32768 blocks. +execute store result score #dbg_logs timber_test run clone ~0 ~0 ~0 ~39 ~19 ~39 ~0 ~64 ~0 filtered #minecraft:logs +execute store result score #dbg_b timber_test run clone ~0 ~20 ~0 ~39 ~39 ~39 ~0 ~64 ~0 filtered #minecraft:logs +scoreboard players operation #dbg_logs timber_test += #dbg_b timber_test +execute store result score #dbg_leaves timber_test run clone ~0 ~0 ~0 ~39 ~19 ~39 ~0 ~64 ~0 filtered #minecraft:leaves +execute store result score #dbg_b timber_test run clone ~0 ~20 ~0 ~39 ~39 ~39 ~0 ~64 ~0 filtered #minecraft:leaves +scoreboard players operation #dbg_leaves timber_test += #dbg_b timber_test +execute store result score #dbg_d7 timber_test run clone ~0 ~0 ~0 ~39 ~19 ~39 ~0 ~64 ~0 filtered #minecraft:leaves[distance=7] +execute store result score #dbg_b timber_test run clone ~0 ~20 ~0 ~39 ~39 ~39 ~0 ~64 ~0 filtered #minecraft:leaves[distance=7] +scoreboard players operation #dbg_d7 timber_test += #dbg_b timber_test +execute store result score #dbg_roots timber_test run clone ~0 ~0 ~0 ~39 ~19 ~39 ~0 ~64 ~0 filtered minecraft:mangrove_roots +execute store result score #dbg_b timber_test run clone ~0 ~20 ~0 ~39 ~39 ~39 ~0 ~64 ~0 filtered minecraft:mangrove_roots +scoreboard players operation #dbg_roots timber_test += #dbg_b timber_test +fill ~0 ~64 ~0 ~39 ~83 ~39 minecraft:air +fail [{"text":"DEBUG mode, nothing was removed. Left standing: logs "},{"score":{"name":"#dbg_logs","objective":"timber_test"}},{"text":", leaves "},{"score":{"name":"#dbg_leaves","objective":"timber_test"}},{"text":" (distance=7: "},{"score":{"name":"#dbg_d7","objective":"timber_test"}},{"text":"), mangrove roots "},{"score":{"name":"#dbg_roots","objective":"timber_test"}}] diff --git a/tests/data/timber_test/function/env/axes_off_setup.mcfunction b/tests/data/timber_test/function/env/axes_off_setup.mcfunction new file mode 100644 index 0000000..eb8ec2e --- /dev/null +++ b/tests/data/timber_test/function/env/axes_off_setup.mcfunction @@ -0,0 +1,9 @@ +#> Settings for the tests of this environment. The environments run as batches one after the other, so +#> a global setting can't disturb another test. The teardown puts the defaults back. +scoreboard players set wooden_axe timber 0 +scoreboard players set stone_axe timber 0 +scoreboard players set copper_axe timber 0 +scoreboard players set iron_axe timber 0 +scoreboard players set golden_axe timber 0 +scoreboard players set diamond_axe timber 0 +scoreboard players set netherite_axe timber 0 diff --git a/tests/data/timber_test/function/env/axes_off_teardown.mcfunction b/tests/data/timber_test/function/env/axes_off_teardown.mcfunction new file mode 100644 index 0000000..885a94d --- /dev/null +++ b/tests/data/timber_test/function/env/axes_off_teardown.mcfunction @@ -0,0 +1,8 @@ +#> Back to the defaults +scoreboard players set wooden_axe timber 1 +scoreboard players set stone_axe timber 1 +scoreboard players set copper_axe timber 1 +scoreboard players set iron_axe timber 1 +scoreboard players set golden_axe timber 1 +scoreboard players set diamond_axe timber 1 +scoreboard players set netherite_axe timber 1 diff --git a/tests/data/timber_test/function/env/chop_down_on_setup.mcfunction b/tests/data/timber_test/function/env/chop_down_on_setup.mcfunction new file mode 100644 index 0000000..c62b641 --- /dev/null +++ b/tests/data/timber_test/function/env/chop_down_on_setup.mcfunction @@ -0,0 +1,3 @@ +#> Settings for the tests of this environment. The environments run as batches one after the other, so +#> a global setting can't disturb another test. The teardown puts the defaults back. +scoreboard players set chop_down timber 1 diff --git a/tests/data/timber_test/function/env/chop_down_on_teardown.mcfunction b/tests/data/timber_test/function/env/chop_down_on_teardown.mcfunction new file mode 100644 index 0000000..84dec0d --- /dev/null +++ b/tests/data/timber_test/function/env/chop_down_on_teardown.mcfunction @@ -0,0 +1,2 @@ +#> Back to the defaults +scoreboard players set chop_down timber 0 diff --git a/tests/data/timber_test/function/env/chop_fungi_on_setup.mcfunction b/tests/data/timber_test/function/env/chop_fungi_on_setup.mcfunction new file mode 100644 index 0000000..c8aadb4 --- /dev/null +++ b/tests/data/timber_test/function/env/chop_fungi_on_setup.mcfunction @@ -0,0 +1,2 @@ +#> chop_fungi is off by default, the fungus tests need it on +scoreboard players set chop_fungi timber 1 diff --git a/tests/data/timber_test/function/env/chop_fungi_on_teardown.mcfunction b/tests/data/timber_test/function/env/chop_fungi_on_teardown.mcfunction new file mode 100644 index 0000000..341c62b --- /dev/null +++ b/tests/data/timber_test/function/env/chop_fungi_on_teardown.mcfunction @@ -0,0 +1,2 @@ +#> Back to the default of chop_fungi +scoreboard players set chop_fungi timber 0 diff --git a/tests/data/timber_test/function/env/chop_trees_off_setup.mcfunction b/tests/data/timber_test/function/env/chop_trees_off_setup.mcfunction new file mode 100644 index 0000000..dcc626a --- /dev/null +++ b/tests/data/timber_test/function/env/chop_trees_off_setup.mcfunction @@ -0,0 +1,3 @@ +#> Settings for the tests of this environment. The environments run as batches one after the other, so +#> a global setting can't disturb another test. The teardown puts the defaults back. +scoreboard players set chop_trees timber 0 diff --git a/tests/data/timber_test/function/env/chop_trees_off_teardown.mcfunction b/tests/data/timber_test/function/env/chop_trees_off_teardown.mcfunction new file mode 100644 index 0000000..1f8c5ef --- /dev/null +++ b/tests/data/timber_test/function/env/chop_trees_off_teardown.mcfunction @@ -0,0 +1,2 @@ +#> Back to the defaults +scoreboard players set chop_trees timber 1 diff --git a/tests/data/timber_test/function/env/destroy_roots_off_setup.mcfunction b/tests/data/timber_test/function/env/destroy_roots_off_setup.mcfunction new file mode 100644 index 0000000..68cba02 --- /dev/null +++ b/tests/data/timber_test/function/env/destroy_roots_off_setup.mcfunction @@ -0,0 +1,2 @@ +#> Setting for the tests of this environment +scoreboard players set destroy_roots timber 0 diff --git a/tests/data/timber_test/function/env/destroy_roots_off_teardown.mcfunction b/tests/data/timber_test/function/env/destroy_roots_off_teardown.mcfunction new file mode 100644 index 0000000..7281b80 --- /dev/null +++ b/tests/data/timber_test/function/env/destroy_roots_off_teardown.mcfunction @@ -0,0 +1,2 @@ +#> Back to the default +scoreboard players set destroy_roots timber 1 diff --git a/tests/data/timber_test/function/env/drop_loot_on_setup.mcfunction b/tests/data/timber_test/function/env/drop_loot_on_setup.mcfunction new file mode 100644 index 0000000..6294289 --- /dev/null +++ b/tests/data/timber_test/function/env/drop_loot_on_setup.mcfunction @@ -0,0 +1,2 @@ +#> Setting for the tests of this environment (a loop that a setting flip starts in a real world is started here) +scoreboard players set drop_loot timber 1 diff --git a/tests/data/timber_test/function/env/drop_loot_on_teardown.mcfunction b/tests/data/timber_test/function/env/drop_loot_on_teardown.mcfunction new file mode 100644 index 0000000..45f14ac --- /dev/null +++ b/tests/data/timber_test/function/env/drop_loot_on_teardown.mcfunction @@ -0,0 +1,2 @@ +#> Back to the default +scoreboard players set drop_loot timber 0 diff --git a/tests/data/timber_test/function/env/flip_admin_setup.mcfunction b/tests/data/timber_test/function/env/flip_admin_setup.mcfunction new file mode 100644 index 0000000..9194352 --- /dev/null +++ b/tests/data/timber_test/function/env/flip_admin_setup.mcfunction @@ -0,0 +1 @@ +#> Nothing to set, the test changes the settings itself. This environment only keeps it apart from the others. diff --git a/tests/data/timber_test/function/env/flip_admin_teardown.mcfunction b/tests/data/timber_test/function/env/flip_admin_teardown.mcfunction new file mode 100644 index 0000000..5a6d3b1 --- /dev/null +++ b/tests/data/timber_test/function/env/flip_admin_teardown.mcfunction @@ -0,0 +1,2 @@ +#> The test flips settings, put them all back +function timber_test:env/restore_all_defaults diff --git a/tests/data/timber_test/function/env/flip_guards_setup.mcfunction b/tests/data/timber_test/function/env/flip_guards_setup.mcfunction new file mode 100644 index 0000000..9194352 --- /dev/null +++ b/tests/data/timber_test/function/env/flip_guards_setup.mcfunction @@ -0,0 +1 @@ +#> Nothing to set, the test changes the settings itself. This environment only keeps it apart from the others. diff --git a/tests/data/timber_test/function/env/flip_guards_teardown.mcfunction b/tests/data/timber_test/function/env/flip_guards_teardown.mcfunction new file mode 100644 index 0000000..5a6d3b1 --- /dev/null +++ b/tests/data/timber_test/function/env/flip_guards_teardown.mcfunction @@ -0,0 +1,2 @@ +#> The test flips settings, put them all back +function timber_test:env/restore_all_defaults diff --git a/tests/data/timber_test/function/env/flip_sliders_setup.mcfunction b/tests/data/timber_test/function/env/flip_sliders_setup.mcfunction new file mode 100644 index 0000000..9194352 --- /dev/null +++ b/tests/data/timber_test/function/env/flip_sliders_setup.mcfunction @@ -0,0 +1 @@ +#> Nothing to set, the test changes the settings itself. This environment only keeps it apart from the others. diff --git a/tests/data/timber_test/function/env/flip_sliders_teardown.mcfunction b/tests/data/timber_test/function/env/flip_sliders_teardown.mcfunction new file mode 100644 index 0000000..5a6d3b1 --- /dev/null +++ b/tests/data/timber_test/function/env/flip_sliders_teardown.mcfunction @@ -0,0 +1,2 @@ +#> The test flips settings, put them all back +function timber_test:env/restore_all_defaults diff --git a/tests/data/timber_test/function/env/flip_toggles_setup.mcfunction b/tests/data/timber_test/function/env/flip_toggles_setup.mcfunction new file mode 100644 index 0000000..9194352 --- /dev/null +++ b/tests/data/timber_test/function/env/flip_toggles_setup.mcfunction @@ -0,0 +1 @@ +#> Nothing to set, the test changes the settings itself. This environment only keeps it apart from the others. diff --git a/tests/data/timber_test/function/env/flip_toggles_teardown.mcfunction b/tests/data/timber_test/function/env/flip_toggles_teardown.mcfunction new file mode 100644 index 0000000..5a6d3b1 --- /dev/null +++ b/tests/data/timber_test/function/env/flip_toggles_teardown.mcfunction @@ -0,0 +1,2 @@ +#> The test flips settings, put them all back +function timber_test:env/restore_all_defaults diff --git a/tests/data/timber_test/function/env/group_setup.mcfunction b/tests/data/timber_test/function/env/group_setup.mcfunction new file mode 100644 index 0000000..ee15eeb --- /dev/null +++ b/tests/data/timber_test/function/env/group_setup.mcfunction @@ -0,0 +1,2 @@ +#> The group environments only split the tests into batches. Dozens of chops in the same tick were too much for the datapack, +#> a big tree now and then kept a few leaves. A batch has a fifth of the tests, nothing to set up. diff --git a/tests/data/timber_test/function/env/group_teardown.mcfunction b/tests/data/timber_test/function/env/group_teardown.mcfunction new file mode 100644 index 0000000..344d6c4 --- /dev/null +++ b/tests/data/timber_test/function/env/group_teardown.mcfunction @@ -0,0 +1 @@ +#> Nothing to put back diff --git a/tests/data/timber_test/function/env/hunger_on_setup.mcfunction b/tests/data/timber_test/function/env/hunger_on_setup.mcfunction new file mode 100644 index 0000000..75a753a --- /dev/null +++ b/tests/data/timber_test/function/env/hunger_on_setup.mcfunction @@ -0,0 +1,3 @@ +#> Settings for the tests of this environment. The environments run as batches one after the other, so +#> a global setting can't disturb another test. The teardown puts the defaults back. +scoreboard players set hunger timber 1 diff --git a/tests/data/timber_test/function/env/hunger_on_teardown.mcfunction b/tests/data/timber_test/function/env/hunger_on_teardown.mcfunction new file mode 100644 index 0000000..29bf0df --- /dev/null +++ b/tests/data/timber_test/function/env/hunger_on_teardown.mcfunction @@ -0,0 +1,2 @@ +#> Back to the defaults +scoreboard players set hunger timber 0 diff --git a/tests/data/timber_test/function/env/min_leaves_13_setup.mcfunction b/tests/data/timber_test/function/env/min_leaves_13_setup.mcfunction new file mode 100644 index 0000000..476d3d0 --- /dev/null +++ b/tests/data/timber_test/function/env/min_leaves_13_setup.mcfunction @@ -0,0 +1,3 @@ +#> Settings for the tests of this environment. The environments run as batches one after the other, so +#> a global setting can't disturb another test. The teardown puts the defaults back. +scoreboard players set min_leaves_found timber 13 diff --git a/tests/data/timber_test/function/env/min_leaves_13_teardown.mcfunction b/tests/data/timber_test/function/env/min_leaves_13_teardown.mcfunction new file mode 100644 index 0000000..8a0c084 --- /dev/null +++ b/tests/data/timber_test/function/env/min_leaves_13_teardown.mcfunction @@ -0,0 +1,2 @@ +#> Back to the defaults +scoreboard players set min_leaves_found timber 5 diff --git a/tests/data/timber_test/function/env/min_leaves_14_setup.mcfunction b/tests/data/timber_test/function/env/min_leaves_14_setup.mcfunction new file mode 100644 index 0000000..44a62b8 --- /dev/null +++ b/tests/data/timber_test/function/env/min_leaves_14_setup.mcfunction @@ -0,0 +1,3 @@ +#> Settings for the tests of this environment. The environments run as batches one after the other, so +#> a global setting can't disturb another test. The teardown puts the defaults back. +scoreboard players set min_leaves_found timber 14 diff --git a/tests/data/timber_test/function/env/min_leaves_14_teardown.mcfunction b/tests/data/timber_test/function/env/min_leaves_14_teardown.mcfunction new file mode 100644 index 0000000..8a0c084 --- /dev/null +++ b/tests/data/timber_test/function/env/min_leaves_14_teardown.mcfunction @@ -0,0 +1,2 @@ +#> Back to the defaults +scoreboard players set min_leaves_found timber 5 diff --git a/tests/data/timber_test/function/env/no_destroy_leaves_setup.mcfunction b/tests/data/timber_test/function/env/no_destroy_leaves_setup.mcfunction new file mode 100644 index 0000000..1a7129c --- /dev/null +++ b/tests/data/timber_test/function/env/no_destroy_leaves_setup.mcfunction @@ -0,0 +1,3 @@ +#> Settings for the tests of this environment. The environments run as batches one after the other, so +#> a global setting can't disturb another test. The teardown puts the defaults back. +scoreboard players set destroy_leaves timber 0 diff --git a/tests/data/timber_test/function/env/no_destroy_leaves_teardown.mcfunction b/tests/data/timber_test/function/env/no_destroy_leaves_teardown.mcfunction new file mode 100644 index 0000000..3a7454f --- /dev/null +++ b/tests/data/timber_test/function/env/no_destroy_leaves_teardown.mcfunction @@ -0,0 +1,2 @@ +#> Back to the defaults +scoreboard players set destroy_leaves timber 1 diff --git a/tests/data/timber_test/function/env/persistent_on_setup.mcfunction b/tests/data/timber_test/function/env/persistent_on_setup.mcfunction new file mode 100644 index 0000000..5cf4a9a --- /dev/null +++ b/tests/data/timber_test/function/env/persistent_on_setup.mcfunction @@ -0,0 +1,3 @@ +#> Settings for the tests of this environment. The environments run as batches one after the other, so +#> a global setting can't disturb another test. The teardown puts the defaults back. +scoreboard players set persistent timber 1 diff --git a/tests/data/timber_test/function/env/persistent_on_teardown.mcfunction b/tests/data/timber_test/function/env/persistent_on_teardown.mcfunction new file mode 100644 index 0000000..117c091 --- /dev/null +++ b/tests/data/timber_test/function/env/persistent_on_teardown.mcfunction @@ -0,0 +1,2 @@ +#> Back to the defaults +scoreboard players set persistent timber 0 diff --git a/tests/data/timber_test/function/env/plant_sapling_on_setup.mcfunction b/tests/data/timber_test/function/env/plant_sapling_on_setup.mcfunction new file mode 100644 index 0000000..910eb41 --- /dev/null +++ b/tests/data/timber_test/function/env/plant_sapling_on_setup.mcfunction @@ -0,0 +1,3 @@ +#> Setting for the tests of this environment (a loop that a setting flip starts in a real world is started here) +scoreboard players set plant_sapling timber 1 +function timber:autoplant/loop diff --git a/tests/data/timber_test/function/env/plant_sapling_on_teardown.mcfunction b/tests/data/timber_test/function/env/plant_sapling_on_teardown.mcfunction new file mode 100644 index 0000000..1ec28ef --- /dev/null +++ b/tests/data/timber_test/function/env/plant_sapling_on_teardown.mcfunction @@ -0,0 +1,4 @@ +#> Back to the default +scoreboard players set plant_sapling timber 0 +# the loop schedules itself: the round that is still scheduled would run in the next batch +schedule clear timber:autoplant/loop diff --git a/tests/data/timber_test/function/env/restore_all_defaults.mcfunction b/tests/data/timber_test/function/env/restore_all_defaults.mcfunction new file mode 100644 index 0000000..c5acfcb --- /dev/null +++ b/tests/data/timber_test/function/env/restore_all_defaults.mcfunction @@ -0,0 +1,30 @@ +#> Puts every setting back to its default, and clears the loops that a setting flip may have scheduled (they would run in the next batch) +scoreboard players set standing timber 1 +scoreboard players set sneaking timber 0 +scoreboard players set destroy_leaves timber 1 +scoreboard players set plant_sapling timber 0 +scoreboard players set destroy_roots timber 1 +scoreboard players set start_chop_on_root timber 1 +scoreboard players set slow_chop timber 0 +scoreboard players set chop_down timber 0 +scoreboard players set stop_chopping timber 0 +scoreboard players set wear_out timber 1 +scoreboard players set drop_loot timber 0 +scoreboard players set hunger timber 0 +scoreboard players set stopsound timber 0 +scoreboard players set wooden_axe timber 1 +scoreboard players set stone_axe timber 1 +scoreboard players set copper_axe timber 1 +scoreboard players set iron_axe timber 1 +scoreboard players set golden_axe timber 1 +scoreboard players set diamond_axe timber 1 +scoreboard players set netherite_axe timber 1 +scoreboard players set chop_trees timber 1 +scoreboard players set chop_fungi timber 0 +scoreboard players set persistent timber 0 +scoreboard players set blocks_per_chop timber 1 +scoreboard players set time_between_chops timber 1 +scoreboard players set max_tree_size timber 555 +scoreboard players set min_leaves_found timber 5 +schedule clear timber:slow_chop/loop +schedule clear timber:autoplant/loop diff --git a/tests/data/timber_test/function/env/slow_chop_batch_setup.mcfunction b/tests/data/timber_test/function/env/slow_chop_batch_setup.mcfunction new file mode 100644 index 0000000..f1b8e38 --- /dev/null +++ b/tests/data/timber_test/function/env/slow_chop_batch_setup.mcfunction @@ -0,0 +1,4 @@ +#> Slow chop on. The loop that does the work is started by the setting flip or by init in a real world, so start it here. +scoreboard players set slow_chop timber 1 +scoreboard players set blocks_per_chop timber 20 +function timber:slow_chop/loop diff --git a/tests/data/timber_test/function/env/slow_chop_batch_teardown.mcfunction b/tests/data/timber_test/function/env/slow_chop_batch_teardown.mcfunction new file mode 100644 index 0000000..6c8b41b --- /dev/null +++ b/tests/data/timber_test/function/env/slow_chop_batch_teardown.mcfunction @@ -0,0 +1,3 @@ +#> Back to the defaults, the loop stops itself when slow_chop is off +scoreboard players set slow_chop timber 0 +scoreboard players set blocks_per_chop timber 1 diff --git a/tests/data/timber_test/function/env/slow_chop_interval_setup.mcfunction b/tests/data/timber_test/function/env/slow_chop_interval_setup.mcfunction new file mode 100644 index 0000000..019d931 --- /dev/null +++ b/tests/data/timber_test/function/env/slow_chop_interval_setup.mcfunction @@ -0,0 +1,4 @@ +#> Slow chop on. The loop that does the work is started by the setting flip or by init in a real world, so start it here. +scoreboard players set slow_chop timber 1 +scoreboard players set time_between_chops timber 10 +function timber:slow_chop/loop diff --git a/tests/data/timber_test/function/env/slow_chop_interval_teardown.mcfunction b/tests/data/timber_test/function/env/slow_chop_interval_teardown.mcfunction new file mode 100644 index 0000000..28d86ba --- /dev/null +++ b/tests/data/timber_test/function/env/slow_chop_interval_teardown.mcfunction @@ -0,0 +1,3 @@ +#> Back to the defaults, the loop stops itself when slow_chop is off +scoreboard players set slow_chop timber 0 +scoreboard players set time_between_chops timber 1 diff --git a/tests/data/timber_test/function/env/slow_chop_on_setup.mcfunction b/tests/data/timber_test/function/env/slow_chop_on_setup.mcfunction new file mode 100644 index 0000000..5314136 --- /dev/null +++ b/tests/data/timber_test/function/env/slow_chop_on_setup.mcfunction @@ -0,0 +1,3 @@ +#> Slow chop on. The loop that does the work is started by the setting flip or by init in a real world, so start it here. +scoreboard players set slow_chop timber 1 +function timber:slow_chop/loop diff --git a/tests/data/timber_test/function/env/slow_chop_on_teardown.mcfunction b/tests/data/timber_test/function/env/slow_chop_on_teardown.mcfunction new file mode 100644 index 0000000..981521e --- /dev/null +++ b/tests/data/timber_test/function/env/slow_chop_on_teardown.mcfunction @@ -0,0 +1,2 @@ +#> Back to the defaults, the loop stops itself when slow_chop is off +scoreboard players set slow_chop timber 0 diff --git a/tests/data/timber_test/function/env/sneak_only_setup.mcfunction b/tests/data/timber_test/function/env/sneak_only_setup.mcfunction new file mode 100644 index 0000000..35ba1b6 --- /dev/null +++ b/tests/data/timber_test/function/env/sneak_only_setup.mcfunction @@ -0,0 +1,4 @@ +#> Settings for the tests of this environment. The environments run as batches one after the other, so +#> a global setting can't disturb another test. The teardown puts the defaults back. +scoreboard players set standing timber 0 +scoreboard players set sneaking timber 1 diff --git a/tests/data/timber_test/function/env/sneak_only_teardown.mcfunction b/tests/data/timber_test/function/env/sneak_only_teardown.mcfunction new file mode 100644 index 0000000..35fb56b --- /dev/null +++ b/tests/data/timber_test/function/env/sneak_only_teardown.mcfunction @@ -0,0 +1,3 @@ +#> Back to the defaults +scoreboard players set standing timber 1 +scoreboard players set sneaking timber 0 diff --git a/tests/data/timber_test/function/env/start_chop_on_root_off_setup.mcfunction b/tests/data/timber_test/function/env/start_chop_on_root_off_setup.mcfunction new file mode 100644 index 0000000..3a95993 --- /dev/null +++ b/tests/data/timber_test/function/env/start_chop_on_root_off_setup.mcfunction @@ -0,0 +1,2 @@ +#> Setting for the tests of this environment +scoreboard players set start_chop_on_root timber 0 diff --git a/tests/data/timber_test/function/env/start_chop_on_root_off_teardown.mcfunction b/tests/data/timber_test/function/env/start_chop_on_root_off_teardown.mcfunction new file mode 100644 index 0000000..829bbce --- /dev/null +++ b/tests/data/timber_test/function/env/start_chop_on_root_off_teardown.mcfunction @@ -0,0 +1,2 @@ +#> Back to the default +scoreboard players set start_chop_on_root timber 1 diff --git a/tests/data/timber_test/function/env/stop_chopping_on_setup.mcfunction b/tests/data/timber_test/function/env/stop_chopping_on_setup.mcfunction new file mode 100644 index 0000000..e153f67 --- /dev/null +++ b/tests/data/timber_test/function/env/stop_chopping_on_setup.mcfunction @@ -0,0 +1,2 @@ +#> Setting for the tests of this environment (a loop that a setting flip starts in a real world is started here) +scoreboard players set stop_chopping timber 1 diff --git a/tests/data/timber_test/function/env/stop_chopping_on_teardown.mcfunction b/tests/data/timber_test/function/env/stop_chopping_on_teardown.mcfunction new file mode 100644 index 0000000..29843cd --- /dev/null +++ b/tests/data/timber_test/function/env/stop_chopping_on_teardown.mcfunction @@ -0,0 +1,2 @@ +#> Back to the default +scoreboard players set stop_chopping timber 0 diff --git a/tests/data/timber_test/function/env/tiny_tree_size_setup.mcfunction b/tests/data/timber_test/function/env/tiny_tree_size_setup.mcfunction new file mode 100644 index 0000000..54fed10 --- /dev/null +++ b/tests/data/timber_test/function/env/tiny_tree_size_setup.mcfunction @@ -0,0 +1,3 @@ +#> Settings for the tests of this environment. The environments run as batches one after the other, so +#> a global setting can't disturb another test. The teardown puts the defaults back. +scoreboard players set max_tree_size timber 3 diff --git a/tests/data/timber_test/function/env/tiny_tree_size_teardown.mcfunction b/tests/data/timber_test/function/env/tiny_tree_size_teardown.mcfunction new file mode 100644 index 0000000..1c28979 --- /dev/null +++ b/tests/data/timber_test/function/env/tiny_tree_size_teardown.mcfunction @@ -0,0 +1,2 @@ +#> Back to the defaults +scoreboard players set max_tree_size timber 555 diff --git a/tests/data/timber_test/function/env/uninstall_setup.mcfunction b/tests/data/timber_test/function/env/uninstall_setup.mcfunction new file mode 100644 index 0000000..d03468e --- /dev/null +++ b/tests/data/timber_test/function/env/uninstall_setup.mcfunction @@ -0,0 +1 @@ +#> Nothing to set up, the test uninstalls the datapack itself. The environment keeps it apart from the other tests. diff --git a/tests/data/timber_test/function/env/uninstall_teardown.mcfunction b/tests/data/timber_test/function/env/uninstall_teardown.mcfunction new file mode 100644 index 0000000..2d69a80 --- /dev/null +++ b/tests/data/timber_test/function/env/uninstall_teardown.mcfunction @@ -0,0 +1,3 @@ +#> The test uninstalled the datapack: bring it back the way a reload does (load.json runs init and main), the other tests need it +function timber:init +function timber:main diff --git a/tests/data/timber_test/function/env/wear_out_off_setup.mcfunction b/tests/data/timber_test/function/env/wear_out_off_setup.mcfunction new file mode 100644 index 0000000..b521a1d --- /dev/null +++ b/tests/data/timber_test/function/env/wear_out_off_setup.mcfunction @@ -0,0 +1,3 @@ +#> Settings for the tests of this environment. The environments run as batches one after the other, so +#> a global setting can't disturb another test. The teardown puts the defaults back. +scoreboard players set wear_out timber 0 diff --git a/tests/data/timber_test/function/env/wear_out_off_teardown.mcfunction b/tests/data/timber_test/function/env/wear_out_off_teardown.mcfunction new file mode 100644 index 0000000..6b974cd --- /dev/null +++ b/tests/data/timber_test/function/env/wear_out_off_teardown.mcfunction @@ -0,0 +1,2 @@ +#> Back to the defaults +scoreboard players set wear_out timber 1 diff --git a/tests/data/timber_test/function/find_lowest_log.mcfunction b/tests/data/timber_test/function/find_lowest_log.mcfunction new file mode 100644 index 0000000..b1082b2 --- /dev/null +++ b/tests/data/timber_test/function/find_lowest_log.mcfunction @@ -0,0 +1,10 @@ +#> Finds the lowest log of the whole tree, not the lowest one in the middle column: mangroves lean, their trunk doesn't start above the +#> place where the tree was generated. Mining a log further up chops upwards only (chop_down is off), the logs below would stay. +#> (The marker sits in the middle of the block: a marker on the lower edge of the selector box isn't counted as inside.) +#> A marker with the tag tb_scan walks through the arena from the bottom (the whole 40x40 arena, y 0 to 39), scan_step stops on the first log. +#> The marker stays on that log, mine_here uses it. Kill it afterwards, it would keep the marker check at the end of the test from finishing. +scoreboard players set #sx timber_test 0 +scoreboard players set #sy timber_test 0 +scoreboard players set #sz timber_test 0 +summon minecraft:marker ~0.5 ~0.5 ~0.5 {Tags:["tb_scan"]} +execute as @e[type=minecraft:marker,tag=tb_scan,dx=39,dy=39,dz=39] at @s store result score #found timber_test run function timber_test:scan_step diff --git a/tests/data/timber_test/function/load.mcfunction b/tests/data/timber_test/function/load.mcfunction new file mode 100644 index 0000000..0b279e7 --- /dev/null +++ b/tests/data/timber_test/function/load.mcfunction @@ -0,0 +1,6 @@ +#> Runs when the tests are loaded. +#> The tests run in parallel, dozens of dummies chop in the same tick. Every chop forks its commands with execute at @e[...], +#> and Minecraft limits the forks per command chain (max_command_forks, default 65536). Without this, one in about 10 suite runs +#> left a few leaves of a tree standing (0 in 30 runs with it). One player chopping at a time in a real world does not get near the limit: +#> the biggest trees of the tests (500 blocks) pass with the default when they run alone. +gamerule minecraft:max_command_forks 1000000000 diff --git a/tests/data/timber_test/function/mine.mcfunction b/tests/data/timber_test/function/mine.mcfunction new file mode 100644 index 0000000..8c3d36a --- /dev/null +++ b/tests/data/timber_test/function/mine.mcfunction @@ -0,0 +1,3 @@ +#> The dummy mines the block at the tree base (~20 ~ ~20) +#> @param name dummy name +$dummy $(name) mine ~20 ~ ~20 diff --git a/tests/data/timber_test/function/mine_here.mcfunction b/tests/data/timber_test/function/mine_here.mcfunction new file mode 100644 index 0000000..9b12c63 --- /dev/null +++ b/tests/data/timber_test/function/mine_here.mcfunction @@ -0,0 +1,15 @@ +#> Run as and at the tb_scan marker standing on the log to mine: puts the dummy next to that log and lets it mine it. +#> The datapack looks for the dropped item within 7 blocks of the player, a dummy standing on the ground is too far away from a log +#> high up. The dummy floats (gravity 0) on a free side of the log, the first of +x, -x, +z, -z that is air. +#> @param name dummy name +$attribute @e[type=minecraft:player,name=$(name),limit=1] minecraft:gravity base set 0 +scoreboard players set #placed timber_test 0 +$execute unless score #placed timber_test matches 1 if block ~1 ~ ~ minecraft:air run tp @e[type=minecraft:player,name=$(name),limit=1] ~1 ~-0.5 ~ +execute unless score #placed timber_test matches 1 if block ~1 ~ ~ minecraft:air run scoreboard players set #placed timber_test 1 +$execute unless score #placed timber_test matches 1 if block ~-1 ~ ~ minecraft:air run tp @e[type=minecraft:player,name=$(name),limit=1] ~-1 ~-0.5 ~ +execute unless score #placed timber_test matches 1 if block ~-1 ~ ~ minecraft:air run scoreboard players set #placed timber_test 1 +$execute unless score #placed timber_test matches 1 if block ~ ~ ~1 minecraft:air run tp @e[type=minecraft:player,name=$(name),limit=1] ~ ~-0.5 ~1 +execute unless score #placed timber_test matches 1 if block ~ ~ ~1 minecraft:air run scoreboard players set #placed timber_test 1 +$execute unless score #placed timber_test matches 1 if block ~ ~ ~-1 minecraft:air run tp @e[type=minecraft:player,name=$(name),limit=1] ~ ~-0.5 ~-1 +execute unless score #placed timber_test matches 1 if block ~ ~ ~-1 minecraft:air run scoreboard players set #placed timber_test 1 +$dummy $(name) mine ~ ~ ~ diff --git a/tests/data/timber_test/function/platform.mcfunction b/tests/data/timber_test/function/platform.mcfunction new file mode 100644 index 0000000..9695489 --- /dev/null +++ b/tests/data/timber_test/function/platform.mcfunction @@ -0,0 +1,2 @@ +#> Flat dirt platform for a test, relative to the test origin (the arena template is 40x40x40) +fill ~ ~-1 ~ ~39 ~-1 ~39 minecraft:dirt diff --git a/tests/data/timber_test/function/player.mcfunction b/tests/data/timber_test/function/player.mcfunction new file mode 100644 index 0000000..e2b7312 --- /dev/null +++ b/tests/data/timber_test/function/player.mcfunction @@ -0,0 +1,10 @@ +#> Spawns a dummy player next to the tree base at ~20 ~ ~20 and gives them an axe +#> Every test needs its own dummy name, tests run in parallel. Player names have at most 16 characters, longer ones silently fail to spawn. +#> @param name dummy name, unique per test +#> @param axe item id, e.g. "minecraft:iron_axe" +$dummy $(name) spawn +$tag @e[type=minecraft:player,name=$(name),limit=1] add timber_test_dummy +$tp @e[type=minecraft:player,name=$(name),limit=1] ~19.5 ~ ~20.5 +$item replace entity @e[type=minecraft:player,name=$(name),limit=1] weapon.mainhand with $(axe) +#> A tall mangrove trunk starts higher than the default reach of 4.5 blocks +$attribute @e[type=minecraft:player,name=$(name),limit=1] minecraft:block_interaction_range base set 30 diff --git a/tests/data/timber_test/function/report_leftovers.mcfunction b/tests/data/timber_test/function/report_leftovers.mcfunction new file mode 100644 index 0000000..d7bc94b --- /dev/null +++ b/tests/data/timber_test/function/report_leftovers.mcfunction @@ -0,0 +1,41 @@ +#> Like assert_no_tree, but nothing fails: leftovers, and a tree that wasn't chopped at all, only warn. +#> For chops that start at a mangrove log. The datapack searches upwards and sideways from the mined log, downwards only with chop_down, +#> so a branch that bends down again can stay, and if the logs it reaches touch fewer than min_leaves_found leaves it chops nothing at all. +#> That is a gap (the goal is to chop every tree), it is reported, not failed. Nothing can be asserted here that always holds. +#> Replaces logs and leaves with air while counting, so run it last. Two slabs, a command may only touch 32768 blocks. +#> @param test name of the test, count_d7 and count_logs have to be called with the same name +scoreboard objectives add timber_test dummy +execute store result score #d7_after timber_test run clone ~0 ~0 ~0 ~39 ~19 ~39 ~0 ~64 ~0 filtered #minecraft:leaves[distance=7] +execute store result score #dtmp timber_test run clone ~0 ~20 ~0 ~39 ~39 ~39 ~0 ~64 ~0 filtered #minecraft:leaves[distance=7] +scoreboard players operation #d7_after timber_test += #dtmp timber_test +fill ~0 ~64 ~0 ~39 ~83 ~39 minecraft:air +fill ~0 ~0 ~0 ~39 ~19 ~39 minecraft:air replace #minecraft:leaves[distance=7] +fill ~0 ~20 ~0 ~39 ~39 ~39 minecraft:air replace #minecraft:leaves[distance=7] +execute store result score #logs timber_test run fill ~0 ~0 ~0 ~39 ~19 ~39 minecraft:air replace #minecraft:logs +execute store result score #dtmp timber_test run fill ~0 ~20 ~0 ~39 ~39 ~39 minecraft:air replace #minecraft:logs +scoreboard players operation #logs timber_test += #dtmp timber_test +execute store result score #leaves timber_test run fill ~0 ~0 ~0 ~39 ~19 ~39 minecraft:air replace #minecraft:leaves +execute store result score #dtmp timber_test run fill ~0 ~20 ~0 ~39 ~39 ~39 minecraft:air replace #minecraft:leaves +scoreboard players operation #leaves timber_test += #dtmp timber_test + +execute store result score #roots timber_test run fill ~0 ~0 ~0 ~39 ~19 ~39 minecraft:air replace minecraft:mangrove_roots +execute store result score #dtmp timber_test run fill ~0 ~20 ~0 ~39 ~39 ~39 minecraft:air replace minecraft:mangrove_roots +scoreboard players operation #roots timber_test += #dtmp timber_test +execute store result score #dtmp timber_test run fill ~0 ~0 ~0 ~39 ~19 ~39 minecraft:air replace minecraft:muddy_mangrove_roots +scoreboard players operation #roots timber_test += #dtmp timber_test +execute store result score #dtmp timber_test run fill ~0 ~20 ~0 ~39 ~39 ~39 minecraft:air replace minecraft:muddy_mangrove_roots +scoreboard players operation #roots timber_test += #dtmp timber_test + +# warnings +$data modify storage timber_test:tmp test set value "$(test)" +$execute store result storage timber_test:tmp before int 1 run scoreboard players get #d7_$(test) timber_test +execute store result storage timber_test:tmp after int 1 run scoreboard players get #d7_after timber_test +execute if score #d7_after timber_test matches 1.. run function timber_test:warn_d7 with storage timber_test:tmp +$execute store result storage timber_test:tmp total int 1 run scoreboard players get #logs0_$(test) timber_test +execute store result storage timber_test:tmp logs int 1 run scoreboard players get #logs timber_test +execute store result storage timber_test:tmp leaves int 1 run scoreboard players get #leaves timber_test +execute store result storage timber_test:tmp roots int 1 run scoreboard players get #roots timber_test +scoreboard players operation #left timber_test = #logs timber_test +scoreboard players operation #left timber_test += #leaves timber_test +scoreboard players operation #left timber_test += #roots timber_test +execute unless score #left timber_test matches 0 run function timber_test:warn_left with storage timber_test:tmp diff --git a/tests/data/timber_test/function/scan_next_x.mcfunction b/tests/data/timber_test/function/scan_next_x.mcfunction new file mode 100644 index 0000000..4b0e88b --- /dev/null +++ b/tests/data/timber_test/function/scan_next_x.mcfunction @@ -0,0 +1,4 @@ +scoreboard players add #sx timber_test 1 +tp @s ~1 ~ ~ +# after the tp the position of this execution is still the old one, take the new one +return run execute at @s run function timber_test:scan_step diff --git a/tests/data/timber_test/function/scan_next_y.mcfunction b/tests/data/timber_test/function/scan_next_y.mcfunction new file mode 100644 index 0000000..a3fbe2e --- /dev/null +++ b/tests/data/timber_test/function/scan_next_y.mcfunction @@ -0,0 +1,6 @@ +scoreboard players set #sx timber_test 0 +scoreboard players set #sz timber_test 0 +scoreboard players add #sy timber_test 1 +tp @s ~-39 ~1 ~-39 +# after the tp the position of this execution is still the old one, take the new one +return run execute at @s run function timber_test:scan_step diff --git a/tests/data/timber_test/function/scan_next_z.mcfunction b/tests/data/timber_test/function/scan_next_z.mcfunction new file mode 100644 index 0000000..ab6d0aa --- /dev/null +++ b/tests/data/timber_test/function/scan_next_z.mcfunction @@ -0,0 +1,5 @@ +scoreboard players set #sx timber_test 0 +scoreboard players add #sz timber_test 1 +tp @s ~-39 ~ ~1 +# after the tp the position of this execution is still the old one, take the new one +return run execute at @s run function timber_test:scan_step diff --git a/tests/data/timber_test/function/scan_step.mcfunction b/tests/data/timber_test/function/scan_step.mcfunction new file mode 100644 index 0000000..4ee2e1d --- /dev/null +++ b/tests/data/timber_test/function/scan_step.mcfunction @@ -0,0 +1,7 @@ +#> Looks at the block under the scanner, moves on if it is no log. Returns 1 if a log was found, 0 if the whole area was searched. +#> return run function is a tail call, the walk through up to 64000 blocks (it stops at the first log, that is after a few layers) doesn't pile up nested calls. +execute if block ~ ~ ~ #minecraft:logs run return 1 +execute if score #sx timber_test matches ..38 run return run function timber_test:scan_next_x +execute if score #sz timber_test matches ..38 run return run function timber_test:scan_next_z +execute if score #sy timber_test matches ..38 run return run function timber_test:scan_next_y +return 0 diff --git a/tests/data/timber_test/function/tree.mcfunction b/tests/data/timber_test/function/tree.mcfunction new file mode 100644 index 0000000..23ad6b2 --- /dev/null +++ b/tests/data/timber_test/function/tree.mcfunction @@ -0,0 +1,12 @@ +#> Generates a vanilla worldgen tree with its trunk base at ~20 ~ ~20, the middle of the arena +#> Not closer to the origin: the tree can't grow into the origin column (PackTest keeps something there), place feature fails silently +#> Some trees (tall mangrove in about 1 of 12) can't be placed, place feature then reports a failure and changes nothing: try up to 5 times +#> @param feature configured feature id, e.g. "minecraft:oak" +scoreboard objectives add timber_test dummy +scoreboard players set #tree_ok timber_test 0 +$execute store success score #tree_ok timber_test run place feature $(feature) ~20 ~ ~20 +$execute unless score #tree_ok timber_test matches 1 store success score #tree_ok timber_test run place feature $(feature) ~20 ~ ~20 +$execute unless score #tree_ok timber_test matches 1 store success score #tree_ok timber_test run place feature $(feature) ~20 ~ ~20 +$execute unless score #tree_ok timber_test matches 1 store success score #tree_ok timber_test run place feature $(feature) ~20 ~ ~20 +$execute unless score #tree_ok timber_test matches 1 store success score #tree_ok timber_test run place feature $(feature) ~20 ~ ~20 +assert score #tree_ok timber_test matches 1 diff --git a/tests/data/timber_test/function/warn_caps.mcfunction b/tests/data/timber_test/function/warn_caps.mcfunction new file mode 100644 index 0000000..019b05f --- /dev/null +++ b/tests/data/timber_test/function/warn_caps.mcfunction @@ -0,0 +1,3 @@ +#> Warns that a fungus was chopped but cap blocks are left standing. Same two paths as warn_d7 (log line for the CI, orange chat for players). +$execute unless entity @a[tag=!timber_test_dummy] run say TIMBER-WARNING $(test): $(caps) cap blocks were left standing, every fungus should be chopped completely +$tellraw @a[tag=!timber_test_dummy] {"text":"Test warning $(test): $(caps) cap blocks were left standing, every fungus should be chopped completely","color":"gold"} diff --git a/tests/data/timber_test/function/warn_d7.mcfunction b/tests/data/timber_test/function/warn_d7.mcfunction new file mode 100644 index 0000000..65081bb --- /dev/null +++ b/tests/data/timber_test/function/warn_d7.mcfunction @@ -0,0 +1,5 @@ +#> Warns about leaves that were left standing. +#> Without a real player (CI) it says it in the server log, where the workflow turns lines with TIMBER-WARNING into GitHub warnings. +#> Real players get an orange chat message instead (tellraw isn't logged, say can't be colored). +$execute unless entity @a[tag=!timber_test_dummy] run say TIMBER-WARNING $(test): $(after) leaves with distance=7 were left standing ($(before) before chopping) +$tellraw @a[tag=!timber_test_dummy] {"text":"Test warning $(test): $(after) leaves with distance=7 were left standing ($(before) before chopping)","color":"gold"} diff --git a/tests/data/timber_test/function/warn_few_leaves.mcfunction b/tests/data/timber_test/function/warn_few_leaves.mcfunction new file mode 100644 index 0000000..55413d9 --- /dev/null +++ b/tests/data/timber_test/function/warn_few_leaves.mcfunction @@ -0,0 +1,3 @@ +#> Warns that a tree was not chopped because too few leaves touch its trunk. Same two paths as warn_d7 (log line for the CI, orange chat for players). +$execute unless entity @a[tag=!timber_test_dummy] run say TIMBER-WARNING $(test): tree was not chopped, only $(adj) leaves next to the trunk (min_leaves_found is $(min)), every tree should be choppable +$tellraw @a[tag=!timber_test_dummy] {"text":"Test warning $(test): tree was not chopped, only $(adj) leaves next to the trunk (min_leaves_found is $(min)), every tree should be choppable","color":"gold"} diff --git a/tests/data/timber_test/function/warn_leaves_left.mcfunction b/tests/data/timber_test/function/warn_leaves_left.mcfunction new file mode 100644 index 0000000..6687689 --- /dev/null +++ b/tests/data/timber_test/function/warn_leaves_left.mcfunction @@ -0,0 +1,3 @@ +#> Warns that a chopped tree left leaves standing (not distance=7, those have warn_d7). Same two paths as warn_d7 (log line for the CI, orange chat for players). +$execute unless entity @a[tag=!timber_test_dummy] run say TIMBER-WARNING $(test): $(leaves) leaves were left standing, every tree should be chopped completely +$tellraw @a[tag=!timber_test_dummy] {"text":"Test warning $(test): $(leaves) leaves were left standing, every tree should be chopped completely","color":"gold"} diff --git a/tests/data/timber_test/function/warn_left.mcfunction b/tests/data/timber_test/function/warn_left.mcfunction new file mode 100644 index 0000000..56808b5 --- /dev/null +++ b/tests/data/timber_test/function/warn_left.mcfunction @@ -0,0 +1,3 @@ +#> Warns that a chop left logs or leaves standing. Same two paths as warn_d7 (log line for the CI, orange chat for players). +$execute unless entity @a[tag=!timber_test_dummy] run say TIMBER-WARNING $(test): chop left $(logs) of $(total) logs, $(roots) roots and $(leaves) leaves standing, every tree should be chopped completely +$tellraw @a[tag=!timber_test_dummy] {"text":"Test warning $(test): chop left $(logs) of $(total) logs, $(roots) roots and $(leaves) leaves standing, every tree should be chopped completely","color":"gold"} diff --git a/tests/data/timber_test/structure/arena.nbt b/tests/data/timber_test/structure/arena.nbt new file mode 100644 index 0000000..e8a5fd1 Binary files /dev/null and b/tests/data/timber_test/structure/arena.nbt differ diff --git a/tests/data/timber_test/test/chop_acacia_tree.mcfunction b/tests/data/timber_test/test/chop_acacia_tree.mcfunction new file mode 100644 index 0000000..1c7666f --- /dev/null +++ b/tests/data/timber_test/test/chop_acacia_tree.mcfunction @@ -0,0 +1,27 @@ +#> Mining the bottom log of an acacia tree with an axe chops down the whole tree +# @environment timber_test:group_1 +# @template timber_test:arena +# @timeout 200 +# @skyaccess true + +function timber_test:platform +function timber_test:tree {feature:"minecraft:acacia"} +assert block ~20 ~ ~20 #minecraft:logs + +# let the leaves settle before the tree is chopped +await delay 1s +function timber_test:count_d7 {test:"chop_acacia_tree"} + +function timber_test:player {name:"acacia_t",axe:"minecraft:iron_axe"} +function timber_test:mine {name:"acacia_t"} + +# wait until the datapack is done with the tree +# (await doesn't work inside a called function, so this block is repeated in every test) +# 1. the base log is gone: the dummy hit the tree +# 2. two ticks pass: the datapack reacts to the mined block in the next tick +# 3. no marker is left in the arena: chopping and slow chop delete their markers when they are done +await not block ~20 ~ ~20 #minecraft:logs +await delay 2t +await not entity @e[type=minecraft:marker,dx=39,dy=39,dz=39] + +function timber_test:assert_no_tree {test:"chop_acacia_tree"} diff --git a/tests/data/timber_test/test/chop_azalea_tree.mcfunction b/tests/data/timber_test/test/chop_azalea_tree.mcfunction new file mode 100644 index 0000000..e625a5c --- /dev/null +++ b/tests/data/timber_test/test/chop_azalea_tree.mcfunction @@ -0,0 +1,27 @@ +#> Mining the bottom log of an azalea tree with an axe chops down the whole tree +# @environment timber_test:group_2 +# @template timber_test:arena +# @timeout 200 +# @skyaccess true + +function timber_test:platform +function timber_test:tree {feature:"minecraft:azalea_tree"} +assert block ~20 ~ ~20 #minecraft:logs + +# let the leaves settle before the tree is chopped +await delay 1s +function timber_test:count_d7 {test:"chop_azalea_tree"} + +function timber_test:player {name:"azalea_t",axe:"minecraft:iron_axe"} +function timber_test:mine {name:"azalea_t"} + +# wait until the datapack is done with the tree +# (await doesn't work inside a called function, so this block is repeated in every test) +# 1. the base log is gone: the dummy hit the tree +# 2. two ticks pass: the datapack reacts to the mined block in the next tick +# 3. no marker is left in the arena: chopping and slow chop delete their markers when they are done +await not block ~20 ~ ~20 #minecraft:logs +await delay 2t +await not entity @e[type=minecraft:marker,dx=39,dy=39,dz=39] + +function timber_test:assert_no_tree {test:"chop_azalea_tree"} diff --git a/tests/data/timber_test/test/chop_birch_tree.mcfunction b/tests/data/timber_test/test/chop_birch_tree.mcfunction new file mode 100644 index 0000000..0d0eb2c --- /dev/null +++ b/tests/data/timber_test/test/chop_birch_tree.mcfunction @@ -0,0 +1,27 @@ +#> Mining the bottom log of a birch tree with an axe chops down the whole tree +# @environment timber_test:group_3 +# @template timber_test:arena +# @timeout 200 +# @skyaccess true + +function timber_test:platform +function timber_test:tree {feature:"minecraft:birch"} +assert block ~20 ~ ~20 #minecraft:logs + +# let the leaves settle before the tree is chopped +await delay 1s +function timber_test:count_d7 {test:"chop_birch_tree"} + +function timber_test:player {name:"birch_t",axe:"minecraft:iron_axe"} +function timber_test:mine {name:"birch_t"} + +# wait until the datapack is done with the tree +# (await doesn't work inside a called function, so this block is repeated in every test) +# 1. the base log is gone: the dummy hit the tree +# 2. two ticks pass: the datapack reacts to the mined block in the next tick +# 3. no marker is left in the arena: chopping and slow chop delete their markers when they are done +await not block ~20 ~ ~20 #minecraft:logs +await delay 2t +await not entity @e[type=minecraft:marker,dx=39,dy=39,dz=39] + +function timber_test:assert_no_tree {test:"chop_birch_tree"} diff --git a/tests/data/timber_test/test/chop_brown_mushroom_fungus.mcfunction b/tests/data/timber_test/test/chop_brown_mushroom_fungus.mcfunction new file mode 100644 index 0000000..a5e8d36 --- /dev/null +++ b/tests/data/timber_test/test/chop_brown_mushroom_fungus.mcfunction @@ -0,0 +1,30 @@ +#> Mining the bottom stem of a huge brown mushroom with an axe chops down the whole fungus (chop_fungi is on) +# @environment timber_test:chop_fungi_on +# @template timber_test:arena +# @timeout 400 +# @skyaccess true + +function timber_test:platform +# nether fungi only grow on nylium, without it place feature fails without a message +setblock ~20 ~-1 ~20 minecraft:mycelium +function timber_test:tree {feature:"minecraft:huge_brown_mushroom"} +assert block ~20 ~ ~20 minecraft:mushroom_stem + +await delay 1s +# With chop_fungi on, every chop of the datapack ends with a kill of ALL marker items of mushroom stems in the world (no distance +# limit). A chop in the same tick that runs first deletes the marker of a mushroom, which then isn't chopped. So the fungus tests +# chop one after the other, 60 ticks after the first one. +await delay 60t +function timber_test:player {name:"brown_mush_t",axe:"minecraft:iron_axe"} +function timber_test:mine {name:"brown_mush_t"} + +# wait until the datapack is done with the fungus +# (await doesn't work inside a called function, so this block is repeated in every test) +# 1. the base stem is gone: the dummy hit the fungus +# 2. five ticks pass: the datapack reacts to the mined block a tick or two later, a mushroom stem breaks at once with an axe +# 3. no marker is left in the arena: chopping and slow chop delete their markers when they are done +await not block ~20 ~ ~20 minecraft:mushroom_stem +await delay 5t +await not entity @e[type=minecraft:marker,dx=39,dy=39,dz=39] + +function timber_test:assert_no_fungus {test:"chop_brown_mushroom_fungus"} diff --git a/tests/data/timber_test/test/chop_cherry_tree.mcfunction b/tests/data/timber_test/test/chop_cherry_tree.mcfunction new file mode 100644 index 0000000..e4a64dc --- /dev/null +++ b/tests/data/timber_test/test/chop_cherry_tree.mcfunction @@ -0,0 +1,28 @@ +#> Mining the bottom log of a cherry tree with an axe chops down the whole tree +# @environment timber_test:group_4 +# @template timber_test:arena +# @timeout 200 +# @skyaccess true + +function timber_test:platform +function timber_test:tree {feature:"minecraft:cherry"} +assert block ~20 ~ ~20 #minecraft:logs + +# let the leaves settle before the tree is chopped +await delay 1s +function timber_test:count_d7 {test:"chop_cherry_tree"} + +function timber_test:player {name:"cherry_t",axe:"minecraft:iron_axe"} +function timber_test:mine {name:"cherry_t"} + +# wait until the datapack is done with the tree +# (await doesn't work inside a called function, so this block is repeated in every test) +# 1. the base log is gone: the dummy hit the tree +# 2. two ticks pass: the datapack reacts to the mined block in the next tick +# 3. no marker is left in the arena: chopping and slow chop delete their markers when they are done +await not block ~20 ~ ~20 #minecraft:logs +await delay 2t +await not entity @e[type=minecraft:marker,dx=39,dy=39,dz=39] + +# big crown: logs have to be gone, leaves that are left only warn (see assert_no_logs_warn_leaves) +function timber_test:assert_no_logs_warn_leaves {test:"chop_cherry_tree"} diff --git a/tests/data/timber_test/test/chop_crimson_fungus.mcfunction b/tests/data/timber_test/test/chop_crimson_fungus.mcfunction new file mode 100644 index 0000000..e02506e --- /dev/null +++ b/tests/data/timber_test/test/chop_crimson_fungus.mcfunction @@ -0,0 +1,29 @@ +#> Mining the bottom stem of a crimson fungus with an axe chops down the whole fungus (chop_fungi is on) +# @environment timber_test:chop_fungi_on +# @template timber_test:arena +# @timeout 400 +# @skyaccess true + +function timber_test:platform +# nether fungi only grow on nylium, without it place feature fails without a message +setblock ~20 ~-1 ~20 minecraft:crimson_nylium +function timber_test:tree {feature:"minecraft:crimson_fungus"} +assert block ~20 ~ ~20 #minecraft:logs + +await delay 1s +# With chop_fungi on, every chop of the datapack ends with a kill of ALL marker items of mushroom stems in the world (no distance +# limit). A chop in the same tick that runs first deletes the marker of a mushroom, which then isn't chopped. So the fungus tests +# chop one after the other, 0 ticks after the first one. +function timber_test:player {name:"crimson_t",axe:"minecraft:iron_axe"} +function timber_test:mine {name:"crimson_t"} + +# wait until the datapack is done with the fungus +# (await doesn't work inside a called function, so this block is repeated in every test) +# 1. the base stem is gone: the dummy hit the fungus +# 2. five ticks pass: the datapack reacts to the mined block a tick or two later, a mushroom stem breaks at once with an axe +# 3. no marker is left in the arena: chopping and slow chop delete their markers when they are done +await not block ~20 ~ ~20 #minecraft:logs +await delay 5t +await not entity @e[type=minecraft:marker,dx=39,dy=39,dz=39] + +function timber_test:assert_no_fungus {test:"chop_crimson_fungus"} diff --git a/tests/data/timber_test/test/chop_crimson_planted_fungus.mcfunction b/tests/data/timber_test/test/chop_crimson_planted_fungus.mcfunction new file mode 100644 index 0000000..64a07c2 --- /dev/null +++ b/tests/data/timber_test/test/chop_crimson_planted_fungus.mcfunction @@ -0,0 +1,30 @@ +#> Mining the bottom stem of a crimson fungus grown from a planted one with an axe chops down the whole fungus (chop_fungi is on) +# @environment timber_test:chop_fungi_on +# @template timber_test:arena +# @timeout 400 +# @skyaccess true + +function timber_test:platform +# nether fungi only grow on nylium, without it place feature fails without a message +setblock ~20 ~-1 ~20 minecraft:crimson_nylium +function timber_test:tree {feature:"minecraft:crimson_fungus_planted"} +assert block ~20 ~ ~20 #minecraft:logs + +await delay 1s +# With chop_fungi on, every chop of the datapack ends with a kill of ALL marker items of mushroom stems in the world (no distance +# limit). A chop in the same tick that runs first deletes the marker of a mushroom, which then isn't chopped. So the fungus tests +# chop one after the other, 24 ticks after the first one. +await delay 24t +function timber_test:player {name:"crimson_pl_t",axe:"minecraft:iron_axe"} +function timber_test:mine {name:"crimson_pl_t"} + +# wait until the datapack is done with the fungus +# (await doesn't work inside a called function, so this block is repeated in every test) +# 1. the base stem is gone: the dummy hit the fungus +# 2. five ticks pass: the datapack reacts to the mined block a tick or two later, a mushroom stem breaks at once with an axe +# 3. no marker is left in the arena: chopping and slow chop delete their markers when they are done +await not block ~20 ~ ~20 #minecraft:logs +await delay 5t +await not entity @e[type=minecraft:marker,dx=39,dy=39,dz=39] + +function timber_test:assert_no_fungus {test:"chop_crimson_planted_fungus"} diff --git a/tests/data/timber_test/test/chop_dark_oak_tree.mcfunction b/tests/data/timber_test/test/chop_dark_oak_tree.mcfunction new file mode 100644 index 0000000..4b0a4c5 --- /dev/null +++ b/tests/data/timber_test/test/chop_dark_oak_tree.mcfunction @@ -0,0 +1,28 @@ +#> Mining the bottom log of a 2x2 dark oak tree with an axe chops down the whole tree +# @environment timber_test:group_5 +# @template timber_test:arena +# @timeout 200 +# @skyaccess true + +function timber_test:platform +function timber_test:tree {feature:"minecraft:dark_oak"} +assert block ~20 ~ ~20 #minecraft:logs + +# let the leaves settle before the tree is chopped +await delay 1s +function timber_test:count_d7 {test:"chop_dark_oak_tree"} + +function timber_test:player {name:"dark_oak_t",axe:"minecraft:iron_axe"} +function timber_test:mine {name:"dark_oak_t"} + +# wait until the datapack is done with the tree +# (await doesn't work inside a called function, so this block is repeated in every test) +# 1. the base log is gone: the dummy hit the tree +# 2. two ticks pass: the datapack reacts to the mined block in the next tick +# 3. no marker is left in the arena: chopping and slow chop delete their markers when they are done +await not block ~20 ~ ~20 #minecraft:logs +await delay 2t +await not entity @e[type=minecraft:marker,dx=39,dy=39,dz=39] + +# big crown: logs have to be gone, leaves that are left only warn (see assert_no_logs_warn_leaves) +function timber_test:assert_no_logs_warn_leaves {test:"chop_dark_oak_tree"} diff --git a/tests/data/timber_test/test/chop_fancy_oak_tree.mcfunction b/tests/data/timber_test/test/chop_fancy_oak_tree.mcfunction new file mode 100644 index 0000000..2d5ec97 --- /dev/null +++ b/tests/data/timber_test/test/chop_fancy_oak_tree.mcfunction @@ -0,0 +1,28 @@ +#> Mining the bottom log of a fancy oak tree with an axe chops down the whole tree +# @environment timber_test:group_1 +# @template timber_test:arena +# @timeout 200 +# @skyaccess true + +function timber_test:platform +function timber_test:tree {feature:"minecraft:fancy_oak"} +assert block ~20 ~ ~20 #minecraft:logs + +# let the leaves settle before the tree is chopped +await delay 1s +function timber_test:count_d7 {test:"chop_fancy_oak_tree"} + +function timber_test:player {name:"fancy_oak_t",axe:"minecraft:iron_axe"} +function timber_test:mine {name:"fancy_oak_t"} + +# wait until the datapack is done with the tree +# (await doesn't work inside a called function, so this block is repeated in every test) +# 1. the base log is gone: the dummy hit the tree +# 2. two ticks pass: the datapack reacts to the mined block in the next tick +# 3. no marker is left in the arena: chopping and slow chop delete their markers when they are done +await not block ~20 ~ ~20 #minecraft:logs +await delay 2t +await not entity @e[type=minecraft:marker,dx=39,dy=39,dz=39] + +# big crown: logs have to be gone, leaves that are left only warn (see assert_no_logs_warn_leaves) +function timber_test:assert_no_logs_warn_leaves {test:"chop_fancy_oak_tree"} diff --git a/tests/data/timber_test/test/chop_jungle_tree.mcfunction b/tests/data/timber_test/test/chop_jungle_tree.mcfunction new file mode 100644 index 0000000..d091632 --- /dev/null +++ b/tests/data/timber_test/test/chop_jungle_tree.mcfunction @@ -0,0 +1,27 @@ +#> Mining the bottom log of a jungle tree with an axe chops down the whole tree +# @environment timber_test:group_2 +# @template timber_test:arena +# @timeout 200 +# @skyaccess true + +function timber_test:platform +function timber_test:tree {feature:"minecraft:jungle_tree"} +assert block ~20 ~ ~20 #minecraft:logs + +# let the leaves settle before the tree is chopped +await delay 1s +function timber_test:count_d7 {test:"chop_jungle_tree"} + +function timber_test:player {name:"jungle_t",axe:"minecraft:iron_axe"} +function timber_test:mine {name:"jungle_t"} + +# wait until the datapack is done with the tree +# (await doesn't work inside a called function, so this block is repeated in every test) +# 1. the base log is gone: the dummy hit the tree +# 2. two ticks pass: the datapack reacts to the mined block in the next tick +# 3. no marker is left in the arena: chopping and slow chop delete their markers when they are done +await not block ~20 ~ ~20 #minecraft:logs +await delay 2t +await not entity @e[type=minecraft:marker,dx=39,dy=39,dz=39] + +function timber_test:assert_no_tree {test:"chop_jungle_tree"} diff --git a/tests/data/timber_test/test/chop_mangrove_log_tree.mcfunction b/tests/data/timber_test/test/chop_mangrove_log_tree.mcfunction new file mode 100644 index 0000000..f19a12d --- /dev/null +++ b/tests/data/timber_test/test/chop_mangrove_log_tree.mcfunction @@ -0,0 +1,36 @@ +#> Mining the lowest log of a mangrove tree chops down the whole tree including its roots +# @environment timber_test:group_3 +# @template timber_test:arena +# @timeout 200 +# @skyaccess true + +function timber_test:platform +function timber_test:tree {feature:"minecraft:mangrove"} + +# let the leaves settle before the tree is chopped +await delay 1s +function timber_test:count_d7 {test:"chop_mangrove_log_tree"} +function timber_test:count_adjacent {test:"chop_mangrove_log_tree"} +function timber_test:count_logs {test:"chop_mangrove_log_tree"} + +function timber_test:player {name:"mangrove_log_t",axe:"minecraft:iron_axe"} +# mine the lowest log of the whole tree, from a spot next to it (see find_lowest_log and mine_here for why) +function timber_test:find_lowest_log +execute as @e[type=minecraft:marker,tag=tb_scan,dx=39,dy=39,dz=39] at @s run function timber_test:mine_here {name:"mangrove_log_t"} +kill @e[type=minecraft:marker,tag=tb_scan,dx=39,dy=39,dz=39] + +# wait until the datapack is done with the tree +# (await doesn't work inside a called function, so this block is repeated in every test) +# 1. the mined block dropped as an item: the dummy hit the tree (the base can be a root here, and any item would do for other things lying around, so wait for this one) +# 2. two ticks pass: the datapack reacts to the mined block in the next tick +# 3. no marker is left in the arena: chopping and slow chop delete their markers when they are done +await entity @e[type=minecraft:item,dx=39,dy=39,dz=39,nbt={Item:{id:"minecraft:mangrove_log"}}] +await delay 2t +await not entity @e[type=minecraft:marker,dx=39,dy=39,dz=39] + +# the datapack only chops a tree with at least min_leaves_found leaves next to a trunk. Some mangroves have fewer (measured with +# 40 trees each: mangrove 15 %, tall mangrove 10 % below 5, the tall one down to 0). That is a gap in the datapack, the goal is to +# chop every tree, so such a tree doesn't fail the test but must not be chopped and gives a warning +# a chop from a log can leave parts of the tree standing or chop nothing (it searches upwards and sideways, see report_leftovers): warning, no failure +execute if score #adj_chop_mangrove_log_tree timber_test >= min_leaves_found timber run function timber_test:report_leftovers {test:"chop_mangrove_log_tree"} +execute if score #adj_chop_mangrove_log_tree timber_test < min_leaves_found timber run function timber_test:assert_not_chopped {test:"chop_mangrove_log_tree"} diff --git a/tests/data/timber_test/test/chop_mangrove_roots_tree.mcfunction b/tests/data/timber_test/test/chop_mangrove_roots_tree.mcfunction new file mode 100644 index 0000000..9e585c1 --- /dev/null +++ b/tests/data/timber_test/test/chop_mangrove_roots_tree.mcfunction @@ -0,0 +1,84 @@ +#> Mining a root of a mangrove tree chops down the whole tree (start_chop_on_root) +# @environment timber_test:group_4 +# @template timber_test:arena +# @timeout 200 +# @skyaccess true + +function timber_test:platform +function timber_test:tree {feature:"minecraft:mangrove"} + +# let the leaves settle before the tree is chopped +await delay 1s +function timber_test:count_d7 {test:"chop_mangrove_roots_tree"} +function timber_test:count_adjacent {test:"chop_mangrove_roots_tree"} +function timber_test:count_logs {test:"chop_mangrove_roots_tree"} + +function timber_test:player {name:"mangrove_root_t",axe:"minecraft:iron_axe"} +# mine the lowest root of the trunk column (first match from the bottom) +scoreboard players set #mined timber_test 0 +execute if block ~20 ~0 ~20 minecraft:mangrove_roots unless score #mined timber_test matches 1 run dummy mangrove_root_t mine ~20 ~0 ~20 +execute if block ~20 ~0 ~20 minecraft:mangrove_roots run scoreboard players set #mined timber_test 1 +execute if block ~20 ~1 ~20 minecraft:mangrove_roots unless score #mined timber_test matches 1 run dummy mangrove_root_t mine ~20 ~1 ~20 +execute if block ~20 ~1 ~20 minecraft:mangrove_roots run scoreboard players set #mined timber_test 1 +execute if block ~20 ~2 ~20 minecraft:mangrove_roots unless score #mined timber_test matches 1 run dummy mangrove_root_t mine ~20 ~2 ~20 +execute if block ~20 ~2 ~20 minecraft:mangrove_roots run scoreboard players set #mined timber_test 1 +execute if block ~20 ~3 ~20 minecraft:mangrove_roots unless score #mined timber_test matches 1 run dummy mangrove_root_t mine ~20 ~3 ~20 +execute if block ~20 ~3 ~20 minecraft:mangrove_roots run scoreboard players set #mined timber_test 1 +execute if block ~20 ~4 ~20 minecraft:mangrove_roots unless score #mined timber_test matches 1 run dummy mangrove_root_t mine ~20 ~4 ~20 +execute if block ~20 ~4 ~20 minecraft:mangrove_roots run scoreboard players set #mined timber_test 1 +execute if block ~20 ~5 ~20 minecraft:mangrove_roots unless score #mined timber_test matches 1 run dummy mangrove_root_t mine ~20 ~5 ~20 +execute if block ~20 ~5 ~20 minecraft:mangrove_roots run scoreboard players set #mined timber_test 1 +execute if block ~20 ~6 ~20 minecraft:mangrove_roots unless score #mined timber_test matches 1 run dummy mangrove_root_t mine ~20 ~6 ~20 +execute if block ~20 ~6 ~20 minecraft:mangrove_roots run scoreboard players set #mined timber_test 1 +execute if block ~20 ~7 ~20 minecraft:mangrove_roots unless score #mined timber_test matches 1 run dummy mangrove_root_t mine ~20 ~7 ~20 +execute if block ~20 ~7 ~20 minecraft:mangrove_roots run scoreboard players set #mined timber_test 1 +execute if block ~20 ~8 ~20 minecraft:mangrove_roots unless score #mined timber_test matches 1 run dummy mangrove_root_t mine ~20 ~8 ~20 +execute if block ~20 ~8 ~20 minecraft:mangrove_roots run scoreboard players set #mined timber_test 1 +execute if block ~20 ~9 ~20 minecraft:mangrove_roots unless score #mined timber_test matches 1 run dummy mangrove_root_t mine ~20 ~9 ~20 +execute if block ~20 ~9 ~20 minecraft:mangrove_roots run scoreboard players set #mined timber_test 1 +execute if block ~20 ~10 ~20 minecraft:mangrove_roots unless score #mined timber_test matches 1 run dummy mangrove_root_t mine ~20 ~10 ~20 +execute if block ~20 ~10 ~20 minecraft:mangrove_roots run scoreboard players set #mined timber_test 1 +execute if block ~20 ~11 ~20 minecraft:mangrove_roots unless score #mined timber_test matches 1 run dummy mangrove_root_t mine ~20 ~11 ~20 +execute if block ~20 ~11 ~20 minecraft:mangrove_roots run scoreboard players set #mined timber_test 1 +execute if block ~20 ~12 ~20 minecraft:mangrove_roots unless score #mined timber_test matches 1 run dummy mangrove_root_t mine ~20 ~12 ~20 +execute if block ~20 ~12 ~20 minecraft:mangrove_roots run scoreboard players set #mined timber_test 1 +execute if block ~20 ~13 ~20 minecraft:mangrove_roots unless score #mined timber_test matches 1 run dummy mangrove_root_t mine ~20 ~13 ~20 +execute if block ~20 ~13 ~20 minecraft:mangrove_roots run scoreboard players set #mined timber_test 1 +execute if block ~20 ~14 ~20 minecraft:mangrove_roots unless score #mined timber_test matches 1 run dummy mangrove_root_t mine ~20 ~14 ~20 +execute if block ~20 ~14 ~20 minecraft:mangrove_roots run scoreboard players set #mined timber_test 1 +execute if block ~20 ~15 ~20 minecraft:mangrove_roots unless score #mined timber_test matches 1 run dummy mangrove_root_t mine ~20 ~15 ~20 +execute if block ~20 ~15 ~20 minecraft:mangrove_roots run scoreboard players set #mined timber_test 1 +execute if block ~20 ~16 ~20 minecraft:mangrove_roots unless score #mined timber_test matches 1 run dummy mangrove_root_t mine ~20 ~16 ~20 +execute if block ~20 ~16 ~20 minecraft:mangrove_roots run scoreboard players set #mined timber_test 1 +execute if block ~20 ~17 ~20 minecraft:mangrove_roots unless score #mined timber_test matches 1 run dummy mangrove_root_t mine ~20 ~17 ~20 +execute if block ~20 ~17 ~20 minecraft:mangrove_roots run scoreboard players set #mined timber_test 1 +execute if block ~20 ~18 ~20 minecraft:mangrove_roots unless score #mined timber_test matches 1 run dummy mangrove_root_t mine ~20 ~18 ~20 +execute if block ~20 ~18 ~20 minecraft:mangrove_roots run scoreboard players set #mined timber_test 1 +execute if block ~20 ~19 ~20 minecraft:mangrove_roots unless score #mined timber_test matches 1 run dummy mangrove_root_t mine ~20 ~19 ~20 +execute if block ~20 ~19 ~20 minecraft:mangrove_roots run scoreboard players set #mined timber_test 1 +execute if block ~20 ~20 ~20 minecraft:mangrove_roots unless score #mined timber_test matches 1 run dummy mangrove_root_t mine ~20 ~20 ~20 +execute if block ~20 ~20 ~20 minecraft:mangrove_roots run scoreboard players set #mined timber_test 1 +execute if block ~20 ~21 ~20 minecraft:mangrove_roots unless score #mined timber_test matches 1 run dummy mangrove_root_t mine ~20 ~21 ~20 +execute if block ~20 ~21 ~20 minecraft:mangrove_roots run scoreboard players set #mined timber_test 1 +execute if block ~20 ~22 ~20 minecraft:mangrove_roots unless score #mined timber_test matches 1 run dummy mangrove_root_t mine ~20 ~22 ~20 +execute if block ~20 ~22 ~20 minecraft:mangrove_roots run scoreboard players set #mined timber_test 1 +execute if block ~20 ~23 ~20 minecraft:mangrove_roots unless score #mined timber_test matches 1 run dummy mangrove_root_t mine ~20 ~23 ~20 +execute if block ~20 ~23 ~20 minecraft:mangrove_roots run scoreboard players set #mined timber_test 1 +execute if block ~20 ~24 ~20 minecraft:mangrove_roots unless score #mined timber_test matches 1 run dummy mangrove_root_t mine ~20 ~24 ~20 +execute if block ~20 ~24 ~20 minecraft:mangrove_roots run scoreboard players set #mined timber_test 1 + +# wait until the datapack is done with the tree +# (await doesn't work inside a called function, so this block is repeated in every test) +# 1. the mined block dropped as an item: the dummy hit the tree (the base can be a root here, and any item would do for other things lying around, so wait for this one) +# 2. two ticks pass: the datapack reacts to the mined block in the next tick +# 3. no marker is left in the arena: chopping and slow chop delete their markers when they are done +await entity @e[type=minecraft:item,dx=39,dy=39,dz=39,nbt={Item:{id:"minecraft:mangrove_roots"}}] +await delay 2t +await not entity @e[type=minecraft:marker,dx=39,dy=39,dz=39] + +# the datapack only chops a tree with at least min_leaves_found leaves next to a trunk. Some mangroves have fewer (measured with +# 40 trees each: mangrove 15 %, tall mangrove 10 % below 5, the tall one down to 0). That is a gap in the datapack, the goal is to +# chop every tree, so such a tree doesn't fail the test but must not be chopped and gives a warning +# a chop that starts at a root can leave parts of the tree standing too (branches that bend down again are not reached, see report_leftovers): warning, no failure +execute if score #adj_chop_mangrove_roots_tree timber_test >= min_leaves_found timber run function timber_test:report_leftovers {test:"chop_mangrove_roots_tree"} +execute if score #adj_chop_mangrove_roots_tree timber_test < min_leaves_found timber run function timber_test:assert_not_chopped {test:"chop_mangrove_roots_tree"} diff --git a/tests/data/timber_test/test/chop_mega_jungle_tree.mcfunction b/tests/data/timber_test/test/chop_mega_jungle_tree.mcfunction new file mode 100644 index 0000000..a100bfa --- /dev/null +++ b/tests/data/timber_test/test/chop_mega_jungle_tree.mcfunction @@ -0,0 +1,28 @@ +#> Mining the bottom log of a 2x2 jungle tree with an axe chops down the whole tree +# @environment timber_test:group_5 +# @template timber_test:arena +# @timeout 200 +# @skyaccess true + +function timber_test:platform +function timber_test:tree {feature:"minecraft:mega_jungle_tree"} +assert block ~20 ~ ~20 #minecraft:logs + +# let the leaves settle before the tree is chopped +await delay 1s +function timber_test:count_d7 {test:"chop_mega_jungle_tree"} + +function timber_test:player {name:"mega_jungle_t",axe:"minecraft:iron_axe"} +function timber_test:mine {name:"mega_jungle_t"} + +# wait until the datapack is done with the tree +# (await doesn't work inside a called function, so this block is repeated in every test) +# 1. the base log is gone: the dummy hit the tree +# 2. two ticks pass: the datapack reacts to the mined block in the next tick +# 3. no marker is left in the arena: chopping and slow chop delete their markers when they are done +await not block ~20 ~ ~20 #minecraft:logs +await delay 2t +await not entity @e[type=minecraft:marker,dx=39,dy=39,dz=39] + +# big crown: logs have to be gone, leaves that are left only warn (see assert_no_logs_warn_leaves) +function timber_test:assert_no_logs_warn_leaves {test:"chop_mega_jungle_tree"} diff --git a/tests/data/timber_test/test/chop_mega_pine_tree.mcfunction b/tests/data/timber_test/test/chop_mega_pine_tree.mcfunction new file mode 100644 index 0000000..a2a6f0b --- /dev/null +++ b/tests/data/timber_test/test/chop_mega_pine_tree.mcfunction @@ -0,0 +1,28 @@ +#> Mining the bottom log of a 2x2 pine tree with an axe chops down the whole tree +# @environment timber_test:group_1 +# @template timber_test:arena +# @timeout 200 +# @skyaccess true + +function timber_test:platform +function timber_test:tree {feature:"minecraft:mega_pine"} +assert block ~20 ~ ~20 #minecraft:logs + +# let the leaves settle before the tree is chopped +await delay 1s +function timber_test:count_d7 {test:"chop_mega_pine_tree"} + +function timber_test:player {name:"mega_pine_t",axe:"minecraft:iron_axe"} +function timber_test:mine {name:"mega_pine_t"} + +# wait until the datapack is done with the tree +# (await doesn't work inside a called function, so this block is repeated in every test) +# 1. the base log is gone: the dummy hit the tree +# 2. two ticks pass: the datapack reacts to the mined block in the next tick +# 3. no marker is left in the arena: chopping and slow chop delete their markers when they are done +await not block ~20 ~ ~20 #minecraft:logs +await delay 2t +await not entity @e[type=minecraft:marker,dx=39,dy=39,dz=39] + +# big crown: logs have to be gone, leaves that are left only warn (see assert_no_logs_warn_leaves) +function timber_test:assert_no_logs_warn_leaves {test:"chop_mega_pine_tree"} diff --git a/tests/data/timber_test/test/chop_mega_spruce_tree.mcfunction b/tests/data/timber_test/test/chop_mega_spruce_tree.mcfunction new file mode 100644 index 0000000..26b4b57 --- /dev/null +++ b/tests/data/timber_test/test/chop_mega_spruce_tree.mcfunction @@ -0,0 +1,28 @@ +#> Mining the bottom log of a 2x2 spruce tree with an axe chops down the whole tree +# @environment timber_test:group_2 +# @template timber_test:arena +# @timeout 200 +# @skyaccess true + +function timber_test:platform +function timber_test:tree {feature:"minecraft:mega_spruce"} +assert block ~20 ~ ~20 #minecraft:logs + +# let the leaves settle before the tree is chopped +await delay 1s +function timber_test:count_d7 {test:"chop_mega_spruce_tree"} + +function timber_test:player {name:"mega_spruce_t",axe:"minecraft:iron_axe"} +function timber_test:mine {name:"mega_spruce_t"} + +# wait until the datapack is done with the tree +# (await doesn't work inside a called function, so this block is repeated in every test) +# 1. the base log is gone: the dummy hit the tree +# 2. two ticks pass: the datapack reacts to the mined block in the next tick +# 3. no marker is left in the arena: chopping and slow chop delete their markers when they are done +await not block ~20 ~ ~20 #minecraft:logs +await delay 2t +await not entity @e[type=minecraft:marker,dx=39,dy=39,dz=39] + +# big crown: logs have to be gone, leaves that are left only warn (see assert_no_logs_warn_leaves) +function timber_test:assert_no_logs_warn_leaves {test:"chop_mega_spruce_tree"} diff --git a/tests/data/timber_test/test/chop_oak_tree.mcfunction b/tests/data/timber_test/test/chop_oak_tree.mcfunction new file mode 100644 index 0000000..3809013 --- /dev/null +++ b/tests/data/timber_test/test/chop_oak_tree.mcfunction @@ -0,0 +1,27 @@ +#> Mining the bottom log of an oak tree with an axe chops down the whole tree +# @environment timber_test:group_3 +# @template timber_test:arena +# @timeout 200 +# @skyaccess true + +function timber_test:platform +function timber_test:tree {feature:"minecraft:oak"} +assert block ~20 ~ ~20 #minecraft:logs + +# let the leaves settle before the tree is chopped +await delay 1s +function timber_test:count_d7 {test:"chop_oak_tree"} + +function timber_test:player {name:"oak_t",axe:"minecraft:iron_axe"} +function timber_test:mine {name:"oak_t"} + +# wait until the datapack is done with the tree +# (await doesn't work inside a called function, so this block is repeated in every test) +# 1. the base log is gone: the dummy hit the tree +# 2. two ticks pass: the datapack reacts to the mined block in the next tick +# 3. no marker is left in the arena: chopping and slow chop delete their markers when they are done +await not block ~20 ~ ~20 #minecraft:logs +await delay 2t +await not entity @e[type=minecraft:marker,dx=39,dy=39,dz=39] + +function timber_test:assert_no_tree {test:"chop_oak_tree"} diff --git a/tests/data/timber_test/test/chop_pale_oak_tree.mcfunction b/tests/data/timber_test/test/chop_pale_oak_tree.mcfunction new file mode 100644 index 0000000..39490bc --- /dev/null +++ b/tests/data/timber_test/test/chop_pale_oak_tree.mcfunction @@ -0,0 +1,28 @@ +#> Mining the bottom log of a 2x2 pale oak tree with an axe chops down the whole tree +# @environment timber_test:group_4 +# @template timber_test:arena +# @timeout 200 +# @skyaccess true + +function timber_test:platform +function timber_test:tree {feature:"minecraft:pale_oak"} +assert block ~20 ~ ~20 #minecraft:logs + +# let the leaves settle before the tree is chopped +await delay 1s +function timber_test:count_d7 {test:"chop_pale_oak_tree"} + +function timber_test:player {name:"pale_oak_t",axe:"minecraft:iron_axe"} +function timber_test:mine {name:"pale_oak_t"} + +# wait until the datapack is done with the tree +# (await doesn't work inside a called function, so this block is repeated in every test) +# 1. the base log is gone: the dummy hit the tree +# 2. two ticks pass: the datapack reacts to the mined block in the next tick +# 3. no marker is left in the arena: chopping and slow chop delete their markers when they are done +await not block ~20 ~ ~20 #minecraft:logs +await delay 2t +await not entity @e[type=minecraft:marker,dx=39,dy=39,dz=39] + +# big crown: logs have to be gone, leaves that are left only warn (see assert_no_logs_warn_leaves) +function timber_test:assert_no_logs_warn_leaves {test:"chop_pale_oak_tree"} diff --git a/tests/data/timber_test/test/chop_pine_tree.mcfunction b/tests/data/timber_test/test/chop_pine_tree.mcfunction new file mode 100644 index 0000000..49c846b --- /dev/null +++ b/tests/data/timber_test/test/chop_pine_tree.mcfunction @@ -0,0 +1,27 @@ +#> Mining the bottom log of a pine tree with an axe chops down the whole tree +# @environment timber_test:group_5 +# @template timber_test:arena +# @timeout 200 +# @skyaccess true + +function timber_test:platform +function timber_test:tree {feature:"minecraft:pine"} +assert block ~20 ~ ~20 #minecraft:logs + +# let the leaves settle before the tree is chopped +await delay 1s +function timber_test:count_d7 {test:"chop_pine_tree"} + +function timber_test:player {name:"pine_t",axe:"minecraft:iron_axe"} +function timber_test:mine {name:"pine_t"} + +# wait until the datapack is done with the tree +# (await doesn't work inside a called function, so this block is repeated in every test) +# 1. the base log is gone: the dummy hit the tree +# 2. two ticks pass: the datapack reacts to the mined block in the next tick +# 3. no marker is left in the arena: chopping and slow chop delete their markers when they are done +await not block ~20 ~ ~20 #minecraft:logs +await delay 2t +await not entity @e[type=minecraft:marker,dx=39,dy=39,dz=39] + +function timber_test:assert_no_tree {test:"chop_pine_tree"} diff --git a/tests/data/timber_test/test/chop_red_mushroom_fungus.mcfunction b/tests/data/timber_test/test/chop_red_mushroom_fungus.mcfunction new file mode 100644 index 0000000..03b069e --- /dev/null +++ b/tests/data/timber_test/test/chop_red_mushroom_fungus.mcfunction @@ -0,0 +1,30 @@ +#> Mining the bottom stem of a huge red mushroom with an axe chops down the whole fungus (chop_fungi is on) +# @environment timber_test:chop_fungi_on +# @template timber_test:arena +# @timeout 400 +# @skyaccess true + +function timber_test:platform +# nether fungi only grow on nylium, without it place feature fails without a message +setblock ~20 ~-1 ~20 minecraft:mycelium +function timber_test:tree {feature:"minecraft:huge_red_mushroom"} +assert block ~20 ~ ~20 minecraft:mushroom_stem + +await delay 1s +# With chop_fungi on, every chop of the datapack ends with a kill of ALL marker items of mushroom stems in the world (no distance +# limit). A chop in the same tick that runs first deletes the marker of a mushroom, which then isn't chopped. So the fungus tests +# chop one after the other, 48 ticks after the first one. +await delay 48t +function timber_test:player {name:"red_mush_t",axe:"minecraft:iron_axe"} +function timber_test:mine {name:"red_mush_t"} + +# wait until the datapack is done with the fungus +# (await doesn't work inside a called function, so this block is repeated in every test) +# 1. the base stem is gone: the dummy hit the fungus +# 2. five ticks pass: the datapack reacts to the mined block a tick or two later, a mushroom stem breaks at once with an axe +# 3. no marker is left in the arena: chopping and slow chop delete their markers when they are done +await not block ~20 ~ ~20 minecraft:mushroom_stem +await delay 5t +await not entity @e[type=minecraft:marker,dx=39,dy=39,dz=39] + +function timber_test:assert_no_fungus {test:"chop_red_mushroom_fungus"} diff --git a/tests/data/timber_test/test/chop_spruce_tree.mcfunction b/tests/data/timber_test/test/chop_spruce_tree.mcfunction new file mode 100644 index 0000000..b938ec8 --- /dev/null +++ b/tests/data/timber_test/test/chop_spruce_tree.mcfunction @@ -0,0 +1,27 @@ +#> Mining the bottom log of a spruce tree with an axe chops down the whole tree +# @environment timber_test:group_1 +# @template timber_test:arena +# @timeout 200 +# @skyaccess true + +function timber_test:platform +function timber_test:tree {feature:"minecraft:spruce"} +assert block ~20 ~ ~20 #minecraft:logs + +# let the leaves settle before the tree is chopped +await delay 1s +function timber_test:count_d7 {test:"chop_spruce_tree"} + +function timber_test:player {name:"spruce_t",axe:"minecraft:iron_axe"} +function timber_test:mine {name:"spruce_t"} + +# wait until the datapack is done with the tree +# (await doesn't work inside a called function, so this block is repeated in every test) +# 1. the base log is gone: the dummy hit the tree +# 2. two ticks pass: the datapack reacts to the mined block in the next tick +# 3. no marker is left in the arena: chopping and slow chop delete their markers when they are done +await not block ~20 ~ ~20 #minecraft:logs +await delay 2t +await not entity @e[type=minecraft:marker,dx=39,dy=39,dz=39] + +function timber_test:assert_no_tree {test:"chop_spruce_tree"} diff --git a/tests/data/timber_test/test/chop_swamp_oak_tree.mcfunction b/tests/data/timber_test/test/chop_swamp_oak_tree.mcfunction new file mode 100644 index 0000000..203c499 --- /dev/null +++ b/tests/data/timber_test/test/chop_swamp_oak_tree.mcfunction @@ -0,0 +1,27 @@ +#> Mining the bottom log of a swamp oak tree with an axe chops down the whole tree +# @environment timber_test:group_2 +# @template timber_test:arena +# @timeout 200 +# @skyaccess true + +function timber_test:platform +function timber_test:tree {feature:"minecraft:swamp_oak"} +assert block ~20 ~ ~20 #minecraft:logs + +# let the leaves settle before the tree is chopped +await delay 1s +function timber_test:count_d7 {test:"chop_swamp_oak_tree"} + +function timber_test:player {name:"swamp_oak_t",axe:"minecraft:iron_axe"} +function timber_test:mine {name:"swamp_oak_t"} + +# wait until the datapack is done with the tree +# (await doesn't work inside a called function, so this block is repeated in every test) +# 1. the base log is gone: the dummy hit the tree +# 2. two ticks pass: the datapack reacts to the mined block in the next tick +# 3. no marker is left in the arena: chopping and slow chop delete their markers when they are done +await not block ~20 ~ ~20 #minecraft:logs +await delay 2t +await not entity @e[type=minecraft:marker,dx=39,dy=39,dz=39] + +function timber_test:assert_no_tree {test:"chop_swamp_oak_tree"} diff --git a/tests/data/timber_test/test/chop_tall_mangrove_roots_tree.mcfunction b/tests/data/timber_test/test/chop_tall_mangrove_roots_tree.mcfunction new file mode 100644 index 0000000..930b808 --- /dev/null +++ b/tests/data/timber_test/test/chop_tall_mangrove_roots_tree.mcfunction @@ -0,0 +1,84 @@ +#> Mining a root of a tall mangrove tree chops down the whole tree (start_chop_on_root) +# @environment timber_test:group_3 +# @template timber_test:arena +# @timeout 200 +# @skyaccess true + +function timber_test:platform +function timber_test:tree {feature:"minecraft:tall_mangrove"} + +# let the leaves settle before the tree is chopped +await delay 1s +function timber_test:count_d7 {test:"chop_tall_mangrove_roots_tree"} +function timber_test:count_adjacent {test:"chop_tall_mangrove_roots_tree"} +function timber_test:count_logs {test:"chop_tall_mangrove_roots_tree"} + +function timber_test:player {name:"tall_mg_root_t",axe:"minecraft:iron_axe"} +# mine the lowest root of the trunk column (first match from the bottom) +scoreboard players set #mined timber_test 0 +execute if block ~20 ~0 ~20 minecraft:mangrove_roots unless score #mined timber_test matches 1 run dummy tall_mg_root_t mine ~20 ~0 ~20 +execute if block ~20 ~0 ~20 minecraft:mangrove_roots run scoreboard players set #mined timber_test 1 +execute if block ~20 ~1 ~20 minecraft:mangrove_roots unless score #mined timber_test matches 1 run dummy tall_mg_root_t mine ~20 ~1 ~20 +execute if block ~20 ~1 ~20 minecraft:mangrove_roots run scoreboard players set #mined timber_test 1 +execute if block ~20 ~2 ~20 minecraft:mangrove_roots unless score #mined timber_test matches 1 run dummy tall_mg_root_t mine ~20 ~2 ~20 +execute if block ~20 ~2 ~20 minecraft:mangrove_roots run scoreboard players set #mined timber_test 1 +execute if block ~20 ~3 ~20 minecraft:mangrove_roots unless score #mined timber_test matches 1 run dummy tall_mg_root_t mine ~20 ~3 ~20 +execute if block ~20 ~3 ~20 minecraft:mangrove_roots run scoreboard players set #mined timber_test 1 +execute if block ~20 ~4 ~20 minecraft:mangrove_roots unless score #mined timber_test matches 1 run dummy tall_mg_root_t mine ~20 ~4 ~20 +execute if block ~20 ~4 ~20 minecraft:mangrove_roots run scoreboard players set #mined timber_test 1 +execute if block ~20 ~5 ~20 minecraft:mangrove_roots unless score #mined timber_test matches 1 run dummy tall_mg_root_t mine ~20 ~5 ~20 +execute if block ~20 ~5 ~20 minecraft:mangrove_roots run scoreboard players set #mined timber_test 1 +execute if block ~20 ~6 ~20 minecraft:mangrove_roots unless score #mined timber_test matches 1 run dummy tall_mg_root_t mine ~20 ~6 ~20 +execute if block ~20 ~6 ~20 minecraft:mangrove_roots run scoreboard players set #mined timber_test 1 +execute if block ~20 ~7 ~20 minecraft:mangrove_roots unless score #mined timber_test matches 1 run dummy tall_mg_root_t mine ~20 ~7 ~20 +execute if block ~20 ~7 ~20 minecraft:mangrove_roots run scoreboard players set #mined timber_test 1 +execute if block ~20 ~8 ~20 minecraft:mangrove_roots unless score #mined timber_test matches 1 run dummy tall_mg_root_t mine ~20 ~8 ~20 +execute if block ~20 ~8 ~20 minecraft:mangrove_roots run scoreboard players set #mined timber_test 1 +execute if block ~20 ~9 ~20 minecraft:mangrove_roots unless score #mined timber_test matches 1 run dummy tall_mg_root_t mine ~20 ~9 ~20 +execute if block ~20 ~9 ~20 minecraft:mangrove_roots run scoreboard players set #mined timber_test 1 +execute if block ~20 ~10 ~20 minecraft:mangrove_roots unless score #mined timber_test matches 1 run dummy tall_mg_root_t mine ~20 ~10 ~20 +execute if block ~20 ~10 ~20 minecraft:mangrove_roots run scoreboard players set #mined timber_test 1 +execute if block ~20 ~11 ~20 minecraft:mangrove_roots unless score #mined timber_test matches 1 run dummy tall_mg_root_t mine ~20 ~11 ~20 +execute if block ~20 ~11 ~20 minecraft:mangrove_roots run scoreboard players set #mined timber_test 1 +execute if block ~20 ~12 ~20 minecraft:mangrove_roots unless score #mined timber_test matches 1 run dummy tall_mg_root_t mine ~20 ~12 ~20 +execute if block ~20 ~12 ~20 minecraft:mangrove_roots run scoreboard players set #mined timber_test 1 +execute if block ~20 ~13 ~20 minecraft:mangrove_roots unless score #mined timber_test matches 1 run dummy tall_mg_root_t mine ~20 ~13 ~20 +execute if block ~20 ~13 ~20 minecraft:mangrove_roots run scoreboard players set #mined timber_test 1 +execute if block ~20 ~14 ~20 minecraft:mangrove_roots unless score #mined timber_test matches 1 run dummy tall_mg_root_t mine ~20 ~14 ~20 +execute if block ~20 ~14 ~20 minecraft:mangrove_roots run scoreboard players set #mined timber_test 1 +execute if block ~20 ~15 ~20 minecraft:mangrove_roots unless score #mined timber_test matches 1 run dummy tall_mg_root_t mine ~20 ~15 ~20 +execute if block ~20 ~15 ~20 minecraft:mangrove_roots run scoreboard players set #mined timber_test 1 +execute if block ~20 ~16 ~20 minecraft:mangrove_roots unless score #mined timber_test matches 1 run dummy tall_mg_root_t mine ~20 ~16 ~20 +execute if block ~20 ~16 ~20 minecraft:mangrove_roots run scoreboard players set #mined timber_test 1 +execute if block ~20 ~17 ~20 minecraft:mangrove_roots unless score #mined timber_test matches 1 run dummy tall_mg_root_t mine ~20 ~17 ~20 +execute if block ~20 ~17 ~20 minecraft:mangrove_roots run scoreboard players set #mined timber_test 1 +execute if block ~20 ~18 ~20 minecraft:mangrove_roots unless score #mined timber_test matches 1 run dummy tall_mg_root_t mine ~20 ~18 ~20 +execute if block ~20 ~18 ~20 minecraft:mangrove_roots run scoreboard players set #mined timber_test 1 +execute if block ~20 ~19 ~20 minecraft:mangrove_roots unless score #mined timber_test matches 1 run dummy tall_mg_root_t mine ~20 ~19 ~20 +execute if block ~20 ~19 ~20 minecraft:mangrove_roots run scoreboard players set #mined timber_test 1 +execute if block ~20 ~20 ~20 minecraft:mangrove_roots unless score #mined timber_test matches 1 run dummy tall_mg_root_t mine ~20 ~20 ~20 +execute if block ~20 ~20 ~20 minecraft:mangrove_roots run scoreboard players set #mined timber_test 1 +execute if block ~20 ~21 ~20 minecraft:mangrove_roots unless score #mined timber_test matches 1 run dummy tall_mg_root_t mine ~20 ~21 ~20 +execute if block ~20 ~21 ~20 minecraft:mangrove_roots run scoreboard players set #mined timber_test 1 +execute if block ~20 ~22 ~20 minecraft:mangrove_roots unless score #mined timber_test matches 1 run dummy tall_mg_root_t mine ~20 ~22 ~20 +execute if block ~20 ~22 ~20 minecraft:mangrove_roots run scoreboard players set #mined timber_test 1 +execute if block ~20 ~23 ~20 minecraft:mangrove_roots unless score #mined timber_test matches 1 run dummy tall_mg_root_t mine ~20 ~23 ~20 +execute if block ~20 ~23 ~20 minecraft:mangrove_roots run scoreboard players set #mined timber_test 1 +execute if block ~20 ~24 ~20 minecraft:mangrove_roots unless score #mined timber_test matches 1 run dummy tall_mg_root_t mine ~20 ~24 ~20 +execute if block ~20 ~24 ~20 minecraft:mangrove_roots run scoreboard players set #mined timber_test 1 + +# wait until the datapack is done with the tree +# (await doesn't work inside a called function, so this block is repeated in every test) +# 1. the mined block dropped as an item: the dummy hit the tree (the base can be a root here, and any item would do for other things lying around, so wait for this one) +# 2. two ticks pass: the datapack reacts to the mined block in the next tick +# 3. no marker is left in the arena: chopping and slow chop delete their markers when they are done +await entity @e[type=minecraft:item,dx=39,dy=39,dz=39,nbt={Item:{id:"minecraft:mangrove_roots"}}] +await delay 2t +await not entity @e[type=minecraft:marker,dx=39,dy=39,dz=39] + +# the datapack only chops a tree with at least min_leaves_found leaves next to a trunk. Some mangroves have fewer (measured with +# 40 trees each: mangrove 15 %, tall mangrove 10 % below 5, the tall one down to 0). That is a gap in the datapack, the goal is to +# chop every tree, so such a tree doesn't fail the test but must not be chopped and gives a warning +# a chop that starts at a root can leave parts of the tree standing too (branches that bend down again are not reached, see report_leftovers): warning, no failure +execute if score #adj_chop_tall_mangrove_roots_tree timber_test >= min_leaves_found timber run function timber_test:report_leftovers {test:"chop_tall_mangrove_roots_tree"} +execute if score #adj_chop_tall_mangrove_roots_tree timber_test < min_leaves_found timber run function timber_test:assert_not_chopped {test:"chop_tall_mangrove_roots_tree"} diff --git a/tests/data/timber_test/test/chop_tall_mangrove_tree.mcfunction b/tests/data/timber_test/test/chop_tall_mangrove_tree.mcfunction new file mode 100644 index 0000000..dbc4891 --- /dev/null +++ b/tests/data/timber_test/test/chop_tall_mangrove_tree.mcfunction @@ -0,0 +1,36 @@ +#> Mining the lowest log of a tall mangrove tree chops down the whole tree including its roots +# @environment timber_test:group_4 +# @template timber_test:arena +# @timeout 200 +# @skyaccess true + +function timber_test:platform +function timber_test:tree {feature:"minecraft:tall_mangrove"} + +# let the leaves settle before the tree is chopped +await delay 1s +function timber_test:count_d7 {test:"chop_tall_mangrove_tree"} +function timber_test:count_adjacent {test:"chop_tall_mangrove_tree"} +function timber_test:count_logs {test:"chop_tall_mangrove_tree"} + +function timber_test:player {name:"tall_mangrove_t",axe:"minecraft:iron_axe"} +# mine the lowest log of the whole tree, from a spot next to it (see find_lowest_log and mine_here for why) +function timber_test:find_lowest_log +execute as @e[type=minecraft:marker,tag=tb_scan,dx=39,dy=39,dz=39] at @s run function timber_test:mine_here {name:"tall_mangrove_t"} +kill @e[type=minecraft:marker,tag=tb_scan,dx=39,dy=39,dz=39] + +# wait until the datapack is done with the tree +# (await doesn't work inside a called function, so this block is repeated in every test) +# 1. the mined block dropped as an item: the dummy hit the tree (the base can be a root here, and any item would do for other things lying around, so wait for this one) +# 2. two ticks pass: the datapack reacts to the mined block in the next tick +# 3. no marker is left in the arena: chopping and slow chop delete their markers when they are done +await entity @e[type=minecraft:item,dx=39,dy=39,dz=39,nbt={Item:{id:"minecraft:mangrove_log"}}] +await delay 2t +await not entity @e[type=minecraft:marker,dx=39,dy=39,dz=39] + +# the datapack only chops a tree with at least min_leaves_found leaves next to a trunk. Some mangroves have fewer (measured with +# 40 trees each: mangrove 15 %, tall mangrove 10 % below 5, the tall one down to 0). That is a gap in the datapack, the goal is to +# chop every tree, so such a tree doesn't fail the test but must not be chopped and gives a warning +# a chop from a log can leave parts of the tree standing or chop nothing (it searches upwards and sideways, see report_leftovers): warning, no failure +execute if score #adj_chop_tall_mangrove_tree timber_test >= min_leaves_found timber run function timber_test:report_leftovers {test:"chop_tall_mangrove_tree"} +execute if score #adj_chop_tall_mangrove_tree timber_test < min_leaves_found timber run function timber_test:assert_not_chopped {test:"chop_tall_mangrove_tree"} diff --git a/tests/data/timber_test/test/chop_warped_fungus.mcfunction b/tests/data/timber_test/test/chop_warped_fungus.mcfunction new file mode 100644 index 0000000..d9d9a67 --- /dev/null +++ b/tests/data/timber_test/test/chop_warped_fungus.mcfunction @@ -0,0 +1,30 @@ +#> Mining the bottom stem of a warped fungus with an axe chops down the whole fungus (chop_fungi is on) +# @environment timber_test:chop_fungi_on +# @template timber_test:arena +# @timeout 400 +# @skyaccess true + +function timber_test:platform +# nether fungi only grow on nylium, without it place feature fails without a message +setblock ~20 ~-1 ~20 minecraft:warped_nylium +function timber_test:tree {feature:"minecraft:warped_fungus"} +assert block ~20 ~ ~20 #minecraft:logs + +await delay 1s +# With chop_fungi on, every chop of the datapack ends with a kill of ALL marker items of mushroom stems in the world (no distance +# limit). A chop in the same tick that runs first deletes the marker of a mushroom, which then isn't chopped. So the fungus tests +# chop one after the other, 12 ticks after the first one. +await delay 12t +function timber_test:player {name:"warped_t",axe:"minecraft:iron_axe"} +function timber_test:mine {name:"warped_t"} + +# wait until the datapack is done with the fungus +# (await doesn't work inside a called function, so this block is repeated in every test) +# 1. the base stem is gone: the dummy hit the fungus +# 2. five ticks pass: the datapack reacts to the mined block a tick or two later, a mushroom stem breaks at once with an axe +# 3. no marker is left in the arena: chopping and slow chop delete their markers when they are done +await not block ~20 ~ ~20 #minecraft:logs +await delay 5t +await not entity @e[type=minecraft:marker,dx=39,dy=39,dz=39] + +function timber_test:assert_no_fungus {test:"chop_warped_fungus"} diff --git a/tests/data/timber_test/test/chop_warped_planted_fungus.mcfunction b/tests/data/timber_test/test/chop_warped_planted_fungus.mcfunction new file mode 100644 index 0000000..0f64f77 --- /dev/null +++ b/tests/data/timber_test/test/chop_warped_planted_fungus.mcfunction @@ -0,0 +1,30 @@ +#> Mining the bottom stem of a warped fungus grown from a planted one with an axe chops down the whole fungus (chop_fungi is on) +# @environment timber_test:chop_fungi_on +# @template timber_test:arena +# @timeout 400 +# @skyaccess true + +function timber_test:platform +# nether fungi only grow on nylium, without it place feature fails without a message +setblock ~20 ~-1 ~20 minecraft:warped_nylium +function timber_test:tree {feature:"minecraft:warped_fungus_planted"} +assert block ~20 ~ ~20 #minecraft:logs + +await delay 1s +# With chop_fungi on, every chop of the datapack ends with a kill of ALL marker items of mushroom stems in the world (no distance +# limit). A chop in the same tick that runs first deletes the marker of a mushroom, which then isn't chopped. So the fungus tests +# chop one after the other, 36 ticks after the first one. +await delay 36t +function timber_test:player {name:"warped_pl_t",axe:"minecraft:iron_axe"} +function timber_test:mine {name:"warped_pl_t"} + +# wait until the datapack is done with the fungus +# (await doesn't work inside a called function, so this block is repeated in every test) +# 1. the base stem is gone: the dummy hit the fungus +# 2. five ticks pass: the datapack reacts to the mined block a tick or two later, a mushroom stem breaks at once with an axe +# 3. no marker is left in the arena: chopping and slow chop delete their markers when they are done +await not block ~20 ~ ~20 #minecraft:logs +await delay 5t +await not entity @e[type=minecraft:marker,dx=39,dy=39,dz=39] + +function timber_test:assert_no_fungus {test:"chop_warped_planted_fungus"} diff --git a/tests/data/timber_test/test/chopped_five_leaves.mcfunction b/tests/data/timber_test/test/chopped_five_leaves.mcfunction new file mode 100644 index 0000000..013ee19 --- /dev/null +++ b/tests/data/timber_test/test/chopped_five_leaves.mcfunction @@ -0,0 +1,33 @@ +#> Mining a log with exactly 5 leaves next to the trunk chops the whole tree (min_leaves_found is 5) +# @environment timber_test:group_5 +# @template timber_test:arena +# @timeout 200 +# @skyaccess true + +function timber_test:platform +# the rule is built for the default of 5 leaves +assert score min_leaves_found timber matches 5 +# a column of 6 logs with 5 leaves: 4 at its sides, one on top +fill ~20 ~0 ~20 ~20 ~5 ~20 minecraft:oak_log +setblock ~21 ~3 ~20 minecraft:oak_leaves[distance=1,persistent=false] +setblock ~19 ~3 ~20 minecraft:oak_leaves[distance=1,persistent=false] +setblock ~20 ~3 ~21 minecraft:oak_leaves[distance=1,persistent=false] +setblock ~20 ~3 ~19 minecraft:oak_leaves[distance=1,persistent=false] +setblock ~20 ~6 ~20 minecraft:oak_leaves[distance=1,persistent=false] + +function timber_test:count_d7 {test:"chopped_five_leaves"} + +function timber_test:count_logs {test:"chopped_five_leaves"} +function timber_test:player {name:"pos5_t",axe:"minecraft:iron_axe"} +function timber_test:mine {name:"pos5_t"} + +# wait until the datapack has had its chance to act +# (await doesn't work inside a called function, so this block is repeated in every test) +# 1. the base log is gone: the dummy hit the structure +# 2. five ticks pass: the datapack reacts to the mined block in the next tick or two +# 3. no marker is left in the arena +await not block ~20 ~ ~20 #minecraft:logs +await delay 5t +await not entity @e[type=minecraft:marker,dx=39,dy=39,dz=39] + +function timber_test:assert_no_tree {test:"chopped_five_leaves"} diff --git a/tests/data/timber_test/test/enchantments_no_silk_touch_drops_no_leaf_blocks.mcfunction b/tests/data/timber_test/test/enchantments_no_silk_touch_drops_no_leaf_blocks.mcfunction new file mode 100644 index 0000000..d6ac2e7 --- /dev/null +++ b/tests/data/timber_test/test/enchantments_no_silk_touch_drops_no_leaf_blocks.mcfunction @@ -0,0 +1,25 @@ +#> Without Silk Touch the leaves of a chopped tree don't drop as leaf blocks (saplings, sticks, apples do) +# @environment timber_test:group_2 +# @template timber_test:arena +# @timeout 400 +# @skyaccess true + +function timber_test:platform +function timber_test:tree {feature:"minecraft:oak"} +assert block ~20 ~ ~20 #minecraft:logs + +await delay 1s +function timber_test:player {name:"silk_off_t",axe:"minecraft:iron_axe"} +item replace entity @e[type=minecraft:player,name=silk_off_t,limit=1] weapon.mainhand with minecraft:iron_axe +function timber_test:mine {name:"silk_off_t"} + +# wait until the datapack has had its chance to act +# (await doesn't work inside a called function, so this block is repeated in every test) +# 1. the base log is gone: the dummy hit the tree +# 2. five ticks pass: the datapack reacts to the mined block in the next tick or two +# 3. no marker is left in the arena +await not block ~20 ~ ~20 #minecraft:logs +await delay 5t +await not entity @e[type=minecraft:marker,dx=39,dy=39,dz=39] + +assert not entity @e[type=minecraft:item,dx=39,dy=39,dz=39,nbt={Item:{id:"minecraft:oak_leaves"}}] diff --git a/tests/data/timber_test/test/enchantments_no_unbreaking_wears_once_per_log.mcfunction b/tests/data/timber_test/test/enchantments_no_unbreaking_wears_once_per_log.mcfunction new file mode 100644 index 0000000..91c1ea1 --- /dev/null +++ b/tests/data/timber_test/test/enchantments_no_unbreaking_wears_once_per_log.mcfunction @@ -0,0 +1,33 @@ +#> Without Unbreaking the axe wears about once per log: twice the damage is more than the number of logs +# @environment timber_test:group_4 +# @template timber_test:arena +# @timeout 400 +# @skyaccess true + +function timber_test:platform +function timber_test:tree {feature:"minecraft:mega_spruce"} +assert block ~20 ~ ~20 #minecraft:logs + +await delay 1s +function timber_test:count_logs {test:"enchantments_no_unbreaking_wears_once_per_log"} +function timber_test:player {name:"unb_none_t",axe:"minecraft:iron_axe"} +item replace entity @e[type=minecraft:player,name=unb_none_t,limit=1] weapon.mainhand with minecraft:iron_axe +function timber_test:mine {name:"unb_none_t"} + +# wait until the datapack has had its chance to act +# (await doesn't work inside a called function, so this block is repeated in every test) +# 1. the base log is gone: the dummy hit the tree +# 2. five ticks pass: the datapack reacts to the mined block in the next tick or two +# 3. no marker is left in the arena +await not block ~20 ~ ~20 #minecraft:logs +await delay 5t +await not entity @e[type=minecraft:marker,dx=39,dy=39,dz=39] + +scoreboard objectives add timber_test dummy +scoreboard players set #dmg timber_test 0 +scoreboard players set #two timber_test 2 +execute store result score #dmg timber_test run data get entity @e[type=minecraft:player,name=unb_none_t,limit=1] SelectedItem.components."minecraft:damage" +# twice the damage compared with the number of logs (no comparison of two scores in assert: subtract, then matches) +scoreboard players operation #dmg timber_test *= #two timber_test +scoreboard players operation #dmg timber_test -= #logs0_enchantments_no_unbreaking_wears_once_per_log timber_test +assert score #dmg timber_test matches 0.. diff --git a/tests/data/timber_test/test/enchantments_silk_touch_drops_leaves_as_blocks.mcfunction b/tests/data/timber_test/test/enchantments_silk_touch_drops_leaves_as_blocks.mcfunction new file mode 100644 index 0000000..569973d --- /dev/null +++ b/tests/data/timber_test/test/enchantments_silk_touch_drops_leaves_as_blocks.mcfunction @@ -0,0 +1,25 @@ +#> With Silk Touch on the axe the leaves of a chopped tree drop as leaf blocks +# @environment timber_test:group_1 +# @template timber_test:arena +# @timeout 400 +# @skyaccess true + +function timber_test:platform +function timber_test:tree {feature:"minecraft:oak"} +assert block ~20 ~ ~20 #minecraft:logs + +await delay 1s +function timber_test:player {name:"silk_on_t",axe:"minecraft:iron_axe"} +item replace entity @e[type=minecraft:player,name=silk_on_t,limit=1] weapon.mainhand with minecraft:iron_axe[minecraft:enchantments={"minecraft:silk_touch":1}] +function timber_test:mine {name:"silk_on_t"} + +# wait until the datapack has had its chance to act +# (await doesn't work inside a called function, so this block is repeated in every test) +# 1. the base log is gone: the dummy hit the tree +# 2. five ticks pass: the datapack reacts to the mined block in the next tick or two +# 3. no marker is left in the arena +await not block ~20 ~ ~20 #minecraft:logs +await delay 5t +await not entity @e[type=minecraft:marker,dx=39,dy=39,dz=39] + +assert entity @e[type=minecraft:item,dx=39,dy=39,dz=39,nbt={Item:{id:"minecraft:oak_leaves"}}] diff --git a/tests/data/timber_test/test/enchantments_unbreaking_lowers_the_wear.mcfunction b/tests/data/timber_test/test/enchantments_unbreaking_lowers_the_wear.mcfunction new file mode 100644 index 0000000..5e7a9ca --- /dev/null +++ b/tests/data/timber_test/test/enchantments_unbreaking_lowers_the_wear.mcfunction @@ -0,0 +1,33 @@ +#> With Unbreaking III the axe wears less than half as much as there are logs (about a quarter) +# @environment timber_test:group_3 +# @template timber_test:arena +# @timeout 400 +# @skyaccess true + +function timber_test:platform +function timber_test:tree {feature:"minecraft:mega_spruce"} +assert block ~20 ~ ~20 #minecraft:logs + +await delay 1s +function timber_test:count_logs {test:"enchantments_unbreaking_lowers_the_wear"} +function timber_test:player {name:"unb_three_t",axe:"minecraft:iron_axe"} +item replace entity @e[type=minecraft:player,name=unb_three_t,limit=1] weapon.mainhand with minecraft:iron_axe[minecraft:enchantments={"minecraft:unbreaking":3}] +function timber_test:mine {name:"unb_three_t"} + +# wait until the datapack has had its chance to act +# (await doesn't work inside a called function, so this block is repeated in every test) +# 1. the base log is gone: the dummy hit the tree +# 2. five ticks pass: the datapack reacts to the mined block in the next tick or two +# 3. no marker is left in the arena +await not block ~20 ~ ~20 #minecraft:logs +await delay 5t +await not entity @e[type=minecraft:marker,dx=39,dy=39,dz=39] + +scoreboard objectives add timber_test dummy +scoreboard players set #dmg timber_test 0 +scoreboard players set #two timber_test 2 +execute store result score #dmg timber_test run data get entity @e[type=minecraft:player,name=unb_three_t,limit=1] SelectedItem.components."minecraft:damage" +# twice the damage compared with the number of logs (no comparison of two scores in assert: subtract, then matches) +scoreboard players operation #dmg timber_test *= #two timber_test +scoreboard players operation #dmg timber_test -= #logs0_enchantments_unbreaking_lowers_the_wear timber_test +assert score #dmg timber_test matches ..-1 diff --git a/tests/data/timber_test/test/not_chopped_four_leaves.mcfunction b/tests/data/timber_test/test/not_chopped_four_leaves.mcfunction new file mode 100644 index 0000000..3f1e5ce --- /dev/null +++ b/tests/data/timber_test/test/not_chopped_four_leaves.mcfunction @@ -0,0 +1,30 @@ +#> Mining a log with only 4 leaves next to the trunk does not chop it (min_leaves_found is 5) +# @environment timber_test:group_1 +# @template timber_test:arena +# @timeout 200 +# @skyaccess true + +function timber_test:platform +# the rule is built for the default of 5 leaves +assert score min_leaves_found timber matches 5 +# a column of 6 logs with 4 leaves at its sides +fill ~20 ~0 ~20 ~20 ~5 ~20 minecraft:oak_log +setblock ~21 ~3 ~20 minecraft:oak_leaves[distance=1,persistent=false] +setblock ~19 ~3 ~20 minecraft:oak_leaves[distance=1,persistent=false] +setblock ~20 ~3 ~21 minecraft:oak_leaves[distance=1,persistent=false] +setblock ~20 ~3 ~19 minecraft:oak_leaves[distance=1,persistent=false] + +function timber_test:count_logs {test:"not_chopped_four_leaves"} +function timber_test:player {name:"neg4_t",axe:"minecraft:iron_axe"} +function timber_test:mine {name:"neg4_t"} + +# wait until the datapack has had its chance to act +# (await doesn't work inside a called function, so this block is repeated in every test) +# 1. the base log is gone: the dummy hit the structure +# 2. five ticks pass: the datapack reacts to the mined block in the next tick or two +# 3. no marker is left in the arena +await not block ~20 ~ ~20 #minecraft:logs +await delay 5t +await not entity @e[type=minecraft:marker,dx=39,dy=39,dz=39] + +function timber_test:assert_only_mined_gone {test:"not_chopped_four_leaves"} diff --git a/tests/data/timber_test/test/not_chopped_log_hut.mcfunction b/tests/data/timber_test/test/not_chopped_log_hut.mcfunction new file mode 100644 index 0000000..33bec43 --- /dev/null +++ b/tests/data/timber_test/test/not_chopped_log_hut.mcfunction @@ -0,0 +1,24 @@ +#> Mining a log of a hut built from logs (no leaves anywhere) does not chop it +# @environment timber_test:group_2 +# @template timber_test:arena +# @timeout 200 +# @skyaccess true + +function timber_test:platform +# a hollow 5x5x4 box of logs, the corner log at ~20 ~ ~20 is mined +fill ~20 ~0 ~20 ~24 ~3 ~24 minecraft:oak_log hollow + +function timber_test:count_logs {test:"not_chopped_log_hut"} +function timber_test:player {name:"neg_hut_t",axe:"minecraft:iron_axe"} +function timber_test:mine {name:"neg_hut_t"} + +# wait until the datapack has had its chance to act +# (await doesn't work inside a called function, so this block is repeated in every test) +# 1. the base log is gone: the dummy hit the structure +# 2. five ticks pass: the datapack reacts to the mined block in the next tick or two +# 3. no marker is left in the arena +await not block ~20 ~ ~20 #minecraft:logs +await delay 5t +await not entity @e[type=minecraft:marker,dx=39,dy=39,dz=39] + +function timber_test:assert_only_mined_gone {test:"not_chopped_log_hut"} diff --git a/tests/data/timber_test/test/not_chopped_log_pile.mcfunction b/tests/data/timber_test/test/not_chopped_log_pile.mcfunction new file mode 100644 index 0000000..13cfa53 --- /dev/null +++ b/tests/data/timber_test/test/not_chopped_log_pile.mcfunction @@ -0,0 +1,24 @@ +#> Mining the bottom log of a stack of logs (no leaves anywhere) does not chop it +# @environment timber_test:group_3 +# @template timber_test:arena +# @timeout 200 +# @skyaccess true + +function timber_test:platform +# a column of 8 logs +fill ~20 ~0 ~20 ~20 ~7 ~20 minecraft:oak_log + +function timber_test:count_logs {test:"not_chopped_log_pile"} +function timber_test:player {name:"neg_pile_t",axe:"minecraft:iron_axe"} +function timber_test:mine {name:"neg_pile_t"} + +# wait until the datapack has had its chance to act +# (await doesn't work inside a called function, so this block is repeated in every test) +# 1. the base log is gone: the dummy hit the structure +# 2. five ticks pass: the datapack reacts to the mined block in the next tick or two +# 3. no marker is left in the arena +await not block ~20 ~ ~20 #minecraft:logs +await delay 5t +await not entity @e[type=minecraft:marker,dx=39,dy=39,dz=39] + +function timber_test:assert_only_mined_gone {test:"not_chopped_log_pile"} diff --git a/tests/data/timber_test/test/placed_leaves_should_not_count.mcfunction b/tests/data/timber_test/test/placed_leaves_should_not_count.mcfunction new file mode 100644 index 0000000..7022e6f --- /dev/null +++ b/tests/data/timber_test/test/placed_leaves_should_not_count.mcfunction @@ -0,0 +1,31 @@ +#> Five leaves placed by a player (persistent) next to a stack of logs: only natural leaves count (setting persistent is off), so it must not be chopped +# @environment timber_test:group_4 +# @template timber_test:arena +# @timeout 200 +# @skyaccess true + +function timber_test:platform +# the rule is built for the default of 5 leaves +assert score min_leaves_found timber matches 5 +# a column of 6 logs with 5 player placed leaves (persistent=true) next to it +fill ~20 ~0 ~20 ~20 ~5 ~20 minecraft:oak_log +setblock ~21 ~3 ~20 minecraft:oak_leaves[distance=1,persistent=true] +setblock ~19 ~3 ~20 minecraft:oak_leaves[distance=1,persistent=true] +setblock ~20 ~3 ~21 minecraft:oak_leaves[distance=1,persistent=true] +setblock ~20 ~3 ~19 minecraft:oak_leaves[distance=1,persistent=true] +setblock ~21 ~4 ~20 minecraft:oak_leaves[distance=1,persistent=true] + +function timber_test:count_logs {test:"placed_leaves_should_not_count"} +function timber_test:player {name:"placed_lv_t",axe:"minecraft:iron_axe"} +function timber_test:mine {name:"placed_lv_t"} + +# wait until the datapack has had its chance to act +# (await doesn't work inside a called function, so this block is repeated in every test) +# 1. the base log is gone: the dummy hit the structure +# 2. five ticks pass: the datapack reacts to the mined block in the next tick or two +# 3. no marker is left in the arena +await not block ~20 ~ ~20 #minecraft:logs +await delay 5t +await not entity @e[type=minecraft:marker,dx=39,dy=39,dz=39] + +function timber_test:assert_only_mined_gone {test:"placed_leaves_should_not_count"} diff --git a/tests/data/timber_test/test/settings_axe_copper_chops.mcfunction b/tests/data/timber_test/test/settings_axe_copper_chops.mcfunction new file mode 100644 index 0000000..5b3501d --- /dev/null +++ b/tests/data/timber_test/test/settings_axe_copper_chops.mcfunction @@ -0,0 +1,26 @@ +#> The copper axe chops a tree by default +# @environment timber_test:group_5 +# @template timber_test:arena +# @timeout 200 +# @skyaccess true + +function timber_test:platform +function timber_test:tree {feature:"minecraft:oak"} +assert block ~20 ~ ~20 #minecraft:logs +assert block ~20 ~2 ~20 #minecraft:logs + +await delay 1s +function timber_test:count_d7 {test:"settings_axe_copper_chops"} +function timber_test:player {name:"ax_copper_t",axe:"minecraft:copper_axe"} +dummy ax_copper_t mine ~20 ~0 ~20 + +# wait until the datapack has had its chance to act +# (await doesn't work inside a called function, so this block is repeated in every test) +# 1. the mined log is gone: the dummy hit the tree +# 2. five ticks pass: the datapack reacts to the mined block in the next tick or two +# 3. no marker is left in the arena +await not block ~20 ~0 ~20 #minecraft:logs +await delay 5t +await not entity @e[type=minecraft:marker,dx=39,dy=39,dz=39] + +function timber_test:assert_no_tree {test:"settings_axe_copper_chops"} diff --git a/tests/data/timber_test/test/settings_axe_copper_off_no_chop.mcfunction b/tests/data/timber_test/test/settings_axe_copper_off_no_chop.mcfunction new file mode 100644 index 0000000..77d1ce5 --- /dev/null +++ b/tests/data/timber_test/test/settings_axe_copper_off_no_chop.mcfunction @@ -0,0 +1,26 @@ +#> With the copper axe switched off it doesn't chop +# @environment timber_test:axes_off +# @template timber_test:arena +# @timeout 200 +# @skyaccess true + +function timber_test:platform +function timber_test:tree {feature:"minecraft:oak"} +assert block ~20 ~ ~20 #minecraft:logs +assert block ~20 ~2 ~20 #minecraft:logs + +await delay 1s +function timber_test:count_logs {test:"settings_axe_copper_off_no_chop"} +function timber_test:player {name:"axo_copper_t",axe:"minecraft:copper_axe"} +dummy axo_copper_t mine ~20 ~0 ~20 + +# wait until the datapack has had its chance to act +# (await doesn't work inside a called function, so this block is repeated in every test) +# 1. the mined log is gone: the dummy hit the tree +# 2. five ticks pass: the datapack reacts to the mined block in the next tick or two +# 3. no marker is left in the arena +await not block ~20 ~0 ~20 #minecraft:logs +await delay 5t +await not entity @e[type=minecraft:marker,dx=39,dy=39,dz=39] + +function timber_test:assert_only_mined_gone {test:"settings_axe_copper_off_no_chop"} diff --git a/tests/data/timber_test/test/settings_axe_diamond_chops.mcfunction b/tests/data/timber_test/test/settings_axe_diamond_chops.mcfunction new file mode 100644 index 0000000..2b74e55 --- /dev/null +++ b/tests/data/timber_test/test/settings_axe_diamond_chops.mcfunction @@ -0,0 +1,26 @@ +#> The diamond axe chops a tree by default +# @environment timber_test:group_1 +# @template timber_test:arena +# @timeout 200 +# @skyaccess true + +function timber_test:platform +function timber_test:tree {feature:"minecraft:oak"} +assert block ~20 ~ ~20 #minecraft:logs +assert block ~20 ~2 ~20 #minecraft:logs + +await delay 1s +function timber_test:count_d7 {test:"settings_axe_diamond_chops"} +function timber_test:player {name:"ax_diamon_t",axe:"minecraft:diamond_axe"} +dummy ax_diamon_t mine ~20 ~0 ~20 + +# wait until the datapack has had its chance to act +# (await doesn't work inside a called function, so this block is repeated in every test) +# 1. the mined log is gone: the dummy hit the tree +# 2. five ticks pass: the datapack reacts to the mined block in the next tick or two +# 3. no marker is left in the arena +await not block ~20 ~0 ~20 #minecraft:logs +await delay 5t +await not entity @e[type=minecraft:marker,dx=39,dy=39,dz=39] + +function timber_test:assert_no_tree {test:"settings_axe_diamond_chops"} diff --git a/tests/data/timber_test/test/settings_axe_diamond_off_no_chop.mcfunction b/tests/data/timber_test/test/settings_axe_diamond_off_no_chop.mcfunction new file mode 100644 index 0000000..e3abc37 --- /dev/null +++ b/tests/data/timber_test/test/settings_axe_diamond_off_no_chop.mcfunction @@ -0,0 +1,26 @@ +#> With the diamond axe switched off it doesn't chop +# @environment timber_test:axes_off +# @template timber_test:arena +# @timeout 200 +# @skyaccess true + +function timber_test:platform +function timber_test:tree {feature:"minecraft:oak"} +assert block ~20 ~ ~20 #minecraft:logs +assert block ~20 ~2 ~20 #minecraft:logs + +await delay 1s +function timber_test:count_logs {test:"settings_axe_diamond_off_no_chop"} +function timber_test:player {name:"axo_diamon_t",axe:"minecraft:diamond_axe"} +dummy axo_diamon_t mine ~20 ~0 ~20 + +# wait until the datapack has had its chance to act +# (await doesn't work inside a called function, so this block is repeated in every test) +# 1. the mined log is gone: the dummy hit the tree +# 2. five ticks pass: the datapack reacts to the mined block in the next tick or two +# 3. no marker is left in the arena +await not block ~20 ~0 ~20 #minecraft:logs +await delay 5t +await not entity @e[type=minecraft:marker,dx=39,dy=39,dz=39] + +function timber_test:assert_only_mined_gone {test:"settings_axe_diamond_off_no_chop"} diff --git a/tests/data/timber_test/test/settings_axe_golden_chops.mcfunction b/tests/data/timber_test/test/settings_axe_golden_chops.mcfunction new file mode 100644 index 0000000..8b09686 --- /dev/null +++ b/tests/data/timber_test/test/settings_axe_golden_chops.mcfunction @@ -0,0 +1,26 @@ +#> The golden axe chops a tree by default +# @environment timber_test:group_2 +# @template timber_test:arena +# @timeout 200 +# @skyaccess true + +function timber_test:platform +function timber_test:tree {feature:"minecraft:oak"} +assert block ~20 ~ ~20 #minecraft:logs +assert block ~20 ~2 ~20 #minecraft:logs + +await delay 1s +function timber_test:count_d7 {test:"settings_axe_golden_chops"} +function timber_test:player {name:"ax_golden_t",axe:"minecraft:golden_axe"} +dummy ax_golden_t mine ~20 ~0 ~20 + +# wait until the datapack has had its chance to act +# (await doesn't work inside a called function, so this block is repeated in every test) +# 1. the mined log is gone: the dummy hit the tree +# 2. five ticks pass: the datapack reacts to the mined block in the next tick or two +# 3. no marker is left in the arena +await not block ~20 ~0 ~20 #minecraft:logs +await delay 5t +await not entity @e[type=minecraft:marker,dx=39,dy=39,dz=39] + +function timber_test:assert_no_tree {test:"settings_axe_golden_chops"} diff --git a/tests/data/timber_test/test/settings_axe_golden_off_no_chop.mcfunction b/tests/data/timber_test/test/settings_axe_golden_off_no_chop.mcfunction new file mode 100644 index 0000000..e44b674 --- /dev/null +++ b/tests/data/timber_test/test/settings_axe_golden_off_no_chop.mcfunction @@ -0,0 +1,26 @@ +#> With the golden axe switched off it doesn't chop +# @environment timber_test:axes_off +# @template timber_test:arena +# @timeout 200 +# @skyaccess true + +function timber_test:platform +function timber_test:tree {feature:"minecraft:oak"} +assert block ~20 ~ ~20 #minecraft:logs +assert block ~20 ~2 ~20 #minecraft:logs + +await delay 1s +function timber_test:count_logs {test:"settings_axe_golden_off_no_chop"} +function timber_test:player {name:"axo_golden_t",axe:"minecraft:golden_axe"} +dummy axo_golden_t mine ~20 ~0 ~20 + +# wait until the datapack has had its chance to act +# (await doesn't work inside a called function, so this block is repeated in every test) +# 1. the mined log is gone: the dummy hit the tree +# 2. five ticks pass: the datapack reacts to the mined block in the next tick or two +# 3. no marker is left in the arena +await not block ~20 ~0 ~20 #minecraft:logs +await delay 5t +await not entity @e[type=minecraft:marker,dx=39,dy=39,dz=39] + +function timber_test:assert_only_mined_gone {test:"settings_axe_golden_off_no_chop"} diff --git a/tests/data/timber_test/test/settings_axe_iron_chops.mcfunction b/tests/data/timber_test/test/settings_axe_iron_chops.mcfunction new file mode 100644 index 0000000..2e42fe9 --- /dev/null +++ b/tests/data/timber_test/test/settings_axe_iron_chops.mcfunction @@ -0,0 +1,26 @@ +#> The iron axe chops a tree by default +# @environment timber_test:group_3 +# @template timber_test:arena +# @timeout 200 +# @skyaccess true + +function timber_test:platform +function timber_test:tree {feature:"minecraft:oak"} +assert block ~20 ~ ~20 #minecraft:logs +assert block ~20 ~2 ~20 #minecraft:logs + +await delay 1s +function timber_test:count_d7 {test:"settings_axe_iron_chops"} +function timber_test:player {name:"ax_iron_t",axe:"minecraft:iron_axe"} +dummy ax_iron_t mine ~20 ~0 ~20 + +# wait until the datapack has had its chance to act +# (await doesn't work inside a called function, so this block is repeated in every test) +# 1. the mined log is gone: the dummy hit the tree +# 2. five ticks pass: the datapack reacts to the mined block in the next tick or two +# 3. no marker is left in the arena +await not block ~20 ~0 ~20 #minecraft:logs +await delay 5t +await not entity @e[type=minecraft:marker,dx=39,dy=39,dz=39] + +function timber_test:assert_no_tree {test:"settings_axe_iron_chops"} diff --git a/tests/data/timber_test/test/settings_axe_iron_off_no_chop.mcfunction b/tests/data/timber_test/test/settings_axe_iron_off_no_chop.mcfunction new file mode 100644 index 0000000..3602cc3 --- /dev/null +++ b/tests/data/timber_test/test/settings_axe_iron_off_no_chop.mcfunction @@ -0,0 +1,26 @@ +#> With the iron axe switched off it doesn't chop +# @environment timber_test:axes_off +# @template timber_test:arena +# @timeout 200 +# @skyaccess true + +function timber_test:platform +function timber_test:tree {feature:"minecraft:oak"} +assert block ~20 ~ ~20 #minecraft:logs +assert block ~20 ~2 ~20 #minecraft:logs + +await delay 1s +function timber_test:count_logs {test:"settings_axe_iron_off_no_chop"} +function timber_test:player {name:"axo_iron_t",axe:"minecraft:iron_axe"} +dummy axo_iron_t mine ~20 ~0 ~20 + +# wait until the datapack has had its chance to act +# (await doesn't work inside a called function, so this block is repeated in every test) +# 1. the mined log is gone: the dummy hit the tree +# 2. five ticks pass: the datapack reacts to the mined block in the next tick or two +# 3. no marker is left in the arena +await not block ~20 ~0 ~20 #minecraft:logs +await delay 5t +await not entity @e[type=minecraft:marker,dx=39,dy=39,dz=39] + +function timber_test:assert_only_mined_gone {test:"settings_axe_iron_off_no_chop"} diff --git a/tests/data/timber_test/test/settings_axe_netherite_chops.mcfunction b/tests/data/timber_test/test/settings_axe_netherite_chops.mcfunction new file mode 100644 index 0000000..c7280a1 --- /dev/null +++ b/tests/data/timber_test/test/settings_axe_netherite_chops.mcfunction @@ -0,0 +1,26 @@ +#> The netherite axe chops a tree by default +# @environment timber_test:group_4 +# @template timber_test:arena +# @timeout 200 +# @skyaccess true + +function timber_test:platform +function timber_test:tree {feature:"minecraft:oak"} +assert block ~20 ~ ~20 #minecraft:logs +assert block ~20 ~2 ~20 #minecraft:logs + +await delay 1s +function timber_test:count_d7 {test:"settings_axe_netherite_chops"} +function timber_test:player {name:"ax_nether_t",axe:"minecraft:netherite_axe"} +dummy ax_nether_t mine ~20 ~0 ~20 + +# wait until the datapack has had its chance to act +# (await doesn't work inside a called function, so this block is repeated in every test) +# 1. the mined log is gone: the dummy hit the tree +# 2. five ticks pass: the datapack reacts to the mined block in the next tick or two +# 3. no marker is left in the arena +await not block ~20 ~0 ~20 #minecraft:logs +await delay 5t +await not entity @e[type=minecraft:marker,dx=39,dy=39,dz=39] + +function timber_test:assert_no_tree {test:"settings_axe_netherite_chops"} diff --git a/tests/data/timber_test/test/settings_axe_netherite_off_no_chop.mcfunction b/tests/data/timber_test/test/settings_axe_netherite_off_no_chop.mcfunction new file mode 100644 index 0000000..f0c09d4 --- /dev/null +++ b/tests/data/timber_test/test/settings_axe_netherite_off_no_chop.mcfunction @@ -0,0 +1,26 @@ +#> With the netherite axe switched off it doesn't chop +# @environment timber_test:axes_off +# @template timber_test:arena +# @timeout 200 +# @skyaccess true + +function timber_test:platform +function timber_test:tree {feature:"minecraft:oak"} +assert block ~20 ~ ~20 #minecraft:logs +assert block ~20 ~2 ~20 #minecraft:logs + +await delay 1s +function timber_test:count_logs {test:"settings_axe_netherite_off_no_chop"} +function timber_test:player {name:"axo_nether_t",axe:"minecraft:netherite_axe"} +dummy axo_nether_t mine ~20 ~0 ~20 + +# wait until the datapack has had its chance to act +# (await doesn't work inside a called function, so this block is repeated in every test) +# 1. the mined log is gone: the dummy hit the tree +# 2. five ticks pass: the datapack reacts to the mined block in the next tick or two +# 3. no marker is left in the arena +await not block ~20 ~0 ~20 #minecraft:logs +await delay 5t +await not entity @e[type=minecraft:marker,dx=39,dy=39,dz=39] + +function timber_test:assert_only_mined_gone {test:"settings_axe_netherite_off_no_chop"} diff --git a/tests/data/timber_test/test/settings_axe_stone_chops.mcfunction b/tests/data/timber_test/test/settings_axe_stone_chops.mcfunction new file mode 100644 index 0000000..e562ce5 --- /dev/null +++ b/tests/data/timber_test/test/settings_axe_stone_chops.mcfunction @@ -0,0 +1,26 @@ +#> The stone axe chops a tree by default +# @environment timber_test:group_5 +# @template timber_test:arena +# @timeout 200 +# @skyaccess true + +function timber_test:platform +function timber_test:tree {feature:"minecraft:oak"} +assert block ~20 ~ ~20 #minecraft:logs +assert block ~20 ~2 ~20 #minecraft:logs + +await delay 1s +function timber_test:count_d7 {test:"settings_axe_stone_chops"} +function timber_test:player {name:"ax_stone_t",axe:"minecraft:stone_axe"} +dummy ax_stone_t mine ~20 ~0 ~20 + +# wait until the datapack has had its chance to act +# (await doesn't work inside a called function, so this block is repeated in every test) +# 1. the mined log is gone: the dummy hit the tree +# 2. five ticks pass: the datapack reacts to the mined block in the next tick or two +# 3. no marker is left in the arena +await not block ~20 ~0 ~20 #minecraft:logs +await delay 5t +await not entity @e[type=minecraft:marker,dx=39,dy=39,dz=39] + +function timber_test:assert_no_tree {test:"settings_axe_stone_chops"} diff --git a/tests/data/timber_test/test/settings_axe_stone_off_no_chop.mcfunction b/tests/data/timber_test/test/settings_axe_stone_off_no_chop.mcfunction new file mode 100644 index 0000000..90622de --- /dev/null +++ b/tests/data/timber_test/test/settings_axe_stone_off_no_chop.mcfunction @@ -0,0 +1,26 @@ +#> With the stone axe switched off it doesn't chop +# @environment timber_test:axes_off +# @template timber_test:arena +# @timeout 200 +# @skyaccess true + +function timber_test:platform +function timber_test:tree {feature:"minecraft:oak"} +assert block ~20 ~ ~20 #minecraft:logs +assert block ~20 ~2 ~20 #minecraft:logs + +await delay 1s +function timber_test:count_logs {test:"settings_axe_stone_off_no_chop"} +function timber_test:player {name:"axo_stone_t",axe:"minecraft:stone_axe"} +dummy axo_stone_t mine ~20 ~0 ~20 + +# wait until the datapack has had its chance to act +# (await doesn't work inside a called function, so this block is repeated in every test) +# 1. the mined log is gone: the dummy hit the tree +# 2. five ticks pass: the datapack reacts to the mined block in the next tick or two +# 3. no marker is left in the arena +await not block ~20 ~0 ~20 #minecraft:logs +await delay 5t +await not entity @e[type=minecraft:marker,dx=39,dy=39,dz=39] + +function timber_test:assert_only_mined_gone {test:"settings_axe_stone_off_no_chop"} diff --git a/tests/data/timber_test/test/settings_axe_wooden_chops.mcfunction b/tests/data/timber_test/test/settings_axe_wooden_chops.mcfunction new file mode 100644 index 0000000..1c857f6 --- /dev/null +++ b/tests/data/timber_test/test/settings_axe_wooden_chops.mcfunction @@ -0,0 +1,26 @@ +#> The wooden axe chops a tree by default +# @environment timber_test:group_1 +# @template timber_test:arena +# @timeout 200 +# @skyaccess true + +function timber_test:platform +function timber_test:tree {feature:"minecraft:oak"} +assert block ~20 ~ ~20 #minecraft:logs +assert block ~20 ~2 ~20 #minecraft:logs + +await delay 1s +function timber_test:count_d7 {test:"settings_axe_wooden_chops"} +function timber_test:player {name:"ax_wooden_t",axe:"minecraft:wooden_axe"} +dummy ax_wooden_t mine ~20 ~0 ~20 + +# wait until the datapack has had its chance to act +# (await doesn't work inside a called function, so this block is repeated in every test) +# 1. the mined log is gone: the dummy hit the tree +# 2. five ticks pass: the datapack reacts to the mined block in the next tick or two +# 3. no marker is left in the arena +await not block ~20 ~0 ~20 #minecraft:logs +await delay 5t +await not entity @e[type=minecraft:marker,dx=39,dy=39,dz=39] + +function timber_test:assert_no_tree {test:"settings_axe_wooden_chops"} diff --git a/tests/data/timber_test/test/settings_axe_wooden_off_no_chop.mcfunction b/tests/data/timber_test/test/settings_axe_wooden_off_no_chop.mcfunction new file mode 100644 index 0000000..c073114 --- /dev/null +++ b/tests/data/timber_test/test/settings_axe_wooden_off_no_chop.mcfunction @@ -0,0 +1,26 @@ +#> With the wooden axe switched off it doesn't chop +# @environment timber_test:axes_off +# @template timber_test:arena +# @timeout 200 +# @skyaccess true + +function timber_test:platform +function timber_test:tree {feature:"minecraft:oak"} +assert block ~20 ~ ~20 #minecraft:logs +assert block ~20 ~2 ~20 #minecraft:logs + +await delay 1s +function timber_test:count_logs {test:"settings_axe_wooden_off_no_chop"} +function timber_test:player {name:"axo_wooden_t",axe:"minecraft:wooden_axe"} +dummy axo_wooden_t mine ~20 ~0 ~20 + +# wait until the datapack has had its chance to act +# (await doesn't work inside a called function, so this block is repeated in every test) +# 1. the mined log is gone: the dummy hit the tree +# 2. five ticks pass: the datapack reacts to the mined block in the next tick or two +# 3. no marker is left in the arena +await not block ~20 ~0 ~20 #minecraft:logs +await delay 5t +await not entity @e[type=minecraft:marker,dx=39,dy=39,dz=39] + +function timber_test:assert_only_mined_gone {test:"settings_axe_wooden_off_no_chop"} diff --git a/tests/data/timber_test/test/settings_chop_down_off_keeps_logs_below.mcfunction b/tests/data/timber_test/test/settings_chop_down_off_keeps_logs_below.mcfunction new file mode 100644 index 0000000..8b04470 --- /dev/null +++ b/tests/data/timber_test/test/settings_chop_down_off_keeps_logs_below.mcfunction @@ -0,0 +1,25 @@ +#> By default only the part above the mined log is chopped: mining the third log keeps the two below +# @environment timber_test:group_2 +# @template timber_test:arena +# @timeout 200 +# @skyaccess true + +function timber_test:platform +function timber_test:tree {feature:"minecraft:oak"} +assert block ~20 ~ ~20 #minecraft:logs +assert block ~20 ~2 ~20 #minecraft:logs + +await delay 1s +function timber_test:player {name:"cdown_off_t",axe:"minecraft:iron_axe"} +dummy cdown_off_t mine ~20 ~2 ~20 + +# wait until the datapack has had its chance to act +# (await doesn't work inside a called function, so this block is repeated in every test) +# 1. the mined log is gone: the dummy hit the tree +# 2. five ticks pass: the datapack reacts to the mined block in the next tick or two +# 3. no marker is left in the arena +await not block ~20 ~2 ~20 #minecraft:logs +await delay 5t +await not entity @e[type=minecraft:marker,dx=39,dy=39,dz=39] + +function timber_test:assert_logs_left {n:2} diff --git a/tests/data/timber_test/test/settings_chop_down_on_chops_logs_below.mcfunction b/tests/data/timber_test/test/settings_chop_down_on_chops_logs_below.mcfunction new file mode 100644 index 0000000..aa13722 --- /dev/null +++ b/tests/data/timber_test/test/settings_chop_down_on_chops_logs_below.mcfunction @@ -0,0 +1,26 @@ +#> With chop_down on mining the third log chops the whole tree, also the logs below +# @environment timber_test:chop_down_on +# @template timber_test:arena +# @timeout 200 +# @skyaccess true + +function timber_test:platform +function timber_test:tree {feature:"minecraft:oak"} +assert block ~20 ~ ~20 #minecraft:logs +assert block ~20 ~2 ~20 #minecraft:logs + +await delay 1s +function timber_test:count_d7 {test:"settings_chop_down_on_chops_logs_below"} +function timber_test:player {name:"cdown_on_t",axe:"minecraft:iron_axe"} +dummy cdown_on_t mine ~20 ~2 ~20 + +# wait until the datapack has had its chance to act +# (await doesn't work inside a called function, so this block is repeated in every test) +# 1. the mined log is gone: the dummy hit the tree +# 2. five ticks pass: the datapack reacts to the mined block in the next tick or two +# 3. no marker is left in the arena +await not block ~20 ~2 ~20 #minecraft:logs +await delay 5t +await not entity @e[type=minecraft:marker,dx=39,dy=39,dz=39] + +function timber_test:assert_no_tree {test:"settings_chop_down_on_chops_logs_below"} diff --git a/tests/data/timber_test/test/settings_chop_fungi_default_off_crimson.mcfunction b/tests/data/timber_test/test/settings_chop_fungi_default_off_crimson.mcfunction new file mode 100644 index 0000000..12c1e7b --- /dev/null +++ b/tests/data/timber_test/test/settings_chop_fungi_default_off_crimson.mcfunction @@ -0,0 +1,23 @@ +#> By default (chop_fungi off) a crimson fungus is not chopped +# @environment timber_test:group_3 +# @template timber_test:arena +# @timeout 200 +# @skyaccess true + +function timber_test:platform +setblock ~20 ~-1 ~20 minecraft:crimson_nylium +function timber_test:tree {feature:"minecraft:crimson_fungus"} +assert block ~20 ~ ~20 #minecraft:logs + +await delay 1s +function timber_test:count_logs {test:"settings_chop_fungi_default_off_crimson"} +function timber_test:player {name:"fg_off_nether_t",axe:"minecraft:iron_axe"} +function timber_test:mine {name:"fg_off_nether_t"} + +# wait until the datapack has had its chance to act +# (await doesn't work inside a called function, so this block is repeated in every test) +await not block ~20 ~ ~20 #minecraft:logs +await delay 5t +await not entity @e[type=minecraft:marker,dx=39,dy=39,dz=39] + +function timber_test:assert_only_mined_gone {test:"settings_chop_fungi_default_off_crimson"} diff --git a/tests/data/timber_test/test/settings_chop_fungi_default_off_mushroom.mcfunction b/tests/data/timber_test/test/settings_chop_fungi_default_off_mushroom.mcfunction new file mode 100644 index 0000000..b92af78 --- /dev/null +++ b/tests/data/timber_test/test/settings_chop_fungi_default_off_mushroom.mcfunction @@ -0,0 +1,22 @@ +#> By default (chop_fungi off) a huge mushroom is not chopped: the stem above the mined block stays +# @environment timber_test:group_4 +# @template timber_test:arena +# @timeout 200 +# @skyaccess true + +function timber_test:platform +setblock ~20 ~-1 ~20 minecraft:mycelium +function timber_test:tree {feature:"minecraft:huge_red_mushroom"} +assert block ~20 ~ ~20 minecraft:mushroom_stem + +await delay 1s +function timber_test:player {name:"fg_off_mush_t",axe:"minecraft:iron_axe"} +function timber_test:mine {name:"fg_off_mush_t"} + +# wait until the datapack has had its chance to act +# (await doesn't work inside a called function, so this block is repeated in every test) +await not block ~20 ~ ~20 minecraft:mushroom_stem +await delay 5t +await not entity @e[type=minecraft:marker,dx=39,dy=39,dz=39] + +assert block ~20 ~2 ~20 minecraft:mushroom_stem diff --git a/tests/data/timber_test/test/settings_chop_trees_off.mcfunction b/tests/data/timber_test/test/settings_chop_trees_off.mcfunction new file mode 100644 index 0000000..1307cc1 --- /dev/null +++ b/tests/data/timber_test/test/settings_chop_trees_off.mcfunction @@ -0,0 +1,26 @@ +#> With chop_trees off nothing is chopped +# @environment timber_test:chop_trees_off +# @template timber_test:arena +# @timeout 200 +# @skyaccess true + +function timber_test:platform +function timber_test:tree {feature:"minecraft:oak"} +assert block ~20 ~ ~20 #minecraft:logs +assert block ~20 ~2 ~20 #minecraft:logs + +await delay 1s +function timber_test:count_logs {test:"settings_chop_trees_off"} +function timber_test:player {name:"notrees_t",axe:"minecraft:iron_axe"} +dummy notrees_t mine ~20 ~0 ~20 + +# wait until the datapack has had its chance to act +# (await doesn't work inside a called function, so this block is repeated in every test) +# 1. the mined log is gone: the dummy hit the tree +# 2. five ticks pass: the datapack reacts to the mined block in the next tick or two +# 3. no marker is left in the arena +await not block ~20 ~0 ~20 #minecraft:logs +await delay 5t +await not entity @e[type=minecraft:marker,dx=39,dy=39,dz=39] + +function timber_test:assert_only_mined_gone {test:"settings_chop_trees_off"} diff --git a/tests/data/timber_test/test/settings_destroy_roots_default_removes_roots.mcfunction b/tests/data/timber_test/test/settings_destroy_roots_default_removes_roots.mcfunction new file mode 100644 index 0000000..e355484 --- /dev/null +++ b/tests/data/timber_test/test/settings_destroy_roots_default_removes_roots.mcfunction @@ -0,0 +1,37 @@ +#> By default chopping a mangrove also removes its roots +# @environment timber_test:group_5 +# @template timber_test:arena +# @timeout 200 +# @skyaccess true + +function timber_test:platform +# a mangrove: 6 logs from height 1 on, 6 roots (three sides at height 1 and below them), 5 natural leaves. The dummy stands on the fourth side +fill ~20 ~1 ~20 ~20 ~6 ~20 minecraft:mangrove_log +setblock ~21 ~1 ~20 minecraft:mangrove_roots +setblock ~20 ~1 ~21 minecraft:mangrove_roots +setblock ~20 ~1 ~19 minecraft:mangrove_roots +setblock ~21 ~0 ~20 minecraft:mangrove_roots +setblock ~20 ~0 ~21 minecraft:mangrove_roots +setblock ~20 ~0 ~19 minecraft:mangrove_roots +setblock ~21 ~4 ~20 minecraft:mangrove_leaves[distance=1,persistent=false] +setblock ~19 ~4 ~20 minecraft:mangrove_leaves[distance=1,persistent=false] +setblock ~20 ~4 ~21 minecraft:mangrove_leaves[distance=1,persistent=false] +setblock ~20 ~4 ~19 minecraft:mangrove_leaves[distance=1,persistent=false] +setblock ~20 ~7 ~20 minecraft:mangrove_leaves[distance=1,persistent=false] + +await delay 1s +function timber_test:count_d7 {test:"settings_destroy_roots_default_removes_roots"} +function timber_test:player {name:"roots_def_t",axe:"minecraft:iron_axe"} +dummy roots_def_t mine ~20 ~1 ~20 + +# wait until the datapack has had its chance to act +# (await doesn't work inside a called function, so this block is repeated in every test) +# 1. the mined block is gone: the dummy hit the tree +# 2. five ticks pass: the datapack reacts to the mined block in the next tick or two +# 3. no marker is left in the arena +await not block ~20 ~1 ~20 minecraft:mangrove_log +await delay 5t +await not entity @e[type=minecraft:marker,dx=39,dy=39,dz=39] + +function timber_test:assert_no_roots +function timber_test:assert_no_tree {test:"settings_destroy_roots_default_removes_roots"} diff --git a/tests/data/timber_test/test/settings_destroy_roots_off_keeps_roots.mcfunction b/tests/data/timber_test/test/settings_destroy_roots_off_keeps_roots.mcfunction new file mode 100644 index 0000000..c02393c --- /dev/null +++ b/tests/data/timber_test/test/settings_destroy_roots_off_keeps_roots.mcfunction @@ -0,0 +1,37 @@ +#> With destroy_roots off the mangrove is chopped but its 6 roots stay +# @environment timber_test:destroy_roots_off +# @template timber_test:arena +# @timeout 200 +# @skyaccess true + +function timber_test:platform +# a mangrove: 6 logs from height 1 on, 6 roots (three sides at height 1 and below them), 5 natural leaves. The dummy stands on the fourth side +fill ~20 ~1 ~20 ~20 ~6 ~20 minecraft:mangrove_log +setblock ~21 ~1 ~20 minecraft:mangrove_roots +setblock ~20 ~1 ~21 minecraft:mangrove_roots +setblock ~20 ~1 ~19 minecraft:mangrove_roots +setblock ~21 ~0 ~20 minecraft:mangrove_roots +setblock ~20 ~0 ~21 minecraft:mangrove_roots +setblock ~20 ~0 ~19 minecraft:mangrove_roots +setblock ~21 ~4 ~20 minecraft:mangrove_leaves[distance=1,persistent=false] +setblock ~19 ~4 ~20 minecraft:mangrove_leaves[distance=1,persistent=false] +setblock ~20 ~4 ~21 minecraft:mangrove_leaves[distance=1,persistent=false] +setblock ~20 ~4 ~19 minecraft:mangrove_leaves[distance=1,persistent=false] +setblock ~20 ~7 ~20 minecraft:mangrove_leaves[distance=1,persistent=false] + +await delay 1s +function timber_test:count_d7 {test:"settings_destroy_roots_off_keeps_roots"} +function timber_test:player {name:"roots_off_t",axe:"minecraft:iron_axe"} +dummy roots_off_t mine ~20 ~1 ~20 + +# wait until the datapack has had its chance to act +# (await doesn't work inside a called function, so this block is repeated in every test) +# 1. the mined block is gone: the dummy hit the tree +# 2. five ticks pass: the datapack reacts to the mined block in the next tick or two +# 3. no marker is left in the arena +await not block ~20 ~1 ~20 minecraft:mangrove_log +await delay 5t +await not entity @e[type=minecraft:marker,dx=39,dy=39,dz=39] + +function timber_test:assert_roots_left {n:6} +function timber_test:assert_no_tree {test:"settings_destroy_roots_off_keeps_roots"} diff --git a/tests/data/timber_test/test/settings_drop_loot_default_drops_logs_on_the_ground.mcfunction b/tests/data/timber_test/test/settings_drop_loot_default_drops_logs_on_the_ground.mcfunction new file mode 100644 index 0000000..3897779 --- /dev/null +++ b/tests/data/timber_test/test/settings_drop_loot_default_drops_logs_on_the_ground.mcfunction @@ -0,0 +1,26 @@ +#> By default the logs of a chopped tree drop on the ground, the inventory of the player stays empty of them +# @environment timber_test:group_1 +# @template timber_test:arena +# @timeout 200 +# @skyaccess true + +function timber_test:platform +function timber_test:tree {feature:"minecraft:oak"} +assert block ~20 ~ ~20 #minecraft:logs + +await delay 1s +function timber_test:player {name:"loot_off_t",axe:"minecraft:iron_axe"} +function timber_test:mine {name:"loot_off_t"} + +# wait until the datapack has had its chance to act +# (await doesn't work inside a called function, so this block is repeated in every test) +# 1. the base log is gone: the dummy hit the tree +# 2. five ticks pass: the datapack reacts to the mined block in the next tick or two +# 3. no marker is left in the arena +await not block ~20 ~ ~20 #minecraft:logs +await delay 5t +await not entity @e[type=minecraft:marker,dx=39,dy=39,dz=39] + +execute store success score #inv timber_test if items entity @e[type=minecraft:player,name=loot_off_t] container.* minecraft:oak_log +assert score #inv timber_test matches 0 +assert entity @e[type=minecraft:item,dx=39,dy=39,dz=39,nbt={Item:{id:"minecraft:oak_log"}}] diff --git a/tests/data/timber_test/test/settings_drop_loot_on_gives_logs_to_the_player.mcfunction b/tests/data/timber_test/test/settings_drop_loot_on_gives_logs_to_the_player.mcfunction new file mode 100644 index 0000000..9f9920a --- /dev/null +++ b/tests/data/timber_test/test/settings_drop_loot_on_gives_logs_to_the_player.mcfunction @@ -0,0 +1,27 @@ +#> With drop_loot on the logs of a chopped tree go into the inventory of the player, not on the ground +# @environment timber_test:drop_loot_on +# @template timber_test:arena +# @timeout 200 +# @skyaccess true + +function timber_test:platform +function timber_test:tree {feature:"minecraft:oak"} +assert block ~20 ~ ~20 #minecraft:logs + +await delay 1s +function timber_test:player {name:"loot_on_t",axe:"minecraft:iron_axe"} +function timber_test:mine {name:"loot_on_t"} + +# wait until the datapack has had its chance to act +# (await doesn't work inside a called function, so this block is repeated in every test) +# 1. the base log is gone: the dummy hit the tree +# 2. five ticks pass: the datapack reacts to the mined block in the next tick or two +# 3. no marker is left in the arena +await not block ~20 ~ ~20 #minecraft:logs +await delay 5t +await not entity @e[type=minecraft:marker,dx=39,dy=39,dz=39] + +# the logs of the chop go straight into the inventory (the drop of the block the dummy mined itself is moved to the dummy, but a dummy picks nothing up) +scoreboard objectives add timber_test dummy +execute store result score #inv timber_test run clear @e[type=minecraft:player,name=loot_on_t,limit=1] minecraft:oak_log 0 +assert score #inv timber_test matches 3.. diff --git a/tests/data/timber_test/test/settings_hunger_on_gives_hunger.mcfunction b/tests/data/timber_test/test/settings_hunger_on_gives_hunger.mcfunction new file mode 100644 index 0000000..28b0447 --- /dev/null +++ b/tests/data/timber_test/test/settings_hunger_on_gives_hunger.mcfunction @@ -0,0 +1,27 @@ +#> With hunger on chopping gives the player the hunger effect +# @environment timber_test:hunger_on +# @template timber_test:arena +# @timeout 200 +# @skyaccess true + +function timber_test:platform +function timber_test:tree {feature:"minecraft:oak"} +assert block ~20 ~ ~20 #minecraft:logs +assert block ~20 ~2 ~20 #minecraft:logs + +await delay 1s +function timber_test:player {name:"hunger_t",axe:"minecraft:iron_axe"} +dummy hunger_t mine ~20 ~0 ~20 + +# wait until the datapack has had its chance to act +# (await doesn't work inside a called function, so this block is repeated in every test) +# 1. the mined log is gone: the dummy hit the tree +# 2. five ticks pass: the datapack reacts to the mined block in the next tick or two +# 3. no marker is left in the arena +await not block ~20 ~0 ~20 #minecraft:logs +await delay 5t +await not entity @e[type=minecraft:marker,dx=39,dy=39,dz=39] + +scoreboard objectives add timber_test dummy +execute store success score #hunger timber_test if entity @e[type=minecraft:player,name=hunger_t,nbt={active_effects:[{id:"minecraft:hunger"}]}] +assert score #hunger timber_test matches 1 diff --git a/tests/data/timber_test/test/settings_max_tree_size_caps_the_chop.mcfunction b/tests/data/timber_test/test/settings_max_tree_size_caps_the_chop.mcfunction new file mode 100644 index 0000000..3b9d25f --- /dev/null +++ b/tests/data/timber_test/test/settings_max_tree_size_caps_the_chop.mcfunction @@ -0,0 +1,30 @@ +#> A tree bigger than max_tree_size (3) is not processed any further: only the first logs go, the rest stays +# @environment timber_test:tiny_tree_size +# @template timber_test:arena +# @timeout 200 +# @skyaccess true + +function timber_test:platform +# a column of 8 logs with 5 natural leaves at its two lowest logs, so it is a tree for the datapack even if only the first logs are looked at +fill ~20 ~0 ~20 ~20 ~7 ~20 minecraft:oak_log +setblock ~21 ~1 ~20 minecraft:oak_leaves[distance=1,persistent=false] +setblock ~19 ~1 ~20 minecraft:oak_leaves[distance=1,persistent=false] +setblock ~20 ~1 ~21 minecraft:oak_leaves[distance=1,persistent=false] +setblock ~20 ~1 ~19 minecraft:oak_leaves[distance=1,persistent=false] +setblock ~21 ~2 ~20 minecraft:oak_leaves[distance=1,persistent=false] + +await delay 1s +function timber_test:count_logs {test:"settings_max_tree_size_caps_the_chop"} +function timber_test:player {name:"maxsize_t",axe:"minecraft:iron_axe"} +dummy maxsize_t mine ~20 ~0 ~20 + +# wait until the datapack has had its chance to act +# (await doesn't work inside a called function, so this block is repeated in every test) +# 1. the mined log is gone: the dummy hit the tree +# 2. five ticks pass: the datapack reacts to the mined block in the next tick or two +# 3. no marker is left in the arena +await not block ~20 ~0 ~20 #minecraft:logs +await delay 5t +await not entity @e[type=minecraft:marker,dx=39,dy=39,dz=39] + +function timber_test:assert_logs_removed {test:"settings_max_tree_size_caps_the_chop",n:2} diff --git a/tests/data/timber_test/test/settings_menu_flips_every_setting.mcfunction b/tests/data/timber_test/test/settings_menu_flips_every_setting.mcfunction new file mode 100644 index 0000000..74b46a0 --- /dev/null +++ b/tests/data/timber_test/test/settings_menu_flips_every_setting.mcfunction @@ -0,0 +1,214 @@ +#> Every setting of the menu can be flipped by a Timber admin and flipped back +# @environment timber_test:flip_toggles +# @timeout 100 + +scoreboard objectives add timber_test dummy +dummy adm_t spawn +tag @e[type=minecraft:player,name=adm_t] add timber_admin + +# standing: default 1 +assert score standing timber matches 1 +scoreboard players set #req timber 100 +execute as @e[type=minecraft:player,name=adm_t,limit=1] run function timber:settings/dispatch +assert score standing timber matches 0 +scoreboard players set #req timber 100 +execute as @e[type=minecraft:player,name=adm_t,limit=1] run function timber:settings/dispatch +assert score standing timber matches 1 + +# sneaking: default 0 +assert score sneaking timber matches 0 +scoreboard players set #req timber 101 +execute as @e[type=minecraft:player,name=adm_t,limit=1] run function timber:settings/dispatch +assert score sneaking timber matches 1 +scoreboard players set #req timber 101 +execute as @e[type=minecraft:player,name=adm_t,limit=1] run function timber:settings/dispatch +assert score sneaking timber matches 0 + +# destroy_leaves: default 1 +assert score destroy_leaves timber matches 1 +scoreboard players set #req timber 102 +execute as @e[type=minecraft:player,name=adm_t,limit=1] run function timber:settings/dispatch +assert score destroy_leaves timber matches 0 +scoreboard players set #req timber 102 +execute as @e[type=minecraft:player,name=adm_t,limit=1] run function timber:settings/dispatch +assert score destroy_leaves timber matches 1 + +# plant_sapling: default 0 +assert score plant_sapling timber matches 0 +scoreboard players set #req timber 103 +execute as @e[type=minecraft:player,name=adm_t,limit=1] run function timber:settings/dispatch +assert score plant_sapling timber matches 1 +scoreboard players set #req timber 103 +execute as @e[type=minecraft:player,name=adm_t,limit=1] run function timber:settings/dispatch +assert score plant_sapling timber matches 0 + +# destroy_roots: default 1 +assert score destroy_roots timber matches 1 +scoreboard players set #req timber 104 +execute as @e[type=minecraft:player,name=adm_t,limit=1] run function timber:settings/dispatch +assert score destroy_roots timber matches 0 +scoreboard players set #req timber 104 +execute as @e[type=minecraft:player,name=adm_t,limit=1] run function timber:settings/dispatch +assert score destroy_roots timber matches 1 + +# start_chop_on_root: default 1 +assert score start_chop_on_root timber matches 1 +scoreboard players set #req timber 105 +execute as @e[type=minecraft:player,name=adm_t,limit=1] run function timber:settings/dispatch +assert score start_chop_on_root timber matches 0 +scoreboard players set #req timber 105 +execute as @e[type=minecraft:player,name=adm_t,limit=1] run function timber:settings/dispatch +assert score start_chop_on_root timber matches 1 + +# slow_chop: default 0 +assert score slow_chop timber matches 0 +scoreboard players set #req timber 106 +execute as @e[type=minecraft:player,name=adm_t,limit=1] run function timber:settings/dispatch +assert score slow_chop timber matches 1 +scoreboard players set #req timber 106 +execute as @e[type=minecraft:player,name=adm_t,limit=1] run function timber:settings/dispatch +assert score slow_chop timber matches 0 + +# chop_down: default 0 +assert score chop_down timber matches 0 +scoreboard players set #req timber 107 +execute as @e[type=minecraft:player,name=adm_t,limit=1] run function timber:settings/dispatch +assert score chop_down timber matches 1 +scoreboard players set #req timber 107 +execute as @e[type=minecraft:player,name=adm_t,limit=1] run function timber:settings/dispatch +assert score chop_down timber matches 0 + +# stop_chopping: default 0 +assert score stop_chopping timber matches 0 +scoreboard players set #req timber 108 +execute as @e[type=minecraft:player,name=adm_t,limit=1] run function timber:settings/dispatch +assert score stop_chopping timber matches 1 +scoreboard players set #req timber 108 +execute as @e[type=minecraft:player,name=adm_t,limit=1] run function timber:settings/dispatch +assert score stop_chopping timber matches 0 + +# wear_out: default 1 +assert score wear_out timber matches 1 +scoreboard players set #req timber 109 +execute as @e[type=minecraft:player,name=adm_t,limit=1] run function timber:settings/dispatch +assert score wear_out timber matches 0 +scoreboard players set #req timber 109 +execute as @e[type=minecraft:player,name=adm_t,limit=1] run function timber:settings/dispatch +assert score wear_out timber matches 1 + +# drop_loot: default 0 +assert score drop_loot timber matches 0 +scoreboard players set #req timber 110 +execute as @e[type=minecraft:player,name=adm_t,limit=1] run function timber:settings/dispatch +assert score drop_loot timber matches 1 +scoreboard players set #req timber 110 +execute as @e[type=minecraft:player,name=adm_t,limit=1] run function timber:settings/dispatch +assert score drop_loot timber matches 0 + +# hunger: default 0 +assert score hunger timber matches 0 +scoreboard players set #req timber 111 +execute as @e[type=minecraft:player,name=adm_t,limit=1] run function timber:settings/dispatch +assert score hunger timber matches 1 +scoreboard players set #req timber 111 +execute as @e[type=minecraft:player,name=adm_t,limit=1] run function timber:settings/dispatch +assert score hunger timber matches 0 + +# stopsound: default 0 +assert score stopsound timber matches 0 +scoreboard players set #req timber 112 +execute as @e[type=minecraft:player,name=adm_t,limit=1] run function timber:settings/dispatch +assert score stopsound timber matches 1 +scoreboard players set #req timber 112 +execute as @e[type=minecraft:player,name=adm_t,limit=1] run function timber:settings/dispatch +assert score stopsound timber matches 0 + +# chop_trees: default 1 +assert score chop_trees timber matches 1 +scoreboard players set #req timber 113 +execute as @e[type=minecraft:player,name=adm_t,limit=1] run function timber:settings/dispatch +assert score chop_trees timber matches 0 +scoreboard players set #req timber 113 +execute as @e[type=minecraft:player,name=adm_t,limit=1] run function timber:settings/dispatch +assert score chop_trees timber matches 1 + +# chop_fungi: default 0 +assert score chop_fungi timber matches 0 +scoreboard players set #req timber 114 +execute as @e[type=minecraft:player,name=adm_t,limit=1] run function timber:settings/dispatch +assert score chop_fungi timber matches 1 +scoreboard players set #req timber 114 +execute as @e[type=minecraft:player,name=adm_t,limit=1] run function timber:settings/dispatch +assert score chop_fungi timber matches 0 + +# persistent: default 0 +assert score persistent timber matches 0 +scoreboard players set #req timber 115 +execute as @e[type=minecraft:player,name=adm_t,limit=1] run function timber:settings/dispatch +assert score persistent timber matches 1 +scoreboard players set #req timber 115 +execute as @e[type=minecraft:player,name=adm_t,limit=1] run function timber:settings/dispatch +assert score persistent timber matches 0 + +# wooden_axe: default 1 +assert score wooden_axe timber matches 1 +scoreboard players set #req timber 116 +execute as @e[type=minecraft:player,name=adm_t,limit=1] run function timber:settings/dispatch +assert score wooden_axe timber matches 0 +scoreboard players set #req timber 116 +execute as @e[type=minecraft:player,name=adm_t,limit=1] run function timber:settings/dispatch +assert score wooden_axe timber matches 1 + +# golden_axe: default 1 +assert score golden_axe timber matches 1 +scoreboard players set #req timber 117 +execute as @e[type=minecraft:player,name=adm_t,limit=1] run function timber:settings/dispatch +assert score golden_axe timber matches 0 +scoreboard players set #req timber 117 +execute as @e[type=minecraft:player,name=adm_t,limit=1] run function timber:settings/dispatch +assert score golden_axe timber matches 1 + +# stone_axe: default 1 +assert score stone_axe timber matches 1 +scoreboard players set #req timber 118 +execute as @e[type=minecraft:player,name=adm_t,limit=1] run function timber:settings/dispatch +assert score stone_axe timber matches 0 +scoreboard players set #req timber 118 +execute as @e[type=minecraft:player,name=adm_t,limit=1] run function timber:settings/dispatch +assert score stone_axe timber matches 1 + +# copper_axe: default 1 +assert score copper_axe timber matches 1 +scoreboard players set #req timber 119 +execute as @e[type=minecraft:player,name=adm_t,limit=1] run function timber:settings/dispatch +assert score copper_axe timber matches 0 +scoreboard players set #req timber 119 +execute as @e[type=minecraft:player,name=adm_t,limit=1] run function timber:settings/dispatch +assert score copper_axe timber matches 1 + +# iron_axe: default 1 +assert score iron_axe timber matches 1 +scoreboard players set #req timber 120 +execute as @e[type=minecraft:player,name=adm_t,limit=1] run function timber:settings/dispatch +assert score iron_axe timber matches 0 +scoreboard players set #req timber 120 +execute as @e[type=minecraft:player,name=adm_t,limit=1] run function timber:settings/dispatch +assert score iron_axe timber matches 1 + +# diamond_axe: default 1 +assert score diamond_axe timber matches 1 +scoreboard players set #req timber 121 +execute as @e[type=minecraft:player,name=adm_t,limit=1] run function timber:settings/dispatch +assert score diamond_axe timber matches 0 +scoreboard players set #req timber 121 +execute as @e[type=minecraft:player,name=adm_t,limit=1] run function timber:settings/dispatch +assert score diamond_axe timber matches 1 + +# netherite_axe: default 1 +assert score netherite_axe timber matches 1 +scoreboard players set #req timber 122 +execute as @e[type=minecraft:player,name=adm_t,limit=1] run function timber:settings/dispatch +assert score netherite_axe timber matches 0 +scoreboard players set #req timber 122 +execute as @e[type=minecraft:player,name=adm_t,limit=1] run function timber:settings/dispatch +assert score netherite_axe timber matches 1 diff --git a/tests/data/timber_test/test/settings_menu_guards_refuse_conflicting_flips.mcfunction b/tests/data/timber_test/test/settings_menu_guards_refuse_conflicting_flips.mcfunction new file mode 100644 index 0000000..fa0adf3 --- /dev/null +++ b/tests/data/timber_test/test/settings_menu_guards_refuse_conflicting_flips.mcfunction @@ -0,0 +1,51 @@ +#> Flips that would break another setting are refused (slow chop and loot to inventory, stop on axe break and wear out) +# @environment timber_test:flip_guards +# @timeout 100 + +scoreboard objectives add timber_test dummy +dummy adm_t spawn +tag @e[type=minecraft:player,name=adm_t] add timber_admin + +# slow chop is on: loot to inventory can't be switched on, without slow chop it can +scoreboard players set slow_chop timber 1 +scoreboard players set #req timber 110 +execute as @e[type=minecraft:player,name=adm_t,limit=1] run function timber:settings/dispatch +assert score drop_loot timber matches 0 +scoreboard players set slow_chop timber 0 +scoreboard players set #req timber 110 +execute as @e[type=minecraft:player,name=adm_t,limit=1] run function timber:settings/dispatch +assert score drop_loot timber matches 1 +scoreboard players set drop_loot timber 0 + +# loot to inventory is on: slow chop can't be switched on, without it can +scoreboard players set drop_loot timber 1 +scoreboard players set #req timber 106 +execute as @e[type=minecraft:player,name=adm_t,limit=1] run function timber:settings/dispatch +assert score slow_chop timber matches 0 +scoreboard players set drop_loot timber 0 +scoreboard players set #req timber 106 +execute as @e[type=minecraft:player,name=adm_t,limit=1] run function timber:settings/dispatch +assert score slow_chop timber matches 1 +scoreboard players set slow_chop timber 0 + +# stop on axe break is on: wear out can't be switched off, without it can +scoreboard players set stop_chopping timber 1 +scoreboard players set #req timber 109 +execute as @e[type=minecraft:player,name=adm_t,limit=1] run function timber:settings/dispatch +assert score wear_out timber matches 1 +scoreboard players set stop_chopping timber 0 +scoreboard players set #req timber 109 +execute as @e[type=minecraft:player,name=adm_t,limit=1] run function timber:settings/dispatch +assert score wear_out timber matches 0 +scoreboard players set wear_out timber 1 + +# wear out is off: stop on axe break can't be switched on, with wear out on it can +scoreboard players set wear_out timber 0 +scoreboard players set #req timber 108 +execute as @e[type=minecraft:player,name=adm_t,limit=1] run function timber:settings/dispatch +assert score stop_chopping timber matches 0 +scoreboard players set wear_out timber 1 +scoreboard players set #req timber 108 +execute as @e[type=minecraft:player,name=adm_t,limit=1] run function timber:settings/dispatch +assert score stop_chopping timber matches 1 +scoreboard players set stop_chopping timber 0 diff --git a/tests/data/timber_test/test/settings_menu_only_admins_can_flip.mcfunction b/tests/data/timber_test/test/settings_menu_only_admins_can_flip.mcfunction new file mode 100644 index 0000000..7b27cef --- /dev/null +++ b/tests/data/timber_test/test/settings_menu_only_admins_can_flip.mcfunction @@ -0,0 +1,25 @@ +#> Only a player with the tag timber_admin can change a setting +# @environment timber_test:flip_admin +# @timeout 100 + +scoreboard objectives add timber_test dummy +dummy adm_t spawn +tag @e[type=minecraft:player,name=adm_t] add timber_admin +dummy user_t spawn + +# a player without the tag: nothing changes +assert score sneaking timber matches 0 +scoreboard players set #req timber 101 +execute as @e[type=minecraft:player,name=user_t,limit=1] run function timber:settings/dispatch +assert score sneaking timber matches 0 + +# an admin can +scoreboard players set #req timber 101 +execute as @e[type=minecraft:player,name=adm_t,limit=1] run function timber:settings/dispatch +assert score sneaking timber matches 1 + +# removing the tag takes it away again +tag @e[type=minecraft:player,name=adm_t] remove timber_admin +scoreboard players set #req timber 101 +execute as @e[type=minecraft:player,name=adm_t,limit=1] run function timber:settings/dispatch +assert score sneaking timber matches 1 diff --git a/tests/data/timber_test/test/settings_menu_sliders_set_their_value.mcfunction b/tests/data/timber_test/test/settings_menu_sliders_set_their_value.mcfunction new file mode 100644 index 0000000..ac96b2b --- /dev/null +++ b/tests/data/timber_test/test/settings_menu_sliders_set_their_value.mcfunction @@ -0,0 +1,75 @@ +#> The sliders of the menu set their value: 1 followed by the value (7 comes as 17, 25 as 125, 100 as 1100) +# @environment timber_test:flip_sliders +# @timeout 100 + +scoreboard objectives add timber_test dummy +dummy adm_t spawn +tag @e[type=minecraft:player,name=adm_t] add timber_admin + +# slider blocks sets blocks_per_chop +scoreboard players set adm_t TimberSetBlocks 11 +execute as @e[type=minecraft:player,name=adm_t,limit=1] run function timber:settings/apply/blocks +assert score blocks_per_chop timber matches 1 +scoreboard players set adm_t TimberSetBlocks 17 +execute as @e[type=minecraft:player,name=adm_t,limit=1] run function timber:settings/apply/blocks +assert score blocks_per_chop timber matches 7 +scoreboard players set adm_t TimberSetBlocks 125 +execute as @e[type=minecraft:player,name=adm_t,limit=1] run function timber:settings/apply/blocks +assert score blocks_per_chop timber matches 25 +scoreboard players set adm_t TimberSetBlocks 1100 +execute as @e[type=minecraft:player,name=adm_t,limit=1] run function timber:settings/apply/blocks +assert score blocks_per_chop timber matches 100 +scoreboard players set adm_t TimberSetBlocks 11000 +execute as @e[type=minecraft:player,name=adm_t,limit=1] run function timber:settings/apply/blocks +assert score blocks_per_chop timber matches 1000 + +# slider ticks sets time_between_chops +scoreboard players set adm_t TimberSetTicks 11 +execute as @e[type=minecraft:player,name=adm_t,limit=1] run function timber:settings/apply/ticks +assert score time_between_chops timber matches 1 +scoreboard players set adm_t TimberSetTicks 17 +execute as @e[type=minecraft:player,name=adm_t,limit=1] run function timber:settings/apply/ticks +assert score time_between_chops timber matches 7 +scoreboard players set adm_t TimberSetTicks 125 +execute as @e[type=minecraft:player,name=adm_t,limit=1] run function timber:settings/apply/ticks +assert score time_between_chops timber matches 25 +scoreboard players set adm_t TimberSetTicks 1100 +execute as @e[type=minecraft:player,name=adm_t,limit=1] run function timber:settings/apply/ticks +assert score time_between_chops timber matches 100 +scoreboard players set adm_t TimberSetTicks 11000 +execute as @e[type=minecraft:player,name=adm_t,limit=1] run function timber:settings/apply/ticks +assert score time_between_chops timber matches 1000 + +# slider treesize sets max_tree_size +scoreboard players set adm_t TimberSetTreeSize 11 +execute as @e[type=minecraft:player,name=adm_t,limit=1] run function timber:settings/apply/treesize +assert score max_tree_size timber matches 1 +scoreboard players set adm_t TimberSetTreeSize 17 +execute as @e[type=minecraft:player,name=adm_t,limit=1] run function timber:settings/apply/treesize +assert score max_tree_size timber matches 7 +scoreboard players set adm_t TimberSetTreeSize 125 +execute as @e[type=minecraft:player,name=adm_t,limit=1] run function timber:settings/apply/treesize +assert score max_tree_size timber matches 25 +scoreboard players set adm_t TimberSetTreeSize 1100 +execute as @e[type=minecraft:player,name=adm_t,limit=1] run function timber:settings/apply/treesize +assert score max_tree_size timber matches 100 +scoreboard players set adm_t TimberSetTreeSize 11000 +execute as @e[type=minecraft:player,name=adm_t,limit=1] run function timber:settings/apply/treesize +assert score max_tree_size timber matches 1000 + +# slider leaves sets min_leaves_found +scoreboard players set adm_t TimberSetLeaves 11 +execute as @e[type=minecraft:player,name=adm_t,limit=1] run function timber:settings/apply/leaves +assert score min_leaves_found timber matches 1 +scoreboard players set adm_t TimberSetLeaves 17 +execute as @e[type=minecraft:player,name=adm_t,limit=1] run function timber:settings/apply/leaves +assert score min_leaves_found timber matches 7 +scoreboard players set adm_t TimberSetLeaves 125 +execute as @e[type=minecraft:player,name=adm_t,limit=1] run function timber:settings/apply/leaves +assert score min_leaves_found timber matches 25 +scoreboard players set adm_t TimberSetLeaves 1100 +execute as @e[type=minecraft:player,name=adm_t,limit=1] run function timber:settings/apply/leaves +assert score min_leaves_found timber matches 100 +scoreboard players set adm_t TimberSetLeaves 11000 +execute as @e[type=minecraft:player,name=adm_t,limit=1] run function timber:settings/apply/leaves +assert score min_leaves_found timber matches 1000 diff --git a/tests/data/timber_test/test/settings_min_leaves_13_chops_oak.mcfunction b/tests/data/timber_test/test/settings_min_leaves_13_chops_oak.mcfunction new file mode 100644 index 0000000..6e523ca --- /dev/null +++ b/tests/data/timber_test/test/settings_min_leaves_13_chops_oak.mcfunction @@ -0,0 +1,26 @@ +#> An oak has 13 leaves next to its trunk: min_leaves_found 13 chops it +# @environment timber_test:min_leaves_13 +# @template timber_test:arena +# @timeout 200 +# @skyaccess true + +function timber_test:platform +function timber_test:tree {feature:"minecraft:oak"} +assert block ~20 ~ ~20 #minecraft:logs +assert block ~20 ~2 ~20 #minecraft:logs + +await delay 1s +function timber_test:count_d7 {test:"settings_min_leaves_13_chops_oak"} +function timber_test:player {name:"minl13_t",axe:"minecraft:iron_axe"} +dummy minl13_t mine ~20 ~0 ~20 + +# wait until the datapack has had its chance to act +# (await doesn't work inside a called function, so this block is repeated in every test) +# 1. the mined log is gone: the dummy hit the tree +# 2. five ticks pass: the datapack reacts to the mined block in the next tick or two +# 3. no marker is left in the arena +await not block ~20 ~0 ~20 #minecraft:logs +await delay 5t +await not entity @e[type=minecraft:marker,dx=39,dy=39,dz=39] + +function timber_test:assert_no_tree {test:"settings_min_leaves_13_chops_oak"} diff --git a/tests/data/timber_test/test/settings_min_leaves_14_keeps_oak.mcfunction b/tests/data/timber_test/test/settings_min_leaves_14_keeps_oak.mcfunction new file mode 100644 index 0000000..e3a153b --- /dev/null +++ b/tests/data/timber_test/test/settings_min_leaves_14_keeps_oak.mcfunction @@ -0,0 +1,26 @@ +#> An oak has 13 leaves next to its trunk: min_leaves_found 14 doesn't chop it +# @environment timber_test:min_leaves_14 +# @template timber_test:arena +# @timeout 200 +# @skyaccess true + +function timber_test:platform +function timber_test:tree {feature:"minecraft:oak"} +assert block ~20 ~ ~20 #minecraft:logs +assert block ~20 ~2 ~20 #minecraft:logs + +await delay 1s +function timber_test:count_logs {test:"settings_min_leaves_14_keeps_oak"} +function timber_test:player {name:"minl14_t",axe:"minecraft:iron_axe"} +dummy minl14_t mine ~20 ~0 ~20 + +# wait until the datapack has had its chance to act +# (await doesn't work inside a called function, so this block is repeated in every test) +# 1. the mined log is gone: the dummy hit the tree +# 2. five ticks pass: the datapack reacts to the mined block in the next tick or two +# 3. no marker is left in the arena +await not block ~20 ~0 ~20 #minecraft:logs +await delay 5t +await not entity @e[type=minecraft:marker,dx=39,dy=39,dz=39] + +function timber_test:assert_only_mined_gone {test:"settings_min_leaves_14_keeps_oak"} diff --git a/tests/data/timber_test/test/settings_no_destroy_leaves.mcfunction b/tests/data/timber_test/test/settings_no_destroy_leaves.mcfunction new file mode 100644 index 0000000..ce0d5eb --- /dev/null +++ b/tests/data/timber_test/test/settings_no_destroy_leaves.mcfunction @@ -0,0 +1,26 @@ +#> With destroy_leaves off the tree is chopped but its leaves stay +# @environment timber_test:no_destroy_leaves +# @template timber_test:arena +# @timeout 200 +# @skyaccess true + +function timber_test:platform +function timber_test:tree {feature:"minecraft:oak"} +assert block ~20 ~ ~20 #minecraft:logs +assert block ~20 ~2 ~20 #minecraft:logs + +await delay 1s +function timber_test:count_leaves {test:"settings_no_destroy_leaves"} +function timber_test:player {name:"nodl_t",axe:"minecraft:iron_axe"} +dummy nodl_t mine ~20 ~0 ~20 + +# wait until the datapack has had its chance to act +# (await doesn't work inside a called function, so this block is repeated in every test) +# 1. the mined log is gone: the dummy hit the tree +# 2. five ticks pass: the datapack reacts to the mined block in the next tick or two +# 3. no marker is left in the arena +await not block ~20 ~0 ~20 #minecraft:logs +await delay 5t +await not entity @e[type=minecraft:marker,dx=39,dy=39,dz=39] + +function timber_test:assert_logs_gone_leaves_kept {test:"settings_no_destroy_leaves"} diff --git a/tests/data/timber_test/test/settings_persistent_on_counts_placed_leaves.mcfunction b/tests/data/timber_test/test/settings_persistent_on_counts_placed_leaves.mcfunction new file mode 100644 index 0000000..772ab78 --- /dev/null +++ b/tests/data/timber_test/test/settings_persistent_on_counts_placed_leaves.mcfunction @@ -0,0 +1,30 @@ +#> With persistent on leaves placed by a player count: a log stack with 5 of them is chopped +# @environment timber_test:persistent_on +# @template timber_test:arena +# @timeout 200 +# @skyaccess true + +function timber_test:platform +# a column of 6 logs with 5 leaves placed by a player (persistent=true) +fill ~20 ~0 ~20 ~20 ~5 ~20 minecraft:oak_log +setblock ~21 ~3 ~20 minecraft:oak_leaves[distance=1,persistent=true] +setblock ~19 ~3 ~20 minecraft:oak_leaves[distance=1,persistent=true] +setblock ~20 ~3 ~21 minecraft:oak_leaves[distance=1,persistent=true] +setblock ~20 ~3 ~19 minecraft:oak_leaves[distance=1,persistent=true] +setblock ~21 ~4 ~20 minecraft:oak_leaves[distance=1,persistent=true] + +await delay 1s +function timber_test:count_d7 {test:"settings_persistent_on_counts_placed_leaves"} +function timber_test:player {name:"persist_t",axe:"minecraft:iron_axe"} +dummy persist_t mine ~20 ~0 ~20 + +# wait until the datapack has had its chance to act +# (await doesn't work inside a called function, so this block is repeated in every test) +# 1. the mined log is gone: the dummy hit the tree +# 2. five ticks pass: the datapack reacts to the mined block in the next tick or two +# 3. no marker is left in the arena +await not block ~20 ~0 ~20 #minecraft:logs +await delay 5t +await not entity @e[type=minecraft:marker,dx=39,dy=39,dz=39] + +function timber_test:assert_no_tree {test:"settings_persistent_on_counts_placed_leaves"} diff --git a/tests/data/timber_test/test/settings_plant_sapling_default_keeps_the_item.mcfunction b/tests/data/timber_test/test/settings_plant_sapling_default_keeps_the_item.mcfunction new file mode 100644 index 0000000..d030587 --- /dev/null +++ b/tests/data/timber_test/test/settings_plant_sapling_default_keeps_the_item.mcfunction @@ -0,0 +1,13 @@ +#> By default a sapling item stays an item: nothing is planted +# @environment timber_test:group_2 +# @template timber_test:arena +# @timeout 400 +# @skyaccess true + +function timber_test:platform +summon minecraft:item ~10.5 ~0.5 ~10.5 {Item:{id:"minecraft:oak_sapling",count:1}} + +# longer than the 2 seconds of the loop, three times over +await delay 7s +assert entity @e[type=minecraft:item,dx=39,dy=39,dz=39,nbt={Item:{id:"minecraft:oak_sapling"}}] +assert block ~10 ~ ~10 minecraft:air diff --git a/tests/data/timber_test/test/settings_plant_sapling_on_plants_the_sapling.mcfunction b/tests/data/timber_test/test/settings_plant_sapling_on_plants_the_sapling.mcfunction new file mode 100644 index 0000000..daf0b2d --- /dev/null +++ b/tests/data/timber_test/test/settings_plant_sapling_on_plants_the_sapling.mcfunction @@ -0,0 +1,11 @@ +#> With plant_sapling on a sapling item that lies on the ground is planted (the loop checks every 2 seconds) +# @environment timber_test:plant_sapling_on +# @template timber_test:arena +# @timeout 400 +# @skyaccess true + +function timber_test:platform +summon minecraft:item ~10.5 ~0.5 ~10.5 {Item:{id:"minecraft:oak_sapling",count:1}} + +# the sapling item falls on the dirt, the loop runs every 2 seconds +await block ~10 ~ ~10 minecraft:oak_sapling diff --git a/tests/data/timber_test/test/settings_slow_chop_blocks_per_chop.mcfunction b/tests/data/timber_test/test/settings_slow_chop_blocks_per_chop.mcfunction new file mode 100644 index 0000000..88316f0 --- /dev/null +++ b/tests/data/timber_test/test/settings_slow_chop_blocks_per_chop.mcfunction @@ -0,0 +1,22 @@ +#> With blocks_per_chop 20 the whole tree (about 60 blocks) is gone after 12 ticks +# @environment timber_test:slow_chop_batch +# @template timber_test:arena +# @timeout 600 +# @skyaccess true + +function timber_test:platform +function timber_test:tree {feature:"minecraft:oak"} +assert block ~20 ~ ~20 #minecraft:logs + +await delay 1s +function timber_test:count_d7 {test:"settings_slow_chop_blocks_per_chop"} +function timber_test:player {name:"slowbat_t",axe:"minecraft:iron_axe"} +function timber_test:mine {name:"slowbat_t"} + +# the base log is gone: the dummy hit the tree +await not block ~20 ~ ~20 #minecraft:logs +await delay 12t +# 60 blocks at 20 per tick: done by now +assert not entity @e[type=minecraft:marker,dx=39,dy=39,dz=39] + +function timber_test:assert_no_tree {test:"settings_slow_chop_blocks_per_chop"} diff --git a/tests/data/timber_test/test/settings_slow_chop_ignores_player_placed_leaves.mcfunction b/tests/data/timber_test/test/settings_slow_chop_ignores_player_placed_leaves.mcfunction new file mode 100644 index 0000000..f676993 --- /dev/null +++ b/tests/data/timber_test/test/settings_slow_chop_ignores_player_placed_leaves.mcfunction @@ -0,0 +1,27 @@ +#> With slow chop on, leaves placed by a player still don't make a log stack a tree (the leaves are checked when the chop starts, as the player, not in the slow loop) +# @environment timber_test:slow_chop_on +# @template timber_test:arena +# @timeout 200 +# @skyaccess true + +function timber_test:platform +# a column of 6 logs with 5 leaves placed by a player (persistent=true) +fill ~20 ~0 ~20 ~20 ~5 ~20 minecraft:oak_log +setblock ~21 ~3 ~20 minecraft:oak_leaves[distance=1,persistent=true] +setblock ~19 ~3 ~20 minecraft:oak_leaves[distance=1,persistent=true] +setblock ~20 ~3 ~21 minecraft:oak_leaves[distance=1,persistent=true] +setblock ~20 ~3 ~19 minecraft:oak_leaves[distance=1,persistent=true] +setblock ~21 ~4 ~20 minecraft:oak_leaves[distance=1,persistent=true] + +await delay 1s +function timber_test:count_logs {test:"settings_slow_chop_ignores_player_placed_leaves"} +function timber_test:player {name:"slow_placed_t",axe:"minecraft:iron_axe"} +function timber_test:mine {name:"slow_placed_t"} + +# wait until the datapack has had its chance to act +# (await doesn't work inside a called function, so this block is repeated in every test) +await not block ~20 ~ ~20 #minecraft:logs +await delay 10t +await not entity @e[type=minecraft:marker,dx=39,dy=39,dz=39] + +function timber_test:assert_only_mined_gone {test:"settings_slow_chop_ignores_player_placed_leaves"} diff --git a/tests/data/timber_test/test/settings_slow_chop_removes_blocks_gradually.mcfunction b/tests/data/timber_test/test/settings_slow_chop_removes_blocks_gradually.mcfunction new file mode 100644 index 0000000..ac72598 --- /dev/null +++ b/tests/data/timber_test/test/settings_slow_chop_removes_blocks_gradually.mcfunction @@ -0,0 +1,29 @@ +#> With slow_chop on the tree is chopped block by block: after 10 ticks it is still going, in the end it is all gone +# @environment timber_test:slow_chop_on +# @template timber_test:arena +# @timeout 600 +# @skyaccess true + +function timber_test:platform +function timber_test:tree {feature:"minecraft:oak"} +assert block ~20 ~ ~20 #minecraft:logs + +await delay 1s +function timber_test:count_d7 {test:"settings_slow_chop_removes_blocks_gradually"} +function timber_test:player {name:"slow_t",axe:"minecraft:iron_axe"} +function timber_test:mine {name:"slow_t"} + +# the base log is gone: the dummy hit the tree +await not block ~20 ~ ~20 #minecraft:logs +await delay 10t +# still going: markers of the blocks that are still to go, and most of the leaves are there +assert entity @e[type=minecraft:marker,dx=39,dy=39,dz=39] +execute store result score #remaining timber_test run clone ~0 ~0 ~0 ~39 ~19 ~39 ~0 ~64 ~0 filtered #minecraft:leaves +fill ~0 ~64 ~0 ~39 ~83 ~39 minecraft:air +assert score #remaining timber_test matches 30.. + +# wait until the slow chop is done: no marker is left in the arena +# (await doesn't work inside a called function, so this block is repeated in every test) +await not entity @e[type=minecraft:marker,dx=39,dy=39,dz=39] + +function timber_test:assert_no_tree {test:"settings_slow_chop_removes_blocks_gradually"} diff --git a/tests/data/timber_test/test/settings_slow_chop_time_between_chops.mcfunction b/tests/data/timber_test/test/settings_slow_chop_time_between_chops.mcfunction new file mode 100644 index 0000000..2ce476c --- /dev/null +++ b/tests/data/timber_test/test/settings_slow_chop_time_between_chops.mcfunction @@ -0,0 +1,28 @@ +#> With time_between_chops 10 a block goes every 10 ticks: after 40 ticks only a few are gone +# @environment timber_test:slow_chop_interval +# @template timber_test:arena +# @timeout 2000 +# @skyaccess true + +function timber_test:platform +function timber_test:tree {feature:"minecraft:oak"} +assert block ~20 ~ ~20 #minecraft:logs + +await delay 1s +function timber_test:count_d7 {test:"settings_slow_chop_time_between_chops"} +function timber_test:player {name:"slowint_t",axe:"minecraft:iron_axe"} +function timber_test:mine {name:"slowint_t"} + +# the base log is gone: the dummy hit the tree +await not block ~20 ~ ~20 #minecraft:logs +await delay 40t +assert entity @e[type=minecraft:marker,dx=39,dy=39,dz=39] +execute store result score #remaining timber_test run clone ~0 ~0 ~0 ~39 ~19 ~39 ~0 ~64 ~0 filtered #minecraft:leaves +fill ~0 ~64 ~0 ~39 ~83 ~39 minecraft:air +assert score #remaining timber_test matches 40.. + +# wait until the slow chop is done: no marker is left in the arena +# (await doesn't work inside a called function, so this block is repeated in every test) +await not entity @e[type=minecraft:marker,dx=39,dy=39,dz=39] + +function timber_test:assert_no_tree {test:"settings_slow_chop_time_between_chops"} diff --git a/tests/data/timber_test/test/settings_sneak_only_sneaking_chops.mcfunction b/tests/data/timber_test/test/settings_sneak_only_sneaking_chops.mcfunction new file mode 100644 index 0000000..a6667bd --- /dev/null +++ b/tests/data/timber_test/test/settings_sneak_only_sneaking_chops.mcfunction @@ -0,0 +1,33 @@ +#> With standing off and sneaking on a sneaking player chops +# @environment timber_test:sneak_only +# @template timber_test:arena +# @timeout 200 +# @skyaccess true + +function timber_test:platform +# a column of 6 logs with 5 natural leaves from height 3 on (a random oak can have leaves right above the dummy, then it can't duck) +fill ~20 ~0 ~20 ~20 ~5 ~20 minecraft:oak_log +setblock ~21 ~3 ~20 minecraft:oak_leaves[distance=1,persistent=false] +setblock ~19 ~3 ~20 minecraft:oak_leaves[distance=1,persistent=false] +setblock ~20 ~3 ~21 minecraft:oak_leaves[distance=1,persistent=false] +setblock ~20 ~3 ~19 minecraft:oak_leaves[distance=1,persistent=false] +setblock ~21 ~4 ~20 minecraft:oak_leaves[distance=1,persistent=false] + +await delay 1s +function timber_test:count_d7 {test:"settings_sneak_only_sneaking_chops"} +function timber_test:player {name:"sneakon_t",axe:"minecraft:iron_axe"} +dummy sneakon_t sneak true +# the dummy counts as sneaking a tick or more after the command: wait for it +await entity @e[type=minecraft:player,name=sneakon_t,predicate=timber:sneaking] +dummy sneakon_t mine ~20 ~0 ~20 + +# wait until the datapack has had its chance to act +# (await doesn't work inside a called function, so this block is repeated in every test) +# 1. the mined log is gone: the dummy hit the tree +# 2. five ticks pass: the datapack reacts to the mined block in the next tick or two +# 3. no marker is left in the arena +await not block ~20 ~0 ~20 #minecraft:logs +await delay 5t +await not entity @e[type=minecraft:marker,dx=39,dy=39,dz=39] + +function timber_test:assert_no_tree {test:"settings_sneak_only_sneaking_chops"} diff --git a/tests/data/timber_test/test/settings_sneak_only_standing_no_chop.mcfunction b/tests/data/timber_test/test/settings_sneak_only_standing_no_chop.mcfunction new file mode 100644 index 0000000..5b16fb9 --- /dev/null +++ b/tests/data/timber_test/test/settings_sneak_only_standing_no_chop.mcfunction @@ -0,0 +1,26 @@ +#> With standing off and sneaking on a standing player doesn't chop +# @environment timber_test:sneak_only +# @template timber_test:arena +# @timeout 200 +# @skyaccess true + +function timber_test:platform +function timber_test:tree {feature:"minecraft:oak"} +assert block ~20 ~ ~20 #minecraft:logs +assert block ~20 ~2 ~20 #minecraft:logs + +await delay 1s +function timber_test:count_logs {test:"settings_sneak_only_standing_no_chop"} +function timber_test:player {name:"standoff_t",axe:"minecraft:iron_axe"} +dummy standoff_t mine ~20 ~0 ~20 + +# wait until the datapack has had its chance to act +# (await doesn't work inside a called function, so this block is repeated in every test) +# 1. the mined log is gone: the dummy hit the tree +# 2. five ticks pass: the datapack reacts to the mined block in the next tick or two +# 3. no marker is left in the arena +await not block ~20 ~0 ~20 #minecraft:logs +await delay 5t +await not entity @e[type=minecraft:marker,dx=39,dy=39,dz=39] + +function timber_test:assert_only_mined_gone {test:"settings_sneak_only_standing_no_chop"} diff --git a/tests/data/timber_test/test/settings_sneaking_default_no_chop.mcfunction b/tests/data/timber_test/test/settings_sneaking_default_no_chop.mcfunction new file mode 100644 index 0000000..77bd6bc --- /dev/null +++ b/tests/data/timber_test/test/settings_sneaking_default_no_chop.mcfunction @@ -0,0 +1,33 @@ +#> By default (standing on, sneaking off) a sneaking player doesn't chop +# @environment timber_test:group_3 +# @template timber_test:arena +# @timeout 200 +# @skyaccess true + +function timber_test:platform +# a column of 6 logs with 5 natural leaves from height 3 on (a random oak can have leaves right above the dummy, then it can't duck) +fill ~20 ~0 ~20 ~20 ~5 ~20 minecraft:oak_log +setblock ~21 ~3 ~20 minecraft:oak_leaves[distance=1,persistent=false] +setblock ~19 ~3 ~20 minecraft:oak_leaves[distance=1,persistent=false] +setblock ~20 ~3 ~21 minecraft:oak_leaves[distance=1,persistent=false] +setblock ~20 ~3 ~19 minecraft:oak_leaves[distance=1,persistent=false] +setblock ~21 ~4 ~20 minecraft:oak_leaves[distance=1,persistent=false] + +await delay 1s +function timber_test:count_logs {test:"settings_sneaking_default_no_chop"} +function timber_test:player {name:"sneak_def_t",axe:"minecraft:iron_axe"} +dummy sneak_def_t sneak true +# the dummy counts as sneaking a tick or more after the command: wait for it +await entity @e[type=minecraft:player,name=sneak_def_t,predicate=timber:sneaking] +dummy sneak_def_t mine ~20 ~0 ~20 + +# wait until the datapack has had its chance to act +# (await doesn't work inside a called function, so this block is repeated in every test) +# 1. the mined log is gone: the dummy hit the tree +# 2. five ticks pass: the datapack reacts to the mined block in the next tick or two +# 3. no marker is left in the arena +await not block ~20 ~0 ~20 #minecraft:logs +await delay 5t +await not entity @e[type=minecraft:marker,dx=39,dy=39,dz=39] + +function timber_test:assert_only_mined_gone {test:"settings_sneaking_default_no_chop"} diff --git a/tests/data/timber_test/test/settings_start_chop_on_root_default_chops.mcfunction b/tests/data/timber_test/test/settings_start_chop_on_root_default_chops.mcfunction new file mode 100644 index 0000000..4847b40 --- /dev/null +++ b/tests/data/timber_test/test/settings_start_chop_on_root_default_chops.mcfunction @@ -0,0 +1,37 @@ +#> By default mining a root chops the mangrove (start_chop_on_root is on) +# @environment timber_test:group_4 +# @template timber_test:arena +# @timeout 200 +# @skyaccess true + +function timber_test:platform +# a mangrove: 6 logs from height 1 on, 6 roots (three sides at height 1 and below them), 5 natural leaves. The dummy stands on the fourth side +fill ~20 ~1 ~20 ~20 ~6 ~20 minecraft:mangrove_log +setblock ~21 ~1 ~20 minecraft:mangrove_roots +setblock ~20 ~1 ~21 minecraft:mangrove_roots +setblock ~20 ~1 ~19 minecraft:mangrove_roots +setblock ~21 ~0 ~20 minecraft:mangrove_roots +setblock ~20 ~0 ~21 minecraft:mangrove_roots +setblock ~20 ~0 ~19 minecraft:mangrove_roots +setblock ~21 ~4 ~20 minecraft:mangrove_leaves[distance=1,persistent=false] +setblock ~19 ~4 ~20 minecraft:mangrove_leaves[distance=1,persistent=false] +setblock ~20 ~4 ~21 minecraft:mangrove_leaves[distance=1,persistent=false] +setblock ~20 ~4 ~19 minecraft:mangrove_leaves[distance=1,persistent=false] +setblock ~20 ~7 ~20 minecraft:mangrove_leaves[distance=1,persistent=false] + +await delay 1s +function timber_test:count_d7 {test:"settings_start_chop_on_root_default_chops"} +function timber_test:player {name:"root_start_t",axe:"minecraft:iron_axe"} +dummy root_start_t mine ~21 ~1 ~20 + +# wait until the datapack has had its chance to act +# (await doesn't work inside a called function, so this block is repeated in every test) +# 1. the mined block is gone: the dummy hit the tree +# 2. five ticks pass: the datapack reacts to the mined block in the next tick or two +# 3. no marker is left in the arena +await not block ~21 ~1 ~20 minecraft:mangrove_roots +await delay 5t +await not entity @e[type=minecraft:marker,dx=39,dy=39,dz=39] + +function timber_test:assert_no_roots +function timber_test:assert_no_tree {test:"settings_start_chop_on_root_default_chops"} diff --git a/tests/data/timber_test/test/settings_start_chop_on_root_off_no_chop.mcfunction b/tests/data/timber_test/test/settings_start_chop_on_root_off_no_chop.mcfunction new file mode 100644 index 0000000..689cb44 --- /dev/null +++ b/tests/data/timber_test/test/settings_start_chop_on_root_off_no_chop.mcfunction @@ -0,0 +1,36 @@ +#> With start_chop_on_root off mining a root doesn't chop: all 6 logs stay +# @environment timber_test:start_chop_on_root_off +# @template timber_test:arena +# @timeout 200 +# @skyaccess true + +function timber_test:platform +# a mangrove: 6 logs from height 1 on, 6 roots (three sides at height 1 and below them), 5 natural leaves. The dummy stands on the fourth side +fill ~20 ~1 ~20 ~20 ~6 ~20 minecraft:mangrove_log +setblock ~21 ~1 ~20 minecraft:mangrove_roots +setblock ~20 ~1 ~21 minecraft:mangrove_roots +setblock ~20 ~1 ~19 minecraft:mangrove_roots +setblock ~21 ~0 ~20 minecraft:mangrove_roots +setblock ~20 ~0 ~21 minecraft:mangrove_roots +setblock ~20 ~0 ~19 minecraft:mangrove_roots +setblock ~21 ~4 ~20 minecraft:mangrove_leaves[distance=1,persistent=false] +setblock ~19 ~4 ~20 minecraft:mangrove_leaves[distance=1,persistent=false] +setblock ~20 ~4 ~21 minecraft:mangrove_leaves[distance=1,persistent=false] +setblock ~20 ~4 ~19 minecraft:mangrove_leaves[distance=1,persistent=false] +setblock ~20 ~7 ~20 minecraft:mangrove_leaves[distance=1,persistent=false] + +await delay 1s +function timber_test:count_d7 {test:"settings_start_chop_on_root_off_no_chop"} +function timber_test:player {name:"root_off_t",axe:"minecraft:iron_axe"} +dummy root_off_t mine ~21 ~1 ~20 + +# wait until the datapack has had its chance to act +# (await doesn't work inside a called function, so this block is repeated in every test) +# 1. the mined block is gone: the dummy hit the tree +# 2. five ticks pass: the datapack reacts to the mined block in the next tick or two +# 3. no marker is left in the arena +await not block ~21 ~1 ~20 minecraft:mangrove_roots +await delay 5t +await not entity @e[type=minecraft:marker,dx=39,dy=39,dz=39] + +function timber_test:assert_logs_left {n:6} diff --git a/tests/data/timber_test/test/settings_stop_chopping_off_chops_the_tree_with_a_worn_axe.mcfunction b/tests/data/timber_test/test/settings_stop_chopping_off_chops_the_tree_with_a_worn_axe.mcfunction new file mode 100644 index 0000000..e702d5d --- /dev/null +++ b/tests/data/timber_test/test/settings_stop_chopping_off_chops_the_tree_with_a_worn_axe.mcfunction @@ -0,0 +1,26 @@ +#> By default (stop_chopping off) a tree is chopped completely even if the axe breaks on the way +# @environment timber_test:group_5 +# @template timber_test:arena +# @timeout 200 +# @skyaccess true + +function timber_test:platform +function timber_test:tree {feature:"minecraft:oak"} +assert block ~20 ~ ~20 #minecraft:logs + +await delay 1s +function timber_test:count_d7 {test:"settings_stop_chopping_off_chops_the_tree_with_a_worn_axe"} +function timber_test:player {name:"worn_off_t",axe:"minecraft:iron_axe"} +item replace entity @e[type=minecraft:player,name=worn_off_t,limit=1] weapon.mainhand with minecraft:iron_axe[minecraft:damage=248] +function timber_test:mine {name:"worn_off_t"} + +# wait until the datapack has had its chance to act +# (await doesn't work inside a called function, so this block is repeated in every test) +# 1. the base log is gone: the dummy hit the tree +# 2. five ticks pass: the datapack reacts to the mined block in the next tick or two +# 3. no marker is left in the arena +await not block ~20 ~ ~20 #minecraft:logs +await delay 5t +await not entity @e[type=minecraft:marker,dx=39,dy=39,dz=39] + +function timber_test:assert_no_tree {test:"settings_stop_chopping_off_chops_the_tree_with_a_worn_axe"} diff --git a/tests/data/timber_test/test/settings_stop_chopping_on_stops_with_a_worn_axe.mcfunction b/tests/data/timber_test/test/settings_stop_chopping_on_stops_with_a_worn_axe.mcfunction new file mode 100644 index 0000000..b38f156 --- /dev/null +++ b/tests/data/timber_test/test/settings_stop_chopping_on_stops_with_a_worn_axe.mcfunction @@ -0,0 +1,27 @@ +#> With stop_chopping on a tree is chopped only as far as the axe lasts: logs stay +# @environment timber_test:stop_chopping_on +# @template timber_test:arena +# @timeout 200 +# @skyaccess true + +function timber_test:platform +function timber_test:tree {feature:"minecraft:oak"} +assert block ~20 ~ ~20 #minecraft:logs + +await delay 1s +function timber_test:count_logs {test:"settings_stop_chopping_on_stops_with_a_worn_axe"} +function timber_test:player {name:"worn_on_t",axe:"minecraft:iron_axe"} +item replace entity @e[type=minecraft:player,name=worn_on_t,limit=1] weapon.mainhand with minecraft:iron_axe[minecraft:damage=248] +function timber_test:mine {name:"worn_on_t"} + +# wait until the datapack has had its chance to act +# (await doesn't work inside a called function, so this block is repeated in every test) +# 1. the base log is gone: the dummy hit the tree +# 2. five ticks pass: the datapack reacts to the mined block in the next tick or two +# 3. no marker is left in the arena +await not block ~20 ~ ~20 #minecraft:logs +await delay 5t +await not entity @e[type=minecraft:marker,dx=39,dy=39,dz=39] + +# the axe can take about two more blocks: the chop stops, some logs are left (a full oak has 4 to 6) +function timber_test:assert_logs_left {n:"1.."} diff --git a/tests/data/timber_test/test/settings_toggle_off_player_does_not_chop.mcfunction b/tests/data/timber_test/test/settings_toggle_off_player_does_not_chop.mcfunction new file mode 100644 index 0000000..010a4a2 --- /dev/null +++ b/tests/data/timber_test/test/settings_toggle_off_player_does_not_chop.mcfunction @@ -0,0 +1,26 @@ +#> A player who switched Timber off with the TimberToggle trigger doesn't chop +# @template timber_test:arena +# @timeout 200 +# @skyaccess true + +scoreboard objectives add timber_test dummy +function timber_test:platform +function timber_test:tree {feature:"minecraft:oak"} +assert block ~20 ~ ~20 #minecraft:logs + +await delay 1s +function timber_test:count_logs {test:"settings_toggle_off_player_does_not_chop"} +function timber_test:player {name:"toggle_off_t",axe:"minecraft:iron_axe"} +# the datapack runs every tick and handles the trigger, the score timber_disabled says that the player is switched off +scoreboard players set toggle_off_t TimberToggle 1 +await score toggle_off_t timber_disabled matches 1 + +function timber_test:mine {name:"toggle_off_t"} + +# wait until the datapack has had its chance to act +# (await doesn't work inside a called function, so this block is repeated in every test) +await not block ~20 ~ ~20 #minecraft:logs +await delay 5t +await not entity @e[type=minecraft:marker,dx=39,dy=39,dz=39] + +function timber_test:assert_only_mined_gone {test:"settings_toggle_off_player_does_not_chop"} diff --git a/tests/data/timber_test/test/settings_toggle_twice_player_chops_again.mcfunction b/tests/data/timber_test/test/settings_toggle_twice_player_chops_again.mcfunction new file mode 100644 index 0000000..c3e30a4 --- /dev/null +++ b/tests/data/timber_test/test/settings_toggle_twice_player_chops_again.mcfunction @@ -0,0 +1,28 @@ +#> A player who switched Timber off and on again with the TimberToggle trigger chops +# @template timber_test:arena +# @timeout 200 +# @skyaccess true + +scoreboard objectives add timber_test dummy +function timber_test:platform +function timber_test:tree {feature:"minecraft:oak"} +assert block ~20 ~ ~20 #minecraft:logs + +await delay 1s +function timber_test:count_d7 {test:"settings_toggle_twice_player_chops_again"} +function timber_test:player {name:"toggle_on_t",axe:"minecraft:iron_axe"} +scoreboard players set toggle_on_t TimberToggle 1 +await score toggle_on_t timber_disabled matches 1 +# the trigger has to be enabled again before the next use, the datapack does that every tick +scoreboard players set toggle_on_t TimberToggle 1 +await score toggle_on_t timber_disabled matches 0 + +function timber_test:mine {name:"toggle_on_t"} + +# wait until the datapack has had its chance to act +# (await doesn't work inside a called function, so this block is repeated in every test) +await not block ~20 ~ ~20 #minecraft:logs +await delay 5t +await not entity @e[type=minecraft:marker,dx=39,dy=39,dz=39] + +function timber_test:assert_no_tree {test:"settings_toggle_twice_player_chops_again"} diff --git a/tests/data/timber_test/test/settings_wear_out_default_damages_axe.mcfunction b/tests/data/timber_test/test/settings_wear_out_default_damages_axe.mcfunction new file mode 100644 index 0000000..91c1f75 --- /dev/null +++ b/tests/data/timber_test/test/settings_wear_out_default_damages_axe.mcfunction @@ -0,0 +1,28 @@ +#> By default chopping damages the axe more than the one block that was mined (vanilla takes 1) +# @environment timber_test:group_1 +# @template timber_test:arena +# @timeout 200 +# @skyaccess true + +function timber_test:platform +function timber_test:tree {feature:"minecraft:oak"} +assert block ~20 ~ ~20 #minecraft:logs +assert block ~20 ~2 ~20 #minecraft:logs + +await delay 1s +function timber_test:player {name:"wear_def_t",axe:"minecraft:iron_axe"} +dummy wear_def_t mine ~20 ~0 ~20 + +# wait until the datapack has had its chance to act +# (await doesn't work inside a called function, so this block is repeated in every test) +# 1. the mined log is gone: the dummy hit the tree +# 2. five ticks pass: the datapack reacts to the mined block in the next tick or two +# 3. no marker is left in the arena +await not block ~20 ~0 ~20 #minecraft:logs +await delay 5t +await not entity @e[type=minecraft:marker,dx=39,dy=39,dz=39] + +scoreboard objectives add timber_test dummy +scoreboard players set #dmg timber_test 0 +execute store result score #dmg timber_test run data get entity @e[type=minecraft:player,name=wear_def_t,limit=1] SelectedItem.components."minecraft:damage" +assert score #dmg timber_test matches 2.. diff --git a/tests/data/timber_test/test/settings_wear_out_off_keeps_axe.mcfunction b/tests/data/timber_test/test/settings_wear_out_off_keeps_axe.mcfunction new file mode 100644 index 0000000..5df40ae --- /dev/null +++ b/tests/data/timber_test/test/settings_wear_out_off_keeps_axe.mcfunction @@ -0,0 +1,28 @@ +#> With wear_out off only the mined block damages the axe (vanilla takes 1) +# @environment timber_test:wear_out_off +# @template timber_test:arena +# @timeout 200 +# @skyaccess true + +function timber_test:platform +function timber_test:tree {feature:"minecraft:oak"} +assert block ~20 ~ ~20 #minecraft:logs +assert block ~20 ~2 ~20 #minecraft:logs + +await delay 1s +function timber_test:player {name:"wear_off_t",axe:"minecraft:iron_axe"} +dummy wear_off_t mine ~20 ~0 ~20 + +# wait until the datapack has had its chance to act +# (await doesn't work inside a called function, so this block is repeated in every test) +# 1. the mined log is gone: the dummy hit the tree +# 2. five ticks pass: the datapack reacts to the mined block in the next tick or two +# 3. no marker is left in the arena +await not block ~20 ~0 ~20 #minecraft:logs +await delay 5t +await not entity @e[type=minecraft:marker,dx=39,dy=39,dz=39] + +scoreboard objectives add timber_test dummy +scoreboard players set #dmg timber_test 0 +execute store result score #dmg timber_test run data get entity @e[type=minecraft:player,name=wear_off_t,limit=1] SelectedItem.components."minecraft:damage" +assert score #dmg timber_test matches 1 diff --git a/tests/data/timber_test/test/uninstall_removes_everything.mcfunction b/tests/data/timber_test/test/uninstall_removes_everything.mcfunction new file mode 100644 index 0000000..8eb5b42 --- /dev/null +++ b/tests/data/timber_test/test/uninstall_removes_everything.mcfunction @@ -0,0 +1,19 @@ +#> After timber:uninstall nothing of the datapack is left: no scoreboard or trigger, no storage key, no scheduled function +# @environment timber_test:uninstall +# @timeout 100 + +# The checks are generated from the code of the datapack by .github/scripts/gen-uninstall-check.py (the workflow runs it before the tests): +# one per "scoreboard objectives add", storage key and "schedule function" in any function. So a scoreboard, trigger, storage or schedule that is +# added and forgotten in uninstall.mcfunction makes this fail, with its name. +# The storage keys get a value first, so there is something to remove. +scoreboard objectives add timber_test dummy +scoreboard players set #uninstall_prepare_ran timber_test 0 +scoreboard players set #uninstall_check_ran timber_test 0 +function timber_test:generated/uninstall_prepare +function timber:uninstall +function timber_test:generated/uninstall_objectives + +# The generated functions set these markers in their first line. PackTest doesn't complain about a function that doesn't exist, so without +# the markers a missing generation step (a workflow that forgot it, a wrong path) would leave a test that checks nothing and passes. +assert score #uninstall_prepare_ran timber_test matches 1 +assert score #uninstall_check_ran timber_test matches 1 diff --git a/tests/data/timber_test/test_environment/axes_off.json b/tests/data/timber_test/test_environment/axes_off.json new file mode 100644 index 0000000..7788f20 --- /dev/null +++ b/tests/data/timber_test/test_environment/axes_off.json @@ -0,0 +1,5 @@ +{ + "type": "minecraft:function", + "setup": "timber_test:env/axes_off_setup", + "teardown": "timber_test:env/axes_off_teardown" +} diff --git a/tests/data/timber_test/test_environment/chop_down_on.json b/tests/data/timber_test/test_environment/chop_down_on.json new file mode 100644 index 0000000..64d737b --- /dev/null +++ b/tests/data/timber_test/test_environment/chop_down_on.json @@ -0,0 +1,5 @@ +{ + "type": "minecraft:function", + "setup": "timber_test:env/chop_down_on_setup", + "teardown": "timber_test:env/chop_down_on_teardown" +} diff --git a/tests/data/timber_test/test_environment/chop_fungi_on.json b/tests/data/timber_test/test_environment/chop_fungi_on.json new file mode 100644 index 0000000..0e24136 --- /dev/null +++ b/tests/data/timber_test/test_environment/chop_fungi_on.json @@ -0,0 +1,5 @@ +{ + "type": "minecraft:function", + "setup": "timber_test:env/chop_fungi_on_setup", + "teardown": "timber_test:env/chop_fungi_on_teardown" +} diff --git a/tests/data/timber_test/test_environment/chop_trees_off.json b/tests/data/timber_test/test_environment/chop_trees_off.json new file mode 100644 index 0000000..37c10bf --- /dev/null +++ b/tests/data/timber_test/test_environment/chop_trees_off.json @@ -0,0 +1,5 @@ +{ + "type": "minecraft:function", + "setup": "timber_test:env/chop_trees_off_setup", + "teardown": "timber_test:env/chop_trees_off_teardown" +} diff --git a/tests/data/timber_test/test_environment/destroy_roots_off.json b/tests/data/timber_test/test_environment/destroy_roots_off.json new file mode 100644 index 0000000..7869248 --- /dev/null +++ b/tests/data/timber_test/test_environment/destroy_roots_off.json @@ -0,0 +1,5 @@ +{ + "type": "minecraft:function", + "setup": "timber_test:env/destroy_roots_off_setup", + "teardown": "timber_test:env/destroy_roots_off_teardown" +} diff --git a/tests/data/timber_test/test_environment/drop_loot_on.json b/tests/data/timber_test/test_environment/drop_loot_on.json new file mode 100644 index 0000000..14fead6 --- /dev/null +++ b/tests/data/timber_test/test_environment/drop_loot_on.json @@ -0,0 +1,5 @@ +{ + "type": "minecraft:function", + "setup": "timber_test:env/drop_loot_on_setup", + "teardown": "timber_test:env/drop_loot_on_teardown" +} diff --git a/tests/data/timber_test/test_environment/flip_admin.json b/tests/data/timber_test/test_environment/flip_admin.json new file mode 100644 index 0000000..a094d55 --- /dev/null +++ b/tests/data/timber_test/test_environment/flip_admin.json @@ -0,0 +1,5 @@ +{ + "type": "minecraft:function", + "setup": "timber_test:env/flip_admin_setup", + "teardown": "timber_test:env/flip_admin_teardown" +} diff --git a/tests/data/timber_test/test_environment/flip_guards.json b/tests/data/timber_test/test_environment/flip_guards.json new file mode 100644 index 0000000..49b2983 --- /dev/null +++ b/tests/data/timber_test/test_environment/flip_guards.json @@ -0,0 +1,5 @@ +{ + "type": "minecraft:function", + "setup": "timber_test:env/flip_guards_setup", + "teardown": "timber_test:env/flip_guards_teardown" +} diff --git a/tests/data/timber_test/test_environment/flip_sliders.json b/tests/data/timber_test/test_environment/flip_sliders.json new file mode 100644 index 0000000..28ecc52 --- /dev/null +++ b/tests/data/timber_test/test_environment/flip_sliders.json @@ -0,0 +1,5 @@ +{ + "type": "minecraft:function", + "setup": "timber_test:env/flip_sliders_setup", + "teardown": "timber_test:env/flip_sliders_teardown" +} diff --git a/tests/data/timber_test/test_environment/flip_toggles.json b/tests/data/timber_test/test_environment/flip_toggles.json new file mode 100644 index 0000000..2115dff --- /dev/null +++ b/tests/data/timber_test/test_environment/flip_toggles.json @@ -0,0 +1,5 @@ +{ + "type": "minecraft:function", + "setup": "timber_test:env/flip_toggles_setup", + "teardown": "timber_test:env/flip_toggles_teardown" +} diff --git a/tests/data/timber_test/test_environment/group_1.json b/tests/data/timber_test/test_environment/group_1.json new file mode 100644 index 0000000..c1a66db --- /dev/null +++ b/tests/data/timber_test/test_environment/group_1.json @@ -0,0 +1,5 @@ +{ + "type": "minecraft:function", + "setup": "timber_test:env/group_setup", + "teardown": "timber_test:env/group_teardown" +} diff --git a/tests/data/timber_test/test_environment/group_2.json b/tests/data/timber_test/test_environment/group_2.json new file mode 100644 index 0000000..c1a66db --- /dev/null +++ b/tests/data/timber_test/test_environment/group_2.json @@ -0,0 +1,5 @@ +{ + "type": "minecraft:function", + "setup": "timber_test:env/group_setup", + "teardown": "timber_test:env/group_teardown" +} diff --git a/tests/data/timber_test/test_environment/group_3.json b/tests/data/timber_test/test_environment/group_3.json new file mode 100644 index 0000000..c1a66db --- /dev/null +++ b/tests/data/timber_test/test_environment/group_3.json @@ -0,0 +1,5 @@ +{ + "type": "minecraft:function", + "setup": "timber_test:env/group_setup", + "teardown": "timber_test:env/group_teardown" +} diff --git a/tests/data/timber_test/test_environment/group_4.json b/tests/data/timber_test/test_environment/group_4.json new file mode 100644 index 0000000..c1a66db --- /dev/null +++ b/tests/data/timber_test/test_environment/group_4.json @@ -0,0 +1,5 @@ +{ + "type": "minecraft:function", + "setup": "timber_test:env/group_setup", + "teardown": "timber_test:env/group_teardown" +} diff --git a/tests/data/timber_test/test_environment/group_5.json b/tests/data/timber_test/test_environment/group_5.json new file mode 100644 index 0000000..c1a66db --- /dev/null +++ b/tests/data/timber_test/test_environment/group_5.json @@ -0,0 +1,5 @@ +{ + "type": "minecraft:function", + "setup": "timber_test:env/group_setup", + "teardown": "timber_test:env/group_teardown" +} diff --git a/tests/data/timber_test/test_environment/hunger_on.json b/tests/data/timber_test/test_environment/hunger_on.json new file mode 100644 index 0000000..2a9d123 --- /dev/null +++ b/tests/data/timber_test/test_environment/hunger_on.json @@ -0,0 +1,5 @@ +{ + "type": "minecraft:function", + "setup": "timber_test:env/hunger_on_setup", + "teardown": "timber_test:env/hunger_on_teardown" +} diff --git a/tests/data/timber_test/test_environment/min_leaves_13.json b/tests/data/timber_test/test_environment/min_leaves_13.json new file mode 100644 index 0000000..e262400 --- /dev/null +++ b/tests/data/timber_test/test_environment/min_leaves_13.json @@ -0,0 +1,5 @@ +{ + "type": "minecraft:function", + "setup": "timber_test:env/min_leaves_13_setup", + "teardown": "timber_test:env/min_leaves_13_teardown" +} diff --git a/tests/data/timber_test/test_environment/min_leaves_14.json b/tests/data/timber_test/test_environment/min_leaves_14.json new file mode 100644 index 0000000..016bbb7 --- /dev/null +++ b/tests/data/timber_test/test_environment/min_leaves_14.json @@ -0,0 +1,5 @@ +{ + "type": "minecraft:function", + "setup": "timber_test:env/min_leaves_14_setup", + "teardown": "timber_test:env/min_leaves_14_teardown" +} diff --git a/tests/data/timber_test/test_environment/no_destroy_leaves.json b/tests/data/timber_test/test_environment/no_destroy_leaves.json new file mode 100644 index 0000000..f854745 --- /dev/null +++ b/tests/data/timber_test/test_environment/no_destroy_leaves.json @@ -0,0 +1,5 @@ +{ + "type": "minecraft:function", + "setup": "timber_test:env/no_destroy_leaves_setup", + "teardown": "timber_test:env/no_destroy_leaves_teardown" +} diff --git a/tests/data/timber_test/test_environment/persistent_on.json b/tests/data/timber_test/test_environment/persistent_on.json new file mode 100644 index 0000000..f736ecc --- /dev/null +++ b/tests/data/timber_test/test_environment/persistent_on.json @@ -0,0 +1,5 @@ +{ + "type": "minecraft:function", + "setup": "timber_test:env/persistent_on_setup", + "teardown": "timber_test:env/persistent_on_teardown" +} diff --git a/tests/data/timber_test/test_environment/plant_sapling_on.json b/tests/data/timber_test/test_environment/plant_sapling_on.json new file mode 100644 index 0000000..bc02358 --- /dev/null +++ b/tests/data/timber_test/test_environment/plant_sapling_on.json @@ -0,0 +1,5 @@ +{ + "type": "minecraft:function", + "setup": "timber_test:env/plant_sapling_on_setup", + "teardown": "timber_test:env/plant_sapling_on_teardown" +} diff --git a/tests/data/timber_test/test_environment/slow_chop_batch.json b/tests/data/timber_test/test_environment/slow_chop_batch.json new file mode 100644 index 0000000..1be042e --- /dev/null +++ b/tests/data/timber_test/test_environment/slow_chop_batch.json @@ -0,0 +1,5 @@ +{ + "type": "minecraft:function", + "setup": "timber_test:env/slow_chop_batch_setup", + "teardown": "timber_test:env/slow_chop_batch_teardown" +} diff --git a/tests/data/timber_test/test_environment/slow_chop_interval.json b/tests/data/timber_test/test_environment/slow_chop_interval.json new file mode 100644 index 0000000..1d1196a --- /dev/null +++ b/tests/data/timber_test/test_environment/slow_chop_interval.json @@ -0,0 +1,5 @@ +{ + "type": "minecraft:function", + "setup": "timber_test:env/slow_chop_interval_setup", + "teardown": "timber_test:env/slow_chop_interval_teardown" +} diff --git a/tests/data/timber_test/test_environment/slow_chop_on.json b/tests/data/timber_test/test_environment/slow_chop_on.json new file mode 100644 index 0000000..6277bce --- /dev/null +++ b/tests/data/timber_test/test_environment/slow_chop_on.json @@ -0,0 +1,5 @@ +{ + "type": "minecraft:function", + "setup": "timber_test:env/slow_chop_on_setup", + "teardown": "timber_test:env/slow_chop_on_teardown" +} diff --git a/tests/data/timber_test/test_environment/sneak_only.json b/tests/data/timber_test/test_environment/sneak_only.json new file mode 100644 index 0000000..1209613 --- /dev/null +++ b/tests/data/timber_test/test_environment/sneak_only.json @@ -0,0 +1,5 @@ +{ + "type": "minecraft:function", + "setup": "timber_test:env/sneak_only_setup", + "teardown": "timber_test:env/sneak_only_teardown" +} diff --git a/tests/data/timber_test/test_environment/start_chop_on_root_off.json b/tests/data/timber_test/test_environment/start_chop_on_root_off.json new file mode 100644 index 0000000..cc0628a --- /dev/null +++ b/tests/data/timber_test/test_environment/start_chop_on_root_off.json @@ -0,0 +1,5 @@ +{ + "type": "minecraft:function", + "setup": "timber_test:env/start_chop_on_root_off_setup", + "teardown": "timber_test:env/start_chop_on_root_off_teardown" +} diff --git a/tests/data/timber_test/test_environment/stop_chopping_on.json b/tests/data/timber_test/test_environment/stop_chopping_on.json new file mode 100644 index 0000000..a686e08 --- /dev/null +++ b/tests/data/timber_test/test_environment/stop_chopping_on.json @@ -0,0 +1,5 @@ +{ + "type": "minecraft:function", + "setup": "timber_test:env/stop_chopping_on_setup", + "teardown": "timber_test:env/stop_chopping_on_teardown" +} diff --git a/tests/data/timber_test/test_environment/tiny_tree_size.json b/tests/data/timber_test/test_environment/tiny_tree_size.json new file mode 100644 index 0000000..fd0e8cd --- /dev/null +++ b/tests/data/timber_test/test_environment/tiny_tree_size.json @@ -0,0 +1,5 @@ +{ + "type": "minecraft:function", + "setup": "timber_test:env/tiny_tree_size_setup", + "teardown": "timber_test:env/tiny_tree_size_teardown" +} diff --git a/tests/data/timber_test/test_environment/uninstall.json b/tests/data/timber_test/test_environment/uninstall.json new file mode 100644 index 0000000..d54f575 --- /dev/null +++ b/tests/data/timber_test/test_environment/uninstall.json @@ -0,0 +1,5 @@ +{ + "type": "minecraft:function", + "setup": "timber_test:env/uninstall_setup", + "teardown": "timber_test:env/uninstall_teardown" +} diff --git a/tests/data/timber_test/test_environment/wear_out_off.json b/tests/data/timber_test/test_environment/wear_out_off.json new file mode 100644 index 0000000..acbe4b0 --- /dev/null +++ b/tests/data/timber_test/test_environment/wear_out_off.json @@ -0,0 +1,5 @@ +{ + "type": "minecraft:function", + "setup": "timber_test:env/wear_out_off_setup", + "teardown": "timber_test:env/wear_out_off_teardown" +} diff --git a/tests/pack.mcmeta b/tests/pack.mcmeta new file mode 100644 index 0000000..26312cd --- /dev/null +++ b/tests/pack.mcmeta @@ -0,0 +1,8 @@ +{ + "pack": { + "description": "Tests for Timber Datapack (run with PackTest)", + "pack_format": 121.0, + "min_format": 101.0, + "max_format": 121.0 + } +}