Skip to content

Instantly share code, notes, and snippets.

@3TUSK
Last active April 14, 2017 07:49
Show Gist options
  • Save 3TUSK/6ddf7631ba2ab5ff44a9710778f4b3bd to your computer and use it in GitHub Desktop.
Save 3TUSK/6ddf7631ba2ab5ff44a9710778f4b3bd to your computer and use it in GitHub Desktop.
This is a letter to all Minecraft modders. TLDR: blocking i/o vs. nonblocking i/o in minecraft mod on main thread. Even though we suggest things, they are still our suggestions. We are here solely for discussing this topic, including our suggestions. If you want to express your support, don't click star, reply or simply give an emoji. Stargazer …

A LETTER TO ANY MODDERS WHO SEE THIS

First of all, happy new year!

This letter has sole purpose on request of threaded version checker, or more generally speaking, threaded I/O for any operations that involved with internet. If you are a player, you may ignore this letter as it would not matter much for you.

Well, let’s talk about the version check today.
Under most circumstances, one is always expected to have mods of latest version running in his/her modpack, as it will contains less bugs/malfunctions/any of unexpected behaviors. To ensure that, modders will usually apply version check mechanism onto their mod. This is with good motive isn’t it?

However, sometimes it is not done properly. We know that saying “properly” make such argument not objective, but that’s pretty much how it works.
That said, some version checkers, in some mods, are running on the main thread. This is actually a horrible move, and the reason is that, if your connection, for whatever reason(s), is stuck, then the main thread will look like frozen – don’t forget that Minecraft initializes all stuff on main thread, which make the situation much more worse.
Similar situation happened on other internet I/O as well. For example, some mods may download patreon supporter list for further usage, and that dowloading may happen on main thread.

Yes, we acknowledge that it does not matter if you have a good internet. But what if not? What if your internet has some special situations, specially speaking, if some of websites are blocked within your internet? Have you ever imagine that the time when you can’t open GitHub because it is blocked?
And yes, we acknowledge that it does not matter if you have a large pack like Infinity Evolved or AllTheMods. However, hypothetically speaking, what if you do have lots of mod that run internet I/O on main thread?

And that is pretty much why there is such a letter. We do not expect much on our request, because we also acknowledge that modders may have other concerns that we might never think of. We are here solely for discussion, not for drama.

Also, we do have some our own ideas regarding it:

  1. Provide an option in configuration file to disable version check entirely. This is definitely not favorable solution for some of modders who want enforcement of version check, but this is still an available solution.
  2. Use MinecraftForge’s built-in version check system. Yes they do have a threaded version check system available for all forge-based mod. Just write one more json, host on GitHub, put url into your @Mod annotation and you are all set! Also MinecraftForge has documentation on this system as well!
  3. For those who use their own version checker for whatever reasons, we strongly suggest that you run your checker on another thread. The main reason is that, it would never accidentally stuck the main thread. And that would not be a big deal if you don’t have other concern.

Again, we are here solely for discussion. We do not want to enforce some kind of standard, nor would we. We are here to express our concerns.

Best wishes to everyone.

This letter is authored by multiple people. We use this gist's stargazer to track author list, so please forgive this inconvenience.

@capSAR273
Copy link

👍

@hanyuwei70
Copy link

👍

@RecursiveG
Copy link

👍

@ustc-zzzz
Copy link

👍

@liach
Copy link

liach commented Jan 31, 2017

😕

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment