Add summoned creature appear/disappear animation

This commit is contained in:
Electroblob77
2020-06-04 22:45:39 +01:00
parent 09967ac256
commit 33d4652758
34 changed files with 169 additions and 52 deletions
@@ -1,6 +1,7 @@
package electroblob.wizardry.entity.living;
import electroblob.wizardry.Wizardry;
import electroblob.wizardry.client.DrawingUtils;
import net.minecraft.entity.EntityLivingBase;
import net.minecraft.entity.ai.EntityAIHurtByTarget;
import net.minecraft.entity.ai.EntityAINearestAttackableTarget;
@@ -105,6 +106,11 @@ public class EntityBlazeMinion extends EntityBlaze implements ISummonedCreature
return false;
}
@Override
public int getAnimationColour(float animationProgress){
return DrawingUtils.mix(0xffdd4d, 0xff6600, animationProgress);
}
@Override
protected boolean processInteract(EntityPlayer player, EnumHand hand){
// In this case, the delegate method determines whether super is called.
@@ -54,6 +54,11 @@ public class EntityDecoy extends EntitySummonedCreature {
}
}
@Override
public int getAnimationColour(float animationProgress){
return 0xffc600;
}
@Override
public boolean isEntityInvulnerable(DamageSource source){
return true;
@@ -1,6 +1,7 @@
package electroblob.wizardry.entity.living;
import electroblob.wizardry.Wizardry;
import electroblob.wizardry.client.DrawingUtils;
import electroblob.wizardry.registry.WizardryPotions;
import electroblob.wizardry.registry.WizardrySounds;
import electroblob.wizardry.util.ParticleBuilder;
@@ -96,6 +97,11 @@ public class EntityIceGiant extends EntityIronGolem implements ISummonedCreature
}
}
@Override
public int getAnimationColour(float animationProgress){
return DrawingUtils.mix(0xffffff, 0x73e1ff, animationProgress);
}
@Override
public void onLivingUpdate(){
@@ -1,6 +1,7 @@
package electroblob.wizardry.entity.living;
import electroblob.wizardry.Wizardry;
import electroblob.wizardry.client.DrawingUtils;
import electroblob.wizardry.registry.Spells;
import electroblob.wizardry.registry.WizardrySounds;
import electroblob.wizardry.util.ParticleBuilder;
@@ -61,6 +62,11 @@ public class EntityIceWraith extends EntityBlazeMinion {
}
}
@Override
public int getAnimationColour(float animationProgress){
return DrawingUtils.mix(0xffffff, 0x73e1ff, animationProgress);
}
@Override
public void onLivingUpdate(){
@@ -1,6 +1,7 @@
package electroblob.wizardry.entity.living;
import electroblob.wizardry.Wizardry;
import electroblob.wizardry.client.DrawingUtils;
import electroblob.wizardry.registry.Spells;
import electroblob.wizardry.util.ParticleBuilder;
import electroblob.wizardry.util.ParticleBuilder.Type;
@@ -49,6 +50,11 @@ public class EntityLightningWraith extends EntityBlazeMinion {
}
}
@Override
public int getAnimationColour(float animationProgress){
return DrawingUtils.mix(0xffffff, 0x0092ff, animationProgress);
}
@Override
public void onLivingUpdate(){
// Fortunately, lightning wraiths don't replace any of blazes' particle effects or the fire sound, they only
@@ -1,5 +1,6 @@
package electroblob.wizardry.entity.living;
import electroblob.wizardry.client.DrawingUtils;
import electroblob.wizardry.registry.Spells;
import electroblob.wizardry.registry.WizardrySounds;
import electroblob.wizardry.spell.Spell;
@@ -151,6 +152,11 @@ public class EntityPhoenix extends EntitySummonedCreature implements ISpellCaste
}
}
@Override
public int getAnimationColour(float animationProgress){
return DrawingUtils.mix(0xffdd4d, 0xff6600, animationProgress);
}
@Override
public void onLivingUpdate(){
@@ -91,6 +91,11 @@ public class EntityVexMinion extends EntityVex implements ISummonedCreature {
}
}
@Override
public int getAnimationColour(float animationProgress){
return 0xef829c;
}
@Override
public boolean hasParticleEffect(){
return true;
@@ -94,8 +94,8 @@ public class EntityZombieMinion extends EntityZombie implements ISummonedCreatur
private void spawnParticleEffect(){
if(this.world.isRemote){
for(int i = 0; i < 15; i++){
this.world.spawnParticle(EnumParticleTypes.SMOKE_LARGE, this.posX + this.rand.nextFloat(),
this.posY + 1 + this.rand.nextFloat(), this.posZ + this.rand.nextFloat(), 0, 0, 0);
this.world.spawnParticle(EnumParticleTypes.SMOKE_LARGE, this.posX + this.rand.nextFloat() - 0.5f,
this.posY + this.rand.nextFloat() * 2, this.posZ + this.rand.nextFloat() - 0.5f, 0, 0, 0);
}
}
}
@@ -105,6 +105,11 @@ public class EntityZombieMinion extends EntityZombie implements ISummonedCreatur
return true;
}
@Override
public boolean hasAnimation(){
return this.dataManager.get(SPAWN_PARTICLES) || this.ticksExisted > 20;
}
public void hideParticles(){
this.dataManager.set(SPAWN_PARTICLES, false);
}
@@ -239,6 +239,16 @@ public interface ISummonedCreature extends IEntityAdditionalSpawnData, IEntityOw
/** Whether this creature should spawn a subtle black swirl particle effect while alive. */
boolean hasParticleEffect();
/** Returns whether this creature has an animation when appearing and disappearing. */
default boolean hasAnimation(){
return true;
}
/** Returns the colour of this creature's appear/disappear animation. */
default int getAnimationColour(float animationProgress){
return 0x000000;
}
/**
* Called from the event handler after the damage change is applied. Does nothing by default, but can be overridden
* to do something when a successful attack is made. This was added because the event-based damage source system can