FTB Tweaks

FTB Tweaks

7M Downloads

Recipes don't get send to the client with FTBTweaks

Sir-Will opened this issue · 6 comments

commented

hey,
adding recipes only on the server doesn't sync it to the client. Running /mt reload will show the recipes until the player relogs.
I tried it with those directories:

  • scripts
  • world/scripts
  • modpack/common/scripts
  • modpack/normal/scripts
commented
commented

Why not?

commented
commented

It's an feature of Minetweaker/Crafttweaker. If #8 gets implemented I don't really care about this issue as I can disable FTBTweaks then.

commented

Can we please get a fix for this or #8 it stops any server owner from adding custom scripts to fix for example broken recipes in released pack versions, fix general bugs that are resolved in beta versions or even add their own utility recipes.

commented

So I ended up debugging this while searching for a solution for my own server, first of all

MineTweakerMod.NETWORK.sendToAll(new MineTweakerLoadScriptsPacket(MineTweakerAPI.tweaker.getScriptData()));

this is in the current code and throws an NPE on the client every time you join a server, so it should be moved in a check if the environment is a server.

Second CraftTweaker syncs serverside only scripts with the client on connect without issues, you can see this easily by just checking the client log when connecting to a server which has a script that doesn't exist on the client.

[04:33:03] [Client thread/INFO] [STDOUT/]: [minetweaker.runtime.MTTweaker:load:95]: Loading scripts
[04:33:03] [Client thread/INFO] [STDOUT/]: [minetweaker.runtime.MTTweaker:load:142]: MineTweaker: Loading test.zs
[04:33:03] [Client thread/INFO] [STDOUT/]: [minetweaker.runtime.MTTweaker:load:95]: Loading scripts

Now look at that log, what's up with that second reload after getting a script from the server? The real issue is that after logging in, FTBLib on the client will fire onMessage which then tells the client to reload all plugins, FTBTweaks then does it's thing and reloads MineTweaker on the client overwritting the data it just received from the server.

@jaredlll08 so your argument that it's laggy or buggy is invalid, it already works it just gets overwritten by FTBTweaks. As a fix I propose disabling FTBTweaks on the client when connecting to a dedicated server, since the server will send all the scripts anyway.
If you want I'll even provide a pull request for this!

Bonus: https://gist.github.com/phit/72fb8a5ce252c2223ea0cec993663166
this log shows everything I just explained ;)