Crafting Tweaks

Crafting Tweaks

109M Downloads

Client-only spread is incredibly inefficient. causes visible lockups.

JaSpr opened this issue ยท 4 comments

commented

I've had this issue on multiple servers where I am only running the mod locally. The algorithm being used to spread and balance the grid could use some work. Sometimes, I've had the game physically lock up and have to be force quit, but that doesn't happen much anymore (in 1.12.2). Lately, it just locks up for a couple of seconds.

That said, I think the algorithm just needs some refactoring. I was hoping to work on it today, but when I run the client through gradle, then connect to a local vanilla server, the crafting tweaks buttons don't actually do anything, so I'm unable to test out any improvements.

commented

does this happen in 1.19.x as well or no?
I always check mods github before installing them so I won't encounter compatibility or errors or crashes ...
so just curious if it still present in 1.19.x versions as well?
thanks in advance <3

commented

Thanks! I'll take a look.

On a side note, why is server-side instant?

commented

Server-side doesn't have to rely on actual slot movements and can manipulate stacks in slots directly, which can be done in one go and doesn't require any communication until after everything is already done. Client-side would also feel instant if implemented in a non-lazy way, since it'd be one packet then instead of [way too many].

commented

Yeah, I think I remember thinking it's crazy inefficient but was lazy at the time (since the client-only implementations are less frequently used). I'm busy with other stuff right now but if I remember correctly it's placing items one by one when it could just make use of Vanilla's inbuilt spreading.

As to why it won't work on a Vanilla server, I don't know. It should only enable server-side mode if the server claims to have Crafting Tweaks installed during handshake (which shouldn't even be possible since that handshake doesn't happen on Vanilla).

I've always just set the TEST_CLIENT_SIDE boolean in CraftingTweaks.java to true, that way it's possible to test without running a server at all.