Change spell chat messages to hotbar toast notifications

This commit is contained in:
Electroblob77
2019-01-06 15:31:48 +00:00
parent b8ba7d1ea4
commit 2db96cf18d
15 changed files with 43 additions and 38 deletions
@@ -39,8 +39,9 @@ public class Arc extends SpellRay {
// This is a lot neater than it was, thanks to the damage type system.
if(MagicDamage.isEntityImmune(DamageType.SHOCK, target)){
if(!world.isRemote) caster.sendMessage(new TextComponentTranslation("spell.resist", target.getName(),
this.getNameForTranslationFormatted()));
if(!world.isRemote && caster instanceof EntityPlayer) ((EntityPlayer)caster).sendStatusMessage(
new TextComponentTranslation("spell.resist",
target.getName(), this.getNameForTranslationFormatted()), true);
}else{
target.attackEntityFrom(MagicDamage.causeDirectMagicDamage(caster, DamageType.SHOCK),
BASE_DAMAGE * modifiers.get(SpellModifiers.POTENCY));
@@ -96,8 +96,9 @@ public class ChainLightning extends SpellRay {
private void electrocute(World world, Entity caster, Entity origin, Entity target, float damage){
if(MagicDamage.isEntityImmune(DamageType.SHOCK, target)){
if(!world.isRemote) caster.sendMessage(new TextComponentTranslation("spell.resist", target.getName(),
this.getNameForTranslationFormatted()));
if(!world.isRemote && caster instanceof EntityPlayer) ((EntityPlayer)caster).sendStatusMessage(
new TextComponentTranslation("spell.resist", target.getName(), this.getNameForTranslationFormatted()),
true);
}else{
target.attackEntityFrom(MagicDamage.causeDirectMagicDamage(caster, DamageType.SHOCK), damage);
}
@@ -57,7 +57,7 @@ public class Clairvoyance extends Spell {
if(caster.dimension == properties.getClairvoyanceDimension()){
if(properties.getClairvoyanceLocation() != null){
if(!world.isRemote) caster.sendMessage(new TextComponentTranslation("spell." + this.getUnlocalisedName() + ".searching"));
if(!world.isRemote) caster.sendStatusMessage(new TextComponentTranslation("spell." + this.getUnlocalisedName() + ".searching"), true);
EntityZombie arbitraryZombie = new EntityZombie(world){
@Override
@@ -96,13 +96,13 @@ public class Clairvoyance extends Spell {
}
}
if(!world.isRemote) caster.sendMessage(new TextComponentTranslation("spell." + this.getUnlocalisedName() + ".outofrange"));
if(!world.isRemote) caster.sendStatusMessage(new TextComponentTranslation("spell." + this.getUnlocalisedName() + ".outofrange"), true);
}else{
if(!world.isRemote) caster.sendMessage(new TextComponentTranslation("spell." + this.getUnlocalisedName() + ".undefined"));
if(!world.isRemote) caster.sendStatusMessage(new TextComponentTranslation("spell." + this.getUnlocalisedName() + ".undefined"), true);
}
}else{
if(!world.isRemote) caster.sendMessage(new TextComponentTranslation("spell." + this.getUnlocalisedName() + ".wrongdimension"));
if(!world.isRemote) caster.sendStatusMessage(new TextComponentTranslation("spell." + this.getUnlocalisedName() + ".wrongdimension"), true);
}
}
@@ -158,8 +158,8 @@ public class Clairvoyance extends Spell {
properties.setClairvoyancePoint(pos, event.getWorld().provider.getDimension());
if(!event.getWorld().isRemote){
event.getEntityPlayer().sendMessage(
new TextComponentTranslation("spell." + Spells.clairvoyance.getUnlocalisedName() + ".confirm", Spells.clairvoyance.getNameForTranslationFormatted()));
event.getEntityPlayer().sendStatusMessage(
new TextComponentTranslation("spell." + Spells.clairvoyance.getUnlocalisedName() + ".confirm", Spells.clairvoyance.getNameForTranslationFormatted()), true);
}
event.setCanceled(true);
@@ -67,8 +67,9 @@ public class Firestorm extends SpellRay {
if(target instanceof EntityLivingBase){
if(MagicDamage.isEntityImmune(DamageType.FIRE, target)){
if(!world.isRemote && ticksInUse == 1) caster.sendMessage(new TextComponentTranslation("spell.resist",
target.getName(), this.getNameForTranslationFormatted()));
if(!world.isRemote && ticksInUse == 1 && caster instanceof EntityPlayer) ((EntityPlayer)caster)
.sendStatusMessage(new TextComponentTranslation("spell.resist", target.getName(),
this.getNameForTranslationFormatted()), true);
}else{
target.setFire((int)(BASE_DURATION * modifiers.get(WizardryItems.duration_upgrade)));
WizardryUtilities.attackEntityWithoutKnockback(target,
@@ -65,9 +65,10 @@ public class FlameRay extends SpellRay {
if(target instanceof EntityLivingBase){
if(MagicDamage.isEntityImmune(DamageType.FIRE, target)){
if(!world.isRemote && ticksInUse == 1) caster.sendMessage(new TextComponentTranslation("spell.resist",
target.getName(), this.getNameForTranslationFormatted()));
}else {
if(!world.isRemote && ticksInUse == 1 && caster instanceof EntityPlayer) ((EntityPlayer)caster)
.sendStatusMessage(new TextComponentTranslation("spell.resist", target.getName(),
this.getNameForTranslationFormatted()), true);
}else{
target.setFire((int)(BASE_DURATION * modifiers.get(WizardryItems.duration_upgrade)));
WizardryUtilities.attackEntityWithoutKnockback(target,
MagicDamage.causeDirectMagicDamage(caster, DamageType.FIRE),
@@ -47,8 +47,8 @@ public class Freeze extends SpellRay {
}
if(MagicDamage.isEntityImmune(DamageType.FROST, target)){
if(!world.isRemote) caster.sendMessage(new TextComponentTranslation("spell.resist", target.getName(),
this.getNameForTranslationFormatted()));
if(!world.isRemote && caster instanceof EntityPlayer) ((EntityPlayer)caster).sendStatusMessage(
new TextComponentTranslation("spell.resist", target.getName(), this.getNameForTranslationFormatted()), true);
}else{
((EntityLivingBase)target).addPotionEffect(new PotionEffect(WizardryPotions.frost,
(int)(BASE_DURATION * modifiers.get(WizardryItems.duration_upgrade)), 1));
@@ -70,8 +70,9 @@ public class FrostRay extends SpellRay {
if(target.isBurning()) target.extinguish();
if(MagicDamage.isEntityImmune(DamageType.FROST, target)){
if(!world.isRemote && ticksInUse == 1) caster.sendMessage(new TextComponentTranslation("spell.resist",
target.getName(), this.getNameForTranslationFormatted()));
if(!world.isRemote && ticksInUse == 1 && caster instanceof EntityPlayer) ((EntityPlayer)caster)
.sendStatusMessage(new TextComponentTranslation("spell.resist", target.getName(),
this.getNameForTranslationFormatted()), true);
}else{
// For frost ray the entity can move slightly, unlike freeze
((EntityLivingBase)target).addPotionEffect(new PotionEffect(WizardryPotions.frost,
@@ -33,8 +33,8 @@ public class Ignite extends SpellRay {
if(target instanceof EntityLivingBase) {
if(MagicDamage.isEntityImmune(DamageType.FIRE, target)){
if(!world.isRemote) caster.sendMessage(new TextComponentTranslation("spell.resist", target.getName(),
this.getNameForTranslationFormatted()));
if(!world.isRemote && caster instanceof EntityPlayer) ((EntityPlayer)caster).sendStatusMessage(
new TextComponentTranslation("spell.resist", target.getName(), this.getNameForTranslationFormatted()), true);
}else{
target.setFire((int)(BASE_DURATION * modifiers.get(WizardryItems.duration_upgrade)));
}
@@ -62,9 +62,9 @@ public class LightningRay extends SpellRay {
if(WizardryUtilities.isLiving(target)){
if(MagicDamage.isEntityImmune(DamageType.SHOCK, target)){
if(!world.isRemote && ticksInUse == 1)
caster.sendMessage(new TextComponentTranslation("spell.resist", target.getName(),
this.getNameForTranslationFormatted()));
if(!world.isRemote && ticksInUse == 1 && caster instanceof EntityPlayer)
((EntityPlayer)caster).sendStatusMessage(new TextComponentTranslation("spell.resist", target.getName(),
this.getNameForTranslationFormatted()), true);
}else{
WizardryUtilities.attackEntityWithoutKnockback(target,
MagicDamage.causeDirectMagicDamage(caster, DamageType.SHOCK),
@@ -143,9 +143,9 @@ public class LightningWeb extends SpellRay {
private void electrocute(World world, Entity caster, Entity origin, Entity target, float damage, int ticksInUse){
if(MagicDamage.isEntityImmune(DamageType.SHOCK, target)){
if(!world.isRemote && ticksInUse == 1)
caster.sendMessage(new TextComponentTranslation("spell.resist",
target.getName(), this.getNameForTranslationFormatted()));
if(!world.isRemote && ticksInUse == 1 && caster instanceof EntityPlayer)
((EntityPlayer)caster).sendStatusMessage(new TextComponentTranslation("spell.resist", target.getName(),
this.getNameForTranslationFormatted()), true);
}else{
WizardryUtilities.attackEntityWithoutKnockback(target,
MagicDamage.causeDirectMagicDamage(caster, DamageType.SHOCK), damage);
@@ -54,8 +54,8 @@ public class MindControl extends SpellRay {
if(!canControl(target)){
// Adds a message saying that the player/boss entity/wizard resisted mind control
caster.sendMessage(new TextComponentTranslation("spell.resist", target.getName(),
this.getNameForTranslationFormatted()));
((EntityPlayer)caster).sendStatusMessage(new TextComponentTranslation("spell.resist", target.getName(),
this.getNameForTranslationFormatted()), true);
}else if(target instanceof EntityLiving){
@@ -41,8 +41,8 @@ public class Poison extends SpellRay {
// Has no effect on undead or spiders.
if(MagicDamage.isEntityImmune(DamageType.POISON, target)){
if(!world.isRemote) caster.sendMessage(new TextComponentTranslation("spell.resist", target.getName(),
this.getNameForTranslationFormatted()));
if(!world.isRemote && caster instanceof EntityPlayer) ((EntityPlayer)caster).sendStatusMessage(
new TextComponentTranslation("spell.resist", target.getName(), this.getNameForTranslationFormatted()), true);
}else{
target.attackEntityFrom(MagicDamage.causeDirectMagicDamage(caster, DamageType.POISON),
1 * modifiers.get(SpellModifiers.POTENCY));
@@ -54,8 +54,8 @@ public class Slime extends SpellRay {
if(WizardryUtilities.isLiving(target) && !(target instanceof EntityMagicSlime)){
if(target instanceof EntitySlime){
if(!world.isRemote) caster.sendMessage(new TextComponentTranslation("spell.resist", target.getName(),
this.getNameForTranslationFormatted()));
if(!world.isRemote && caster instanceof EntityPlayer) ((EntityPlayer)caster).sendStatusMessage(
new TextComponentTranslation("spell.resist", target.getName(), this.getNameForTranslationFormatted()), true);
}else{
if(target instanceof EntitySkeleton && caster instanceof EntityPlayer)
@@ -46,15 +46,15 @@ public class Transportation extends Spell {
return true;
}else{
if(!world.isRemote)
caster.sendMessage(new TextComponentTranslation("spell." + this.getUnlocalisedName() + ".missing"));
caster.sendStatusMessage(new TextComponentTranslation("spell." + this.getUnlocalisedName() + ".missing"), true);
}
}else{
if(!world.isRemote)
caster.sendMessage(new TextComponentTranslation("spell." + this.getUnlocalisedName() + ".undefined"));
caster.sendStatusMessage(new TextComponentTranslation("spell." + this.getUnlocalisedName() + ".undefined"), true);
}
}else{
if(!world.isRemote)
caster.sendMessage(new TextComponentTranslation("spell." + this.getUnlocalisedName() + ".wrongdimension"));
caster.sendStatusMessage(new TextComponentTranslation("spell." + this.getUnlocalisedName() + ".wrongdimension"), true);
}
}
return false;
@@ -37,8 +37,8 @@ public class Wither extends SpellRay {
// Has no effect on withers or wither skeletons.
if(MagicDamage.isEntityImmune(DamageType.WITHER, target)){
if(!world.isRemote) caster.sendMessage(new TextComponentTranslation("spell.resist", target.getName(),
this.getNameForTranslationFormatted()));
if(!world.isRemote && caster instanceof EntityPlayer) ((EntityPlayer)caster).sendStatusMessage(
new TextComponentTranslation("spell.resist", target.getName(), this.getNameForTranslationFormatted()), true);
}else{
target.attackEntityFrom(MagicDamage.causeDirectMagicDamage(caster, DamageType.WITHER),
BASE_DAMAGE * modifiers.get(SpellModifiers.POTENCY));