Expand description
.yres resource files — a mod’s texts, images, sounds, files, colors,
numbers and flags, like a C# project’s Resources/*.resx. See
Yog-IDLE’s docs/yres.md for the format.
yog build reads resources/**/*.yres: <Set>.yres is the neutral
(en_us) file of resource set <Set>, <Set>.<locale>.yres its culture
variants (texts only). It
- writes the texts into
assets/<mod id>/lang/<locale>.json(merged with a hand-written one),{name}/{0}placeholders turned into%1$s; - bundles image/file/sound entries’ files under
assets/<mod id>/..., plus asounds.jsonfor the sounds; - generates
.yog-build/generated/resources/<Set>.g.rs— a type per set with a typed accessor per entry — andresources.g.rsincluding them, pulled in ascrate::resbyyog_api::resources!();; - resolves
@<Set>.<name>references for.yuiscreens andyog.toml.
Structs§
- Compiled
- Everything
yog buildmakes of a mod’s resources. - Entry
- One entry of a
.yresfile. - Entry
Object - An entry’s object form:
{ "type": ..., "value": ..., "comment": ..., ... }. - Picture
- An image’s picture: its PNG and the file the build writes it to — which a texture packed into an atlas takes the place of.
- Refs
- What
.yuiscreens andyog.tomlcan refer to as@<Set>.<name>. - ResFile
- One
.yresfile. - Set
- A resource set: its neutral file and culture variants.
Enums§
- Kind
- An entry’s type.
- Value
- A scalar as written: a string, a number (its literal), a bool, or bytes
(a picture, a sound, a file —
@bytes:<base64>).
Constants§
- GENERATED_
DIR - Where the per-set
<Set>.g.rsfiles go. - GENERATED_
FILE - Where the generated accessors go, under the mod root.
The file
yog_api::resources!()includes; it includes oneresources/<Set>.g.rsper set (shown under its.yresin Yog-IDLE). - NEUTRAL_
LOCALE - The locale of the neutral
<Set>.yresfiles. - RESOURCES_
DIR - Where resource files live, under the mod root.
Functions§
- accessor_
name - The accessor for entry
name:screen.title→screen_title,ModName→mod_name. - color_
of - A color entry’s value as ARGB, when it is one.
- compile
- Compiles the mod’s resources (see the module docs). Any error fails the whole thing, listing every problem.
- default_
key - The default translation key of text
namein setset. - find
- Every
resources/**/*.yresof the mod atroot, sorted. - name_
problem - What’s wrong with entry name
name, if anything. - parse
- Parses
.yrestext. Every problem is reported,line:column: name: messageone per line; names aren’t validated here (see [valid_name]). - resolve_
image - Resolves a
yog.tomlimage value:@<Set>.<name>→ its image source. - resolve_
text - Resolves a
yog.tomlvalue:@<Set>.<name>of a text → (neutral text, Some(key)); anything else as is. Errors on an unknown reference. - valid_
locale - Minecraft’s locale codes: lower case,
en_us,pt_br,lol_us, … - valid_
name - An entry name: identifiers joined by
.(title,screen.title). - valid_
set_ name - A resource set name: one identifier (
Strings,Icons). - value_
problem - What’s wrong with
e’s value for its type, if anything — the build’s rule, which editors show too. - write
.yrestext forentries, as the IDE writes it.- write_
sources - Writes
.yog-build/generated/resources/<Set>.g.rsper set and.yog-build/generated/resources.g.rsincluding them all (whatyog_api::resources!()pulls in ascrate::res); deletes those of sets that are gone.
Type Aliases§
- Output
- A generated file: path inside the
.yogand its bytes.