MonitoringMinecraft MonitoringMinecraft

YARRP

Мод FabricNeoForge

Библиотечный мод для Майнкрафт — рантайм ресурс-паки

25.7к скачиваний 3 подписчика
Оцените первым

Has it ever bothered you that so much configuration of blocks, items, recipes, and now even enchantments is defined in untyped JSON files? Well then you should probably just use data generation which is much more battle tested and even used by Mojang for the Vanilla data. But, if you also want to be able to adjust the data dynamically or want some things to be configurable, then this might just be the thing for you. YARRP is inspired by ARRP and BRRP but written from the ground up with an easy to use Kotlin API. It allows you to create resource packs (i.e. both data packs and asset packs) at runtime, so you don't need to have JSON files ready for all possible options.

Usage

To add YARRP as a dependency, add the following to your build.gradle.kts:

repositories {
    // you can use either one
    maven("https://jitpack.io")
    maven("https://api.modrinth.com/maven")
}

dependencies {
    // replace the versions and loader as needed. the loader is one of `fabric` or `neoforge`
    modImplementation("com.github.RubixDev.YARRP:yarrp-mc1.21.1-fabric:v0.2.0") // when using jitpack
    modImplementation("maven.modrinth:yarrp:0.2.0+1.21.1-fabric") // when using modrinth maven
}

Don't forget to also list YARRP as a dependency in your fabric.mod.json and neoforge.mods.toml files.

You can then use YARRP by creating a pack and adding it to one of the register callbacks. Here's an example:

object MyModResources {
    // call this in your mod initializer
    fun register() {
        YarrpCallbacks.register(PackPosition.AFTER_VANILLA, ResourceType.SERVER_DATA) {
            add(PACK)
        }
    }

    @JvmField
    val PACK = RuntimeResourcePack(
        RuntimeResourcePack.createInfo(
            Identifier.of("modid", "my_runtime_pack"),
            Text.of("Pack Title"),
            "pack version", // should probably be set to the version of your mod
        ),
        RuntimeResourcePack.createMetadata(Text.of("pack description")),
    )

    val MY_ENCHANTMENT: RegistryKey<Enchantment> = PACK.addEnchantment(
        Identifier.of("modid", "my_enchantment"),
        Enchantment.definition(
            // this dummy type can be used to create a RegistryEntryList from a given TagKey
            // but should only be used for adding resources to a runtime pack
            DummyHolderSet(ItemTags.LEG_ARMOR_ENCHANTABLE),
            5,
            3,
            Enchantment.leveledCost(5, 8),
            Enchantment.leveledCost(55, 8),
            2,
            AttributeModifierSlot.LEGS,
        ),
    )

    init {
        if (MyModSettings.myEnchantmentIsTreasure) {
            PACK.addTag(EnchantmentTags.TREASURE) { add(MY_ENCHANTMENT) }
        } else {
            PACK.addTag(EnchantmentTags.NON_TREASURE) { add(MY_ENCHANTMENT) }
        }

        if (MyModSettings.enableRecipe) {
            PACK.addRecipeAndAdvancement(
                Identifier.of("modid", "my_recipe"),
                ShapedRecipeJsonBuilder.create(RecipeCategory.MISC, Items.DIAMOND, 64)
                    .criterion("tick", TickCriterion.Conditions.createTick())
                    .pattern("//")
                    .pattern("//")
                    .input('/', Items.STICK),
            )
        }
    }
}

Full API documentation can be found at yarrp.rubixdev.de.

Смотри также

Похожие подборки моды — по версиям Майнкрафта, загрузчикам и жанрам.

Сервера Майнкрафт

Играть интереснее на сервере — выбирай в рейтинге серверов Майнкрафт и заходи прямо сейчас.

SkyBars
SkyBars Java + BE
1053 онлайн
1.8 — 26.2 версия
🎮 ВЫЖИВАНИЕ ⚔️ АНАРХИЯ 🚗 ГТА РП 🎤 ГОЛОСОВОЙ ЧАТ 🎁 БЕСПЛАТНЫЙ ДОНАТ 🌟 СМП 💻 ПК+ТЕЛЕФОН
MigosMc
MigosMc Java + BE
1168 онлайн
1.8 — 26.2 версия
🌿 MigosMc.net | Гриферский сервер с войс-чатом | Награды за онлайн ⭐ ВЫЖИВАНИЕ⭐ ОДИНБЛОК⭐ МИНИ-ИГРЫ
SeasonEra
4 онлайн
26.1.2 версия
Выживание • Экономика • Кланы • Приваты • Донат • PVP • Работа
PLIRGAME - ДЕВУШКИ ВОЙС ЧАТ
31 онлайн
1.21.10 — 26.1.1 версия
❤️ Выживание! ❤️ Войс Чат ❤️ Девушки ❤️ /free
MineLauncher
Лаунчер Майнкрафт без лицензии — все версии
Бесплатный лаунчер для ПК и Андроид — все версии 26.2, 1.21.11, 26.1.2, 1.21.8. Fabric, NeoForge, Forge, шейдеры, моды и скины в один клик.
Без лицензии Fabric, NeoForge, Forge Моды, шейдеры, скины Все версии Майнкрафта ПК и Андроид Для слабых ПК Сервера в лаунчере
Скачать бесплатно
Windows и Андроид · Бесплатно · Без лицензии
Наш чат