Skip to content

Generated methods CSV doesn't support record method names #922

Open
@Su5eD

Description

@Su5eD

Currently, the generator for method and field CSV files, OfficialChannelProvider, distinguishes methods and fields by their prefix, which is func_ / m_ for methods and field_ / f_ for fields. However, in records, the names of accessor methods are the same as the field they're accessing. As an example, see NoiseGeneratorSettings.surfaceRule.

for (IMappingFile.IField fld : cls.getFields()) {
String name = obf.remapField(fld.getMapped());
if (name.startsWith("field_") || name.startsWith("f_"))
sfields.put(name, fld.getOriginal());
}
for (IMappingFile.IMethod mtd : cls.getMethods()) {
String name = obf.remapMethod(mtd.getMapped(), mtd.getMappedDescriptor());
if (name.startsWith("func_") || name.startsWith("m_"))
smethods.put(name, mtd.getOriginal());
}

This leads to all record method names being filtered out as fields by the generator.
When the mappings are later used at runtime by modlauncher for remapping class member names, record methods will never be remapped due to this issue.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions