Skip to content

Instantly share code, notes, and snippets.

@KosmX
Last active February 2, 2024 21:27
Show Gist options
  • Save KosmX/1f1d57f94c4f8f476a7c93c365c74972 to your computer and use it in GitHub Desktop.
Save KosmX/1f1d57f94c4f8f476a7c93c365c74972 to your computer and use it in GitHub Desktop.

Forge modloader sucks... I had to create multiple workarounds...

  • Forge networking API modifies the binary packet, adds a varInt before it...

    I had to use low-level networking to avoid this behaviour.

  • Forge network doens't listen to Plugin channel if the server is not forge.

    I had to implement a custom listener and mix it with the built-in.

  • Forge plugin registration happens in login-phase

    Send hello packet when channel register or if that was before play-phase, then when goint to that phase.

  • Can't access to player trackers (who can see who) from Forge API

    I copied the accessor from Fabric API into the Forge mod.

  • Forge ModList.get().isLoaded() returns NullPointerException instead of a bool (1.16.5)...

    Try to load the class with reflect and if failed, then no mod is loaded.

  • 1.7.10 can not fake mod ID

    Mixin into forge core to fake it...

  • 1.18.2 JarJar library skips Mixin config

    Don't Use JarJar

  • Client-only mod is not possible

    Only apply mixins on client-side, present on server but does nothing..

  • Forge tries to load before warning about missing mandatory dependencies, but mixin is failing.

    Implement IMixinConfigPlugin and conditionally disable failing mixins, allowing Forge to load and warn about missing dependency.
    For this I had to workaround ModList.get() is null.

  • Forge 1.16 has no ResourceLoader register event

    After some searching, I've found an event: ParticleFactoryRegisterEvent what is fired just when I should add my resourceManager.

  • Forge 1.19+ fail if I try to load multiple jars with the same package (probably an optimization for their slow annotation indexing)

    I had to move packages in playerAnimator to not fail in dev

I was really hoping that NeoForge learns from the mistakes of its predecessor, but no

  • NeoForge Configuration task does not accept vanilla interface, I have to implement its own interface.

UnNeoForgifierConfigurationTaskWrapper. I could've solved it differently, but I had enough of making my API Forge compatible.

OptiFine workaround

  • replaces ModelPart.render() and bendy-lib can not find the redirect target

    Use Dynamic mixins

Fabric API

  • startTracking event fires before sending the packet

    custom mixin to the function

Spigradle

  • Can not add runtime-only dependencies without messing up the runtime classpath

    Spigradle resolves subproject dependencies, create a subproject for the runtime plugins...

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment