neoforged / ModDevGradle

A Gradle plugin for developing Minecraft mods using NeoForge
https://projects.neoforged.net/neoforged/moddevgradle
GNU Lesser General Public License v2.1
33 stars 4 forks source link

Add the ability to inject interfaces into Minecraft classes #83

Closed shartte closed 3 months ago

shartte commented 3 months ago

Interface Injection

Interface injection is an advanced feature allowing mods to add additional interfaces to Minecraft classes and interfaces at development time. This feature requires that mods use ASM or Mixins to make the same extensions at runtime.

To use this feature, place an interface injection data-file in your project and configure the interfaceInjectionData property to include it. Since this feature only applies at development time, you do not need to include this data file in your jar.

[!IMPORTANT] This feature only applies at development time. You need to use Mixins or Coremods to make it work at runtime.

build.gradle

neoForge {
    interfaceInjectionData = files("interfaces.json")
}

interfaces.json

{
  "net/minecraft/world/item/ItemStack": [
    "testproject/FunExtensions"
  ]
}

In addition, you can add additional data-files to the interfaceInjectionData configuration using normal Project dependency syntax in your dependencies block.

Fixes #82

neoforged-pr-publishing[bot] commented 3 months ago

Last commit published: 69be9ed6fa751ff8f38c4b069fb8855aa41eee46.

PR Publishing ### The artifacts published by this PR: - :package: [`net.neoforged.moddev.repositories:net.neoforged.moddev.repositories.gradle.plugin:0.1.136-pr-83-fix-82`](https://github.com/neoforged/ModDevGradle/packages/2197246) - :package: [`net.neoforged.moddev:net.neoforged.moddev.gradle.plugin:0.1.136-pr-83-fix-82`](https://github.com/neoforged/ModDevGradle/packages/2197245) - :package: [`net.neoforged:moddev-gradle:0.1.136-pr-83-fix-82`](https://github.com/neoforged/ModDevGradle/packages/2197243) ### Repository Declaration In order to use the artifacts published by the PR, add the following repository to your buildscript: ```gradle repositories { maven { name 'Maven for PR #83' // https://github.com/neoforged/ModDevGradle/pull/83 url 'https://prmaven.neoforged.net/ModDevGradle/pr83' content { includeModule('net.neoforged.moddev.repositories', 'net.neoforged.moddev.repositories.gradle.plugin') includeModule('net.neoforged.moddev', 'net.neoforged.moddev.gradle.plugin') includeModule('net.neoforged', 'moddev-gradle') } } } ```