mirror of
https://github.com/Jacobwasbeast/LegacyWeaveLoader.git
synced 2026-06-04 12:04:31 +00:00
feat(api/runtime): java-style assets and localization sync
This commit is contained in:
@@ -1,3 +1,5 @@
|
||||
using WeaveLoader.API;
|
||||
|
||||
namespace WeaveLoader.API.Item;
|
||||
|
||||
/// <summary>
|
||||
@@ -10,10 +12,13 @@ public class ItemProperties
|
||||
internal float AttackDamageValue = 0.0f;
|
||||
internal string IconValue = "";
|
||||
internal CreativeTab CreativeTabValue = CreativeTab.None;
|
||||
internal string? NameValue;
|
||||
internal Text? 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>
|
||||
/// <summary>
|
||||
/// Icon name in the items atlas. Use Java-style names like "examplemod:item/ruby"
|
||||
/// from assets/examplemod/textures/item/ruby.png, or vanilla names like "diamond", "ingotIron".
|
||||
/// </summary>
|
||||
public ItemProperties Icon(string iconName) { IconValue = iconName; return this; }
|
||||
|
||||
/// <summary>
|
||||
@@ -25,5 +30,7 @@ public class ItemProperties
|
||||
public ItemProperties AttackDamage(float damage) { AttackDamageValue = damage; 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; }
|
||||
public ItemProperties Name(string displayName) { NameValue = Text.Literal(displayName); return this; }
|
||||
/// <summary>Localized display name using a language key (e.g. "item.examplemod.ruby").</summary>
|
||||
public ItemProperties Name(Text text) { NameValue = text; return this; }
|
||||
}
|
||||
|
||||
@@ -116,7 +116,7 @@ public static class ItemRegistry
|
||||
(int)nativeTier,
|
||||
maxDamage,
|
||||
properties.IconValue,
|
||||
properties.NameValue ?? "");
|
||||
properties.NameValue?.Resolve() ?? "");
|
||||
|
||||
if (numericId >= 0)
|
||||
ConfigureToolMaterial(id, numericId, ToolKind.Pickaxe, material, properties);
|
||||
@@ -129,7 +129,7 @@ public static class ItemRegistry
|
||||
(int)(material?.BaseTierValue ?? shovelItem.Tier),
|
||||
properties.MaxDamageValue,
|
||||
properties.IconValue,
|
||||
properties.NameValue ?? "");
|
||||
properties.NameValue?.Resolve() ?? "");
|
||||
|
||||
if (numericId >= 0)
|
||||
ConfigureToolMaterial(id, numericId, ToolKind.Shovel, material, properties);
|
||||
@@ -142,7 +142,7 @@ public static class ItemRegistry
|
||||
(int)(material?.BaseTierValue ?? hoeItem.Tier),
|
||||
properties.MaxDamageValue,
|
||||
properties.IconValue,
|
||||
properties.NameValue ?? "");
|
||||
properties.NameValue?.Resolve() ?? "");
|
||||
|
||||
if (numericId >= 0)
|
||||
ConfigureToolMaterial(id, numericId, ToolKind.Hoe, material, properties);
|
||||
@@ -155,7 +155,7 @@ public static class ItemRegistry
|
||||
(int)(material?.BaseTierValue ?? axeItem.Tier),
|
||||
properties.MaxDamageValue,
|
||||
properties.IconValue,
|
||||
properties.NameValue ?? "");
|
||||
properties.NameValue?.Resolve() ?? "");
|
||||
|
||||
if (numericId >= 0)
|
||||
ConfigureToolMaterial(id, numericId, ToolKind.Axe, material, properties);
|
||||
@@ -168,7 +168,7 @@ public static class ItemRegistry
|
||||
(int)(material?.BaseTierValue ?? swordItem.Tier),
|
||||
properties.MaxDamageValue,
|
||||
properties.IconValue,
|
||||
properties.NameValue ?? "");
|
||||
properties.NameValue?.Resolve() ?? "");
|
||||
|
||||
if (numericId >= 0)
|
||||
ConfigureToolMaterial(id, numericId, ToolKind.Sword, material, properties);
|
||||
@@ -180,7 +180,7 @@ public static class ItemRegistry
|
||||
properties.MaxStackSizeValue,
|
||||
properties.MaxDamageValue,
|
||||
properties.IconValue,
|
||||
properties.NameValue ?? "");
|
||||
properties.NameValue?.Resolve() ?? "");
|
||||
}
|
||||
|
||||
if (numericId < 0)
|
||||
|
||||
Reference in New Issue
Block a user