PaperMC / paperweight

Gradle build system plugin for Paper and Paper forks

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Paperweight can't remap class if it extends non-included third-party class which extends NMS class

TheSirCororo opened this issue · comments

I have 2 classes. One of them is located in jar A in module A of root project, other located in jar B in module B of root project. All of them has active paperweight plugin. Module A has dependency on module B by compileOnly (which don't includes it into fat jar).
Module A has AEntity class which extends BEntity in B module which extends PathfinderMob from NMS.

I have following code:

AEntity a = ...;
GoalSelector goalSelector = a.goalSelector;

Bytecode of reobf jar:

AEntity a = ...;
PathfinderGoalSelector goalSelector = a.goalSelector;

goalSelector field was NOT remapped.

Core has correct remapped bytecode, but plugin does NOT.

I fixed this by doing following:

AEntity a = ...;
GoalSelector goalSelector = ((PathfinderMob) a).goalSelector;

Which was correctly remapped to:

AEntity a = ...;
PathfinderGoalSelector goalSelector = ((EntityCreature) a).oB;

Problem occured because paperweight can not detect NMS in other jar (other module) of project.

Possible solution: mark nms classes which remapped by paperweight with metadata and detect it. (maybe annotation processor can be used)

You need to add the dependency to the remap classpath:

abstract val remapClasspath: ConfigurableFileCollection

You need to add the dependency to the remap classpath:

abstract val remapClasspath: ConfigurableFileCollection

What should I provide to this property? I tried to use from(project(":B").compilations.getByName("compileClasspath")) and runtimeClasspath too but got error or non-changed bytecode. I tried to use from(project(":B").file("src/main/kotlin")) and it dont work too. Help please.

I fixed it, thanks