mrshmllow / BetterRecipeBook

Adds brewing, smithing, and QOL changes to the vanilla recipe book!
https://curseforge.com/minecraft/mc-mods/brb
MIT License
21 stars 8 forks source link

Feature force place recipe option #86

Closed TauCubed closed 10 months ago

TauCubed commented 11 months ago

Manually place ingredients in the crafting grid rather than asking the server to do it. (addresses #83)

This fixes issues where the server doesn't properly track unlocked recipes and prevents you from auto-filling recipes you haven't "unlocked" yet.

mrshmllow commented 11 months ago

Support Batch Crafting

If it is truly impossible to have both unlockAll and batch crafting, maybe we can have a system to only allow batch crafting on recipes youve actually unlocked?

TauCubed commented 11 months ago

~Support Batch Crafting~

If it is truly impossible to have both unlockAll and batch crafting, maybe we can have a system to only allow batch crafting on recipes youve actually unlocked?

It's possible to do batch crafting but it'd take a bit of work. And I'm not sure if it's needed as once you craft it it should be unlocked. Thus I'm thinking of focusing on keeping track of unlocked recipes by changing how unlock recipes works.

Or, perhaps I could implement batch crafting but idk if it's worth it.

To clarify: Batch crafting will still work so long as you have unlocked the recipe server-side.

TauCubed commented 11 months ago

I completely forgot about furnace recipes existing.

mrshmllow commented 11 months ago

hey so i am going to repair the git history of this branch its kinda wrecked

mrshmllow commented 11 months ago

Okay that was scary but it should have no conflicts now

mrshmllow commented 11 months ago

Ideally, this code becomes a "force unlock" and will only need to be used a single time per recipe. When you instant craft, the first craft will be force unlocked and then it will fall back on the server to do the rest.

TauCubed commented 11 months ago

Yep that is currently how it behaves.

mrshmllow commented 11 months ago

It is still possible to break the recipe but since 9ae3d6f its a lot more stable

TauCubed commented 11 months ago

I didn't want to do it that way because it can generate way too many inventory click packets.

For instance, crafting 64 gold ingots from gold nuggets will require one click to pickup stack, one click to place a single item and one more click to place the stack back. This means it will create (64 x 9 * 2.98)=1716 inventory click packets. Any server distro with reasonable packet rate limits (such as paper) will cause you to get kicked or for some of the packets to get dropped and end up making a right mess.

While it would be possible to avoid placing the stack back and thus reduce the amount to around 1100, it's still way too many and I don't think this is a good idea.

mrshmllow commented 11 months ago

Sorry, I hadn't thought that through. I think if it is too hard to support it, there must be a better user experience than stuff not working as a user might expect and getting in their way.

I think it would be nicer to turn this whole thing from unlock all to "display locked" and have some kind of info on screen. Ill think about it more.

TauCubed commented 11 months ago

That's what it did before. It would display the ghost recipe of recipes until the server responded. Either with a ghost recipe from the server or by placing the recipe in the grid.

I think it's good how it was. After crafting one item batch crafting will work. And it will only affect recipes that the server fails to unlock when they should be.

I might revert it to before the batch crafting. If you think batch crafting is really required I could perhaps find a better way to do it on the weekend but idk. My thoughts are computing the optimal sequence of right click + drags to split the resources evenly. Not currently sure how this is implemented behind the scenes though.

mrshmllow commented 11 months ago

Batch crafting isn't required neither is instant crafting I just want a better way to display the difference for a better user experience

mrshmllow commented 11 months ago

Something like this is what i had in mind

image