yog-cli 0.45.0

Yog build tool — `yog build` compiles a mod and packages it as .yog.
# warning: resources/Book.ru_ru.yres: 2 text(s) not translated (shown in en_us): intro, landing
# warning: content has blocks/items, but src/ never calls `yog_api::content!();` — they get models but aren't registered
# resources: Book.g.rs
/// The resources of `resources/Book.yres`.
#[allow(dead_code)]
pub struct Book;

#[allow(dead_code, non_snake_case, clippy::all)]
impl Book {
    /// Translation key of [`Self::title`]: `gm.title`.
    pub const TITLE_KEY: &'static str = "gm.title";
    /// Looks up a localized string similar to "Golden Guide".
    ///
    /// `title` (resources/Book.yres:2)
    pub fn title() -> ::std::string::String {
        ::yog_api::tr(Self::TITLE_KEY)
    }
    /// Translation key of [`Self::intro`]: `gm.intro`.
    pub const INTRO_KEY: &'static str = "gm.intro";
    /// Looks up a localized string similar to "Rubies are {accent|red}. See {link=@entry:gm:ruby|the ruby page}.".
    ///
    /// `intro` (resources/Book.yres:3)
    pub fn intro() -> ::std::string::String {
        ::yog_api::tr(Self::INTRO_KEY)
    }
    /// Translation key of [`Self::landing`]: `gm.landing`.
    pub const LANDING_KEY: &'static str = "gm.landing";
    /// Looks up a localized string similar to "Welcome.".
    ///
    /// `landing` (resources/Book.yres:4)
    pub fn landing() -> ::std::string::String {
        ::yog_api::tr(Self::LANDING_KEY)
    }
}

# content.g.rs
// <auto-generated>
//     Generated by `yog build` from content/** — don't edit, it's rewritten
//     on every build. Included by `yog_api::content!()`.
// </auto-generated>
include!(concat!(env!("CARGO_MANIFEST_DIR"), "/generated/content/blocks.g.rs"));
include!(concat!(env!("CARGO_MANIFEST_DIR"), "/generated/content/items.g.rs"));
include!(concat!(env!("CARGO_MANIFEST_DIR"), "/generated/content/register.g.rs"));

# content/blocks.g.rs
// <auto-generated>
//     Generated by `yog build` from content/** — don't edit, it's rewritten
//     on every build. Included by `yog_api::content!()`.
// </auto-generated>

/// The blocks of `content/`: the id and a [`::yog_api::BlockDef`] of each.
#[allow(dead_code)]
pub struct Blocks;

#[allow(dead_code, clippy::all)]
impl Blocks {
}

# content/items.g.rs
// <auto-generated>
//     Generated by `yog build` from content/** — don't edit, it's rewritten
//     on every build. Included by `yog_api::content!()`.
// </auto-generated>

/// The items of `content/`: the id and a [`::yog_api::ItemDef`] of each.
#[allow(dead_code)]
pub struct Items;

#[allow(dead_code, clippy::all)]
impl Items {
    /// `gm:ruby` — `content/ruby.yitem`.
    pub const RUBY: &'static str = "gm:ruby";
    /// The definition from `content/ruby.yitem` (name and tooltip come from the lang files).
    pub fn ruby() -> ::yog_api::ItemDef {
        ::yog_api::ItemDef::new(Self::RUBY)
    }
}

# content/register.g.rs
// <auto-generated>
//     Generated by `yog build` from content/** — don't edit, it's rewritten
//     on every build. Included by `yog_api::content!()`.
// </auto-generated>

/// Registers every block and item of `content/` whose file doesn't say
/// `"register": "manual"` — `yog_api::content!()` calls it after
/// `Mod::register`.
#[allow(unused_variables)]
pub fn register(registry: &mut ::yog_api::Registry) {
    registry.register_item(Items::ruby());
    registry.add_recipe(::yog_api::Recipe { id: "gm:ruby".into(), kind: ::yog_api::RecipeKind::Shapeless { ingredients: vec![vec!["minecraft:redstone".into()]] }, result: "gm:ruby".into(), count: 1, group: None, category: None });
    registry.register_book_data("gm:guide", include_bytes!(concat!(env!("CARGO_MANIFEST_DIR"), "/generated/books/gm__guide.ydata")));
}

// Runs when the mod's library loads: `export_mod!` calls `register` after
// `Mod::register`.
#[::yog_api::ctor::ctor(unsafe, crate_path = ::yog_api::ctor)]
fn __yog_content_auto_register() {
    ::yog_api::__yog_content_registrars()
        .lock()
        .unwrap_or_else(|e| e.into_inner())
        .push(register);
}

# generated/books/gm__guide.ydata
{
  "id": "gm:guide",
  "name": "gm.title",
  "version": 1,
  "landing_text": "gm.landing",
  "nameplate_color": "FFDD98",
  "accent": "#aa2233",
  "book_texture": "yog:gui/book",
  "categories": [
    {
      "id": "gm:basics",
      "name": "Basics",
      "icon": "gm:ruby",
      "sortnum": 0
    }
  ],
  "entries": [
    {
      "id": "gm:ruby",
      "name": "item.gm.ruby",
      "category": "@category:gm:basics",
      "pages": [
        {
          "type": "text",
          "text": "gm.intro"
        },
        {
          "type": "spotlight",
          "item": "@item:gm:ruby"
        },
        {
          "type": "recipe",
          "recipe": "@recipe:gm:ruby"
        },
        {
          "type": "entity",
          "entity": "@entity:minecraft:allay",
          "name": "entity.minecraft.allay"
        },
        {
          "type": "multiblock",
          "pattern": [
            [
              "F"
            ]
          ],
          "mapping": {
            "F": "@block:minecraft:furnace[facing=north]"
          }
        },
        {
          "type": "relations",
          "entries": [
            "@entry:gm:ruby"
          ]
        }
      ],
      "icon": "minecraft:textures/item/emerald.png",
      "priority": 0,
      "secret": false,
      "read_by_default": false,
      "requires": []
    }
  ],
  "i18n": true,
  "layouts": [],
  "page_types": []
}

# assets/gm/items/ruby.json
{
  "model": {
    "model": "gm:item/ruby",
    "type": "minecraft:model"
  }
}
# assets/gm/lang/en_us.json
{
  "gm.intro": "Rubies are {accent|red}. See {link=@entry:gm:ruby|the ruby page}.",
  "gm.landing": "Welcome.",
  "gm.title": "Golden Guide",
  "item.gm.ruby": "Ruby"
}
# assets/gm/lang/ru_ru.json
{
  "gm.title": "Золотое руководство"
}
# assets/gm/models/item/ruby.json
{
  "parent": "minecraft:item/generated",
  "textures": {
    "layer0": "minecraft:item/emerald"
  }
}