csontgolyo

Create me mod a that ads a new kelp type: huge kelp and its model is way bigger 3x3 and it can grow fruits on it

Kodari AI
KodariSep 21 at 4:02 am 5
HugeKelpFruit
Adds a new giant kelp block type that grows in a 3x3 cross-section pattern, significantly larger than standard kelp. This massive aquatic plant features a unique growth mechanic where edible kelp fruits periodically spawn on its surface, providing a renewable food source. The mod includes custom block models, textures, and growth behavior for both the giant kelp stalks and their fruit-bearing nodes, enhancing underwater exploration and farming opportunities.
  1. Create a Fabric 1.21.4 project with a registered Huge Kelp block and item.

  2. Implement random-tick fruit growth through block states, with a 3×3 oversized kelp model.

  3. Add required metadata, blockstates, models, language, and Gradle files.

Created the Fabric 1.21.4 Huge Kelp mod.

  • Registers a Huge Kelp block and item.

  • Uses a 3×3 oversized kelp model.

  • Grows through four fruit stages via random ticks.

  • Includes blockstates, oversized models, item definition, translations, Fabric metadata, and Gradle setup.

  • Uses vanilla kelp and melon textures.

Kodari can make mistakes. Review important code before using.
Files
src
build.gradle
gradle.properties
settings.gradle
Code
13 394
src/main/java/com/example/hugekelp/HugeKelpMod.java
package com.example.hugekelp;

import net.fabricmc.api.ModInitializer;
import net.minecraft.block.AbstractBlock;
import net.minecraft.block.Block;
import net.minecraft.block.MapColor;
import net.minecraft.item.BlockItem;
import net.minecraft.item.Item;
import net.minecraft.registry.Registry;
import net.minecraft.registry.RegistryKey;
import net.minecraft.registry.RegistryKeys;
import net.minecraft.registry.Registries;
import net.minecraft.util.Identifier;

public final class HugeKelpMod implements ModInitializer {
    public static final String MOD_ID = "hugekelp";
    public static final Identifier HUGE_KELP_ID = Identifier.of(MOD_ID, "huge_kelp");
    public static final RegistryKey<Block> HUGE_KELP_BLOCK_KEY = RegistryKey.of(RegistryKeys.BLOCK, HUGE_KELP_ID);
    public static final RegistryKey<Item> HUGE_KELP_ITEM_KEY = RegistryKey.of(RegistryKeys.ITEM, HUGE_KELP_ID);

    public static final Block HUGE_KELP = Registry.register(
            Registries.BLOCK,
            HUGE_KELP_BLOCK_KEY,
            new HugeKelpBlock(AbstractBlock.Settings.create()
                    .mapColor(MapColor.GREEN)
                    .strength(1.0F)
                    .ticksRandomly()
                    .registryKey(HUGE_KELP_BLOCK_KEY))
    );

    public static final Item HUGE_KELP_ITEM = Registry.register(
            Registries.ITEM,
            HUGE_KELP_ITEM_KEY,
            new BlockItem(HUGE_KELP, new Item.Settings().registryKey(HUGE_KELP_ITEM_KEY))
    );

    public static void initialize() {
    }

    @Override
    public void onInitialize() {
        initialize();
    }
}