monke166

create a chainsaw that cuts trees down really fast. and needs 3 iron to craft

Kodari AI
KodariOct 30 at 6:23 pm 1
TimberChainsaw
Adds a craftable chainsaw tool that rapidly fells entire trees. When a player right-clicks a log with the chainsaw, it instantly breaks the entire connected tree trunk and all its leaves, dropping all blocks and experience. The chainsaw is crafted with 3 iron ingots and 2 sticks in a specific pattern. It has durability and can be enchanted with Unbreaking and Efficiency. The plugin detects tree structures by scanning connected log blocks and removes them simultaneously for a satisfying instant tree-felling experience.
  1. Create the plugin entry point and recipe for a chainsaw made with exactly 3 iron ingots and 2 sticks.

  2. Add tree-felling logic that instantly breaks nearby connected logs when the chainsaw is used.

  3. Add the plugin metadata and Paper build setup.

Created the TreeChainsaw plugin. Craft it with 3 iron ingots across the top and 2 sticks down the center; use it on a log to instantly fell up to 512 connected logs.

Kodari can make mistakes. Review important code before using.
Files
src
build.gradle
Code
4 167
src/main/java/com/kodari/treechainsaw/TreeChainsawPlugin.java
package com.kodari.treechainsaw;

import org.bukkit.Bukkit;
import org.bukkit.NamespacedKey;
import org.bukkit.plugin.java.JavaPlugin;

public final class TreeChainsawPlugin extends JavaPlugin {
    private NamespacedKey chainsawKey;

    @Override
    public void onEnable() {
        chainsawKey = new NamespacedKey(this, "chainsaw");
        ChainsawListener listener = new ChainsawListener(chainsawKey);
        getServer().getPluginManager().registerEvents(listener, this);
        listener.registerRecipe(this);
    }

    @Override
    public void onDisable() {
        if (chainsawKey != null) {
            Bukkit.removeRecipe(chainsawKey);
        }
    }
}