PaperMC / paperweight

Gradle build system plugin for Paper and Paper forks
240 stars 48 forks source link

[userdev] Generate multiple spigot mapping classes with same mojang mapping code. #249

Closed Rothes closed 4 months ago

Rothes commented 4 months ago

Imagine a scenario: You coded a class using NMS. You found that the code is consistent in mojang mappings from 1.19 to 1.20.2 (or more versions). But you are compiling the plugin to Spigot mappings. For this, you need to create multiple modules and copy the java source file, and only specify the different minecraft version in build.gradle file, like what most plugins are doing now.

This would be a mess as you need to maintain it in different projects. With a simple change, you need to keep them in sync. This is cumbersome. I'm thinking of if the plugin can generate classes in different minecraft versions automaticlly in a single project, this would help a lot in maintaining. This seems to work, applying a different mapping and adding a version ordinal to the end of the class name. Plugin can access them using reflect.

jpenilla commented 4 months ago

Such a feature is out of scope for paperweight. Also if the code is unchanged I don't see why you couldn't include named classes from one gradle project in the remap input of multiple others.

Rothes commented 4 months ago

I hope to delegate everything to a plugin. This operation requires creating a project manually. But I understand that this is not accepted. Thanks.