mirror of
https://github.com/Jacobwasbeast/LegacyWeaveLoader.git
synced 2026-05-30 01:24:30 +00:00
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
27 lines
1.3 KiB
C#
27 lines
1.3 KiB
C#
namespace LegacyForge.API.Item;
|
|
|
|
/// <summary>
|
|
/// Fluent builder for defining item properties.
|
|
/// </summary>
|
|
public class ItemProperties
|
|
{
|
|
internal int MaxStackSizeValue = 64;
|
|
internal int MaxDamageValue = 0;
|
|
internal string IconValue = "";
|
|
internal CreativeTab CreativeTabValue = CreativeTab.None;
|
|
internal string? NameValue;
|
|
|
|
public ItemProperties MaxStackSize(int size) { MaxStackSizeValue = size; return this; }
|
|
/// <summary>Icon name in the items atlas. Use namespaced ID for mod textures (e.g. "examplemod:ruby" from assets/items/ruby.png), or vanilla names like "diamond", "ingotIron".</summary>
|
|
public ItemProperties Icon(string iconName) { IconValue = iconName; return this; }
|
|
|
|
/// <summary>
|
|
/// Set max damage for a tool/armor item. Setting this to a positive value
|
|
/// makes the item damageable with a durability bar.
|
|
/// </summary>
|
|
public ItemProperties MaxDamage(int damage) { MaxDamageValue = damage; MaxStackSizeValue = 1; return this; }
|
|
public ItemProperties InCreativeTab(CreativeTab tab) { CreativeTabValue = tab; return this; }
|
|
/// <summary>Display name shown in-game (e.g. "Ruby"). Used for localization.</summary>
|
|
public ItemProperties Name(string displayName) { NameValue = displayName; return this; }
|
|
}
|