diff --git a/src/main/java/electroblob/wizardry/entity/living/EntityEvilWizard.java b/src/main/java/electroblob/wizardry/entity/living/EntityEvilWizard.java index 44dc43b0..00b4d2e2 100644 --- a/src/main/java/electroblob/wizardry/entity/living/EntityEvilWizard.java +++ b/src/main/java/electroblob/wizardry/entity/living/EntityEvilWizard.java @@ -48,6 +48,7 @@ import net.minecraft.util.DamageSource; import net.minecraft.util.EnumHand; import net.minecraft.util.ResourceLocation; import net.minecraft.util.SoundEvent; +import net.minecraft.util.text.TextComponentTranslation; import net.minecraft.world.DifficultyInstance; import net.minecraft.world.EnumDifficulty; import net.minecraft.world.World; @@ -250,8 +251,12 @@ public class EntityEvilWizard extends EntityMob implements ISpellCaster, IEntity // When right-clicked with a spell book in creative, sets one of the spells to that spell if(player.capabilities.isCreativeMode && stack.getItem() instanceof ItemSpellBook){ - if(this.spells.size() >= 4 && Spell.get(stack.getItemDamage()).canBeCastByNPCs()){ - this.spells.set(rand.nextInt(3) + 1, Spell.get(stack.getItemDamage())); + Spell spell = Spell.get(stack.getItemDamage()); + if(this.spells.size() >= 4 && spell.canBeCastByNPCs()){ + // The set(...) method returns the element that was replaced - neat! + player.sendMessage(new TextComponentTranslation("item." + Wizardry.MODID + ":spell_book.apply_to_wizard", + this.getDisplayName(), this.spells.set(rand.nextInt(3) + 1, spell).getNameForTranslationFormatted(), + spell.getNameForTranslationFormatted())); return true; } } diff --git a/src/main/java/electroblob/wizardry/entity/living/EntityWizard.java b/src/main/java/electroblob/wizardry/entity/living/EntityWizard.java index 9c3a474f..9114aeba 100644 --- a/src/main/java/electroblob/wizardry/entity/living/EntityWizard.java +++ b/src/main/java/electroblob/wizardry/entity/living/EntityWizard.java @@ -67,6 +67,7 @@ import net.minecraft.util.DamageSource; import net.minecraft.util.EnumHand; import net.minecraft.util.math.BlockPos; import net.minecraft.util.text.ITextComponent; +import net.minecraft.util.text.TextComponentTranslation; import net.minecraft.village.MerchantRecipe; import net.minecraft.village.MerchantRecipeList; import net.minecraft.world.DifficultyInstance; @@ -372,8 +373,12 @@ public class EntityWizard extends EntityCreature implements INpc, IMerchant, ISp // When right-clicked with a spell book in creative, sets one of the spells to that spell if(player.capabilities.isCreativeMode && stack.getItem() instanceof ItemSpellBook){ - if(this.spells.size() >= 4 && Spell.get(stack.getItemDamage()).canBeCastByNPCs()){ - this.spells.set(rand.nextInt(3) + 1, Spell.get(stack.getItemDamage())); + Spell spell = Spell.get(stack.getItemDamage()); + if(this.spells.size() >= 4 && spell.canBeCastByNPCs()){ + // The set(...) method returns the element that was replaced - neat! + player.sendMessage(new TextComponentTranslation("item." + Wizardry.MODID + ":spell_book.apply_to_wizard", + this.getDisplayName(), this.spells.set(rand.nextInt(3) + 1, spell).getNameForTranslationFormatted(), + spell.getNameForTranslationFormatted())); return true; } } diff --git a/src/main/resources/assets/ebwizardry/lang/en_gb.lang b/src/main/resources/assets/ebwizardry/lang/en_gb.lang index 720a3b1f..17165266 100644 --- a/src/main/resources/assets/ebwizardry/lang/en_gb.lang +++ b/src/main/resources/assets/ebwizardry/lang/en_gb.lang @@ -15,6 +15,8 @@ item.ebwizardry:advanced_wand.name=Advanced Wand item.ebwizardry:master_wand.name=Master Wand item.ebwizardry:spell_book.name=Spell Book +item.ebwizardry:spell_book.apply_to_wizard=Replaced %1$s's spell %2$s with %3$s + item.ebwizardry:arcane_tome.name=Tome of Arcana item.ebwizardry:arcane_tome.desc1=Upgrades any %1$s item.ebwizardry:arcane_tome.desc2=wand to %1$s tier diff --git a/src/main/resources/assets/ebwizardry/lang/en_us.lang b/src/main/resources/assets/ebwizardry/lang/en_us.lang index 7c14a457..fe97b0ae 100644 --- a/src/main/resources/assets/ebwizardry/lang/en_us.lang +++ b/src/main/resources/assets/ebwizardry/lang/en_us.lang @@ -15,6 +15,8 @@ item.ebwizardry:advanced_wand.name=Advanced Wand item.ebwizardry:master_wand.name=Master Wand item.ebwizardry:spell_book.name=Spell Book +item.ebwizardry:spell_book.apply_to_wizard=Replaced %1$s's spell %2$s with %3$s + item.ebwizardry:arcane_tome.name=Tome of Arcana item.ebwizardry:arcane_tome.desc1=Upgrades any %1$s item.ebwizardry:arcane_tome.desc2=wand to %1$s tier