Add chat readout for applying spells to wizards in creative mode
This commit is contained in:
@@ -48,6 +48,7 @@ import net.minecraft.util.DamageSource;
|
|||||||
import net.minecraft.util.EnumHand;
|
import net.minecraft.util.EnumHand;
|
||||||
import net.minecraft.util.ResourceLocation;
|
import net.minecraft.util.ResourceLocation;
|
||||||
import net.minecraft.util.SoundEvent;
|
import net.minecraft.util.SoundEvent;
|
||||||
|
import net.minecraft.util.text.TextComponentTranslation;
|
||||||
import net.minecraft.world.DifficultyInstance;
|
import net.minecraft.world.DifficultyInstance;
|
||||||
import net.minecraft.world.EnumDifficulty;
|
import net.minecraft.world.EnumDifficulty;
|
||||||
import net.minecraft.world.World;
|
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
|
// 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(player.capabilities.isCreativeMode && stack.getItem() instanceof ItemSpellBook){
|
||||||
if(this.spells.size() >= 4 && Spell.get(stack.getItemDamage()).canBeCastByNPCs()){
|
Spell spell = Spell.get(stack.getItemDamage());
|
||||||
this.spells.set(rand.nextInt(3) + 1, 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;
|
return true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -67,6 +67,7 @@ import net.minecraft.util.DamageSource;
|
|||||||
import net.minecraft.util.EnumHand;
|
import net.minecraft.util.EnumHand;
|
||||||
import net.minecraft.util.math.BlockPos;
|
import net.minecraft.util.math.BlockPos;
|
||||||
import net.minecraft.util.text.ITextComponent;
|
import net.minecraft.util.text.ITextComponent;
|
||||||
|
import net.minecraft.util.text.TextComponentTranslation;
|
||||||
import net.minecraft.village.MerchantRecipe;
|
import net.minecraft.village.MerchantRecipe;
|
||||||
import net.minecraft.village.MerchantRecipeList;
|
import net.minecraft.village.MerchantRecipeList;
|
||||||
import net.minecraft.world.DifficultyInstance;
|
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
|
// 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(player.capabilities.isCreativeMode && stack.getItem() instanceof ItemSpellBook){
|
||||||
if(this.spells.size() >= 4 && Spell.get(stack.getItemDamage()).canBeCastByNPCs()){
|
Spell spell = Spell.get(stack.getItemDamage());
|
||||||
this.spells.set(rand.nextInt(3) + 1, 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;
|
return true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -15,6 +15,8 @@ item.ebwizardry:advanced_wand.name=Advanced Wand
|
|||||||
item.ebwizardry:master_wand.name=Master Wand
|
item.ebwizardry:master_wand.name=Master Wand
|
||||||
item.ebwizardry:spell_book.name=Spell Book
|
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.name=Tome of Arcana
|
||||||
item.ebwizardry:arcane_tome.desc1=Upgrades any %1$s
|
item.ebwizardry:arcane_tome.desc1=Upgrades any %1$s
|
||||||
item.ebwizardry:arcane_tome.desc2=wand to %1$s tier
|
item.ebwizardry:arcane_tome.desc2=wand to %1$s tier
|
||||||
|
|||||||
@@ -15,6 +15,8 @@ item.ebwizardry:advanced_wand.name=Advanced Wand
|
|||||||
item.ebwizardry:master_wand.name=Master Wand
|
item.ebwizardry:master_wand.name=Master Wand
|
||||||
item.ebwizardry:spell_book.name=Spell Book
|
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.name=Tome of Arcana
|
||||||
item.ebwizardry:arcane_tome.desc1=Upgrades any %1$s
|
item.ebwizardry:arcane_tome.desc1=Upgrades any %1$s
|
||||||
item.ebwizardry:arcane_tome.desc2=wand to %1$s tier
|
item.ebwizardry:arcane_tome.desc2=wand to %1$s tier
|
||||||
|
|||||||
Reference in New Issue
Block a user