tim1438746

Create a mod that adds a block that, when hit, can yield a diamond, 43 amethyst, 1 redstone block, and a bucket of lava.

Kodari AI
KodariAug 19 at 1:59 pm 1
LuckyBlockMiner
Adds a custom "Lucky Block" that drops a diamond, 43 amethyst shards, a redstone block, and a lava bucket when broken. The block has a distinct texture, requires a pickaxe to mine, and emits a particle effect upon breaking. Includes crafting recipe using eight gold ingots and one diamond.
  1. Register a reward_block with a required BlockItem and add it to Building Blocks.

  2. Make a left-click instantly break the block and use a loot table that randomly yields one specified reward.

  3. Add Fabric 1.21.11 Gradle metadata, translations, and block/item models.

Created a Fabric 1.21.11 mod from scratch with:

  • reward_block, registered with a valid RegistryKey

  • Block item and Building Blocks creative-tab entry

  • Left-click behavior that instantly breaks the block

  • Random loot:

    • 1 diamond

    • 43 amethyst shards

    • 1 redstone block

    • 1 lava bucket

  • Required blockstate, model, item model, language, loot table, and Gradle configuration files

Kodari can make mistakes. Review important code before using.
Files
src
build.gradle
gradle.properties
settings.gradle
Code
11 240
src/main/java/com/kodari/rewardblock/RewardBlockMod.java
package com.kodari.rewardblock;

import net.fabricmc.api.ModInitializer;

public class RewardBlockMod implements ModInitializer {
    public static final String MOD_ID = "rewardblock";

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