feat(api/runtime): java-style assets and localization sync
@@ -2,24 +2,40 @@
|
||||
|
||||
## Language files
|
||||
|
||||
Language files live in `assets/lang/` with the format `{locale}.lang` (e.g. `en-GB.lang`, `de-DE.lang`).
|
||||
Language files live in `assets/examplemod/lang/` with the format `{locale}.lang` (e.g. `en-GB.lang`, `de-DE.lang`).
|
||||
|
||||
**Current API:** Use `BlockProperties.Name()` and `ItemProperties.Name()` when registering blocks and items. These set the display name shown in-game. The ModLoader hooks into the game's string lookup so your names appear correctly.
|
||||
Use `Text.Translatable()` with `BlockProperties.Name()` / `ItemProperties.Name()` to pull localized strings
|
||||
from these `.lang` files. Format: `key=value` per line, with `#` for comments.
|
||||
|
||||
**Future:** Multi-locale support may load from these `.lang` files. Format: `key=value` per line, with `#` for comments.
|
||||
Example:
|
||||
|
||||
```csharp
|
||||
.Name(Text.Translatable("item.examplemod.ruby"))
|
||||
.Name(Text.Literal("Ruby")) // literal fallback if you don't want localization
|
||||
```
|
||||
|
||||
## Textures
|
||||
|
||||
Mod textures are supported via the dynamic atlas system. Place PNG files in:
|
||||
Mod textures use Java-style asset paths. Place PNG files in:
|
||||
|
||||
- **Blocks:** `assets/blocks/{name}.png` → icon `{modid}:{name}` (e.g. `ruby_ore.png` → `examplemod:ruby_ore`)
|
||||
- **Items:** `assets/items/{name}.png` → icon `{modid}:{name}` (e.g. `ruby.png` → `examplemod:ruby`)
|
||||
- **Blocks:** `assets/examplemod/textures/block/{name}.png` → icon `examplemod:block/{name}`
|
||||
- **Items:** `assets/examplemod/textures/item/{name}.png` → icon `examplemod:item/{name}`
|
||||
|
||||
The mod ID is derived from the mod folder name (lowercase, hyphens removed). Use the namespaced icon in `BlockProperties.Icon()` and `ItemProperties.Icon()`:
|
||||
Use the Java-style icon in `BlockProperties.Icon()` and `ItemProperties.Icon()`:
|
||||
|
||||
```csharp
|
||||
.Icon("examplemod:ruby_ore") // block from assets/blocks/ruby_ore.png
|
||||
.Icon("examplemod:ruby") // item from assets/items/ruby.png
|
||||
.Icon("examplemod:block/ruby_ore") // block from assets/examplemod/textures/block/ruby_ore.png
|
||||
.Icon("examplemod:item/ruby") // item from assets/examplemod/textures/item/ruby.png
|
||||
```
|
||||
|
||||
Textures must be 16×16 pixels (or any size; they are scaled). For vanilla icons, use names like `gold_ore`, `diamond`, etc.
|
||||
Textures must be 16×16 pixels (or any size; they are scaled).
|
||||
|
||||
## Models (Java-style)
|
||||
|
||||
Block and item models are supported using Java-style JSON assets:
|
||||
|
||||
- **Blocks:** `assets/examplemod/models/block/{name}.json`
|
||||
- **Items:** `assets/examplemod/models/item/{name}.json`
|
||||
- **Entities (future):** `assets/examplemod/models/entity/{name}.json`
|
||||
|
||||
The `examplemod` namespace should match your mod ID (lowercase).
|
||||
|
||||
@@ -1,7 +1,4 @@
|
||||
# ExampleMod language file (en-GB)
|
||||
# Display names for blocks and items.
|
||||
# In the current API, use BlockProperties.Name() and ItemProperties.Name() instead.
|
||||
# This file documents the expected format for future multi-locale support.
|
||||
|
||||
block.examplemod.ruby_ore=Ruby Ore
|
||||
block.examplemod.ruby_stone=Ruby Stone
|
||||
|
Before Width: | Height: | Size: 2.8 KiB After Width: | Height: | Size: 2.8 KiB |
|
Before Width: | Height: | Size: 2.4 KiB After Width: | Height: | Size: 2.4 KiB |
|
Before Width: | Height: | Size: 2.4 KiB After Width: | Height: | Size: 2.4 KiB |
|
Before Width: | Height: | Size: 2.2 KiB After Width: | Height: | Size: 2.2 KiB |
|
Before Width: | Height: | Size: 3.7 KiB After Width: | Height: | Size: 3.7 KiB |
|
Before Width: | Height: | Size: 2.2 KiB After Width: | Height: | Size: 2.2 KiB |
|
Before Width: | Height: | Size: 5.6 KiB After Width: | Height: | Size: 5.6 KiB |
|
Before Width: | Height: | Size: 5.2 KiB After Width: | Height: | Size: 5.2 KiB |
|
Before Width: | Height: | Size: 2.4 KiB After Width: | Height: | Size: 2.4 KiB |
|
Before Width: | Height: | Size: 2.3 KiB After Width: | Height: | Size: 2.3 KiB |
|
Before Width: | Height: | Size: 2.9 KiB After Width: | Height: | Size: 2.9 KiB |
|
Before Width: | Height: | Size: 3.6 KiB After Width: | Height: | Size: 3.6 KiB |
|
Before Width: | Height: | Size: 2.3 KiB After Width: | Height: | Size: 2.3 KiB |
|
Before Width: | Height: | Size: 3.9 KiB After Width: | Height: | Size: 3.9 KiB |
@@ -1,5 +0,0 @@
|
||||
# ExampleMod language file (de-DE)
|
||||
# German translations for ExampleMod content.
|
||||
|
||||
block.examplemod.ruby_ore=Rubinerz
|
||||
item.examplemod.ruby=Rubin
|
||||