Skip to content

marcusgreenwood/vibecraft

Folders and files

NameName
Last commit message
Last commit date

Latest commit

ย 

History

8 Commits
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 

Repository files navigation

Vibecraft - AI-Powered Minecraft Mod Development Framework ๐Ÿค–๐Ÿ’ฅ

A comprehensive framework for AI-assisted "vibe coding" of Minecraft mods with automated RPA testing validation.

This project demonstrates how to build Minecraft mods using AI coding assistants (like Cursor, Claude, GitHub Copilot) with confidence, backed by automated testing that verifies functionality actually works in the game environment.

Table of Contents

Framework Overview

๐ŸŽฏ Primary Goals

  1. AI Vibe Coding Framework - Enable rapid, intuitive development with AI coding assistants
  2. RPA Testing Validation - Automated Robot-powered testing that verifies code actually works in Minecraft
  3. Example Implementation - Demonstrate the framework with working mod features

๐Ÿค– Why This Matters

Modern AI coding assistants can generate Minecraft mod code rapidly, but they cannot verify that the code works in the complex game environment. This framework bridges that gap by providing:

  • Immediate validation of AI-generated code
  • Automated regression testing for iterative development
  • Real game environment testing beyond unit tests
  • Confidence in AI suggestions through comprehensive verification

AI Vibe Coding Support

๐Ÿง  What is "Vibe Coding"?

"Vibe coding" refers to the intuitive, experimental approach where developers:

  • Code by intuition and feel rather than rigid specifications
  • Rapidly prototype and iterate on ideas
  • Use AI assistants to generate code based on natural language descriptions
  • Focus on creative exploration over upfront planning

๐Ÿ”„ The AI Development Loop

1. ๐Ÿ’ญ Describe desired functionality to AI
2. ๐Ÿค– AI generates mod code 
3. ๐Ÿงช Automated tests validate in real Minecraft
4. โœ… Tests pass โ†’ Feature ready
5. โŒ Tests fail โ†’ AI debugs and fixes
6. ๐Ÿ” Repeat until working

๐ŸŽฏ Framework Benefits for AI Development

  • Rapid Feedback - Know immediately if AI code works
  • Safe Experimentation - Test crazy ideas without breaking anything
  • Iterative Refinement - AI can continuously improve based on test results
  • Complex Validation - Tests verify game mechanics, not just syntax
  • Documentation Through Tests - Tests serve as executable specifications

RPA-Powered Test Framework

๐Ÿค– Robot Process Automation (RPA) Testing

This framework uses Java's Robot class to perform actual UI automation of Minecraft:

// Real UI automation - not mocked!
Robot robot = new Robot();
pressKey(robot, KeyEvent.VK_T);           // Open chat
typeString(robot, "/runalltests");        // Type command  
pressKey(robot, KeyEvent.VK_ENTER);       // Execute
monitorGameLogs();                        // Validate results

๐ŸŽฎ Why RPA Instead of Unit Tests?

Minecraft mods involve complex interactions that unit tests can't capture:

  • Game Engine Integration - Mixins, entity spawning, world interaction
  • Client-Server Communication - Network packets, synchronization
  • UI Interactions - Key bindings, chat commands, player input
  • Real-Time Systems - Entity ticking, explosion mechanics, physics

๐Ÿ”ง Test Architecture

โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”    โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”    โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”
โ”‚   Test Runner   โ”‚    โ”‚   Minecraft      โ”‚    โ”‚   Validation    โ”‚
โ”‚                 โ”‚    โ”‚                  โ”‚    โ”‚                 โ”‚
โ”‚ โ€ข Launch Game   โ”‚โ”€โ”€โ”€โ–ถโ”‚ โ€ข Load Mod       โ”‚โ”€โ”€โ”€โ–ถโ”‚ โ€ข Parse Logs    โ”‚
โ”‚ โ€ข Type Commands โ”‚    โ”‚ โ€ข Execute Tests  โ”‚    โ”‚ โ€ข Check Results โ”‚
โ”‚ โ€ข Monitor Logs  โ”‚    โ”‚ โ€ข Real Entities  โ”‚    โ”‚ โ€ข Report Status โ”‚
โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜    โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜    โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜

โšก Automated Test Flow

  1. Environment Setup

    launchMinecraft()           // Start game with mod
    waitForWorldLoad()          // Ensure game is ready
    setupTestEnvironment()      // Creative mode, clear area
  2. Test Execution

    typeCommand("/runalltests")  // Execute comprehensive tests
    monitorGameLogs()           // Watch for success/failure
    parseTestResults()          // Extract validation data
  3. Real Game Validation

    spawnCreeper()              // Create actual entities
    triggerExplosion()          // Test real game mechanics
    measureExplosionRadius()    // Verify functionality works

๐Ÿงช Test Categories

  • Entity Integration - Spawn mobs, verify behavior
  • Game Mechanics - Test explosions, physics, interactions
  • Command System - Validate chat commands work correctly
  • Client-Server - Test networking and synchronization
  • Configuration - Verify settings persistence and application

Adding New Functionality

Follow the .cursorrules for the complete workflow. Key steps:

  1. Write tests first in TestCommand.java
  2. Implement the feature
  3. Run tests with ./run-test.sh
  4. Fix until passing
  5. Update documentation

Quick Examples

New Command:

dispatcher.register(literal("mycommand")
    .executes(context -> {
        // Your logic here
        return 1;
    }));

New Test:

private static boolean testMyFeature(ServerCommandSource source, ServerPlayerEntity player, ServerWorld world) {
    try {
        // Test your functionality
        return true; // or false if validation fails
    } catch (Exception e) {
        return false;
    }
}

Testing System

๐ŸŽฏ Core Testing Philosophy

This framework prioritizes integration testing over unit testing because Minecraft mods require validation of:

  • Real game interactions - Not just isolated functions
  • Complex state management - Entities, world state, networking
  • Performance under load - Actual game conditions
  • Cross-system integration - Client โ†” Server โ†” Game Engine

โšก Test Execution

# Run full automated test suite
./run-test.sh

# Manual test execution (in-game)
/runalltests

# Test specific functionality  
/testexplosion
/boom 5.0

๐Ÿ“Š Test Output Example

๐Ÿงช Running Vibecraft integration tests...
๐Ÿงช Testing creeper explosion...
  โ†’ Spawning creeper...
  โ†’ Igniting creeper...
  โ†’ Creating explosion (9.0x power)...
  โ†’ Explosion completed! Expected power: 9.0x
โœ… Creeper explosion test passed
๐Ÿงช Testing TNT launching...
  โ†’ Testing TNT launching system...
  โ†’ Spawning launched TNT...
  โ†’ TNT tag: โœ“
  โ†’ TNT velocity: โœ“
โœ… TNT launching test passed
โœ… All tests passed (4/4)

โšก Quick Test Execution

./run-test.sh              # Full automated test suite  
/runalltests               # Manual in-game testing

Results show step-by-step validation:

๐Ÿงช Running Vibecraft integration tests...
โœ… Creeper explosion test passed
โœ… TNT launching test passed
โœ… All tests passed (4/4)

Development Setup

# Prerequisites: Java 21+, Gradle 8.0+
git clone <repository-url>
cd creeper-explosions

# Build and test
./gradlew build
./run-test.sh

# Development 
./gradlew runClient    # Launch Minecraft with mod

Building

./gradlew build
# Output: build/libs/vibecraft-1.0.0.jar

Contributing

Follow the .cursorrules workflow: write tests first, implement features, run tests, update docs.

License

This project is licensed under the MIT License - see the LICENSE file for details.


Mod Features

๐Ÿงจ Explosion Multipliers (Example Implementation)

  • Configurable explosion sizes from 0.1x to 50x
  • Chat commands for easy configuration (/boom, /explosionmultiplier)
  • Random multiplier ranges for dynamic gameplay
  • Test explosions to preview effects (/testexplosion)

๐Ÿš€ TNT Launching (Example Implementation)

  • Attack button (left-click) launching - hold longer for more power
  • Power-based trajectory - 1x to 5x launch power based on hold duration
  • Impact explosions - launched TNT explodes on impact with multiplied power
  • Visual feedback - shows launch power when TNT is fired

๐Ÿ“‹ Commands Reference

Simple Commands

  • /boom [multiplier] - Set explosion multiplier (0.1x to 50x)
  • /testexplosion - Create test explosion with current multiplier

Advanced Commands (OP level 2 required)

  • /explosionmultiplier set <value> - Set fixed multiplier
  • /explosionmultiplier range <min> <max> - Set random range
  • /explosionmultiplier show - Display current settings
  • /explosionmultiplier reset - Reset to defaults (2x-20x random)

Testing Commands

  • /runalltests - Execute comprehensive mod testing
  • /clientquit - Cleanly quit the client (for automation)

TNT Launching Usage

  • Hold TNT in main hand
  • Press and hold left-click - longer hold = more power (1x-5x)
  • Release to launch - TNT flies with trajectory and explodes on impact

๐ŸŽฎ Installation (For Playing)

  1. Install Fabric Loader for Minecraft 1.21.8
  2. Download Fabric API
  3. Place both Fabric API and Vibecraft JAR in your mods/ folder
  4. Launch Minecraft

Why This Framework Matters

This project demonstrates how to build Minecraft mods that are AI-development ready. By providing comprehensive automated testing, clear architecture, and detailed documentation, we enable:

  • Rapid prototyping with AI assistance
  • Reliable iteration on complex game mechanics
  • Confident deployment of AI-generated code
  • Educational value for understanding mod development

The RPA testing framework proves that "vibe coding" can be both creative and reliable when supported by proper validation infrastructure.

Build the future of AI-assisted modding! ๐Ÿค–๐Ÿ’ฅ๐Ÿš€

About

vibe-coding for Minecraft

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published