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

Fabric 1.21 Support #874

Merged
merged 12 commits into from
Jul 22, 2024
Merged

Conversation

Bram1903
Copy link
Contributor

@Bram1903 Bram1903 commented Jul 5, 2024

Fabric 1.21 Support

Description

Between versions 1.20 and 1.21, there have been multiple changes to the configureSerialization method in the PacketEventsInjectorMixin class. The configureSerialization method now requires additional parameters: boolean memoryOnly and BandwidthDebugMonitor bandwidthDebugMonitor. This change causes an InvalidInjectionException upon startup, resulting in a difficult-to-follow stack trace in the console.

I discovered the missing parameters when updating to version 1.21, as my IDE indicated missing constructor parameters. Additionally, updating to the latest version required several Gradle adjustments to resolve dependencies properly.

Tasks

  • Fixed the PacketEventsInjectorMixin for version 1.21
  • Fixed resolving the fabric API dependency, as the mod ID changed from fabric to fabric-api
  • Updated Fabric Loom from 0.11-SNAPSHOT to 1.7.2
  • Updated Fabric Loom and ParchmentMC mappings to version 1.21
  • Switched from johnrengelman's shadow plugin to Googler's shadow fork (johnrengelman's plugin does not support Java 21, see: Future home/support for Shadow? GradleUp/shadow#908
  • Updated Shadow from 8.1.1 to 8.1.8 (adds Java 21 support, needed for Fabric and probably Sponge in the future)
  • Removed the net.minecraft.network.chat.contents.LiteralContents import in PacketEventsMod as the LiteralContents class no longer exists (unused import)
  • Fix Adventure not being properly shaded (Thanks for the fix @AbhigyaKrishna)
  • Fix no packets being processed (Thanks for the fix @retrooper)
  • Fix backward compatibility (if possible)

Shadow Googler

Initially, I planned to create a separate PR for the shadow plugin update. However, I encountered an issue that justified including it in this pull request. If necessary, I can create a separate PR for this change.

Johnrengelman's shadow plugin lacks support for Java 21 and hasn't been updated recently. This support is crucial for Fabric Loom to merge mappings into the final PE Fabric build. Most projects, including PaperMC, have switched to Googler's shadow fork, which does not introduce breaking changes. For more information, see: GradleUp/shadow#908

Backward Compatibility

The updated configureSerialization method in the PacketEventsInjectorMixin requires two new parameters, causing InvalidInjectionException in older versions due to unrecognized parameters. We need a solution to support both the previous and newer versions.

Fabric Mod ID Change

As of Minecraft 1.19.2, Fabric API's mod ID has changed from fabric to fabric-api. When backporting from 1.19.2 to earlier versions, you must alter the depends section of your fabric.mod.json to expect fabric.

I updated our internal dependency from fabric to fabric-api so it now properly resolves the Fabric API on recent versions.

Updated: Gradle Wrapper 8.5 -> 8.7 (Required by Fabric Loom)
Removed: parchmentmc (Fabric Loom provides native support for Parchment mappings as of version 0.9)
Changed: Fabric Dependency id from fabric -> fabric-api (see: https://fabricmc.net/2022/11/24/1193.html)
…ndency

Re-added: Parchment (mixed something up)
Fixed: Compile issue with removed class import
@AbhigyaKrishna AbhigyaKrishna marked this pull request as ready for review July 5, 2024 12:28
@AbhigyaKrishna AbhigyaKrishna marked this pull request as draft July 5, 2024 12:29
@retrooper retrooper marked this pull request as ready for review July 19, 2024 15:23
@retrooper
Copy link
Owner

We're leaving this PR open in case anyone is willing to work on backwards compatibility, but backwards compatibility is not priority for platforms other than Spigot FYI. If no one cares about that, we'll just merge it :)

@Bram1903 Bram1903 changed the title (WIP) Fabric 1.21 Support Fabric 1.21 Support Jul 20, 2024
@retrooper retrooper merged commit ea1e11d into retrooper:2.0 Jul 22, 2024
1 check passed
@retrooper
Copy link
Owner

Thanks for this.

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.

3 participants