The great particle refactoring part 1: Introducing ParticleBuilder!

Adds ParticleBuilder to replace the particle spawning methods in the proxies, and changes all particle spawning to use the builder except for in the spell classes, which are to be reorganised first.
This commit is contained in:
Electroblob
2018-06-05 21:13:41 +01:00
parent 466b3bbc27
commit d91a3e056a
119 changed files with 722 additions and 972 deletions
@@ -1,9 +1,9 @@
package electroblob.wizardry.entity.projectile;
import electroblob.wizardry.Wizardry;
import electroblob.wizardry.util.MagicDamage;
import electroblob.wizardry.util.MagicDamage.DamageType;
import electroblob.wizardry.util.WizardryParticleType;
import electroblob.wizardry.util.ParticleBuilder;
import electroblob.wizardry.util.ParticleBuilder.Type;
import net.minecraft.entity.Entity;
import net.minecraft.entity.EntityLivingBase;
import net.minecraft.init.MobEffects;
@@ -13,6 +13,7 @@ import net.minecraft.util.math.RayTraceResult;
import net.minecraft.world.World;
public class EntityDarknessOrb extends EntityMagicProjectile {
public EntityDarknessOrb(World par1World){
super(par1World);
}
@@ -59,17 +60,13 @@ public class EntityDarknessOrb extends EntityMagicProjectile {
super.onUpdate();
if(world.isRemote){
float brightness = rand.nextFloat() * 0.2f;
Wizardry.proxy.spawnParticle(WizardryParticleType.SPARKLE, world,
this.posX + (this.rand.nextDouble() - 0.5D) * (double)this.width,
this.posY + this.rand.nextDouble() * (double)this.height,
this.posZ + (this.rand.nextDouble() - 0.5D) * (double)this.width, 0, 0, 0, 20 + rand.nextInt(10),
brightness, 0.0f, brightness);
Wizardry.proxy.spawnParticle(WizardryParticleType.DARK_MAGIC, world,
this.posX + (this.rand.nextDouble() - 0.5D) * (double)this.width,
this.posY + this.rand.nextDouble() * (double)this.height,
this.posZ + (this.rand.nextDouble() - 0.5D) * (double)this.width, 0.0d, 0.0d, 0.0d, 0, 0.1f, 0.0f,
0.0f);
ParticleBuilder.create(Type.SPARKLE, this).lifetime(20 + rand.nextInt(10))
.colour(brightness, 0.0f, brightness).spawn(world);
ParticleBuilder.create(Type.DARK_MAGIC, this).colour(0.1f, 0.0f, 0.0f).spawn(world);
}
if(this.ticksExisted > 150){
@@ -1,8 +1,8 @@
package electroblob.wizardry.entity.projectile;
import electroblob.wizardry.Wizardry;
import electroblob.wizardry.util.MagicDamage.DamageType;
import electroblob.wizardry.util.WizardryParticleType;
import electroblob.wizardry.util.ParticleBuilder;
import electroblob.wizardry.util.ParticleBuilder.Type;
import net.minecraft.entity.Entity;
import net.minecraft.entity.EntityLivingBase;
import net.minecraft.init.MobEffects;
@@ -56,10 +56,8 @@ public class EntityDart extends EntityMagicArrow {
@Override
public void tickInAir(){
if(this.world.isRemote){
Wizardry.proxy.spawnParticle(WizardryParticleType.LEAF, world, this.posX, this.posY, this.posZ, 0, -0.03, 0,
10 + rand.nextInt(5));
ParticleBuilder.create(Type.LEAF).pos(this.posX, this.posY, this.posZ).lifetime(10 + rand.nextInt(5));
}
}
@@ -2,10 +2,10 @@ package electroblob.wizardry.entity.projectile;
import java.util.List;
import electroblob.wizardry.Wizardry;
import electroblob.wizardry.util.MagicDamage;
import electroblob.wizardry.util.MagicDamage.DamageType;
import electroblob.wizardry.util.WizardryParticleType;
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;
@@ -33,10 +33,9 @@ public class EntityFirebomb extends EntityBomb {
super(par1World, par2, par4, par6);
}
/**
* Called when this EntityThrowable hits a block or entity.
*/
@Override
protected void onImpact(RayTraceResult par1RayTraceResult){
Entity entityHit = par1RayTraceResult.entityHit;
if(entityHit != null){
@@ -52,21 +51,16 @@ public class EntityFirebomb extends EntityBomb {
// Particle effect
if(world.isRemote){
this.world.spawnParticle(EnumParticleTypes.EXPLOSION_LARGE, this.posX, this.posY, this.posZ, 0, 0, 0);
for(int i = 0; i < 60 * blastMultiplier; i++){
// this.world.spawnParticle(EnumParticleTypes.FLAME, this.posX + (this.rand.nextDouble()*4 -
// 2)*blastMultiplier, this.posY + (this.rand.nextDouble()*4 - 2)*blastMultiplier, this.posZ +
// (this.rand.nextDouble()*4 - 2)*blastMultiplier, 0, 0, 0);
Wizardry.proxy.spawnParticle(WizardryParticleType.MAGIC_FIRE, world,
this.posX + (this.rand.nextDouble() * 4 - 2) * blastMultiplier,
this.posY + (this.rand.nextDouble() * 4 - 2) * blastMultiplier,
this.posZ + (this.rand.nextDouble() * 4 - 2) * blastMultiplier, 0, 0, 0, 15 + rand.nextInt(5),
2 + rand.nextFloat(), 0, 0);
Wizardry.proxy.spawnParticle(WizardryParticleType.DARK_MAGIC, world,
this.posX + (this.rand.nextDouble() * 4 - 2) * blastMultiplier,
this.posY + (this.rand.nextDouble() * 4 - 2) * blastMultiplier,
this.posZ + (this.rand.nextDouble() * 4 - 2) * blastMultiplier, 0.0d, 0.0d, 0.0d, 0, 1.0f,
0.2f + rand.nextFloat() * 0.4f, 0.0f);
ParticleBuilder.create(Type.MAGIC_FIRE, rand, posX, posY, posZ, 2*blastMultiplier, false)
.lifetime(15 + rand.nextInt(5)).scale(2 + rand.nextFloat()).spawn(world);
ParticleBuilder.create(Type.DARK_MAGIC, rand, posX, posY, posZ, 2*blastMultiplier, false)
.colour(1.0f, 0.2f + rand.nextFloat() * 0.4f, 0.0f).spawn(world);
}
}
@@ -2,10 +2,10 @@ package electroblob.wizardry.entity.projectile;
import java.util.List;
import electroblob.wizardry.Wizardry;
import electroblob.wizardry.util.MagicDamage;
import electroblob.wizardry.util.MagicDamage.DamageType;
import electroblob.wizardry.util.WizardryParticleType;
import electroblob.wizardry.util.ParticleBuilder;
import electroblob.wizardry.util.ParticleBuilder.Type;
import electroblob.wizardry.util.WizardryUtilities;
import net.minecraft.entity.EntityLivingBase;
import net.minecraft.init.SoundEvents;
@@ -54,11 +54,8 @@ public class EntityForceOrb extends EntityMagicProjectile {
if(this.world.isRemote){
for(int j = 0; j < 20; j++){
float brightness = 0.5f + (rand.nextFloat() / 2);
double x = this.posX - 0.25d + (rand.nextDouble() / 2);
double y = this.posY - 0.25d + (rand.nextDouble() / 2);
double z = this.posZ - 0.25d + (rand.nextDouble() / 2);
Wizardry.proxy.spawnParticle(WizardryParticleType.SPARKLE, world, x, y, z, (x - this.posX) * 2,
(y - this.posY) * 2, (z - this.posZ) * 2, 6, brightness, 1.0f, brightness + 0.2f);
ParticleBuilder.create(Type.SPARKLE, rand, posX, posY, posZ, 0.25, true).lifetime(6)
.colour(brightness, 1.0f, brightness + 0.2f).spawn(world);
}
this.world.spawnParticle(EnumParticleTypes.EXPLOSION_LARGE, this.posX, this.posY, this.posZ, 0, 0, 0);
}
@@ -2,12 +2,12 @@ package electroblob.wizardry.entity.projectile;
import java.util.List;
import electroblob.wizardry.Wizardry;
import electroblob.wizardry.registry.WizardryPotions;
import electroblob.wizardry.registry.WizardrySounds;
import electroblob.wizardry.util.MagicDamage;
import electroblob.wizardry.util.MagicDamage.DamageType;
import electroblob.wizardry.util.WizardryParticleType;
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;
@@ -60,16 +60,13 @@ public class EntityIceCharge extends EntityBomb {
if(world.isRemote){
this.world.spawnParticle(EnumParticleTypes.EXPLOSION_LARGE, this.posX, this.posY, this.posZ, 0, 0, 0);
for(int i = 0; i < 30 * blastMultiplier; i++){
ParticleBuilder.create(Type.ICE, rand, this.posX, this.posY, this.posZ, 2 * blastMultiplier, false)
.lifetime(35).spawn(world);
float brightness = 0.4f + rand.nextFloat() * 0.5f;
Wizardry.proxy.spawnParticle(WizardryParticleType.ICE, world,
this.posX + (this.rand.nextDouble() * 4 - 2) * blastMultiplier,
this.posY + (this.rand.nextDouble() * 4 - 2) * blastMultiplier,
this.posZ + (this.rand.nextDouble() * 4 - 2) * blastMultiplier, 0.0d, 0.0d, 0.0d, 35);
Wizardry.proxy.spawnParticle(WizardryParticleType.DARK_MAGIC, world,
this.posX + (this.rand.nextDouble() * 4 - 2) * blastMultiplier,
this.posY + (this.rand.nextDouble() * 4 - 2) * blastMultiplier,
this.posZ + (this.rand.nextDouble() * 4 - 2) * blastMultiplier, 0.0d, 0.0d, 0.0d, 0, brightness,
brightness + 0.1f, 1.0f);
ParticleBuilder.create(Type.DARK_MAGIC, rand, this.posX, this.posY, this.posZ, 2 * blastMultiplier, false)
.colour(brightness, brightness + 0.1f, 1.0f).spawn(world);
}
}
@@ -1,10 +1,10 @@
package electroblob.wizardry.entity.projectile;
import electroblob.wizardry.Wizardry;
import electroblob.wizardry.registry.WizardryPotions;
import electroblob.wizardry.util.MagicDamage;
import electroblob.wizardry.util.MagicDamage.DamageType;
import electroblob.wizardry.util.WizardryParticleType;
import electroblob.wizardry.util.ParticleBuilder;
import electroblob.wizardry.util.ParticleBuilder.Type;
import net.minecraft.entity.Entity;
import net.minecraft.entity.EntityLivingBase;
import net.minecraft.init.SoundEvents;
@@ -68,11 +68,8 @@ public class EntityIceLance extends EntityMagicArrow {
// Adds a particle effect when the ice lance hits a block.
if(this.world.isRemote){
for(int j = 0; j < 10; j++){
double x = this.posX - 0.25d + (rand.nextDouble() / 2);
double y = this.posY - 0.25d + (rand.nextDouble() / 2);
double z = this.posZ - 0.25d + (rand.nextDouble() / 2);
Wizardry.proxy.spawnParticle(WizardryParticleType.ICE, world, x, y, z, x - this.posX, y - this.posY,
z - this.posZ, 20 + rand.nextInt(10));
ParticleBuilder.create(Type.ICE, this.rand, this.posX, this.posY, this.posZ, 0.5, true)
.lifetime(20 + rand.nextInt(10)).spawn(world);
}
}
// Parameters for sound: sound event name, volume, pitch.
@@ -1,10 +1,10 @@
package electroblob.wizardry.entity.projectile;
import electroblob.wizardry.Wizardry;
import electroblob.wizardry.registry.WizardryPotions;
import electroblob.wizardry.util.MagicDamage;
import electroblob.wizardry.util.MagicDamage.DamageType;
import electroblob.wizardry.util.WizardryParticleType;
import electroblob.wizardry.util.ParticleBuilder;
import electroblob.wizardry.util.ParticleBuilder.Type;
import net.minecraft.entity.Entity;
import net.minecraft.entity.EntityLivingBase;
import net.minecraft.init.SoundEvents;
@@ -64,11 +64,8 @@ public class EntityIceShard extends EntityMagicArrow {
// Adds a particle effect when the ice shard hits a block.
if(this.world.isRemote){
for(int j = 0; j < 10; j++){
double x = this.posX - 0.25d + (rand.nextDouble() / 2);
double y = this.posY - 0.25d + (rand.nextDouble() / 2);
double z = this.posZ - 0.25d + (rand.nextDouble() / 2);
Wizardry.proxy.spawnParticle(WizardryParticleType.ICE, world, x, y, z, x - this.posX, y - this.posY,
z - this.posZ, 20 + rand.nextInt(10));
ParticleBuilder.create(Type.ICE, this.rand, this.posX, this.posY, this.posZ, 0.5, true)
.lifetime(20 + rand.nextInt(10)).spawn(world);
}
}
// Parameters for sound: sound event name, volume, pitch.
@@ -1,9 +1,9 @@
package electroblob.wizardry.entity.projectile;
import electroblob.wizardry.Wizardry;
import electroblob.wizardry.registry.WizardrySounds;
import electroblob.wizardry.util.MagicDamage.DamageType;
import electroblob.wizardry.util.WizardryParticleType;
import electroblob.wizardry.util.ParticleBuilder;
import electroblob.wizardry.util.ParticleBuilder.Type;
import net.minecraft.entity.Entity;
import net.minecraft.entity.EntityLivingBase;
import net.minecraft.world.World;
@@ -46,15 +46,10 @@ public class EntityLightningArrow extends EntityMagicArrow {
if(world.isRemote){
for(int j = 0; j < 8; j++){
Wizardry.proxy.spawnParticle(WizardryParticleType.SPARK, world, this.posX + rand.nextFloat() - 0.5,
this.posY + this.height / 2 + rand.nextFloat() - 0.5, this.posZ + rand.nextFloat() - 0.5, 0, 0,
0, 3);
ParticleBuilder.create(Type.SPARK, rand, posX, posY + height / 2, posZ, 1, false).spawn(world);
}
}
/* Pretty sure this needn't be here, probably missed it when I implemented the damage type system. if(entityHit
* instanceof EntityCreeper && !((EntityCreeper)entityHit).getPowered()){
* entityHit.getDataWatcher().updateObject(17, Byte.valueOf((byte)1)); if(this.getShootingEntity() instanceof
* EntityPlayer) ((EntityPlayer)this.getShootingEntity()).addStat(Wizardry.chargeCreeper); } */
this.playSound(WizardrySounds.SPELL_SPARK, 1.0F, 1.0F);
}
@@ -66,8 +61,7 @@ public class EntityLightningArrow extends EntityMagicArrow {
}
if(world.isRemote){
Wizardry.proxy.spawnParticle(WizardryParticleType.SPARK, world, this.posX, this.posY, this.posZ, 0, 0, 0,
3);
ParticleBuilder.create(Type.SPARK).pos(posX, posY, posZ).spawn(world);
}
}
@@ -2,11 +2,11 @@ package electroblob.wizardry.entity.projectile;
import java.util.List;
import electroblob.wizardry.Wizardry;
import electroblob.wizardry.registry.WizardrySounds;
import electroblob.wizardry.util.MagicDamage;
import electroblob.wizardry.util.MagicDamage.DamageType;
import electroblob.wizardry.util.WizardryParticleType;
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;
@@ -14,6 +14,7 @@ import net.minecraft.util.math.RayTraceResult;
import net.minecraft.world.World;
public class EntityLightningDisc extends EntityMagicProjectile {
public EntityLightningDisc(World par1World){
super(par1World);
}
@@ -38,8 +39,9 @@ public class EntityLightningDisc extends EntityMagicProjectile {
}
@Override
protected void onImpact(RayTraceResult mop){
Entity entityHit = mop.entityHit;
protected void onImpact(RayTraceResult result){
Entity entityHit = result.entityHit;
if(entityHit != null){
float damage = 12 * damageMultiplier;
@@ -50,7 +52,7 @@ public class EntityLightningDisc extends EntityMagicProjectile {
this.playSound(WizardrySounds.SPELL_SPARK, 1.0F, 1.2F / (this.rand.nextFloat() * 0.2F + 0.9F));
if(mop.typeOfHit == RayTraceResult.Type.BLOCK) this.setDead();
if(result.typeOfHit == RayTraceResult.Type.BLOCK) this.setDead();
}
@Override
@@ -61,10 +63,9 @@ public class EntityLightningDisc extends EntityMagicProjectile {
// Particle effect
if(world.isRemote){
for(int i = 0; i < 8; i++){
Wizardry.proxy.spawnParticle(WizardryParticleType.SPARK, world, this.posX + rand.nextFloat() * 2 - 1,
this.posY, this.posZ + rand.nextFloat() - 0.5, 0, 0, 0, 3);
// world.spawnParticle(EnumParticleTypes.SMOKE_LARGE, this.posX + rand.nextFloat() - 0.5, this.posY +
// this.height/2 + rand.nextFloat() - 0.5, this.posZ + rand.nextFloat() - 0.5, 0, 0, 0);
// TODO: Why are the x and z parameters different?
ParticleBuilder.create(Type.SPARK).pos(this.posX + rand.nextFloat() * 2 - 1,
this.posY, this.posZ + rand.nextFloat() - 0.5).spawn(world);
}
}
@@ -1,7 +1,7 @@
package electroblob.wizardry.entity.projectile;
import electroblob.wizardry.Wizardry;
import electroblob.wizardry.util.WizardryParticleType;
import electroblob.wizardry.util.ParticleBuilder;
import electroblob.wizardry.util.ParticleBuilder.Type;
import net.minecraft.entity.Entity;
import net.minecraft.entity.EntityLivingBase;
import net.minecraft.init.SoundEvents;
@@ -53,16 +53,8 @@ public class EntityMagicMissile extends EntityMagicArrow {
}
if(this.world.isRemote){
if(this.ticksExisted % 2 == 1){
Wizardry.proxy.spawnParticle(WizardryParticleType.SPARKLE, world, this.posX, this.posY, this.posZ, 0, 0,
0, 20 + rand.nextInt(10), 0.5f + (rand.nextFloat() / 2), 0.5f + (rand.nextFloat() / 2),
0.5f + (rand.nextFloat() / 2));
}else{
Wizardry.proxy.spawnParticle(WizardryParticleType.SPARKLE, world, this.posX, this.posY, this.posZ, 0, 0,
0, 20 + rand.nextInt(10), 0.5f + (rand.nextFloat() / 2), 0.5f + (rand.nextFloat() / 2),
0.5f + (rand.nextFloat() / 2));
}
ParticleBuilder.create(Type.SPARKLE).pos(this.posX, this.posY, this.posZ).lifetime(20 + rand.nextInt(10))
.colour(0.5f + (rand.nextFloat() / 2), 0.5f + (rand.nextFloat() / 2), 0.5f + (rand.nextFloat() / 2)).spawn(world);
}
}
@@ -2,10 +2,10 @@ package electroblob.wizardry.entity.projectile;
import java.util.List;
import electroblob.wizardry.Wizardry;
import electroblob.wizardry.util.MagicDamage;
import electroblob.wizardry.util.MagicDamage.DamageType;
import electroblob.wizardry.util.WizardryParticleType;
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;
@@ -54,16 +54,12 @@ public class EntityPoisonBomb extends EntityBomb {
// Particle effect
if(world.isRemote){
for(int i = 0; i < 60 * blastMultiplier; i++){
Wizardry.proxy.spawnParticle(WizardryParticleType.SPARKLE, world,
this.posX + (this.rand.nextDouble() * 4 - 2) * blastMultiplier,
this.posY + (this.rand.nextDouble() * 4 - 2) * blastMultiplier,
this.posZ + (this.rand.nextDouble() * 4 - 2) * blastMultiplier, 0.0d, 0.0d, 0.0d, 35,
0.2f + rand.nextFloat() * 0.3f, 0.6f, 0.0f);
Wizardry.proxy.spawnParticle(WizardryParticleType.DARK_MAGIC, world,
this.posX + (this.rand.nextDouble() * 4 - 2) * blastMultiplier,
this.posY + (this.rand.nextDouble() * 4 - 2) * blastMultiplier,
this.posZ + (this.rand.nextDouble() * 4 - 2) * blastMultiplier, 0.0d, 0.0d, 0.0d, 0,
0.2f + rand.nextFloat() * 0.2f, 0.8f, 0.0f);
ParticleBuilder.create(Type.SPARKLE, rand, posX, posY, posZ, 2*blastMultiplier, false).lifetime(35)
.colour(0.2f + rand.nextFloat() * 0.3f, 0.6f, 0.0f).spawn(world);
ParticleBuilder.create(Type.DARK_MAGIC, rand, posX, posY, posZ, 2*blastMultiplier, false)
.colour(0.2f + rand.nextFloat() * 0.2f, 0.8f, 0.0f).spawn(world);
}
// Spawning this after the other particles fixes the rendering colour bug. It's a bit of a cheat, but it
// works pretty well.
@@ -2,9 +2,9 @@ package electroblob.wizardry.entity.projectile;
import java.util.List;
import electroblob.wizardry.Wizardry;
import electroblob.wizardry.registry.WizardryPotions;
import electroblob.wizardry.util.WizardryParticleType;
import electroblob.wizardry.util.ParticleBuilder;
import electroblob.wizardry.util.ParticleBuilder.Type;
import electroblob.wizardry.util.WizardryUtilities;
import net.minecraft.entity.EntityLiving;
import net.minecraft.entity.EntityLivingBase;
@@ -42,16 +42,15 @@ public class EntitySmokeBomb extends EntityBomb {
if(world.isRemote){
this.world.spawnParticle(EnumParticleTypes.EXPLOSION_LARGE, this.posX, this.posY, this.posZ, 0, 0, 0);
for(int i = 0; i < 60 * blastMultiplier; i++){
this.world.spawnParticle(EnumParticleTypes.SMOKE_LARGE,
this.posX + (this.rand.nextDouble() * 4 - 2) * blastMultiplier,
this.posY + (this.rand.nextDouble() * 4 - 2) * blastMultiplier,
this.posZ + (this.rand.nextDouble() * 4 - 2) * blastMultiplier, 0, 0, 0);
float brightness = rand.nextFloat() * 0.3f;
Wizardry.proxy.spawnParticle(WizardryParticleType.DARK_MAGIC, world,
this.posX + (this.rand.nextDouble() * 4 - 2) * blastMultiplier,
this.posY + (this.rand.nextDouble() * 4 - 2) * blastMultiplier,
this.posZ + (this.rand.nextDouble() * 4 - 2) * blastMultiplier, 0.0d, 0.0d, 0.0d, 0, brightness,
brightness, brightness);
ParticleBuilder.create(Type.DARK_MAGIC, rand, posX, posY, posZ, 2*blastMultiplier, false)
.colour(brightness, brightness, brightness).spawn(world);
}
}
@@ -2,11 +2,11 @@ package electroblob.wizardry.entity.projectile;
import java.util.List;
import electroblob.wizardry.Wizardry;
import electroblob.wizardry.registry.WizardrySounds;
import electroblob.wizardry.util.MagicDamage;
import electroblob.wizardry.util.MagicDamage.DamageType;
import electroblob.wizardry.util.WizardryParticleType;
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;
@@ -55,9 +55,10 @@ public class EntitySpark extends EntityMagicProjectile {
// Particle effect
if(world.isRemote){
for(int i = 0; i < 8; i++){
Wizardry.proxy.spawnParticle(WizardryParticleType.SPARK, world, this.posX + rand.nextFloat() - 0.5,
this.posY + this.height / 2 + rand.nextFloat() - 0.5, this.posZ + rand.nextFloat() - 0.5, 0, 0,
0, 3);
double x = this.posX + rand.nextDouble() - 0.5;
double y = this.posY + this.height / 2 + rand.nextDouble() - 0.5;
double z = this.posZ + rand.nextDouble() - 0.5;
ParticleBuilder.create(Type.SPARK).pos(x, y, z).spawn(world);
}
}
@@ -2,12 +2,12 @@ package electroblob.wizardry.entity.projectile;
import java.util.List;
import electroblob.wizardry.Wizardry;
import electroblob.wizardry.entity.EntityArc;
import electroblob.wizardry.registry.WizardrySounds;
import electroblob.wizardry.util.MagicDamage;
import electroblob.wizardry.util.MagicDamage.DamageType;
import electroblob.wizardry.util.WizardryParticleType;
import electroblob.wizardry.util.ParticleBuilder;
import electroblob.wizardry.util.ParticleBuilder.Type;
import electroblob.wizardry.util.WizardryUtilities;
import io.netty.buffer.ByteBuf;
import net.minecraft.entity.Entity;
@@ -63,9 +63,10 @@ public class EntitySparkBomb extends EntityBomb {
// Particle effect
if(world.isRemote){
for(int i = 0; i < 8; i++){
Wizardry.proxy.spawnParticle(WizardryParticleType.SPARK, world, this.posX + rand.nextFloat() - 0.5,
this.posY + this.height / 2 + rand.nextFloat() - 0.5, this.posZ + rand.nextFloat() - 0.5, 0, 0,
0, 3);
double x = this.posX + rand.nextDouble() - 0.5;
double y = this.posY + this.height / 2 + rand.nextDouble() - 0.5;
double z = this.posZ + rand.nextDouble() - 0.5;
ParticleBuilder.create(Type.SPARK).pos(x, y, z).spawn(world);
world.spawnParticle(EnumParticleTypes.SMOKE_LARGE, this.posX + rand.nextFloat() - 0.5,
this.posY + this.height / 2 + rand.nextFloat() - 0.5, this.posZ + rand.nextFloat() - 0.5, 0, 0,
0);
@@ -106,10 +107,10 @@ public class EntitySparkBomb extends EntityBomb {
}else{
// Particle effect
for(int j = 0; j < 8; j++){
Wizardry.proxy.spawnParticle(WizardryParticleType.SPARK, world,
target.posX + rand.nextFloat() - 0.5,
target.getEntityBoundingBox().minY + target.height * rand.nextFloat(),
target.posZ + rand.nextFloat() - 0.5, 0, 0, 0, 3);
double x = target.posX + rand.nextFloat() - 0.5;
double y = target.getEntityBoundingBox().minY + target.height * rand.nextFloat();
double z = target.posZ + rand.nextFloat() - 0.5;
ParticleBuilder.create(Type.SPARK).pos(x, y, z).spawn(world);
world.spawnParticle(EnumParticleTypes.SMOKE_LARGE, target.posX + rand.nextFloat() - 0.5,
target.getEntityBoundingBox().minY + target.height * rand.nextFloat(),
target.posZ + rand.nextFloat() - 0.5, 0, 0, 0);
@@ -1,9 +1,9 @@
package electroblob.wizardry.entity.projectile;
import electroblob.wizardry.Wizardry;
import electroblob.wizardry.util.MagicDamage;
import electroblob.wizardry.util.MagicDamage.DamageType;
import electroblob.wizardry.util.WizardryParticleType;
import electroblob.wizardry.util.ParticleBuilder;
import electroblob.wizardry.util.ParticleBuilder.Type;
import net.minecraft.entity.Entity;
import net.minecraft.entity.EntityLivingBase;
import net.minecraft.init.SoundEvents;
@@ -68,9 +68,7 @@ public class EntityThunderbolt extends EntityMagicProjectile {
super.onUpdate();
if(world.isRemote){
Wizardry.proxy.spawnParticle(WizardryParticleType.SPARK, world, this.posX + rand.nextFloat() * 0.2 - 0.1,
this.posY + this.height / 2 + rand.nextFloat() * 0.2 - 0.1,
this.posZ + rand.nextFloat() * 0.2 - 0.1, 0, 0, 0, 3);
ParticleBuilder.create(Type.SPARK, rand, posX, posY + height/2, posZ, 0.1, false).spawn(world);
for(int i = 0; i < 4; i++){
world.spawnParticle(EnumParticleTypes.SMOKE_NORMAL, this.posX + rand.nextFloat() * 0.2 - 0.1,
this.posY + this.height / 2 + rand.nextFloat() * 0.2 - 0.1,