▶️ ЗАБЕРИ СВОИ 8 ПОДАРКОВ 🎁 ПРИ СОЗДАНИИ СВОЕГО МАЙНКРАФТ СЕРВЕРА
Моды/Mod That Closes The Game When It Opens Mk.2
Mod That Closes The Game When It Opens Mk.2

Mod That Closes The Game When It Opens Mk.2

An experiment to make the smallest possible Fabric mod (with actual code). Does what the title says.

Оцените первым
183
3

An experiment to make the smallest possible Fabric mod (with actual code). Does what the title says.

So what't the drill?

The (self-imposed) rules are to make the smallest possible Fabric mod that "does something". The definition of that in my opinion is to run, or at least attempt to, some code. So what can be done with that?

  1. The class.
    public class i extends java.io.File {
        public i() {
            throw null;
        }
    }
    
    Although it looks simple, this is not valid Java - the compiled bytecode was manually modified to make it throw a null, and to remove this parameter in the initializer. Also, by default all classes extend java.lang.Object, so it was changed to java.io.File to save two letters.
  1. Mod metadata
    Abusing the fabric.mod.json format, it can be compacted down to

    {"id":"id","version":"i","initializer":"i"}
    

    Back in 2019 Fabric used to have a different metadata format, which is still supported to this day! Thanks to it, the file doesn't need a schemaVersion field, or the complex entrypoints setup.

  2. Build process
    There are two files, so there isn't much to compress, but to squeeze the most of it, they are zipped with the zopfli compressor. It is possible to get a smaller file size with .xz format, but it wouldn't be possible to load as a mod in that case.

  3. Runtime
    Well, there isn't much code to ""do something"" - a no-op instruction would technically suffice, but I don't think it's interesting. So instead the code tries to throw an exception, and fails because it can't throw null. Task failed successfully, I guess…

Партнёрский материал

Как поиграть с друзьями с модом Mod That Closes The Game When It Opens Mk.2?

Мод Mod That Closes The Game When It Opens Mk.2 куда интереснее в компании: поднимите сервер Майнкрафт с уже установленным модом, позовите друзей и играйте по своим правилам. Хостинг Майнкрафт для мода Mod That Closes The Game When It Opens Mk.2 будет готов за пару минут - BungeeHost сделает всё за вас.

Часто задаваемые вопросы

Совместимость

Minecraft: Java Edition

26w14a26.3.x26.2.x26.1.x1.21.x1.20.x1.19.x1.18.x1.17.x1.16.x1.15.x1.14.x

Платформы

Поддерживаемые окружения

Клиент и сервер

Ссылки

Создатели

Детали

Лицензия:
Опубликован:1 месяц назад
Обновлён:1 месяц назад
Главная