That's one heck of a commit you've got there...
I may have got a bit behind with version control. A lot behind, in fact. Maybe I'll go back and split this sometime - then again, I probably won't. But hey, at least it's here!
This commit is contained in:
@@ -1,19 +1,14 @@
|
||||
package electroblob.wizardry.item;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import javax.annotation.Nullable;
|
||||
|
||||
import electroblob.wizardry.WizardData;
|
||||
import electroblob.wizardry.Wizardry;
|
||||
import electroblob.wizardry.data.WizardData;
|
||||
import electroblob.wizardry.event.DiscoverSpellEvent;
|
||||
import electroblob.wizardry.registry.WizardryAdvancementTriggers;
|
||||
import electroblob.wizardry.registry.WizardrySounds;
|
||||
import electroblob.wizardry.registry.WizardryTabs;
|
||||
import electroblob.wizardry.spell.Spell;
|
||||
import electroblob.wizardry.util.WizardryUtilities;
|
||||
import net.minecraft.client.util.ITooltipFlag;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.init.SoundEvents;
|
||||
import net.minecraft.item.EnumRarity;
|
||||
import net.minecraft.item.Item;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.util.ActionResult;
|
||||
@@ -25,6 +20,9 @@ import net.minecraftforge.common.MinecraftForge;
|
||||
import net.minecraftforge.fml.relauncher.Side;
|
||||
import net.minecraftforge.fml.relauncher.SideOnly;
|
||||
|
||||
import javax.annotation.Nullable;
|
||||
import java.util.List;
|
||||
|
||||
public class ItemIdentificationScroll extends Item {
|
||||
|
||||
public ItemIdentificationScroll(){
|
||||
@@ -38,11 +36,15 @@ public class ItemIdentificationScroll extends Item {
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public EnumRarity getRarity(ItemStack stack){
|
||||
return EnumRarity.UNCOMMON;
|
||||
}
|
||||
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public void addInformation(ItemStack stack, @Nullable World worldIn, List<String> tooltip, ITooltipFlag flagIn) {
|
||||
tooltip.add(net.minecraft.client.resources.I18n.format("item." + Wizardry.MODID + ":identification_scroll.desc1", "\u00A77"));
|
||||
tooltip.add(net.minecraft.client.resources.I18n.format("item." + Wizardry.MODID + ":identification_scroll.desc2", "\u00A77"));
|
||||
public void addInformation(ItemStack stack, @Nullable World world, List<String> tooltip, net.minecraft.client.util.ITooltipFlag flag) {
|
||||
Wizardry.proxy.addMultiLineDescription(tooltip, "item." + this.getRegistryName() + ".desc");
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -52,27 +54,26 @@ public class ItemIdentificationScroll extends Item {
|
||||
|
||||
if(WizardData.get(player) != null){
|
||||
|
||||
WizardData properties = WizardData.get(player);
|
||||
WizardData data = WizardData.get(player);
|
||||
|
||||
for(ItemStack stack1 : WizardryUtilities.getPrioritisedHotbarAndOffhand(player)){
|
||||
|
||||
if(!stack1.isEmpty()){
|
||||
Spell spell = Spell.get(stack1.getItemDamage());
|
||||
Spell spell = Spell.byMetadata(stack1.getItemDamage());
|
||||
if((stack1.getItem() instanceof ItemSpellBook || stack1.getItem() instanceof ItemScroll)
|
||||
&& !properties.hasSpellBeenDiscovered(spell)){
|
||||
&& !data.hasSpellBeenDiscovered(spell)){
|
||||
|
||||
if(!MinecraftForge.EVENT_BUS.post(new DiscoverSpellEvent(player, spell,
|
||||
DiscoverSpellEvent.Source.IDENTIFICATION_SCROLL))){
|
||||
// Identification scrolls give the chat readout in creative mode, otherwise it looks like
|
||||
// nothing happens!
|
||||
properties.discoverSpell(spell);
|
||||
WizardryAdvancementTriggers.identify_spell.triggerFor(player);
|
||||
player.playSound(SoundEvents.ENTITY_PLAYER_LEVELUP, 1.25f, 1);
|
||||
if(!player.capabilities.isCreativeMode) stack.shrink(1);
|
||||
data.discoverSpell(spell);
|
||||
player.playSound(WizardrySounds.MISC_DISCOVER_SPELL, 1.25f, 1);
|
||||
if(!player.isCreative()) stack.shrink(1);
|
||||
if(!world.isRemote) player.sendMessage(new TextComponentTranslation("spell.discover",
|
||||
spell.getNameForTranslationFormatted()));
|
||||
|
||||
return new ActionResult<ItemStack>(EnumActionResult.SUCCESS, stack);
|
||||
return new ActionResult<>(EnumActionResult.SUCCESS, stack);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -82,7 +83,7 @@ public class ItemIdentificationScroll extends Item {
|
||||
new TextComponentTranslation("item." + Wizardry.MODID + ":identification_scroll.nothing_to_identify"));
|
||||
}
|
||||
|
||||
return new ActionResult<ItemStack>(EnumActionResult.FAIL, stack);
|
||||
return new ActionResult<>(EnumActionResult.FAIL, stack);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user