mirror of
https://github.com/GTNewHorizons/Chisel.git
synced 2026-11-12 08:17:48 +00:00
utitilies: add replaceTags(), update getName()
replaceTags() is helpful for finding remapped items. Adding a getName(Item item) and using replaceTags() in old getName(Block block)
This commit is contained in:
1 parent
ffcbf444cd
commit
480b6c3629
1 file changed
+9
-6
@@ -57,18 +57,21 @@ public class General
|
||||
return stack.getItem();
|
||||
}
|
||||
|
||||
public static String getUnlocalizedName(Block block)
|
||||
public static String getName(Item item)
|
||||
{
|
||||
String name = block.getUnlocalizedName();
|
||||
if(name.startsWith("tile.")) name = name.substring(5);
|
||||
|
||||
return name;
|
||||
String res = item.getUnlocalizedName();
|
||||
return cleanTags(res);
|
||||
}
|
||||
|
||||
public static String getName(Block block)
|
||||
{
|
||||
String res = block.getUnlocalizedName();
|
||||
return res.substring(5);
|
||||
return cleanTags(res);
|
||||
}
|
||||
|
||||
public static String cleanTags(String tag)
|
||||
{
|
||||
return tag.replaceAll("[Cc]hisel\\p{Punct}", "").replaceFirst("^tile\\.", "").replaceFirst("^item\\.", "");
|
||||
}
|
||||
|
||||
|
||||
|
||||
Reference in new issue
Block a user