A Paper 1.21.11 plugin to generate custom trees on a creative server.
/treegen(or/tg) → you receive a Magic Sapling.- Left-click with the sapling in hand → opens the configuration menu:
- Trunk: drag & drop a block from your inventory onto the trunk slot.
- Tree type: click to cycle between Oak, Birch, Cherry, Slender, Bonsai and Weeping.
- Leaves: up to 9 blocks (drag & drop), each with its proportion in % (left-click +5 / right-click -5 / shift ±1 on the paper below). Right-click a leaf to remove it.
- Air: percentage of holes in the foliage (sparse foliage).
- Height / Width: left-click +1, right-click -1, shift ±5.
- The config is saved on the sapling when the menu closes — each sapling has its own config.
- Right-click → plants the tree on the targeted block (range 120 blocks). Each tree has randomness: height, trunk waver, branch angles, foliage outlines.
The Classic and Bonsai trees have visible roots and a trunk that thickens with the width (up to ~3x3) and splits into scaffold branches.
The tree only replaces air, grass and leaves: it never destroys a build. Leaves are placed in persistent mode (no decay).
Java 21 required. Maven is bundled in tools/:
tools\apache-maven-3.9.16\bin\mvn.cmd package
The jar is produced at target/TreeGenerator-1.0.0.jar → copy it into
server/plugins/.
cd server
start.bat
Paper 1.21.11 server (build 132), flat world, creative gamemode, on
localhost:25565. After rebuilding the plugin, copy the jar into
server/plugins/ and restart the server.
TreeGenPlugin/TreeGenCommand— bootstrap + the/tgcommand.config/TreeConfig— a sapling's config (serialized into the item in PDC).item/SaplingItem— creation/reading of the magic sapling.gui/TreeGui+gui/GuiListener— the configuration menu.listener/InteractListener— left-click (menu) / right-click (planting).gen/TreeGenerator— the generation algorithm (plan in memory, then application in the world; weighted leaf draw).