Skip to content

Add test-api-v1 (feat: Scoped Events)#5285

Open
Kilip1000 wants to merge 59 commits intoFabricMC:26.1.1from
FabulabsMC:debug-api
Open

Add test-api-v1 (feat: Scoped Events)#5285
Kilip1000 wants to merge 59 commits intoFabricMC:26.1.1from
FabulabsMC:debug-api

Conversation

@Kilip1000
Copy link
Copy Markdown
Contributor

@Kilip1000 Kilip1000 commented Mar 29, 2026

Add fabric-dev-debug-api-v1, featuring EventScopes.

Earthcomputer and others added 20 commits December 15, 2025 15:15
Co-authored-by: Juuz <6596629+Juuxel@users.noreply.github.com>
# Conflicts:
#	fabric-debug-api-v1/src/main/java/net/fabricmc/fabric/mixin/debug/EntityMixin.java
#	fabric-debug-api-v1/src/main/java/net/fabricmc/fabric/mixin/debug/MobMixin.java
refactor: ServerMobEffectsGameTest now uses EventScopes,
an api introduced through the fabric-debug-api-v1 module
@sylv256 sylv256 added the enhancement New feature or request label Mar 29, 2026
@sylv256 sylv256 self-requested a review March 29, 2026 22:36
Copy link
Copy Markdown
Member

@sylv256 sylv256 left a comment

Choose a reason for hiding this comment

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

Overall, good for now. Obviously we're going to need docs and some unit tests, but there are some other considerations, most of which are small. One huge concern, though, is that the ServiceLoader system will apply outside of development environments. Is there any way we can ensure it only applies in dev?

I am at least glad that we don't have MODMUSS_RETURN_EVENT and EncapsulationBreaker3000 anymore.

Edit: small nitpick, but could you write a description in compliance with the CONTRIBUTING.md?

@sylv256
Copy link
Copy Markdown
Member

sylv256 commented Mar 30, 2026

Can you move things to a new dev-only module called fabric-dev-debug-api-v1? That'll help reduce the complexity here and resolve a few issues. Rationale below, discussion in Discord.

In lieu of some kind of dev-only child module for Debug API, we should make a dev-only module called fabric-dev-debug-api-v1. If we could, we would go back in time and rename fabric-gametest-api-v1 to fabric-test-api-v1, but we obviously can't, so to avoid another GameTest API situation, fabric-dev-debug-api-v1 makes more sense for a dev-only version of Debug API which will only have Scoped Events for now.

@sylv256
Copy link
Copy Markdown
Member

sylv256 commented Mar 30, 2026

Can you move things to a new dev-only module called fabric-dev-debug-api-v1?

I'll do this later.

@Kilip1000 Kilip1000 force-pushed the debug-api branch 2 times, most recently from 228df1f to 6d4b306 Compare March 30, 2026 16:15
Copy link
Copy Markdown
Member

@sylv256 sylv256 left a comment

Choose a reason for hiding this comment

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

LGTM, though I'm not sure if we need more events or not. I know Modmuss's original PR had a lot, but I'm pretty sure that was due to its jankiness.
Also, should it be called EventScope#registerScoped, EventScope#registerEvent, or something else entirely?

@Kilip1000 Kilip1000 marked this pull request as ready for review March 30, 2026 23:20
@Kilip1000 Kilip1000 requested a review from sylv256 March 30, 2026 23:20
Copy link
Copy Markdown
Member

@sylv256 sylv256 left a comment

Choose a reason for hiding this comment

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

Already reviewed, same comments as above.

@sylv256 sylv256 requested a review from Earthcomputer March 30, 2026 23:34
Copy link
Copy Markdown
Contributor

@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.

Also not sure about the name of EventScope.registerScoped, but everything else looks fine

@sylv256
Copy link
Copy Markdown
Member

sylv256 commented Mar 30, 2026

Also not sure about the name of EventScope.registerScoped, but everything else looks fine

I think EventScope.registerEvent should make it clearer what it does without repeating itself.

@Earthcomputer
Copy link
Copy Markdown
Contributor

I don't like registerEvent, it makes it sound like you're registering an event. registerScoped is better, or maybe just register.

@sylv256
Copy link
Copy Markdown
Member

sylv256 commented Mar 30, 2026

I think I'll just go with register.

Copy link
Copy Markdown
Member

@modmuss50 modmuss50 left a comment

Choose a reason for hiding this comment

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

Sorry to be blunt but I'm really not keen on this approach, its ripping open the event api in all the ways that go against good API design. I think we can do better where we dont need to undermine the existing event API but its going to need some thought. I dont have the magic solution at the moment in the past I have tried using reflection to achieve this in a way that wraps the event.

@Kilip1000 Kilip1000 changed the base branch from 26.1 to 26.1.1 April 2, 2026 00:09
@Kilip1000 Kilip1000 changed the title Add dev-debug-api-v1 (feat: Scoped Events) Add test-api-v1 (feat: Scoped Events) Apr 2, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request new module Pull requests that introduce new modules

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants