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
This commit is contained in:
@@ -3,7 +3,6 @@ package electroblob.wizardry.spell;
|
||||
import electroblob.wizardry.constants.Element;
|
||||
import electroblob.wizardry.constants.SpellType;
|
||||
import electroblob.wizardry.constants.Tier;
|
||||
import electroblob.wizardry.entity.EntityArc;
|
||||
import electroblob.wizardry.registry.WizardrySounds;
|
||||
import electroblob.wizardry.util.MagicDamage;
|
||||
import electroblob.wizardry.util.MagicDamage.DamageType;
|
||||
@@ -18,6 +17,7 @@ import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.util.EnumFacing;
|
||||
import net.minecraft.util.EnumHand;
|
||||
import net.minecraft.util.math.BlockPos;
|
||||
import net.minecraft.util.math.Vec3d;
|
||||
import net.minecraft.util.text.TextComponentTranslation;
|
||||
import net.minecraft.world.World;
|
||||
|
||||
@@ -71,23 +71,18 @@ public class LightningRay extends SpellRay {
|
||||
BASE_DAMAGE * modifiers.get(SpellModifiers.POTENCY));
|
||||
}
|
||||
|
||||
if(!world.isRemote){
|
||||
if(world.isRemote){
|
||||
|
||||
if(ticksInUse % 3 == 0) ParticleBuilder.create(Type.LIGHTNING).entity(caster)
|
||||
.pos(caster != null ? origin.subtract(caster.getPositionVector()) : origin).target(target).spawn(world);
|
||||
|
||||
if(ticksInUse % 2 == 0){
|
||||
|
||||
EntityArc arc = new EntityArc(world);
|
||||
arc.setEndpointCoords(caster.posX, caster.posY + 1.2, caster.posZ, target.posX,
|
||||
target.posY + target.height / 2, target.posZ);
|
||||
arc.lifetime = 1;
|
||||
world.spawnEntity(arc);
|
||||
}
|
||||
|
||||
}else{
|
||||
// Particle effect
|
||||
for(int i=0; i<5; i++){
|
||||
ParticleBuilder.create(Type.SPARK, target).spawn(world);
|
||||
}
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
@@ -101,21 +96,15 @@ public class LightningRay extends SpellRay {
|
||||
@Override
|
||||
protected boolean onMiss(World world, EntityLivingBase caster, int ticksInUse, SpellModifiers modifiers){
|
||||
// This is a nice example of when onMiss is used for more than just returning a boolean
|
||||
if(!world.isRemote){
|
||||
if(world.isRemote && ticksInUse % 4 == 0){
|
||||
|
||||
if(ticksInUse % 2 == 0){
|
||||
|
||||
double freeRange = 0.8 * baseRange; // The arc does not reach full range when it has a free end
|
||||
|
||||
EntityArc arc = new EntityArc(world);
|
||||
arc.setEndpointCoords(caster.posX, caster.posY + 1.2, caster.posZ,
|
||||
caster.posX + caster.getLookVec().x * freeRange,
|
||||
caster.posY + caster.getEyeHeight() + caster.getLookVec().y * freeRange,
|
||||
caster.posZ + caster.getLookVec().z * freeRange);
|
||||
arc.lifetime = 1;
|
||||
world.spawnEntity(arc);
|
||||
|
||||
}
|
||||
if(caster != null) origin = origin.subtract(0, Y_OFFSET, 0);
|
||||
|
||||
double freeRange = 0.8 * baseRange; // The arc does not reach full range when it has a free end
|
||||
Vec3d endpoint = origin.add(direction.scale(freeRange));
|
||||
|
||||
ParticleBuilder.create(Type.LIGHTNING).entity(caster)
|
||||
.pos(caster != null ? origin.subtract(caster.getPositionVector()) : origin).target(endpoint).spawn(world);
|
||||
}
|
||||
|
||||
return true;
|
||||
|
||||
Reference in New Issue
Block a user