That's one heck of a commit you've got there...
I may have got a bit behind with version control. A lot behind, in fact. Maybe I'll go back and split this sometime - then again, I probably won't. But hey, at least it's here!
This commit is contained in:
@@ -1,15 +1,13 @@
|
||||
package electroblob.wizardry.entity.projectile;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import electroblob.wizardry.registry.Spells;
|
||||
import electroblob.wizardry.registry.WizardrySounds;
|
||||
import electroblob.wizardry.spell.Spell;
|
||||
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.Entity;
|
||||
import net.minecraft.entity.EntityLivingBase;
|
||||
import net.minecraft.util.math.RayTraceResult;
|
||||
import net.minecraft.world.World;
|
||||
|
||||
@@ -26,13 +24,13 @@ public class EntitySpark extends EntityMagicProjectile {
|
||||
|
||||
if(entityHit != null){
|
||||
|
||||
float damage = 6 * damageMultiplier;
|
||||
entityHit.attackEntityFrom(MagicDamage.causeIndirectMagicDamage(this, this.getThrower(), DamageType.SHOCK),
|
||||
damage);
|
||||
float damage = Spells.homing_spark.getProperty(Spell.DAMAGE).floatValue() * damageMultiplier;
|
||||
entityHit.attackEntityFrom(MagicDamage.causeIndirectMagicDamage(this, this.getThrower(),
|
||||
DamageType.SHOCK), damage);
|
||||
|
||||
}
|
||||
|
||||
this.playSound(WizardrySounds.SPELL_SPARK, 1.0F, 1.2F / (this.rand.nextFloat() * 0.2F + 0.9F));
|
||||
this.playSound(WizardrySounds.ENTITY_HOMING_SPARK_HIT, 1.0F, 1.2F / (this.rand.nextFloat() * 0.2F + 0.9F));
|
||||
|
||||
// Particle effect
|
||||
if(world.isRemote){
|
||||
@@ -47,40 +45,16 @@ public class EntitySpark extends EntityMagicProjectile {
|
||||
this.setDead();
|
||||
}
|
||||
|
||||
public void onUpdate(){
|
||||
|
||||
super.onUpdate();
|
||||
|
||||
if(!this.collided && !world.isRemote){
|
||||
|
||||
double seekingRange = 5.0d;
|
||||
|
||||
List<EntityLivingBase> entities = WizardryUtilities.getEntitiesWithinRadius(seekingRange, this.posX,
|
||||
this.posY, this.posZ, this.world);
|
||||
Entity target = null;
|
||||
|
||||
for(Entity possibleTarget : entities){
|
||||
// Decides if current entity should be replaced.
|
||||
if(target == null || this.getDistance(target) > this.getDistance(possibleTarget)){
|
||||
// Decides if new entity is a valid target.
|
||||
if(WizardryUtilities.isValidTarget(this.getThrower(), possibleTarget)){
|
||||
target = possibleTarget;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if(target != null && Math.abs(this.motionX) < 1 && Math.abs(this.motionY) < 1
|
||||
&& Math.abs(this.motionZ) < 1){
|
||||
this.addVelocity((target.posX - this.posX) / 30, (target.posY + target.height / 2 - this.posY) / 30,
|
||||
(target.posZ - this.posZ) / 30);
|
||||
}
|
||||
}
|
||||
|
||||
if(this.ticksExisted > 100){
|
||||
this.setDead();
|
||||
}
|
||||
@Override
|
||||
public float getSeekingStrength(){
|
||||
return Spells.homing_spark.getProperty(Spell.SEEKING_STRENGTH).floatValue();
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public int getLifetime(){
|
||||
return 50;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean hasNoGravity(){
|
||||
return true;
|
||||
|
||||
Reference in New Issue
Block a user