dave blun

Make me a Minecraft Fabric mod for Java 1.21.1 that adds farming sprinklers.

Sprinklers

* Sprinklers make crops grow faster. * 5 upgrade levels total. * Level 1: 6×6 block radius, +25% crop growth speed. * Each upgrade increases:

* Growth speed by +25% * Radius by +2 blocks * Level 2: 8×8 radius, +50% growth speed. * Continue this progression for all 5 levels.

Kodari AI
KodariAug 31 at 8:53 am 2
SprinklerGrowthMod
Adds upgradable farming sprinklers to Minecraft. Five levels of sprinklers accelerate crop growth and cover expanding areas. Level 1 provides a 6x6 radius with +25% growth speed. Each subsequent level increases growth speed by 25% and radius by 2 blocks, culminating in Level 5 with a 14x14 radius and +125% growth speed. Sprinklers are placeable blocks that actively hydrate and boost nearby crops, offering a progressive farming automation system for mid-to-late game players.

I’ll create a complete Fabric 26.2 sprinkler mod with a registered sprinkler block, persistent five-level upgrades, crop-growth ticking, and the required project/resource files.

  1. Project setup: create the Java 25/Fabric 26.2 Gradle project and mod metadata.

  2. Sprinkler content: register the block, block item, and persistent block entity.

  3. Gameplay: add five levels, iron-ingot upgrades, crop acceleration, recipe, loot, models, and translations.

Created the Fabric sprinkler mod project.

  • Targets Fabric 26.2 with Java 25.

  • Adds a craftable Sprinkler block with persistent upgrade levels.

  • Upgrade using iron ingots by right-clicking:

    • Level 1: 6×6 area, +25% growth

    • Level 2: 8×8 area, +50% growth

    • Level 3: 10×10 area, +75% growth

    • Level 4: 12×12 area, +100% growth

    • Level 5: 14×14 area, +125% growth

  • Sprinklers accelerate crops above them every second.

  • Includes block entity persistence, recipe, loot table, models, blockstate, and English translations.

Kodari can make mistakes. Review important code before using.
Files
src
build.gradle
gradle.properties
settings.gradle
Code
15 447
src/main/java/com/kodari/sprinklers/KodariSprinklers.java
package com.kodari.sprinklers;

import net.fabricmc.api.ModInitializer;
import net.fabricmc.fabric.api.event.player.UseBlockCallback;
import net.minecraft.network.chat.Component;
import net.minecraft.world.InteractionHand;
import net.minecraft.world.InteractionResult;
import net.minecraft.world.entity.player.Player;
import net.minecraft.world.item.Items;
import net.minecraft.world.level.block.entity.BlockEntity;
import net.minecraft.world.phys.BlockHitResult;
import net.minecraft.world.level.Level;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

public class KodariSprinklers implements ModInitializer {
	public static final String MOD_ID = "kodari_sprinklers";
	public static final Logger LOGGER = LoggerFactory.getLogger(MOD_ID);

	@Override
	public void onInitialize() {
		ModBlocks.initialize();
		ModBlockEntities.initialize();

		UseBlockCallback.EVENT.register(KodariSprinklers::handleSprinklerUpgrade);
	}

	private static InteractionResult handleSprinklerUpgrade(
			Player player, Level level, InteractionHand hand, BlockHitResult hitResult) {
		BlockEntity blockEntity = level.getBlockEntity(hitResult.getBlockPos());
		if (!(blockEntity instanceof SprinklerBlockEntity sprinkler)
				|| !player.getItemInHand(hand).is(Items.IRON_INGOT)
				|| player.isSpectator()) {
			return InteractionResult.PASS;
		}

		if (sprinkler.isMaxLevel()) {
			if (!level.isClientSide()) {
				player.sendSystemMessage(Component.translatable("message.kodari_sprinklers.max_level"));
			}
			return InteractionResult.SUCCESS;
		}

		if (!level.isClientSide()) {
			if (!player.isCreative()) {
				player.getItemInHand(hand).shrink(1);
			}
			sprinkler.upgrade();
			player.sendSystemMessage(Component.translatable(
					"message.kodari_sprinklers.upgraded",
					sprinkler.getLevel(),
					sprinkler.getAreaSize(),
					sprinkler.getGrowthBonusPercent()));
		}

		return InteractionResult.SUCCESS;
	}
}