Add tier, element and spell type to advanced tooltips for spell books and scrolls
This commit is contained in:
@@ -1,6 +1,7 @@
|
|||||||
package electroblob.wizardry.item;
|
package electroblob.wizardry.item;
|
||||||
|
|
||||||
import electroblob.wizardry.Wizardry;
|
import electroblob.wizardry.Wizardry;
|
||||||
|
import electroblob.wizardry.data.SpellGlyphData;
|
||||||
import electroblob.wizardry.event.SpellCastEvent;
|
import electroblob.wizardry.event.SpellCastEvent;
|
||||||
import electroblob.wizardry.event.SpellCastEvent.Source;
|
import electroblob.wizardry.event.SpellCastEvent.Source;
|
||||||
import electroblob.wizardry.packet.PacketCastSpell;
|
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.common.network.simpleimpl.IMessage;
|
||||||
import net.minecraftforge.fml.relauncher.Side;
|
import net.minecraftforge.fml.relauncher.Side;
|
||||||
import net.minecraftforge.fml.relauncher.SideOnly;
|
import net.minecraftforge.fml.relauncher.SideOnly;
|
||||||
|
import net.minecraftforge.oredict.OreDictionary;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
public class ItemScroll extends Item implements ISpellCastingItem {
|
public class ItemScroll extends Item implements ISpellCastingItem {
|
||||||
|
|
||||||
@@ -81,6 +85,25 @@ public class ItemScroll extends Item implements ISpellCastingItem {
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@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
|
@Override
|
||||||
public int getMaxItemUseDuration(ItemStack stack){
|
public int getMaxItemUseDuration(ItemStack stack){
|
||||||
return CASTING_TIME;
|
return CASTING_TIME;
|
||||||
|
|||||||
@@ -64,10 +64,13 @@ public class ItemSpellBook extends Item {
|
|||||||
: "#\u00A79" + SpellGlyphData.getGlyphName(spell, world));
|
: "#\u00A79" + SpellGlyphData.getGlyphName(spell, world));
|
||||||
|
|
||||||
tooltip.add(spell.getTier().getDisplayNameWithFormatting());
|
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
|
@Override
|
||||||
|
|||||||
Reference in New Issue
Block a user