Files
Wizardry/src/main/java/electroblob/wizardry/entity/construct/EntityHealAura.java
T
Electroblob77 b374f71533 The great particle refactoring part 2: Splitting and Streamlining!
- Splits all particle textures into individual files intead of sprite sheets
- Replaces arc and lightning pulse entities with particles
- Pulls particle code up to the general ParticleWizardry so behaviours such as spin can be applied to all particle types
- Renames a few ParticleBuilder methods for conciseness.
- Adds a few new particle effects to various spells and entities, with a slight tweak to EntityMagicArrow#onBlockHit to facilitate impact effects
2019-01-01 21:40:04 +00:00

85 lines
2.2 KiB
Java

package electroblob.wizardry.entity.construct;
import java.util.List;
import electroblob.wizardry.registry.WizardrySounds;
import electroblob.wizardry.util.MagicDamage;
import electroblob.wizardry.util.MagicDamage.DamageType;
import electroblob.wizardry.util.ParticleBuilder;
import electroblob.wizardry.util.ParticleBuilder.Type;
import electroblob.wizardry.util.WizardryUtilities;
import net.minecraft.entity.EntityLivingBase;
import net.minecraft.util.DamageSource;
import net.minecraft.world.World;
public class EntityHealAura extends EntityMagicConstruct {
public EntityHealAura(World world){
super(world);
this.height = 1.0f;
this.width = 5.0f;
}
@Override
public void onUpdate(){
if(this.ticksExisted % 25 == 1){
this.playSound(WizardrySounds.SPELL_LOOP_SPARKLE, 0.1f, 1.0f);
}
super.onUpdate();
if(!this.world.isRemote){
List<EntityLivingBase> targets = WizardryUtilities.getEntitiesWithinRadius(2.5, posX, posY, posZ, world);
for(EntityLivingBase target : targets){
if(this.isValidTarget(target)){
if(target.isEntityUndead()){
double velX = target.motionX;
double velY = target.motionY;
double velZ = target.motionZ;
if(this.getCaster() != null){
target.attackEntityFrom(
MagicDamage.causeIndirectMagicDamage(this, getCaster(), DamageType.RADIANT),
1 * damageMultiplier);
}else{
target.attackEntityFrom(DamageSource.MAGIC, 1 * damageMultiplier);
}
// Removes knockback
target.motionX = velX;
target.motionY = velY;
target.motionZ = velZ;
}
}else if(target.getHealth() < target.getMaxHealth() && this.ticksExisted % 5 == 0){
target.heal(1 * damageMultiplier);
}
}
}else{
for(int i=1; i<3; i++){
float brightness = 0.5f + (rand.nextFloat() * 0.5f);
double radius = rand.nextDouble() * 2.0;
double angle = rand.nextDouble() * Math.PI * 2;
ParticleBuilder.create(Type.SPARKLE)
.pos(this.posX + radius * Math.cos(angle), this.posY, this.posZ + radius * Math.sin(angle))
.vel(0, 0.05, 0)
.time(48 + this.rand.nextInt(12))
.clr(1.0f, 1.0f, brightness)
.spawn(world);
}
}
}
@Override
public boolean canRenderOnFire(){
return false;
}
}