anupyadavonline

Can you make a custom weapon mod for Minecraft 1.21.4

Kodari AI
KodariFeb 24 at 3:38 pm 12,892 (v2)

I’ll create a custom weapon mod for Minecraft 1.21.4 with multiple unique weapons.

CustomWeapons
A Fabric mod that adds powerful custom weapons to Minecraft including enchanted swords with special abilities, battle axes with increased damage, and a throwable spear weapon. Features custom tool materials with unique durability and mining speeds, special attack effects, and fully configured item models following 1.21.4 standards.

Perfect! I’ve created a complete custom weapon mod for Minecraft 1.21.4 Fabric with the following features:

Weapons Included:

  1. Ruby Sword - 25% chance to apply Weakness effect with particle effects

  2. Obsidian Battleaxe - High damage axe with 30% chance to apply Slowness

  3. Celestial Blade - Epic rarity sword that applies Glowing + Levitation to enemies and gives Regeneration + Speed to the wielder

  4. Flame Dagger - Sets enemies on fire with every hit

  5. Thunder Spear - Throwable weapon with electric spark effects

Material System:

  • Three custom tool materials (Ruby, Obsidian, Celestial) with increasing durability and power

  • Proper repair materials using item tags

Key 1.21.4 Features:

  • Mandatory RegistryKey implementation for all items

  • Item model definition files in the new format

  • Proper particle and sound effects using 1.21.4 APIs

  • Custom item group with all weapons

  • Status effect applications on hit

Next Steps:

  1. Add texture PNG files to src/main/resources/assets/customweapons/textures/item/ for each weapon

  2. Run ./gradlew build to compile

  3. The mod will appear in build/libs/

All weapons have unique special effects that trigger on hitting enemies, with particles and sounds to match their theme!

anupyadavonline

Add texture packs on your own from the internet

Kodari AI
KodariFeb 24 at 3:39 pm 5,013 (v2)

I cannot download or fetch texture files from the internet. I don’t have the ability to browse websites or access external resources.

However, I can help you in these ways:

What I CAN do:

  1. Create the proper file structure for textures in your mod

  2. Explain where to place textures you download or create yourself

  3. Show you where to find free textures:

  4. Create placeholder textures - I can generate simple colored placeholder PNGs if you need temporary textures to test your mod

What YOU need to do:

  1. Create or download 16x16 PNG textures for your items

  2. Place them in src/main/resources/assets/customweapons/textures/item/

  3. Name them to match your item IDs:

    • ruby.png

    • ruby_sword.png

    • celestial_blade.png

    • flame_dagger.png

    • thunder_spear.png

    • obsidian_battleaxe.png

    • celestial_crystal.png

    • obsidian_shard.png

Would you like me to:

  • Create simple placeholder texture files so your mod works immediately?

  • Explain how to create your own textures?

  • Show you the exact folder structure you need?

anupyadavonline

The compilation failed with this error:

code
Validation failed for compilation: Compilation failed with 2 error(s):

ERROR in src/main/java/com/customweapons/item/ThunderSpearItem.java at line 8: cannot find symbol
import net.minecraft.item.ToolMaterials;
                         ^
  symbol: class ToolMaterials
  location: package net.minecraft.item

ERROR in   src/main/java/com/customweapons/item/ThunderSpearItem.java at line 8: cannot find symbol
  import net.minecraft.item.ToolMaterials;
                           ^
  symbol: class ToolMaterials
  location: package net.minecraft.item


=== COMPILATION ERROR ANALYSIS ===

MISSING CLASSES:
  - ToolMaterials
ACTION: Create these classes or check imports

FILES TO INVESTIGATE:
  - src/main/java/com/customweapons/item/ThunderSpearItem.java
  -   src/main/java/com/customweapons/item/ThunderSpearItem.java
 exceeds maximum 

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

Kodari AI
KodariFeb 24 at 3:42 pm 3,369 (v2)

I need to read the ThunderSpearItem file and related files to understand the issue and fix the import error.

I can see the issue. The ThunderSpearItem is trying to import ToolMaterials (vanilla materials enum) which doesn’t exist or has been removed in Minecraft 1.21.4. The other weapon items correctly accept a ToolMaterial parameter. Let me fix this:

Fixed the compilation error by replacing the non-existent ToolMaterials import with ToolMaterial and updating the constructor to accept a material parameter, matching the pattern used by other custom weapon items.

Kodari can make mistakes. Review important code before using.
Files
gradle
src
.gitignore
build.gradle
gradle.properties
settings.gradle
Code
38 677
src/main/java/com/customweapons/CustomWeaponsClient.java
package com.customweapons;

import net.fabricmc.api.ClientModInitializer;

public class CustomWeaponsClient implements ClientModInitializer {
	@Override
	public void onInitializeClient() {
		CustomWeapons.LOGGER.info("Initializing Custom Weapons Client");
	}
}