chris_youtube.2
πŸ“Ž 1 file 1,170 chars
πŸ“„
pasted-code-1776432270666.txt
txt 2 lines
β–Ά
Create a Minecraft Java Edition mod (Fabric or Forge) that adds a progression system of TNT blocks called β€œTNT Levels” from Level 1 to Level 10. Each TNT uses the vanilla TNT model but is visually distinguished by different color tints per level (Level 1 red, Level 2 orange, Level 3 yellow, Level 4 green, Level 5 blue, and progressively darker or unique shades for higher levels), optionally showing a small β€œLv.X” indicator. Each TNT level has increasing explosion power, radius, and block destruction, starting with Level 1 slightly stronger than vanilla TNT and scaling up so Level 10 is extremely powerful. Crafting is progressive: Level 1 uses the normal TNT recipe, while each next level is crafted using the previous level TNT plus increasing amounts of gunpowder and sand, making higher levels progressively harder to obtain. The code should be clean, modular, and easy to extend with more TNT levels without major rewrites. Include optional features such as a config file to adjust explosion strength scaling, chain reactions between higher-level TNTs, a creative mode tab containing all TNT variants, and optional custom explosion sounds for higher levels.
chris_youtube.2
πŸ“Ž 1 file 1,170 chars
πŸ“„
pasted-code-1776435635655.txt
txt 2 lines
β–Ά
Create a Minecraft Java Edition mod (Fabric or Forge) that adds a progression system of TNT blocks called β€œTNT Levels” from Level 1 to Level 10. Each TNT uses the vanilla TNT model but is visually distinguished by different color tints per level (Level 1 red, Level 2 orange, Level 3 yellow, Level 4 green, Level 5 blue, and progressively darker or unique shades for higher levels), optionally showing a small β€œLv.X” indicator. Each TNT level has increasing explosion power, radius, and block destruction, starting with Level 1 slightly stronger than vanilla TNT and scaling up so Level 10 is extremely powerful. Crafting is progressive: Level 1 uses the normal TNT recipe, while each next level is crafted using the previous level TNT plus increasing amounts of gunpowder and sand, making higher levels progressively harder to obtain. The code should be clean, modular, and easy to extend with more TNT levels without major rewrites. Include optional features such as a config file to adjust explosion strength scaling, chain reactions between higher-level TNTs, a creative mode tab containing all TNT variants, and optional custom explosion sounds for higher levels.
Kodari AI
KodariApr 17 at 2:34 pm 71,045 (v2)

I’ll read the necessary docs before building this project.

TntLevels
A Fabric 1.21.4 mod adding 10 progressive TNT variants. Each level features increasing explosion power (Level 1 slightly stronger than vanilla, Level 10 catastrophically powerful) with distinct color tints for easy identification. Crafting scales in difficulty: Level 1 uses the vanilla TNT recipe, each subsequent level requires the previous TNT plus growing amounts of gunpowder, sand, and rare materials. Includes a JSON config file for explosion power scaling, chain reactions between high-level TNTs, a dedicated creative tab, and optional enhanced explosion sounds.

Now I’ll build the full mod systematically.

Now creating all resource files:

Now item definitions with per-level constant tint colors (decimal values computed from hex):

Now recipes β€” Level 1 uses vanilla TNT pattern, Levels 2–6 use shapeless with growing ingredients, Levels 7–10 use expensive shaped recipes:

Now loot tables so each block drops itself when mined:


The mod is fully built across 57 files. Here’s a summary of the architecture:

  • TntLevel enum β€” single source of truth for all 10 levels: ID, base power, and RGB color

  • TntLevelBlock extends TntBlock β€” inherits ALL vanilla TNT trigger behavior (redstone, fire charge, arrows, explosions); overrides 4 key methods to set PENDING_LEVEL ThreadLocal before calling super, so the entity mixin can pick it up without needing to know the block

  • TntBlockMixin β€” intercepts the public static TntBlock.primeTnt() as a secondary safety net, also sets the ThreadLocal for any trigger path not covered by the overrides

  • TntEntityMixin β€” (1) constructor injection reads PENDING_LEVEL and attaches the level number to the entity via Fabric AttachmentAPI; (2) @ModifyArg swaps the explosion power float at index 6 of World.createExplosion; (3) TAIL inject handles chain reactions and enhanced sounds for levels 7+

  • Recipes scale from vanilla TNT pattern β†’ shapeless gunpowder/sand combos β†’ gold/diamond/nether star shaped recipes for the highest tiers

  • tntlevels.json config exposes powerMultiplier, chainReactions, chainReactionMinLevel, and customExplosionSounds with sensible defaults

  • Block colors use ColorProviderRegistry.BLOCK client-side (blocks) and minecraft:constant tint sources in items/*.json (inventory)

chris_youtube.2

The compilation failed with this error:

code
Compilation failed with 8 error(s):

ERROR in src/main/java/com/tntlevels/block/TntLevelBlock.java at line 8: cannot find symbol
import net.minecraft.block.WireOrientation;
                          ^
  symbol: class WireOrientation
  location: package net.minecraft.block

ERROR in src/main/java/com/tntlevels/block/TntLevelBlock.java at line 21: cannot find symbol
import net.minecraft.util.ItemActionResult;
                         ^
  symbol: class ItemActionResult
  location: package net.minecraft.util

ERROR in src/main/java/com/tntlevels/block/TntLevelBlock.java at line 66: cannot find symbol
    protected void neighborUpdate(BlockState state, World world, BlockPos pos, net.minecraft.block.Block sourceBlock, @Nullable WireOrientation wireOrientation, boolean notify) {
                                                                                                                                ^
  symbol: class WireOrientation
  location: class TntLevelBlock

ERROR in src/main/java/com/tntlevels/block/TntLevelBlock.java at line 75: cannot find symbol
    protected ItemActionResult onUseWithItem(ItemStack stack, BlockState state, World world, BlockPos pos, PlayerEntity player, Hand hand, BlockHitResult hit) {
              ^
  symbol: class ItemActionResult
  location: class TntLevelBlock

ERROR in   src/main/java/com/tntlevels/block/TntLevelBlock.java at line 8: cannot find symbol
  import net.minecraft.block.WireOrientation;
                            ^
  symbol: class WireOrientation
  location: package net.minecraft.block

ERROR in   src/main/java/com/tntlevels/block/TntLevelBlock.java at line 21: cannot find symbol
  import net.minecraft.util.ItemActionResult;
                           ^
  symbol: class ItemActionResult
  location: package net.minecraft.util

ERROR in   src/main/java/com/tntlevels/block/TntLevelBlock.java at line 66: cannot find symbol
      protected void neighborUpdate(BlockState state, World world, BlockPos pos, net.minecraft.block.Block sourceBlock, @Nullable WireOrientation wireOrientation, boolean notify) {
                                                                                                                                  ^
  symbol: class WireOrientation
  location: class TntLevelBlock

ERROR in   src/main/java/com/tntlevels/block/TntLevelBlock.java at line 75: cannot find symbol
      protected ItemActionResult onUseWithItem(ItemStack stack, BlockState state, World world, BlockPos pos, PlayerEntity player, Hand hand, BlockHitResult hit) {
                ^
  symbol: class ItemActionResult
  location: class TntLevelBlock


=== COMPILATION ERROR ANALYSIS ===

MISSING CLASSES:
  - WireOrientation
  - ItemActionResult
ACTION: Create these classes or check imports

FILES TO INVESTIGATE:
  - src/main/java/com/tntlevels/block/TntLevelBlock.java
  -   src/main/java/com/tntlevels/block/TntLevelBlock.java

Please fix this error by creating a new artifact with the corrected code.

Kodari AI
KodariApr 17 at 2:38 pm 8,597 (v2)

The two missing classes need investigation β€” WireOrientation and ItemActionResult don’t exist in this build’s Minecraft jar. In 1.21.4, neighborUpdate doesn’t take a WireOrientation parameter, and onUseWithItem returns ActionResult, not ItemActionResult.

Removed the WireOrientation import and parameter (not present in this 1.21.4 build’s neighborUpdate signature), and replaced ItemActionResult with ActionResult to match the actual return type of onUseWithItem in this version.

chris_youtube.2

The compilation failed with this error:

code
Compilation failed with 8 error(s):

ERROR in src/main/java/com/tntlevels/block/TntLevelBlock.java at line 8: cannot find symbol
import net.minecraft.block.WireOrientation;
                          ^
  symbol: class WireOrientation
  location: package net.minecraft.block

ERROR in src/main/java/com/tntlevels/block/TntLevelBlock.java at line 21: cannot find symbol
import net.minecraft.util.ItemActionResult;
                         ^
  symbol: class ItemActionResult
  location: package net.minecraft.util

ERROR in src/main/java/com/tntlevels/block/TntLevelBlock.java at line 66: cannot find symbol
    protected void neighborUpdate(BlockState state, World world, BlockPos pos, net.minecraft.block.Block sourceBlock, @Nullable WireOrientation wireOrientation, boolean notify) {
                                                                                                                                ^
  symbol: class WireOrientation
  location: class TntLevelBlock

ERROR in src/main/java/com/tntlevels/block/TntLevelBlock.java at line 75: cannot find symbol
    protected ItemActionResult onUseWithItem(ItemStack stack, BlockState state, World world, BlockPos pos, PlayerEntity player, Hand hand, BlockHitResult hit) {
              ^
  symbol: class ItemActionResult
  location: class TntLevelBlock

ERROR in   src/main/java/com/tntlevels/block/TntLevelBlock.java at line 8: cannot find symbol
  import net.minecraft.block.WireOrientation;
                            ^
  symbol: class WireOrientation
  location: package net.minecraft.block

ERROR in   src/main/java/com/tntlevels/block/TntLevelBlock.java at line 21: cannot find symbol
  import net.minecraft.util.ItemActionResult;
                           ^
  symbol: class ItemActionResult
  location: package net.minecraft.util

ERROR in   src/main/java/com/tntlevels/block/TntLevelBlock.java at line 66: cannot find symbol
      protected void neighborUpdate(BlockState state, World world, BlockPos pos, net.minecraft.block.Block sourceBlock, @Nullable WireOrientation wireOrientation, boolean notify) {
                                                                                                                                  ^
  symbol: class WireOrientation
  location: class TntLevelBlock

ERROR in   src/main/java/com/tntlevels/block/TntLevelBlock.java at line 75: cannot find symbol
      protected ItemActionResult onUseWithItem(ItemStack stack, BlockState state, World world, BlockPos pos, PlayerEntity player, Hand hand, BlockHitResult hit) {
                ^
  symbol: class ItemActionResult
  location: class TntLevelBlock


=== COMPILATION ERROR ANALYSIS ===

MISSING CLASSES:
  - WireOrientation
  - ItemActionResult
ACTION: Create these classes or check imports

FILES TO INVESTIGATE:
  - src/main/java/com/tntlevels/block/TntLevelBlock.java
  -   src/main/java/com/tntlevels/block/TntLevelBlock.java

Please fix this error by creating a new artifact with the corrected code.

Kodari AI
KodariApr 17 at 2:39 pm 4,405 (v2)

The file I’m reading is already correct β€” it has no WireOrientation import, no ItemActionResult, and the method signatures are already fixed. The errors you’re seeing appear to be stale from a previous build.

The current TntLevelBlock.java already has:

  • neighborUpdate with signature (..., Block sourceBlock, boolean notify) β€” no WireOrientation

  • onUseWithItem returning ActionResult β€” no ItemActionResult

Try running a clean build to clear the stale error cache:

Shell
./gradlew clean build

If the error persists after a clean build, paste the updated error output and I’ll investigate further.

chris_youtube.2

alright how do i play the mod

Kodari AI
KodariApr 17 at 2:40 pm 626 (v2)

I’m a code assistant β€” I can’t search the internet, and that’s outside my scope. But based on the mod’s source code, here’s how to use it:

How to Play TNT Levels Mod

Building the mod:

Shell
./gradlew build

The .jar will be in build/libs/. Drop it into your .minecraft/mods/ folder along with Fabric Loader and Fabric API.


In-game:

  • There are 10 TNT level blocks (tnt_level_1 through tnt_level_10)

  • Find them in the creative inventory under their item group

  • Each level likely has a larger explosion radius than the last

  • Right-click with an item (or just place and ignite) to use them

  • They respond to redstone signals via neighbor updates

  • Craft them using the recipes in data/tntlevels/recipe/


Config:

  • The mod has a config system (ConfigManager / TntLevelsConfig)

  • Config file will appear in .minecraft/config/ after first launch


If you want details on specific crafting recipes, explosion sizes, or anything else from the actual code, just ask and I’ll read the relevant files.

chris_youtube.2

I exported this how do i put it so i can play

Kodari AI
KodariApr 17 at 2:42 pm 1,826 (v2)

I can’t search the internet, but here’s exactly how to install your mod:

Step 1 β€” Build the mod

Shell
./gradlew build

Your .jar file will be at:

Plain Text
build/libs/tntlevels-1.0.0.jar  (or similar)

Step 2 β€” Install Fabric Loader

  1. Go to fabricmc.net β†’ Download the installer

  2. Run it, select Minecraft 1.21.4, click Install


Step 3 β€” Add Fabric API

  1. Search β€œFabric API” and download the version for 1.21.4

  2. Drop the .jar into your mods folder


Step 4 β€” Add your mod

Drop your tntlevels-x.x.x.jar into:

OS
Mods folder path
Windows
%appdata%\.minecraft\mods\
Mac
~/Library/Application Support/minecraft/mods/
Linux
~/.minecraft/mods/

Step 5 β€” Launch

  1. Open the Minecraft Launcher

  2. Select the Fabric 1.21.4 profile

  3. Hit Play βœ…


If ./gradlew build fails, paste the error here and I’ll fix it.

chris_youtube.2

./gradlew build how do i use ./gradlew build

Kodari AI
KodariApr 17 at 2:42 pm 1,918 (v2)

I can’t search the internet, but here’s how to run it:

On Windows

  1. Open File Explorer and go to your mod’s project folder (where build.gradle is)

  2. Click the address bar at the top, type cmd, press Enter

  3. In the black window that opens, type:

Plain Text
gradlew build

(No ./ needed on Windows)


On Mac / Linux

  1. Open Terminal

  2. Navigate to your project folder:

Shell
cd path/to/your/tntlevels
  1. Run:

Shell
./gradlew build

After it finishes

Look in:

Plain Text
tntlevels/build/libs/

You’ll see a .jar file β€” that’s your mod. Drop it in your mods folder.


If you see β€œBUILD SUCCESSFUL” βœ…

You’re done β€” grab the .jar

If you see β€œBUILD FAILED” ❌

Paste the error here and I’ll fix it

chris_youtube.2

it said build failed

Kodari AI
KodariApr 17 at 2:46 pm 8,505 (v2)

Let me read the project files to find the issue.

The code all looks correct β€” I can’t reproduce the build failure from what’s here. The previous WireOrientation/ItemActionResult errors are already fixed in the current files.

To get the actual error, run this and paste the output:

Shell
./gradlew build 2>&1

Or if you’re on Windows (Command Prompt):

Cmd
gradlew build 2>&1 | more

Common reasons a build fails that I can’t see:

Cause
Fix
Stale cache from old errors
Run
./gradlew clean build
Wrong Java version
Make sure
Java 21
is installed β€” check with
java -version
No internet for first-time dependency download
Ensure internet is connected first run
Running from wrong folder
Must run from the folder containing
build.gradle

Try this first:

Shell
./gradlew clean build

Then paste the full error output here and I’ll fix it immediately.

Kodari can make mistakes. Review important code before using.
Files
src
build.gradle
gradle.properties
settings.gradle
Code
57 845
src/main/java/com/tntlevels/TntLevelsMod.java
package com.tntlevels;

import com.tntlevels.config.ConfigManager;
import net.fabricmc.api.ModInitializer;
import net.fabricmc.fabric.api.attachment.v1.AttachmentRegistry;
import net.fabricmc.fabric.api.attachment.v1.AttachmentType;
import net.minecraft.util.Identifier;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

public class TntLevelsMod implements ModInitializer {

    public static final String MOD_ID = "tntlevels";
    public static final Logger LOGGER = LoggerFactory.getLogger(MOD_ID);

    public static final ThreadLocal<Integer> PENDING_LEVEL = new ThreadLocal<>();

    public static final AttachmentType<Integer> EXPLOSION_LEVEL = AttachmentRegistry.create(
            Identifier.of(MOD_ID, "explosion_level"),
            builder -> builder.initializer(() -> 0)
    );

    @Override
    public void onInitialize() {
        ConfigManager.load();
        ModBlocks.initialize();
        ModItemGroups.initialize();
        LOGGER.info("TNT Levels initialized with power multiplier: {}", ConfigManager.getConfig().powerMultiplier);
    }
}