Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Allow dynamic selectors to choose the class to perform member lookups in #2293

Merged
merged 2 commits into from
May 9, 2024

Conversation

Bawnorton
Copy link
Contributor

@Bawnorton Bawnorton commented May 7, 2024

Motivation

MixinSquared's @TargetHandler is a dynamic selector which targets merged handlers, the accepted references are the name of the mixin and the original name of the handler. The method targeting is the same as @At.method but the members are declared in the mixin class specified by the mixin attribute, thus, when looking up members for a @TargetHandler selector, the class specified in mixin would be the one to lookup. Mcdev's member lookups work off the target class specified in the @Mixin annotation, thus, this change is needed to allow the lookup to occur in a different class.

This pr also fixes namespace lookup as you do not have to declare the namespace for a dynamic selector in the annotation and can instead declare it at registration.

See #2287

…t at registration

* allow dynamic selectors to change the target class that is used when looking up members
Copy link
Member

@Earthcomputer Earthcomputer left a comment

Choose a reason for hiding this comment

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

Looks good other than one thing.

src/main/kotlin/platform/mixin/reference/MixinSelectors.kt Outdated Show resolved Hide resolved
@Earthcomputer Earthcomputer merged commit 8f2bb55 into minecraft-dev:dev May 9, 2024
4 checks passed
Earthcomputer pushed a commit that referenced this pull request Jul 3, 2024
* Fix #2278 1.20.5 requires Java 21

* Suppress `ReferenceToMixin` for `@Dynamic` (#2280)

* Suppress `ReferenceToMixin` for `@Dynamic`

* Fix formatting for `MixinClassCannotBeReferencedSuppressor`

* Move logic to `MixinClassReferenceInspection`

* Update NeoForge MDK

Up until neoforged/MDK@6074a78

* Small adjustment to fabric's build.gradle template

Following fabric-example-mod change for 1.20.5

* Version 1.7.5

* change error requirements from public to non-private (#2289)

untested, I just used the web editor

* Add NeoGradle version dropdown

* NeoForge 1.20.5 template

* Only show the 50 most recent NeoGradle versions

* Allow dynamic selectors to choose the class to perform member lookups in (#2293)

* * fix dynamic selector missing namespace when the selector declares it at registration
* allow dynamic selectors to change the target class that is used when looking up members

* move custom owner over to mixin selector

* Add 2024.2 to readme

* Fix typo

It's late okay

* New: Add support for `@WrapMethod` in MixinExtras. (#2300)

* New: Support `WrongOperationParametersInspection` in `@WrapMethod`s. (#2303)

* Minecraft 1.21 templates

* Version 1.7.6

* fix: #2316 (#2317)

* Initial support for NeoForge's ModDevGradle

Mappings don't work currently, the TSRG file seems to contain
indices to an array in another JSON file?

* Improve fabric.mod.json entrypoints insight

- Recognize entrypoints declared in object form
- Add more conditions to the inspection
- Add some tests to cover the inspection

Fixes #2296

* MixinExtras Expressions: Migrate to Expressions library.

* Fix: Resolve being unable to get the descriptor for some complex types.

* MixinExtras Expressions: Recreate `ClassInfo#getCommonSuperClassOrInterface`.
It's quite scuffed and often returns `Object` even when there is a suitable common interface, but what's important is that this matches the runtime logic.

---------

Co-authored-by: RedNesto <RedNestoMC@gmail.com>
Co-authored-by: senseiwells <66843746+senseiwells@users.noreply.github.com>
Co-authored-by: 7410 <85879080+O7410@users.noreply.github.com>
Co-authored-by: Bawnorton <bawnorton@me.com>
Co-authored-by: Nel <57587152+nelind3@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants