Allow overriding the head item name
This commit is contained in:
parent
e1f79b6af7
commit
b9150379dc
3 changed files with 12 additions and 6 deletions
|
@ -53,7 +53,7 @@ mod_name=Zontreck Library Mod
|
|||
# The license of the mod. Review your options at https://choosealicense.com/. All Rights Reserved is the default.
|
||||
mod_license=GPLv3
|
||||
# The mod version. See https://semver.org/
|
||||
mod_version=1.10.010224.1909
|
||||
mod_version=1.10.010224.1940
|
||||
# The group ID for the mod. It is only important when publishing as an artifact to a Maven repository.
|
||||
# This should match the base package used for the mod sources.
|
||||
# See https://maven.apache.org/guides/mini/guide-naming-conventions.html
|
||||
|
|
|
@ -49,7 +49,7 @@ public class HeadCache
|
|||
private HeadCacheItem()
|
||||
{}
|
||||
|
||||
public ItemStack getAsItem()
|
||||
public ItemStack getAsItem(String itemName)
|
||||
{
|
||||
ItemStack head = new ItemStack(Items.PLAYER_HEAD, 1);
|
||||
|
||||
|
@ -66,8 +66,14 @@ public class HeadCache
|
|||
skullOwner.put("Properties", properties);
|
||||
head.addTagElement(PlayerHeadItem.TAG_SKULL_OWNER, skullOwner);
|
||||
|
||||
Component headname = ChatHelpers.macro("[0]'s Head", name);
|
||||
head.setHoverName(headname);
|
||||
if(itemName == "")
|
||||
{
|
||||
|
||||
Component headname = ChatHelpers.macro("[0]'s Head", name);
|
||||
head.setHoverName(headname);
|
||||
}else {
|
||||
head.setHoverName(ChatHelpers.macro(itemName));
|
||||
}
|
||||
|
||||
return head;
|
||||
|
||||
|
|
|
@ -27,9 +27,9 @@ public class HeadUtilities {
|
|||
}
|
||||
}
|
||||
|
||||
public static ItemStack get(String playerName)
|
||||
public static ItemStack get(String playerName, String itemName)
|
||||
{
|
||||
return cachedLookup(playerName).getAsItem();
|
||||
return cachedLookup(playerName).getAsItem(itemName);
|
||||
}
|
||||
|
||||
private static HeadCacheItem externalHeadRequest(String playerName)
|
||||
|
|
Reference in a new issue