Skip to content

CommandAPI commands "not working" in #minecraft:tick or load functions on Paper #625

@SB2DD

Description

@SB2DD

CommandAPI version

9.7.0

Minecraft version

1.21.1

Are you shading the CommandAPI?

No

What I did

In a datapack, using a CommandAPI command will not "work" in functions defined to be in the "minecraft:load" and "minecraft:tick" tags. (Even though the function actually works at the end, and even doing /function #minecraft:tick works, it doesnt get called by the game automatically as it should)

What actually happened

The tick functions should get called at every game tick, but it's not happening. (Even though everything seems fine when doing /function #minecraft:tick)

What should have happened

The tick functions should get called automatically by the game every tick.

Server logs and CommandAPI config

No response

Other

I was able to fix this in 1.21 by uncommenting line 993 of NMS_1_21_R1.java

// this.<MinecraftServer>getMinecraftServer().getFunctions().replaceLibrary(this.<MinecraftServer>getMinecraftServer().resources.managers().getFunctionLibrary());

Looking at the actual Paper source code and how /minecraft:reload works, this is what makes the ServerFunctionManager update its function library, which makes the tick and load functions work.

I'm opening an issue here and not a PR as I do not have the time to update and test all 19 nms packages of the plugin. So hopefully this helps!

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions