Skip to content
This repository has been archived by the owner on Apr 7, 2020. It is now read-only.

Option to Slow Down Sorting #380

Open
ghost opened this issue Aug 8, 2016 · 14 comments
Open

Option to Slow Down Sorting #380

ghost opened this issue Aug 8, 2016 · 14 comments
Milestone

Comments

@ghost
Copy link

ghost commented Aug 8, 2016

Minecraft Version: 1.10.2
Inventory Tweaks Version: 1.61
Forge Modloader Version: 8.0.99.99

Hello,
I installed this mod to use in a server - however, because sorting sends too many data packets, I flag the NoCheat plugin and get kicked out. Because of this, I propose that the mod adds an option to slow down sorting to, say, 2-3 moves per second. This would allow players to sort without getting kicked out.

@Kobata Kobata added this to the Sometime milestone Aug 8, 2016
@Kobata
Copy link
Collaborator

Kobata commented Aug 8, 2016

Unfortunately attempting to do that in the current setup doesn't work very well. (There was an old attempt at slowing it down, but it froze the client for a long time due to how it did the delay)

In theory a completed MirroredContainerManager could handle it properly as it would disconnect sorting from sending the packets, but I've been stuck trying to figure out how to efficiently do that.

@ghost
Copy link
Author

ghost commented Aug 8, 2016

Durn. Still, thanks for replying! Not many other modders even addressed other issues I had.

@Elijah1111
Copy link

Good luck with the mirrored container I look forward to it

@starr0stealer
Copy link

This relates to #417

Using it with 1.11, all of the sort options triggers it. It usually happens when you sort multiple chests at a time. But if you get kicked and login to sort a chest you get kicked, you need to wait a little while. It also happens when you ctrl + shift + click items, but not as often.

Now for a fix, you can add an option for interval / timeout in between sort requests. It would be in milliseconds. This would stop the kicking since you wont send a bunch of packets back to back as fast.

This is how I've handled it with personal Minecraft mods, as well as MMOs such as WoW/ESO that monitor packet sending rates.

Regarding locking up the client, as long as it is threaded it wont lock-up the client, you will need to ensure the player doesn't move while the sorting happens. Since the interval is in milliseconds it will still happen quickly from an end user perspective, and still be faster than a player manually moving items.

@Kobata
Copy link
Collaborator

Kobata commented Feb 15, 2017

It's not as simple as you'd think, especially since you aren't allowed to thread modifications to the inventory (you'll just cause loads of random CMEs)

The interval delay also needs to be relatively long, as most of the plugins a delay is designed to play well with enforce fairly strict limit (i.e., 20 operations a second), and the sorting code would take somewhere from 1-2 seconds to >15 seconds depending on the number of items with a sufficient delay.

I did build a system out to abstract the sorting from the actual state of the inventory ( https://github.com/Inventory-Tweaks/inventory-tweaks/blob/develop/src/main/java/invtweaks/container/IContainerManager.java ) so if you, or anyone else, feels like experimenting it's not hard to test your ideas.

@Kobata Kobata mentioned this issue Dec 18, 2017
@adracamas
Copy link

Kobata, have you looked into if using Thread.yield() is a possibility to keep it from locking up the client?

@Kobata
Copy link
Collaborator

Kobata commented Dec 19, 2017

It's not on a separate thread, therefore any attempt to pause it must block the client from processing.

As pointed out above, moving it to a separate thread doesn't really help.

@scrith
Copy link

scrith commented Mar 5, 2018

I personally would gladly trade off a forced wait while sorting so I don't get repeatedly kicked from servers just for sorting my chests.

@NaruZosa
Copy link

Agreed, a forced wait would still be faster than sorting manually. Perhaps have the delay not set, but user set so it can be adjusted as well.

@SpeedRider
Copy link

yeah slower would be good.
i would be happy to even wait 30 seconds XD i'm terrible at sorting items XD
please do add this

@rhodso
Copy link

rhodso commented Aug 8, 2018

If possible can this be an option? I don't want to wait 30 secs to just sort my inventory and chests, I could do it myself in that time

@MagentaRuby
Copy link

MagentaRuby commented Aug 8, 2018 via email

@Mercurious1
Copy link

Hi does the mod need to be server side for it to work

@mikuhl-dev
Copy link

Too many servers kick you because sorting sends packets too fast.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests