uploaded:2020/4/10 engine version:1.14.30.2

葉っぱも処理できるカットオール


アニメーションコントローラー

player.jsonと紐付けするのを忘れないでください。

Dat../animation_controllers/system.json
{
  "format_version": "1.10.0",
  "animation_controllers": {
    "controller.animation.player_cutall_block": {
      "states": {
        "default": {
          "transitions": [
            { "medium": "(1.0)" }
          ],
          "on_entry": [
            "/function cut_acacia_logs",
            "/function cut_big_oak_logs",
            "/function cut_birch_logs",
            "/function cut_jungle_logs",
            "/function cut_oak_logs",
            "/function cut_spruce_logs",
            "/funcrion tag"//これの存在意義は分かりませんが、いちおう残してあります
          ]
        },
        "medium": {
          "transitions": [
            { "default": "(1.0)" }
          ],
          "on_entry": [
            "/function cut_acacia_logs",
            "/function cut_big_oak_logs",
            "/function cut_birch_logs",
            "/function cut_jungle_logs",
            "/function cut_oak_logs",
            "/function cut_spruce_logs"
          ]
        }
      }
    },
    "controller.animation.player_cutall_entity": {
      "states": {
        "default": {
          "transitions": [
            { "medium": "(1.0)" }
          ],
          "on_entry": [
            "/function remove_acacia_leaves",
            "/function remove_big_oak_leaves",
            "/function remove_birch_leaves",
            "/function remove_jungle_leaves",
            "/function remove_oak_leaves",
            "/function remove_spruce_leaves"
          ]
        },
        "medium": {
          "transitions": [
            { "default": "(1.0)" }
          ],
          "on_entry": [
            "/function remove_acacia_leaves",
            "/function remove_big_oak_leaves",
            "/function remove_birch_leaves",
            "/function remove_jungle_leaves",
            "/function remove_oak_leaves",
            "/function remove_spruce_leaves"
          ]
        }
      }
    }
  }
}
Edited

ファンクション

「丸太」と「原木」が混在しているのはわたしのグローバルリソースの影響です。もちろん、両方指定する必要はありません。
そしてもちろんアカシアだけではありませんが、名前などを変えるだけなので省略します。


Dat../functions/cut_acacia_logs.mcfunction
execute @e[name="アカシアの丸太"] ~ ~ ~ detect ~ ~1 ~ log2 0 fill ~ ~1 ~ ~ ~1 ~ air 0 destroy
execute @e[name="アカシアの丸太"] ~ ~ ~ detect ~1 ~1 ~ log2 0 fill ~1 ~1 ~ ~1 ~1 ~ air 0 destroy
execute @e[name="アカシアの丸太"] ~ ~ ~ detect ~-1 ~1 ~ log2 0 fill ~-1 ~1 ~ ~-1 ~1 ~ air 0 destroy
execute @e[name="アカシアの丸太"] ~ ~ ~ detect ~ ~1 ~1 log2 0 fill ~ ~1 ~1 ~ ~1 ~1 air 0 destroy
execute @e[name="アカシアの丸太"] ~ ~ ~ detect ~ ~1 ~-1 log2 0 fill ~ ~1 ~-1 ~ ~1 ~-1 air 0 destroy
execute @e[name="アカシアの丸太"] ~ ~ ~ detect ~ ~-1 ~ log2 0 fill ~ ~-1 ~ ~ ~-1 ~ air 0 destroy
execute @e[name="アカシアの丸太"] ~ ~ ~ detect ~1 ~-1 ~ log2 0 fill ~1 ~-1 ~ ~1 ~-1 ~ air 0 destroy
execute @e[name="アカシアの丸太"] ~ ~ ~ detect ~-1 ~-1 ~ log2 0 fill ~-1 ~-1 ~ ~-1 ~-1 ~ air 0 destroy
execute @e[name="アカシアの丸太"] ~ ~ ~ detect ~ ~-1 ~1 log2 0 fill ~ ~-1 ~1 ~ ~-1 ~1 air 0 destroy
execute @e[name="アカシアの丸太"] ~ ~ ~ detect ~ ~-1 ~-1 log2 0 fill ~ ~-1 ~-1 ~ ~-1 ~-1 air 0 destroy
execute @e[name="アカシアの丸太"] ~ ~ ~ detect ~1 ~ ~ log2 0 fill ~1 ~ ~ ~1 ~ ~ air 0 destroy
execute @e[name="アカシアの丸太"] ~ ~ ~ detect ~1 ~1 ~ log2 0 fill ~1 ~1 ~ ~1 ~1 ~ air 0 destroy
execute @e[name="アカシアの丸太"] ~ ~ ~ detect ~1 ~-1 ~ log2 0 fill ~1 ~-1 ~ ~1 ~-1 ~ air 0 destroy
execute @e[name="アカシアの丸太"] ~ ~ ~ detect ~1 ~ ~1 log2 0 fill ~1 ~ ~1 ~1 ~ ~1 air 0 destroy
execute @e[name="アカシアの丸太"] ~ ~ ~ detect ~1 ~ ~-1 log2 0 fill ~1 ~ ~-1 ~1 ~ ~-1 air 0 destroy
execute @e[name="アカシアの丸太"] ~ ~ ~ detect ~-1 ~1 ~ log2 0 fill ~-1 ~1 ~ ~-1 ~1 ~ air 0 destroy
execute @e[name="アカシアの丸太"] ~ ~ ~ detect ~-1 ~-1 ~ log2 0 fill ~-1 ~-1 ~ ~-1 ~-1 ~ air 0 destroy
execute @e[name="アカシアの丸太"] ~ ~ ~ detect ~-1 ~ ~ log2 0 fill ~-1 ~ ~ ~-1 ~ ~ air 0 destroy
execute @e[name="アカシアの丸太"] ~ ~ ~ detect ~-1 ~ ~1 log2 0 fill ~-1 ~ ~1 ~-1 ~ ~1 air 0 destroy
execute @e[name="アカシアの丸太"] ~ ~ ~ detect ~-1 ~ ~-1 log2 0 fill ~-1 ~ ~-1 ~-1 ~ ~-1 air 0 destroy
execute @e[name="アカシアの丸太"] ~ ~ ~ detect ~ ~ ~1 log2 0 fill ~ ~ ~1 ~ ~ ~1 air 0 destroy
execute @e[name="アカシアの丸太"] ~ ~ ~ detect ~1 ~ ~1 log2 0 fill ~1 ~ ~1 ~1 ~ ~1 air 0 destroy
execute @e[name="アカシアの丸太"] ~ ~ ~ detect ~-1 ~ ~1 log2 0 fill ~-1 ~ ~1 ~-1 ~ ~1 air 0 destroy
execute @e[name="アカシアの丸太"] ~ ~ ~ detect ~ ~1 ~1 log2 0 fill ~ ~1 ~1 ~ ~1 ~1 air 0 destroy
execute @e[name="アカシアの丸太"] ~ ~ ~ detect ~ ~-1 ~1 log2 0 fill ~ ~-1 ~1 ~ ~-1 ~1 air 0 destroy
execute @e[name="アカシアの丸太"] ~ ~ ~ detect ~ ~ ~-1 log2 0 fill ~ ~ ~-1 ~ ~ ~-1 air 0 destroy
execute @e[name="アカシアの丸太"] ~ ~ ~ detect ~1 ~ ~-1 log2 0 fill ~1 ~ ~-1 ~1 ~ ~-1 air 0 destroy
execute @e[name="アカシアの丸太"] ~ ~ ~ detect ~-1 ~ ~-1 log2 0 fill ~-1 ~ ~-1 ~-1 ~ ~-1 air 0 destroy
execute @e[name="アカシアの丸太"] ~ ~ ~ detect ~ ~1 ~-1 log2 0 fill ~ ~1 ~-1 ~ ~1 ~-1 air 0 destroy
execute @e[name="アカシアの丸太"] ~ ~ ~ detect ~ ~-1 ~-1 log2 0 fill ~ ~-1 ~-1 ~ ~-1 ~-1 air 0 destroy
execute @e[name="アカシアの原木"] ~ ~ ~ detect ~ ~1 ~ log2 0 fill ~ ~1 ~ ~ ~1 ~ air 0 destroy
execute @e[name="アカシアの原木"] ~ ~ ~ detect ~1 ~1 ~ log2 0 fill ~1 ~1 ~ ~1 ~1 ~ air 0 destroy
execute @e[name="アカシアの原木"] ~ ~ ~ detect ~-1 ~1 ~ log2 0 fill ~-1 ~1 ~ ~-1 ~1 ~ air 0 destroy
execute @e[name="アカシアの原木"] ~ ~ ~ detect ~ ~1 ~1 log2 0 fill ~ ~1 ~1 ~ ~1 ~1 air 0 destroy
execute @e[name="アカシアの原木"] ~ ~ ~ detect ~ ~1 ~-1 log2 0 fill ~ ~1 ~-1 ~ ~1 ~-1 air 0 destroy
execute @e[name="アカシアの原木"] ~ ~ ~ detect ~ ~-1 ~ log2 0 fill ~ ~-1 ~ ~ ~-1 ~ air 0 destroy
execute @e[name="アカシアの原木"] ~ ~ ~ detect ~1 ~-1 ~ log2 0 fill ~1 ~-1 ~ ~1 ~-1 ~ air 0 destroy
execute @e[name="アカシアの原木"] ~ ~ ~ detect ~-1 ~-1 ~ log2 0 fill ~-1 ~-1 ~ ~-1 ~-1 ~ air 0 destroy
execute @e[name="アカシアの原木"] ~ ~ ~ detect ~ ~-1 ~1 log2 0 fill ~ ~-1 ~1 ~ ~-1 ~1 air 0 destroy
execute @e[name="アカシアの原木"] ~ ~ ~ detect ~ ~-1 ~-1 log2 0 fill ~ ~-1 ~-1 ~ ~-1 ~-1 air 0 destroy
execute @e[name="アカシアの原木"] ~ ~ ~ detect ~1 ~ ~ log2 0 fill ~1 ~ ~ ~1 ~ ~ air 0 destroy
execute @e[name="アカシアの原木"] ~ ~ ~ detect ~1 ~1 ~ log2 0 fill ~1 ~1 ~ ~1 ~1 ~ air 0 destroy
execute @e[name="アカシアの原木"] ~ ~ ~ detect ~1 ~-1 ~ log2 0 fill ~1 ~-1 ~ ~1 ~-1 ~ air 0 destroy
execute @e[name="アカシアの原木"] ~ ~ ~ detect ~1 ~ ~1 log2 0 fill ~1 ~ ~1 ~1 ~ ~1 air 0 destroy
execute @e[name="アカシアの原木"] ~ ~ ~ detect ~1 ~ ~-1 log2 0 fill ~1 ~ ~-1 ~1 ~ ~-1 air 0 destroy
execute @e[name="アカシアの原木"] ~ ~ ~ detect ~-1 ~1 ~ log2 0 fill ~-1 ~1 ~ ~-1 ~1 ~ air 0 destroy
execute @e[name="アカシアの原木"] ~ ~ ~ detect ~-1 ~-1 ~ log2 0 fill ~-1 ~-1 ~ ~-1 ~-1 ~ air 0 destroy
execute @e[name="アカシアの原木"] ~ ~ ~ detect ~-1 ~ ~ log2 0 fill ~-1 ~ ~ ~-1 ~ ~ air 0 destroy
execute @e[name="アカシアの原木"] ~ ~ ~ detect ~-1 ~ ~1 log2 0 fill ~-1 ~ ~1 ~-1 ~ ~1 air 0 destroy
execute @e[name="アカシアの原木"] ~ ~ ~ detect ~-1 ~ ~-1 log2 0 fill ~-1 ~ ~-1 ~-1 ~ ~-1 air 0 destroy
execute @e[name="アカシアの原木"] ~ ~ ~ detect ~ ~ ~1 log2 0 fill ~ ~ ~1 ~ ~ ~1 air 0 destroy
execute @e[name="アカシアの原木"] ~ ~ ~ detect ~1 ~ ~1 log2 0 fill ~1 ~ ~1 ~1 ~ ~1 air 0 destroy
execute @e[name="アカシアの原木"] ~ ~ ~ detect ~-1 ~ ~1 log2 0 fill ~-1 ~ ~1 ~-1 ~ ~1 air 0 destroy
execute @e[name="アカシアの原木"] ~ ~ ~ detect ~ ~1 ~1 log2 0 fill ~ ~1 ~1 ~ ~1 ~1 air 0 destroy
execute @e[name="アカシアの原木"] ~ ~ ~ detect ~ ~-1 ~1 log2 0 fill ~ ~-1 ~1 ~ ~-1 ~1 air 0 destroy
execute @e[name="アカシアの原木"] ~ ~ ~ detect ~ ~ ~-1 log2 0 fill ~ ~ ~-1 ~ ~ ~-1 air 0 destroy
execute @e[name="アカシアの原木"] ~ ~ ~ detect ~1 ~ ~-1 log2 0 fill ~1 ~ ~-1 ~1 ~ ~-1 air 0 destroy
execute @e[name="アカシアの原木"] ~ ~ ~ detect ~-1 ~ ~-1 log2 0 fill ~-1 ~ ~-1 ~-1 ~ ~-1 air 0 destroy
execute @e[name="アカシアの原木"] ~ ~ ~ detect ~ ~1 ~-1 log2 0 fill ~ ~1 ~-1 ~ ~1 ~-1 air 0 destroy
execute @e[name="アカシアの原木"] ~ ~ ~ detect ~ ~-1 ~-1 log2 0 fill ~ ~-1 ~-1 ~ ~-1 ~-1 air 0 destroy
execute @e[name="アカシアの丸太",tag=!cutfinish] ~ ~ ~ detect ~ ~-1 ~ dirt 0 summon masec01:cutall_entity ~ ~5 ~ cut_log
execute @e[name="アカシアの丸太",tag=!cutfinish] ~ ~ ~ detect ~ ~-1 ~ grass 0 summon masec01:cutall_entity ~ ~5 ~ cut_log
execute @e[name="アカシアの原木",tag=!cutfinish] ~ ~ ~ detect ~ ~-1 ~ dirt 0 summon masec01:cutall_entity ~ ~5 ~ cut_log
execute @e[name="アカシアの原木",tag=!cutfinish] ~ ~ ~ detect ~ ~-1 ~ grass 0 summon masec01:cutall_entity ~ ~5 ~ cut_log
理論上6方向だけでいいんですが、アイテムがドロップするときにドロップする位置がずれることがあるのを考慮して、ななめの位置の分も検知しています。


Dat../functions/remove_acacia_leaves.mcfunction
execute @e[name="アカシアの丸太",tag=!cutfinish] ~ ~ ~ detect ~ ~-1 ~ dirt 0 summon masec01:cutall_entity ~ ~5 ~ acacia
execute @e[name="アカシアの丸太",tag=!cutfinish] ~ ~ ~ detect ~ ~-1 ~ grass 0 summon masec01:cutall_entity ~ ~5 ~ acacia
execute @e[name="アカシアの原木",tag=!cutfinish] ~ ~ ~ detect ~ ~-1 ~ dirt 0 summon masec01:cutall_entity ~ ~5 ~ acacia
execute @e[name="アカシアの原木",tag=!cutfinish] ~ ~ ~ detect ~ ~-1 ~ grass 0 summon masec01:cutall_entity ~ ~5 ~ acacia
execute @e[name="アカシアの丸太",tag=!cutfinish] ~ ~ ~ detect ~ ~-1 ~ dirt 0 summon masec01:cutall_entity ~ ~5 ~ cut_log
execute @e[name="アカシアの丸太",tag=!cutfinish] ~ ~ ~ detect ~ ~-1 ~ grass 0 summon masec01:cutall_entity ~ ~5 ~ cut_log
execute @e[name="アカシアの原木",tag=!cutfinish] ~ ~ ~ detect ~ ~-1 ~ dirt 0 summon masec01:cutall_entity ~ ~5 ~ cut_log
execute @e[name="アカシアの原木",tag=!cutfinish] ~ ~ ~ detect ~ ~-1 ~ grass 0 summon masec01:cutall_entity ~ ~5 ~ cut_log
execute @e[name="アカシアの丸太"] ~ ~ ~ detect ~ ~1 ~ leaves2 -1 summon masec01:cutall_entity ~ ~5 ~ acacia
execute @e[name="アカシアの原木"] ~ ~ ~ detect ~ ~1 ~ leaves2 -1 summon masec01:cutall_entity ~ ~5 ~ acacia
execute @e[name="アカシアの丸太",tag=!cutfinish] ~ ~ ~ detect ~ ~-1 ~ dirt 0 tag @e[name="アカシアの丸太"] add cutfinish 
execute @e[name="アカシアの丸太",tag=!cutfinish] ~ ~ ~ detect ~ ~-1 ~ grass 0 tag @e[name="アカシアの丸太"] add cutfinish 
execute @e[name="アカシアの原木",tag=!cutfinish] ~ ~ ~ detect ~ ~-1 ~ dirt 0 tag @e[name="アカシアの原木"] add cutfinish 
execute @e[name="アカシアの原木",tag=!cutfinish] ~ ~ ~ detect ~ ~-1 ~ grass 0 tag @e[name="アカシアの原木"] add cutfinish


エンティティ


Dat../entities/cutall_entity.json
{
  "format_version": "1.8.0",
  "minecraft:entity": {
    "description": {
      "identifier": "masec01:cutall_entity",
      "is_spawnable": true,
      "is_summonable": true,
      "is_experimental": false
    },
    
    "component_groups": {
      "vanish": {
        "minecraft:transformation": {
          "into": "minecraft:item"
        }
        //アイテムになると、パッと消えるのでパーティクルや音が出ないんですが、特異な状態で残ってしまうことがあるのでtp-killの方法をおすすめします
      },
      "acacia": {
        "minecraft:collision_box": {
          "width": 10,
          "height": 5
        },
        "minecraft:break_blocks": {
          "breakable_blocks": [ "leaves2" ]
        }
      },
      "big_oak": {
        "minecraft:collision_box": {
          "width": 4.5,
          "height": 5
        },
        "minecraft:break_blocks": {
          "breakable_blocks": [ "leaves2" ]
        }
      },
      "birch": {
        "minecraft:collision_box": {
          "width": 4.5,
          "height": 5
        },
        "minecraft:break_blocks": {
          "breakable_blocks": [ "leaves" ]
        }
      },
      "jungle": {
        "minecraft:collision_box": {
          "width": 4.5,
          "height": 7
        },
        "minecraft:break_blocks": {
          "breakable_blocks": [ "leaves" ]
        }
      },
      "oak": {
        "minecraft:collision_box": {
          "width": 4.5,
          "height": 6
        },
        "minecraft:break_blocks": {
          "breakable_blocks": [ "leaves" ]
        }
      },
      "spruce": {
        "minecraft:collision_box": {
          "width": 5.5,
          "height": 8
        },
        "minecraft:break_blocks": {
          "breakable_blocks": [ "leaves" ]
        }
      },
      "cut_log": {
        "minecraft:collision_box": {
          "width": 1.5,
          "height": 10
        },
        "minecraft:break_blocks": {
          "breakable_blocks": [ "log", "log2" ]
        }
      }//functionで壊しきれない分の補助
    },
    
    "components":{
      "minecraft:collision_box": {
        "width": 4.5,
        "height": 5
      },
      "minecraft:timer": {
        "looping": false,
        "time": 3.0,
        "time_down_event": {
          "event": "vanish",
          "target": "self"
        }
      },
      "minecraft:fire_immune": true,
      //↑意外と重要なコンポーネントです ないと火事になっている木を切ったときに炎が見えてしまいます
      "minecraft:damage_sensor": [
        {
          "cause": "all",
          "deals_damage": false
        }
      ],
      "minecraft:physics": {
        "has_collision": false,
        "has_gravity": true
      },
      //どんな高さの木にも対応できるように予め高い位置に出現させるので、落下させる必要があります
      "minecraft:break_blocks": {
        "breakable_blocks": [ "leaves", "leaves2" ]
      }
    },
    
    "events": {
      "vanish": {
        "add": {
          "component_groups": [ "vanish" ]
        }
      },
      "acacia": {
        "add": {
          "component_groups": [ "acacia" ]
        }
      },
      "big_oak": {
        "add": {
          "component_groups": [ "big_oak" ]
        }
      },
      "birch": {
        "add": {
          "component_groups": [ "birch" ]
        }
      },
      "jungle": {
        "add": {
          "component_groups": [ "jungle" ]
        }
      },
      "oak": {
        "add": {
          "component_groups": [ "oak" ]
        }
      },
      "spruce": {
        "add": {
          "component_groups": [ "spruce" ]
        }
      },
      "cut_log": {
        "add": {
          "component_groups": [ "cut_log" ]
        }
      }
    }
  }
}
constructed by: Masec Rinca