EMI Documentation

repository·1.21·Indexed 18 days ago

https://github.com/emilyploszaj/emi

A featureful and accessible item and recipe viewer for Minecraft that helps players and developers navigate item trees and crafting recipes. The documentation covers Gradle dependency configuration for Fabric, Forge, NeoForge, Architectury, and MultiLoader Template, as well as implementation details for the ChessEmiStack class.

Tokens
1K
Snippets
3
Records
4
Agent score
14%

What's inside EMI

  1. Enable Mixin refmaps for Forge Gradle

    1.21

    If you are using Forge Gradle, you must enable Mixin refmaps in your client sourceset. Add the following properties to your client run configuration in build.gradle.

    runs {
    	client {
    		// Add these two lines
    		property 'mixin.env.remapRefMap', 'true'
    		property 'mixin.env.refMapRemappingFile', "${projectDir}/build/createSrgToMcp/output.srg"
    
    		// The rest of the code that was already here
    		// ...
    	}
    }
  2. Configure EMI dependencies for different modloaders

    1.21

    EMI dependency configuration depends on your modloader and build system. Use the Gradle property emi_version (formatted as EMI_VERSION+MINECRAFT_VERSION, e.g., 1.0.0+1.19.4) to specify the correct version.

    Common dependency setups include:

    • Fabric: Use emi-fabric with :api for compile-only and the base module for local runtime.
    • Forge: Use emi-forge with fg.deobf and :api for compile-only.
    • NeoForge: Use emi-neoforge with :api for compile-only.
    • Architectury: Use emi-xplat-intermediary with :api for compile-only.
    • MultiLoader Template/VanillaGradle: Use emi-xplat-mojmap with :api for compile-only.
    dependencies {
    	// Fabric
    	modCompileOnly "dev.emi:emi-fabric:${emi_version}:api"
    	modLocalRuntime "dev.emi:emi-fabric:${emi_version}"
    
    	// Forge (see below block as well if you use Forge Gradle)
    	compileOnly fg.deobf("dev.emi:emi-forge:${emi_version}:api")
    	runtimeOnly fg.deobf("dev.emi:emi-forge:${emi_version}") 
    
    	// NeoForge
    	compileOnly "dev.emi:emi-neoforge:${emi_version}:api"
    	runtimeOnly "dev.emi:emi-neoforge:${emi_version}" 
    
    	// Architectury
    	modCompileOnly "dev.emi:emi-xplat-intermediary:${emi_version}:api"
    
    	// MultiLoader Template/VanillaGradle
    	compileOnly "dev.emi:emi-xplat-mojmap:${emi_version}:api"
    }
  3. Add the Sleeping Town repository to Gradle

    1.21

    To use EMI as a dependency, you must first add the 'Sleeping Town' Maven repository to your build.gradle file.

    repositories {
    	maven {
    		name = "Sleeping Town"
    		url = "https://repo.sleeping.town/"
    	}
    }
  4. ChessPiece ChessEmiStack implementation

    1.21

    The ChessEmiStack class is an implementation of EmiStack used to represent and render individual chess pieces within the EMI interface. It handles the visual representation of pieces on the board, including highlighting for targets, last moves, and check states, as well as handling promotion UI and tooltips for game actions (like inviting players or restarting games).

    Key behaviors:

    • Rendering: Draws the piece texture using EmiRenderHelper.PIECES. It applies specific background highlights:
      • Target: Green highlight (0x5555ff00) if the position is a target.
      • Last Move: Yellow highlight (0x55aaaa00) if the position was part of the last move.
      • Check: Red highlight (0x55ff0000) if a King is in check.
      • Promotion: Displays promotion options when a pawn is pending promotion.
    • Tooltips: Provides contextual tooltips based on the piece type and game state, such as invitation prompts or restart options.
    • Identification: Each stack is uniquely identified by its board position via getId() using the pattern emi:/chess/{position}.