Add donor perks and tweak generalise rendering of healing totem

This commit is contained in:
Electroblob77
2020-07-19 15:56:07 +01:00
parent a831c2ada3
commit 3343385a7c
28 changed files with 490 additions and 3 deletions
@@ -8,6 +8,8 @@ import net.minecraft.util.text.Style;
import net.minecraft.util.text.TextComponentTranslation;
import net.minecraft.util.text.TextFormatting;
import javax.annotation.Nullable;
public enum Element implements IStringSerializable {
/** The 'default' element, with {@link electroblob.wizardry.registry.Spells#magic_missile magic missile} being its
@@ -49,6 +51,18 @@ public enum Element implements IStringSerializable {
throw new IllegalArgumentException("No such element with unlocalised name: " + name);
}
/** Same as {@link Element#fromName(String)}, but returns the given fallback instead of throwing an exception if no
* element matches the given string. */
@Nullable
public static Element fromName(String name, @Nullable Element fallback){
for(Element element : values()){
if(element.unlocalisedName.equals(name)) return element;
}
return fallback;
}
/** Returns the translated display name of this element, without formatting. */
public String getDisplayName(){
return Wizardry.proxy.translate("element." + getName());