Skip to content

Conversation

@supersaiyansubtlety
Copy link
Member

@supersaiyansubtlety supersaiyansubtlety commented Aug 2, 2025

Adds the option of naming simple types' subtypes based on a transformation of the super simple type's name.

Heavily based on the simple types proposer.

example use case: Entity subclasses with suffix Entity -> PiglinEntity fields and params are named piglin


Additional fixes

  • SimpleTypeSingleIndex:
    • used lower case names for constant conflict detection
    • could give outer class fields an inner class as a parent (no known consequences)
    • inheritance ancestor order iteration was not consistent; inheritance overrides didn't always work
  • ConflictFixProposer looked up mappings using deobf params, breaking it for deobf method param conflicts which can arise from DelegateParametersNameProposer
  • simple type verification test flakiness; separates it into its own test input source set and catches thrown exception instead of capturing log output

Format

Uses the same registry as simple types and expands "inherit" to allow object values. Inherit can now take any of the following forms (also see schema):

"inherit": true removed

"inherit": {
  // equivalent to old "inherit": true
  "type": "DIRECT"
}
"inherit": {
  // names subclass fields by checking if their type ends with the suffix, then names them after their type with the suffix removed
  "type": "TRUNCATED_SUBTYPE_NAME",
  "suffix": "Entity"
}
"inherit": {
  // names subclass fields by checking if their type matches the pattern, then names them after their type with the replacement applied
  "type": "TRANSFORMED_SUBTYPE_NAME",
  "pattern": "(.+)BlockEntityRenderer",
  "replacement": "$1Renderer"
}

Todo:

  • don't do subtype naming for abstract classes (so LivingEntitys aren't named living)
  • more tests

Copy link
Member

@OroArmor OroArmor left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think this would be better as an extension to the simple type field name that already exists, with maybe "inherit_suffix": "Entity" or something.

@supersaiyansubtlety
Copy link
Member Author

I think this would be better as an extension to the simple type field name that already exists, with maybe "inherit_suffix": "Entity" or something.

I'm not sure how that would work.
This proposer is dynamic because it's based on already mapped class names. I don't see how that could be combined with existing simple type names.

@supersaiyansubtlety
Copy link
Member Author

I guess they could be combined and just be doing effectively two separate things.
I don't see a technical reason to combine them though.

@supersaiyansubtlety supersaiyansubtlety added the enhancement New feature or request label Aug 2, 2025
@supersaiyansubtlety supersaiyansubtlety marked this pull request as ready for review August 3, 2025 18:30
@supersaiyansubtlety
Copy link
Member Author

Looking into an issue I found by trying the Entity subtype on MC mappings

@supersaiyansubtlety supersaiyansubtlety self-assigned this Sep 1, 2025
@ix0rai ix0rai self-requested a review September 3, 2025 20:57
implement regex replacement subtype proposer
fix SimpleTypeSingleIndex bug that used constant's local names for conflict detection
fix SimpleTypeSingleIndex bug that could give outer class fields an inner class as a parent (no known consequences)
log errors instead of throwing during "inherit" parsing
add tests for duplicate subtype fields+locals
@supersaiyansubtlety
Copy link
Member Author

diffs for each of the examples in the OP; some spooky diffs are mixed in
entity-qmap.diff.txt
ber-qmap.diff.txt

@ix0rai
Copy link
Member

ix0rai commented Sep 12, 2025

I guess they could be combined and just be doing effectively two separate things. I don't see a technical reason to combine them though.

i agree, i think it's a little cleaner to keep them separate

@supersaiyansubtlety
Copy link
Member Author

I've made substantial changes, so new diffs:
entity-qmap.diff.txt
ber-qmap.diff.txt

@supersaiyansubtlety supersaiyansubtlety added the bug Something isn't working label Dec 1, 2025
Copy link
Member

@ix0rai ix0rai left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

looks great, this feature is really well done! just wondering why you reimplemented toLowerCase() lol

* @return a breadth-first stream of the passed {@code classEntry}'s ancestors;
* order within one level of depth is not guaranteed
*/
public static Stream<ClassEntry> streamAncestors(ClassEntry classEntry, InheritanceIndex inheritance) {
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this implementation does not go in breadth-first order
QuiltMC/enigma#347 will fix this
converting to draft until 347 can be included

@supersaiyansubtlety supersaiyansubtlety marked this pull request as draft December 10, 2025 22:21
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working enhancement New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants