Add tier, element and spell type to advanced tooltips for spell books and scrolls

This commit is contained in:
Electroblob77
2019-09-03 20:55:41 +01:00
parent 97c72685bb
commit c06105cd00
2 changed files with 29 additions and 3 deletions
@@ -1,6 +1,7 @@
package electroblob.wizardry.item;
import electroblob.wizardry.Wizardry;
import electroblob.wizardry.data.SpellGlyphData;
import electroblob.wizardry.event.SpellCastEvent;
import electroblob.wizardry.event.SpellCastEvent.Source;
import electroblob.wizardry.packet.PacketCastSpell;
@@ -22,6 +23,9 @@ import net.minecraftforge.common.MinecraftForge;
import net.minecraftforge.fml.common.network.simpleimpl.IMessage;
import net.minecraftforge.fml.relauncher.Side;
import net.minecraftforge.fml.relauncher.SideOnly;
import net.minecraftforge.oredict.OreDictionary;
import java.util.List;
public class ItemScroll extends Item implements ISpellCastingItem {
@@ -80,6 +84,25 @@ public class ItemScroll extends Item implements ISpellCastingItem {
return Wizardry.proxy.getScrollDisplayName(stack);
}
@Override
@SideOnly(Side.CLIENT)
public void addInformation(ItemStack itemstack, World world, List<String> tooltip, net.minecraft.client.util.ITooltipFlag advanced){
if(world != null){
Spell spell = Spell.byMetadata(itemstack.getItemDamage());
boolean discovered = Wizardry.proxy.shouldDisplayDiscovered(spell, itemstack);
// Advanced tooltips display more information, mainly for searching purposes in creative
if(discovered && advanced.isAdvanced()){ // No cheating!
tooltip.add(spell.getTier().getDisplayName());
tooltip.add(spell.getElement().getDisplayName());
tooltip.add(spell.getType().getDisplayName());
}
}
}
@Override
public int getMaxItemUseDuration(ItemStack stack){
@@ -64,10 +64,13 @@ public class ItemSpellBook extends Item {
: "#\u00A79" + SpellGlyphData.getGlyphName(spell, world));
tooltip.add(spell.getTier().getDisplayNameWithFormatting());
// Advanced tooltips display more information, mainly for searching purposes in creative
if(discovered && advanced.isAdvanced()){ // No cheating!
tooltip.add(spell.getElement().getDisplayName());
tooltip.add(spell.getType().getDisplayName());
}
}
/* Removed to streamline the tooltip a bit. Information is now within the book. if(spell.isContinuous){
* tooltip.add("\u00A79Mana Cost: " + spell.cost + " per second"); }else{ tooltip.add("\u00A79Mana Cost: " +
* spell.cost); } */
}
@Override