zlepper / itlt

It's the little things mod, a mod about the little things.
MIT License
12 stars 5 forks source link

Fix server compatibility indicator Minecraft Forge 1.16.4 #18

Closed kmecpp closed 3 years ago

kmecpp commented 3 years ago

Fixes this with the mod installed only on the client

image

PaintNinja commented 3 years ago

Thank you for your pull request, I was hesitant about adding it myself as I don't understand how it works. Please may you explain it, specifically the (a, b) -> true portion? I find it tricky to wrap my head around the multiple nested lambdas of Forge's extension points. :/

kmecpp commented 3 years ago

The code is just copied directly from https://mcforge.readthedocs.io/en/latest/concepts/sides/#writing-one-sided-mods which also has an okay description of what it does.

The DISPLAYTEST extension point explains lambdas in a little more detail

/**
 * Compatibility display test for the mod.
 * Used for displaying compatibility with remote servers with the same mod, and on disk saves.
 *
 * The supplier provides my "local" version for sending across the network or writing to disk
 * The predicate tests the version from a remote instance or save for acceptability (Boolean is true for network, false for local save)
 */
public static final ExtensionPoint<Pair<Supplier<String>, BiPredicate<String, Boolean>>> DISPLAYTEST = new ExtensionPoint<>();