Skip to content

Fabric - Compatibility with 1.17#3053

Merged
lucko merged 1 commit into
LuckPerms:masterfrom
TjeuKayim:gamemode-notset
Jun 10, 2021
Merged

Fabric - Compatibility with 1.17#3053
lucko merged 1 commit into
LuckPerms:masterfrom
TjeuKayim:gamemode-notset

Conversation

@TjeuKayim
Copy link
Copy Markdown
Contributor

@TjeuKayim TjeuKayim commented Jun 5, 2021

When testing with Fabric for 1.17-rc1, this exception occurred when a player joins:

[Server thread/WARN]: An exception was thrown by me.lucko.luckperms.fabric.context.FabricPlayerCalculator whilst
calculating the context of subject class_3222['****'/150, l='ServerLevel[world]', x=-33.75, y=68.00, z=-18.60]
java.lang.NoSuchFieldError: field_9218
        at me.lucko.luckperms.fabric.context.FabricPlayerCalculator.calculate(FabricPlayerCalculator.java:78) ~[LuckPerms-Fabric-5.3.42.jar:?]
        at me.lucko.luckperms.fabric.context.FabricPlayerCalculator.calculate(FabricPlayerCalculator.java:52) ~[LuckPerms-Fabric-5.3.42.jar:?]
        at me.lucko.luckperms.common.context.ContextManager.calculate(ContextManager.java:131) ~[LuckPerms-Fabric-5.3.42.jar:?]

This is because the enum value GameMode.NOT_SET was removed in 1.17.

The GameMode class now contains a new method to check for the id -1 (see snippet below), but using that would break compatibility with 1.16. That's why I decided to hard code the -1 ID.

    @Nullable
    public static GameMode getOrNull(int id) {
        return id == -1 ? null : byId(id);
    }

I build LuckPerms from source with this patch applied, and confirmed that it works fine with 1.17-rc1 then.

This change makes it compatible with both 1.16 and 1.17
@TjeuKayim TjeuKayim marked this pull request as ready for review June 5, 2021 20:24
@TjeuKayim TjeuKayim changed the title Fabric - Fix compatibility with 1.17-rc1 Fabric - Compatibility with 1.17-rc1 Jun 5, 2021
@Aurelien30000
Copy link
Copy Markdown
Contributor

In the meantime, you should also update all these dependencies ;)

https://github.com/lucko/LuckPerms/blob/master/fabric/build.gradle#L15

@Boxiogral
Copy link
Copy Markdown

Temporary build with this PR applied:
LuckPerms-Fabric-5.3.43.jar.zip

@TjeuKayim
Copy link
Copy Markdown
Contributor Author

@Aurelien30000 In the meantime, you should also update all these dependencies

That needs to be done eventually, but changing the def minecraftVersion might make this mod no longer compatible with 1.16. I think it is better if someone who knows how to update the CI/CD changes the dependency versions, because it will also require Java 16. So, I won't add it to this pull request.

There were little changes between Minecraft 1.17-rc1 and 1.17, and I can confirm LuckPerms still works with 1.17 with this PR applied.

@TjeuKayim TjeuKayim changed the title Fabric - Compatibility with 1.17-rc1 Fabric - Compatibility with 1.17 Jun 10, 2021
@Aurelien30000
Copy link
Copy Markdown
Contributor

Right, but I'm unsure remapped methods still work on 1.17.

@lucko lucko merged commit 044decc into LuckPerms:master Jun 10, 2021
@lucko
Copy link
Copy Markdown
Member

lucko commented Jun 10, 2021

Thank you!

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.

4 participants