AppleSkin Documentation

repository·1.16-forge·Indexed 18 days ago

https://github.com/squeek502/appleskin

A Minecraft mod that enhances the user interface with detailed food, saturation, and exhaustion information. It features food value tooltips, HUD visualizations, food previews, and a debug overlay. AppleSkin also provides an API for mod developers to interact with food metrics and register event handlers via the squeek.appleskin.api.event package.

Tokens
994
Snippets
3
Records
5
Agent score
14%

What's inside AppleSkin

  1. Features of AppleSkin

    1.16-forge

    AppleSkin is a Minecraft mod that provides food-related HUD improvements. Key features include:

    • Food Value Tooltips: Displays food value information when hovering over items in tooltips.
    • HUD Visualizations: Adds visual indicators for saturation and exhaustion to the HUD.
    • Food Preview: Shows potential hunger/saturation restored and potential health restored while holding food in the hand.
    • Debug Overlay: Adds hunger, saturation, and exhaustion information to the F3 debug overlay.
    • Data Syncing: Synchronizes saturation and exhaustion values to the client.
  2. Build AppleSkin from source

    1.16-forge

    To build the project locally, clone the repository and use the Gradle wrapper. You can optionally provide a specific version number during the build process.

    # Standard build
    ./gradlew build
    
    # Build with a specific version
    ./gradlew build -Pversion=1.0.0
  3. Integrate AppleSkin API into Forge mods

    1.16-forge

    To allow your mod to interact with AppleSkin without requiring it as a hard dependency (so your mod loads even if AppleSkin is absent), use compileOnly for the API.

    1. Add the Ryan Liptak Maven repository to your build.gradle.
    2. Add the appleskin-forge dependency with the :api classifier.
    3. Replace <version> with the current version from the Maven repository.

    To test with the full mod in your development environment, add the dependency as runtimeOnly without the :api classifier.

    // In build.gradle
    repositories {
    	maven { url "https://maven.ryanliptak.com/" }
    }
    
    dependencies {
    	// For compiling against the API (does not include AppleSkin in the final mod jar)
    	compileOnly fg.deobf("squeek.appleskin:appleskin-forge:<version>:api")
    
    	// For testing with the full mod in your dev environment
    	runtimeOnly fg.deobf("squeek.appleskin:appleskin-forge:<version>")
    }
  4. Register AppleSkin event handlers safely

    1.16-forge

    When using the AppleSkin API, you should only register your event handlers if the AppleSkin mod is actually loaded in the environment. This prevents crashes when the mod is missing. Use ModList.get().isLoaded("appleskin") within your client setup event.

    // In your @Mod annotated class
    private void clientInit(final FMLClientSetupEvent event) {
        if (ModList.get().isLoaded("appleskin")) {
            MinecraftForge.EVENT_BUS.register(new AppleSkinEventHandler());
        }
    }
    
    // Your event handler implementation
    public class AppleSkinEventHandler {
        @SubscribeEvent
        public void onPreTooltipEvent(TooltipOverlayEvent.Pre event) {
            // Example: hide the tooltip for regular apples
            if (event.itemStack.getItem() == Items.APPLE) {
                event.setCanceled(true);
            }
        }
    }
  5. AppleSkin API Events Reference

    1.16-forge
    AppleSkin provides an event system for mod developers to hook into food-related UI and logic. All available events can be found in the squeek.appleskin.api.event package. One example is TooltipOverlayEvent.Pre, which allows you to intercept or cancel tooltips.