mirror of
https://github.com/Jacobwasbeast/LegacyWeaveLoader.git
synced 2026-06-04 03:54:31 +00:00
Mod textures, display names, and atlas injection
Mod Atlas (ModAtlas.cpp/h): - Build merged terrain.png and items.png from mod assets (blocks/*.png, items/*.png) - Scan vanilla atlas for empty (fully transparent) cells; place mod textures only there - Install merged atlases over game files before Minecraft::init; restore originals after - Hook loadUVs to create SimpleIcon objects for mod textures - Hook registerIcon to return mod icons when requested by name - FixupModIcons: copy field_0x48 (source-image ptr) from vanilla icons after init Mod Strings (ModStrings.cpp/h): - Store mod display names by description ID - Hook GetString to serve mod names for blocks/items API changes: - BlockProperties/ItemProperties: .Name(displayName), namespaced .Icon() - NativeInterop: displayName params, native_allocate_description_id, native_register_string - Registry.Assets for string registration - Output: mods/LegacyForge.API/, mods/ExampleMod/ (per-mod folders) Mod discovery: - Scan mods/*/ for mod folders; load DLLs from each - LegacyForge.API as mod in mods/LegacyForge.API/ ExampleMod: - Ruby ore block and ruby item with custom textures and names - Assets: blocks/ruby_ore.png, items/ruby.png, lang files - Furnace recipe: ruby_ore -> ruby Runtime: loadUVs, registerIcon, getResourceAsStream, GetString hooks; stb_image for PNG
This commit is contained in:
25
ExampleMod/assets/README.md
Normal file
25
ExampleMod/assets/README.md
Normal file
@@ -0,0 +1,25 @@
|
||||
# ExampleMod Assets
|
||||
|
||||
## Language files
|
||||
|
||||
Language files live in `assets/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.
|
||||
|
||||
**Future:** Multi-locale support may load from these `.lang` files. Format: `key=value` per line, with `#` for comments.
|
||||
|
||||
## Textures
|
||||
|
||||
Mod textures are supported via the dynamic atlas system. 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`)
|
||||
|
||||
The mod ID is derived from the mod folder name (lowercase, hyphens removed). Use the namespaced 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
|
||||
```
|
||||
|
||||
Textures must be 16×16 pixels (or any size; they are scaled). For vanilla icons, use names like `gold_ore`, `diamond`, etc.
|
||||
BIN
ExampleMod/assets/blocks/ruby_ore.png
Normal file
BIN
ExampleMod/assets/blocks/ruby_ore.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 313 B |
BIN
ExampleMod/assets/items/ruby.png
Normal file
BIN
ExampleMod/assets/items/ruby.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 313 B |
5
ExampleMod/assets/lang/de-DE.lang
Normal file
5
ExampleMod/assets/lang/de-DE.lang
Normal file
@@ -0,0 +1,5 @@
|
||||
# ExampleMod language file (de-DE)
|
||||
# German translations for ExampleMod content.
|
||||
|
||||
block.examplemod.ruby_ore=Rubinerz
|
||||
item.examplemod.ruby=Rubin
|
||||
7
ExampleMod/assets/lang/en-GB.lang
Normal file
7
ExampleMod/assets/lang/en-GB.lang
Normal file
@@ -0,0 +1,7 @@
|
||||
# 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
|
||||
item.examplemod.ruby=Ruby
|
||||
Reference in New Issue
Block a user