CommandAPI icon indicating copy to clipboard operation
CommandAPI copied to clipboard

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

Open SB2DD opened this issue 1 year ago • 0 comments

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 https://github.com/CommandAPI/CommandAPI/blob/37f96b59d000ce661629410af24624fc1d4f737f/commandapi-platforms/commandapi-bukkit/commandapi-bukkit-nms/commandapi-bukkit-1.21/src/main/java/dev/jorel/commandapi/nms/NMS_1_21_R1.java#L993

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!

SB2DD avatar Dec 09 '24 18:12 SB2DD