bal3607

Create a Minecraft Java Edition Fabric mod called "Sneak to Grow" for Minecraft version 26.3.

When the player holds Shift to sneak, instantly grow all nearby crops and saplings within a 4-block radius. Fully mature wheat, carrots, potatoes, beetroot, and other compatible crops whenever possible. Grow nearby saplings into their full trees using vanilla Minecraft growth mechanics, respecting space and environmental requirements.

Run growth on the server, avoid excessive lag, and only trigger growth while the player is sneaking. Make the mod compatible with Fabric and Minecraft Java Edition 26.3.

Provide a downloadable, working mod file and installation instructions.

Kodari AI
KodariOct 25 at 5:11 am 2
SneakToGrow
A Fabric mod for Minecraft 26.3 that instantly grows all nearby crops and saplings within a 4-block radius when the player holds Shift to sneak. Fully matures wheat, carrots, potatoes, beetroot, and other compatible crops, and grows saplings into full trees using vanilla mechanics while respecting space and environmental requirements. Growth runs server-side to avoid lag, triggering only while sneaking. Compatible with Fabric and Minecraft Java Edition 26.3, providing a downloadable working mod file with installation instructions.
  1. Check the 26.3 server-tick and vanilla growth APIs.

  2. Create the Fabric mod project files and survival behavior.

  3. Give the Kodari build/download and installation steps.

Created the Sneak to Grow Fabric mod. While a player sneaks, it checks a 4-block radius on the server once per second, matures compatible crops, and uses vanilla bonemeal growth checks for nearby saplings. There are no items to craft or find—the ability works automatically in survival.

To get the jar in Kodari:

  1. Click Compile in the top bar (on phone: ⋮ → Compile Project).

  2. Click Compile in the window.

  3. When it succeeds, click Download on the build.

To install it, use Minecraft 26.3 with Fabric Loader 0.19.5 and Fabric API 0.161.0+26.3. Put the downloaded mod jar and Fabric API jar in the instance’s mods folder, then launch the Fabric profile.

bal3607

it grows trees

Kodari AI
KodariOct 25 at 5:16 am 1

Yes—while you sneak, nearby saplings get vanilla growth attempts that can turn them into full trees. Vanilla still checks tree placement, so a sapling may remain if there isn’t enough room or its growth requirements aren’t met.

bal3607

make it grow crops and trees like this mod https://modrinth.com/project/b5JMdB5V

Kodari AI
KodariOct 25 at 5:29 am 1

Updated Sneak to Grow to work like the linked mod: each time you press sneak, nearby compatible crops and saplings receive a vanilla bonemeal-style growth attempt. Crops advance gradually; saplings can grow into trees when vanilla growth conditions and space allow. Release and press sneak again to trigger another attempt; there’s a short cooldown to limit lag.

To download the mod jar in Kodari, click Compile (on phone: ⋮ → Compile Project), click Compile in the window, then click Download when the build succeeds. Install it with Fabric Loader 0.19.5 and Fabric API 0.161.0+26.3 in the mods folder.

bal3607

also add it shows particles like when we use bonemeal on crops and trees while growing

Kodari AI
KodariOct 25 at 5:31 am 1

Added server-sent green bonemeal-style particles whenever a crop or sapling successfully grows. Recompile the project to download the updated jar.

bal3607

make the range of block editable and also add that sugarcane also grow with it and grass doesnt grow

Kodari AI
KodariOct 25 at 5:46 am 3
  1. Make the growth radius editable.

  2. Add sugar cane growth and ensure grass is excluded.

  • Editable range: config/sneaktogrow.properties is created on first launch. Set radius to 1–16 blocks (default 4); restart the game/server for changes to take effect.

  • Sugar cane: Sneaking now triggers vanilla sugar-cane growth checks, including its support, water, and height requirements. Eligible cane can grow by a block; particles appear when it does.

  • Grass excluded: Grass blocks and short, tall, and dry grass won’t be bonemealed by the mod.

To get the updated jar, click Compile in Kodari (on phone: ⋮ → Compile Project), then Compile in the window and Download when it succeeds. Install it with Fabric Loader 0.19.5 and Fabric API 0.161.0+26.3 in your instance’s mods folder.

bal3607

make it grow netherwart

Kodari AI
KodariNov 1 at 10:09 am 1
  1. Add nether wart to the server-side growth scan.

  2. Use its vanilla 1-in-10 random-tick growth chance, with up to 16 attempts per sneak trigger; keep particles on successful growth.

Added Nether Wart growth while sneaking. It uses the vanilla 1-in-10 growth chance for up to 16 attempts per trigger, stops at maturity, and shows particles when it grows. Recompile the project in Kodari to download the updated jar.

bal3607

done

Kodari AI
KodariNov 1 at 10:10 am 1

Great! Recompile the project in Kodari to download the updated jar.

bal3607

make it grow ametyst from budding amethyst

Kodari AI
KodariNov 14 at 9:58 am 1
  1. Trigger repeated vanilla budding-amethyst random ticks while sneaking near a budding block.

  2. Show growth particles at each crystal that changes stage or appears.

Added amethyst growth: while sneaking near budding amethyst, the mod makes 16 vanilla growth attempts, respecting available space and crystal placement rules. Newly formed or advanced crystals show growth particles.

Recompile in Kodari to download the updated jar.

bal3607

fix that the tree grow but when i try to break block it doesnt break or drop

Kodari AI
KodariWed at 7:35 am 2

The tree growth code runs on the server and uses vanilla block updates, so I can’t identify the cause from the code alone.

Does this happen in singleplayer or on a server? Also, are only the grown tree blocks unbreakable, or do other blocks fail to break too? That will help distinguish a growth-sync issue from spawn protection or another server restriction.

bal3607

only grown tree blocks

Kodari AI
KodariWed at 7:59 am 1

The mod calls the same server-side tree growth method as vanilla bonemeal, and vanilla requests client updates for the generated blocks. I haven’t identified a reliable fix yet.

Do the tree blocks disappear or become breakable after you leave and rejoin the world? Also, does this happen in singleplayer or on a multiplayer server?

bal3607

when i break block it come back where i cut it

Kodari AI
KodariWed at 8:04 am 1

The blocks reappearing suggests the server isn’t accepting the break, but I can’t tell why from the growth code alone.

Does this happen in singleplayer or multiplayer, and do the tree blocks still reappear after you leave and rejoin?

bal3607

singleplayer

Kodari AI
KodariWed at 8:26 am 2

Since it happens in singleplayer, multiplayer server permissions aren’t the cause. I checked the growth code: it runs on the server and uses vanilla tree generation, so I can’t identify a reliable fix yet.

Do the blocks still reappear after you save and reopen the world? Also, does it happen with every tree type, and are any other mods installed?

Kodari can make mistakes. Review important code before using.
Files
src
build.gradle
gradle.properties
settings.gradle
Code
5 265
src/main/java/dev/kodari/sneaktogrow/SneakToGrowMod.java
package dev.kodari.sneaktogrow;

import net.fabricmc.api.ModInitializer;
import net.fabricmc.fabric.api.event.lifecycle.v1.ServerTickEvents;
import net.fabricmc.loader.api.FabricLoader;
import net.minecraft.core.BlockPos;
import net.minecraft.core.Direction;
import net.minecraft.core.particles.ParticleTypes;
import net.minecraft.server.level.ServerLevel;
import net.minecraft.server.level.ServerPlayer;
import net.minecraft.world.level.block.AmethystClusterBlock;
import net.minecraft.world.level.block.BonemealableBlock;
import net.minecraft.world.level.block.BonemealSource;
import net.minecraft.world.level.block.BuddingAmethystBlock;
import net.minecraft.world.level.block.GrassBlock;
import net.minecraft.world.level.block.NetherWartBlock;
import net.minecraft.world.level.block.ShortDryGrassBlock;
import net.minecraft.world.level.block.SugarCaneBlock;
import net.minecraft.world.level.block.TallDryGrassBlock;
import net.minecraft.world.level.block.TallGrassBlock;
import net.minecraft.world.level.block.state.BlockState;

import java.io.IOException;
import java.io.UncheckedIOException;
import java.io.Reader;
import java.io.Writer;
import java.nio.file.Files;
import java.nio.file.Path;
import java.util.Map;
import java.util.Properties;
import java.util.WeakHashMap;

public class SneakToGrowMod implements ModInitializer {
    private static final int DEFAULT_RADIUS = 4;
    private static final int MAX_RADIUS = 16;
    private static int radius = DEFAULT_RADIUS;
    private static final int GROWTH_COOLDOWN_TICKS = 5;
    private static final Map<ServerPlayer, SneakState> PLAYER_STATES = new WeakHashMap<>();

    @Override
    public void onInitialize() {
        loadConfig();
        ServerTickEvents.END_LEVEL_TICK.register(SneakToGrowMod::growNearbyPlants);
    }

    private static void loadConfig() {
        Path configPath = FabricLoader.getInstance().getConfigDir().resolve("sneaktogrow.properties");
        Properties config = new Properties();
        try {
            Files.createDirectories(configPath.getParent());
            if (Files.exists(configPath)) {
                try (Reader reader = Files.newBufferedReader(configPath)) {
                    config.load(reader);
                }
            }

            try {
                radius = Math.max(1, Math.min(MAX_RADIUS,
                        Integer.parseInt(config.getProperty("radius", Integer.toString(DEFAULT_RADIUS)))));
            } catch (NumberFormatException exception) {
                radius = DEFAULT_RADIUS;
            }
            config.setProperty("radius", Integer.toString(radius));
            try (Writer writer = Files.newBufferedWriter(configPath)) {
                config.store(writer, "Sneak to Grow settings. Set radius from 1 to 16 blocks.");
            }
        } catch (IOException exception) {
            throw new UncheckedIOException("Unable to load Sneak to Grow configuration", exception);
        }
    }

    private static void growNearbyPlants(ServerLevel level) {
        for (ServerPlayer player : level.players()) {
            SneakState previous = PLAYER_STATES.get(player);
            if (!player.isShiftKeyDown()) {
                if (previous != null && previous.sneaking()) {
                    PLAYER_STATES.put(player, new SneakState(false, previous.lastGrowthTick()));
                }
                continue;
            }

            if (previous != null && previous.sneaking()) {
                continue;
            }
            if (previous != null && player.tickCount - previous.lastGrowthTick() < GROWTH_COOLDOWN_TICKS) {
                PLAYER_STATES.put(player, new SneakState(true, previous.lastGrowthTick()));
                continue;
            }

            PLAYER_STATES.put(player, new SneakState(true, player.tickCount));
            BlockPos playerPos = player.blockPosition();
            int playerX = playerPos.getX();
            int playerY = playerPos.getY();
            int playerZ = playerPos.getZ();

            for (int y = -radius; y <= radius; y++) {
                for (int z = -radius; z <= radius; z++) {
                    for (int x = -radius; x <= radius; x++) {
                        if (x * x + y * y + z * z > radius * radius) {
                            continue;
                        }

                        BlockPos pos = new BlockPos(playerX + x, playerY + y, playerZ + z);
                        if (!level.hasChunkAt(pos)) {
                            continue;
                        }

                        BlockState state = level.getBlockState(pos);
                        if (state.getBlock() instanceof GrassBlock
                                || state.getBlock() instanceof TallGrassBlock
                                || state.getBlock() instanceof ShortDryGrassBlock
                                || state.getBlock() instanceof TallDryGrassBlock) {
                            continue;
                        }

                        boolean grew = false;
                        if (state.getBlock() instanceof BuddingAmethystBlock) {
                            Direction[] directions = Direction.values();
                            BlockState[] surroundingStates = new BlockState[directions.length];
                            for (int i = 0; i < directions.length; i++) {
                                surroundingStates[i] = level.getBlockState(pos.relative(directions[i]));
                            }

                            for (int growthTick = 0; growthTick < 16; growthTick++) {
                                level.getBlockState(pos).randomTick(level, pos, level.getRandom());
                            }

                            for (int i = 0; i < directions.length; i++) {
                                BlockPos crystalPos = pos.relative(directions[i]);
                                BlockState crystalState = level.getBlockState(crystalPos);
                                if (!crystalState.equals(surroundingStates[i])
                                        && crystalState.getBlock() instanceof AmethystClusterBlock) {
                                    level.sendParticles(ParticleTypes.HAPPY_VILLAGER,
                                            crystalPos.getX() + 0.5, crystalPos.getY() + 0.5, crystalPos.getZ() + 0.5,
                                            15, 0.35, 0.45, 0.35, 0.02);
                                    grew = true;
                                }
                            }
                        } else if (state.getBlock() instanceof NetherWartBlock) {
                            int age = state.getValue(NetherWartBlock.AGE);
                            for (int growthTick = 0; growthTick < 16 && age < 3; growthTick++) {
                                if (level.getRandom().nextInt(10) == 0) {
                                    age++;
                                    level.setBlock(pos, state.setValue(NetherWartBlock.AGE, age), 2);
                                    grew = true;
                                }
                            }
                        } else if (state.getBlock() instanceof SugarCaneBlock) {
                            BlockPos abovePos = pos.above();
                            if (level.getBlockState(abovePos).getBlock() instanceof SugarCaneBlock) {
                                continue;
                            }

                            BlockState caneState = state;
                            for (int growthTick = 0; growthTick < 16; growthTick++) {
                                caneState.randomTick(level, pos, level.getRandom());
                                if (level.getBlockState(abovePos).getBlock() instanceof SugarCaneBlock) {
                                    grew = true;
                                    break;
                                }

                                BlockState updatedState = level.getBlockState(pos);
                                if (updatedState.equals(caneState)) {
                                    break;
                                }
                                caneState = updatedState;
                            }
                        } else if (state.getBlock() instanceof BonemealableBlock growable
                                && growable.isValidBonemealTarget(level, pos, state, BonemealSource.INTERACTION)
                                && growable.isBonemealSuccess(level, level.getRandom(), pos, state, BonemealSource.INTERACTION)) {
                            growable.performBonemeal(level, level.getRandom(), pos, state, BonemealSource.INTERACTION);
                            grew = true;
                        }

                        if (grew && !(state.getBlock() instanceof BuddingAmethystBlock)) {
                            level.sendParticles(ParticleTypes.HAPPY_VILLAGER,
                                    pos.getX() + 0.5, pos.getY() + 0.5, pos.getZ() + 0.5,
                                    15, 0.35, 0.45, 0.35, 0.02);
                        }
                    }
                }
            }
        }
    }

    private record SneakState(boolean sneaking, int lastGrowthTick) {
    }
}