'Tis the season!

- Decked the halls
- Jingled the bells
- Wrapped the presents
- Loaded up the sleigh
This commit is contained in:
Electroblob77
2019-12-17 15:53:40 +00:00
parent 9ade6442b2
commit 324094f418
35 changed files with 252 additions and 62 deletions
@@ -1,5 +1,6 @@
package electroblob.wizardry.spell;
import electroblob.wizardry.Wizardry;
import electroblob.wizardry.constants.Constants;
import electroblob.wizardry.event.SpellCastEvent;
import electroblob.wizardry.registry.WizardryItems;
@@ -66,6 +67,11 @@ public class EmpoweringPresence extends Spell {
return true;
}
@Override
protected String getTranslationKey(){
return Wizardry.tisTheSeason ? super.getTranslationKey() + "_festive" : super.getTranslationKey();
}
@SubscribeEvent(priority = EventPriority.LOW) // Doesn't really matter but there's no point processing it if casting is blocked
public static void onSpellCastPreEvent(SpellCastEvent.Pre event){
// Empowerment stacks extra potency on top of the existing potency.
@@ -78,4 +84,5 @@ public class EmpoweringPresence extends Spell {
event.getModifiers().get(SpellModifiers.POTENCY) * potency, true);
}
}
}
@@ -1,5 +1,6 @@
package electroblob.wizardry.spell;
import electroblob.wizardry.Wizardry;
import electroblob.wizardry.registry.WizardryItems;
import electroblob.wizardry.util.AllyDesignationSystem;
import electroblob.wizardry.util.ParticleBuilder;
@@ -62,4 +63,9 @@ public class InvigoratingPresence extends Spell {
return true;
}
@Override
protected String getTranslationKey(){
return Wizardry.tisTheSeason ? super.getTranslationKey() + "_festive" : super.getTranslationKey();
}
}
@@ -597,13 +597,23 @@ public abstract class Spell extends IForgeRegistryEntry.Impl<Spell> implements C
* translating it. If, for whatever reason, you need to supply an ITextComponent but don't want it translated
* (perhaps a name?), you can use TextComponentString, which will simply keep the raw string it is given. */
/** Returns the translation key for this spell. */
protected String getTranslationKey(){
return "spell." + unlocalisedName;
}
/** Returns the translation key for this spell's description. */
protected String getDescriptionTranslationKey(){
return "spell." + unlocalisedName + ".desc";
}
/**
* Returns the translated display name of the spell, without formatting (i.e. not coloured). <b>Client-side
* only!</b> On the server side, use {@link TextComponentTranslation} (see {@link Spell#getNameForTranslation()}).
*/
@SideOnly(Side.CLIENT)
public String getDisplayName(){
return net.minecraft.client.resources.I18n.format("spell." + unlocalisedName);
return net.minecraft.client.resources.I18n.format(getTranslationKey());
}
/**
@@ -611,7 +621,7 @@ public abstract class Spell extends IForgeRegistryEntry.Impl<Spell> implements C
* formatting (i.e. not coloured).
*/
public ITextComponent getNameForTranslation(){
return new TextComponentTranslation("spell." + unlocalisedName);
return new TextComponentTranslation(getTranslationKey());
}
/**
@@ -620,7 +630,7 @@ public abstract class Spell extends IForgeRegistryEntry.Impl<Spell> implements C
*/
@SideOnly(Side.CLIENT)
public String getDisplayNameWithFormatting(){
return this.getElement().getFormattingCode() + net.minecraft.client.resources.I18n.format("spell." + unlocalisedName);
return this.getElement().getFormattingCode() + net.minecraft.client.resources.I18n.format(getTranslationKey());
}
/**
@@ -628,7 +638,7 @@ public abstract class Spell extends IForgeRegistryEntry.Impl<Spell> implements C
* formatting (i.e. coloured).
*/
public ITextComponent getNameForTranslationFormatted(){
return new TextComponentTranslation("spell." + unlocalisedName).setStyle(this.getElement().getColour());
return new TextComponentTranslation(getTranslationKey()).setStyle(this.getElement().getColour());
}
/**
@@ -637,7 +647,7 @@ public abstract class Spell extends IForgeRegistryEntry.Impl<Spell> implements C
*/
@SideOnly(Side.CLIENT)
public String getDescription(){
return net.minecraft.client.resources.I18n.format("spell." + unlocalisedName + ".desc");
return net.minecraft.client.resources.I18n.format(getDescriptionTranslationKey());
}
// ============================================ Sound methods ==============================================
@@ -1,5 +1,6 @@
package electroblob.wizardry.spell;
import electroblob.wizardry.Wizardry;
import electroblob.wizardry.util.ParticleBuilder;
import electroblob.wizardry.util.ParticleBuilder.Type;
import electroblob.wizardry.util.SpellModifiers;
@@ -9,7 +10,11 @@ import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.item.EnumAction;
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.world.World;
import net.minecraftforge.fml.relauncher.Side;
import net.minecraftforge.fml.relauncher.SideOnly;
public class SummonSnowGolem extends Spell {
@@ -45,4 +50,8 @@ public class SummonSnowGolem extends Spell {
return true;
}
@Override
protected String getTranslationKey(){
return Wizardry.tisTheSeason ? super.getTranslationKey() + "_festive" : super.getTranslationKey();
}
}