fabric-loom icon indicating copy to clipboard operation
fabric-loom copied to clipboard

[Suggestion] Way to declare injected interfaces elsewhere

Open TropheusJ opened this issue 2 years ago • 5 comments

One of my projects has around 300 lines worth of injected interfaces. This makes the fmj very messy and 7x longer than it needs to be. On top of this, since $ is used for inner classes AND to mark something as a placeholder for gradle, we need this in our processResources:

for (int i = 0; i < 6000; i++) {
	String name = "class_$i"
	properties.put(name, name)
}
properties.put("DeserializerAccessor", "DeserializerAccessor")
properties.put("MixAccessor", "MixAccessor")
properties.put("AnimatedTextureAccessor", "AnimatedTextureAccessor")
properties.put("BuilderAccessor", "BuilderAccessor")
properties.put("EntryAccessor", "EntryAccessor")

I've tried storing them elsewhere and copying them over with gradle property expansion in processResources, but that doesn't work since loom directly reads the file. I tried messing around with adding a source set for it to look at, but got nowhere. Specifying injected interfaces elsewhere would solve this.

TropheusJ avatar Jun 29 '22 04:06 TropheusJ

I believe the idea is to eventually expand AW to include other kinds of bytecode edits such as itf injection.

Technici4n avatar Jun 29 '22 07:06 Technici4n

Not a solution for the long files, but you can rewrite $ as \u0024 in JSON files to prevent processResources from trying to expand it.

Juuxel avatar Jun 29 '22 21:06 Juuxel

I think you can also use single quotes in groovy for string literals

modmuss50 avatar Jun 29 '22 21:06 modmuss50

Yes, but this has nothing to do with Groovy but Gradle's task failing to process json files with unrelated $ in them

Juuxel avatar Jun 29 '22 21:06 Juuxel

Oh my bad, I read the code snippet totally wrong :D

modmuss50 avatar Jun 29 '22 21:06 modmuss50