A template/example Minecraft Forge MOD for version 1.21.4 with automated development workflow for WSL/Windows environments.
This MOD adds:
- Example Block: A new buildable block with stone-like properties
- Example Item: A food item that can be consumed anytime
- Example Tab: A custom creative mode tab to organize MOD items
- Minecraft: 1.21.4
- Forge: 54.1.0
- Java: 21
- Gradle: 8.12.1
- Java 21
- WSL2 (for Windows users)
- Minecraft with Forge 1.21.4-54.1.0 installed
# Quick build (skips tests for faster development)
./quick-build.sh
# Full build with tests
./gradlew buildFor WSL users developing for Windows Minecraft:
-
Auto-watch and deploy:
./watch-build.sh
This will:
- Monitor
src/directory for changes - Automatically rebuild when Java files are modified
- Deploy the MOD to Windows Minecraft mods folder
- Monitor
-
Manual deployment:
./deploy-mod.sh
-
VS Code Integration:
- Use
Ctrl+Shift+P→ "Tasks: Run Task" - Available tasks:
- "Watch & Auto-Deploy"
- "Quick Build"
- "Deploy MOD to Windows"
- Use
- Build the MOD:
./gradlew build - Copy
build/libs/examplemod-1.0.0.jarto your Minecraftmods/folder - Launch Minecraft with Forge 1.21.4-54.1.0
src/main/java/com/example/examplemod/
├── ExampleMod.java # Main MOD class
└── Config.java # Configuration management
Scripts:
├── quick-build.sh # Fast development build
├── watch-build.sh # Auto-watch and deploy
└── deploy-mod.sh # Deploy to Windows
// Register a new item
public static final RegistryObject<Item> MY_ITEM = ITEMS.register("my_item",
() -> new Item(new Item.Properties().setId(ITEMS.key("my_item")))
);// Register a new block
public static final RegistryObject<Block> MY_BLOCK = BLOCKS.register("my_block",
() -> new Block(BlockBehaviour.Properties.of().setId(BLOCKS.key("my_block")))
);
// Register the block item
public static final RegistryObject<Item> MY_BLOCK_ITEM = ITEMS.register("my_block",
() -> new BlockItem(MY_BLOCK.get(), new Item.Properties().setId(ITEMS.key("my_block")))
);The MOD uses Forge's configuration system. Configuration files are generated in:
- Single player:
saves/[world]/serverconfig/ - Dedicated server:
serverconfig/
- Fork the repository
- Create a feature branch
- Make your changes
- Test thoroughly
- Submit a pull request
This project is licensed under the MIT License - see the LICENSE.txt file for details.
- Built with Minecraft Forge MDK
- Uses the standard Forge development patterns
- Optimized for WSL/Windows development workflow