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:
@@ -2,8 +2,8 @@ package electroblob.wizardry.entity.living;
|
||||
|
||||
import java.lang.ref.WeakReference;
|
||||
|
||||
import electroblob.wizardry.Wizardry;
|
||||
import electroblob.wizardry.util.WizardryParticleType;
|
||||
import electroblob.wizardry.util.ParticleBuilder;
|
||||
import electroblob.wizardry.util.ParticleBuilder.Type;
|
||||
import io.netty.buffer.ByteBuf;
|
||||
import net.minecraft.entity.EntityLivingBase;
|
||||
import net.minecraft.entity.SharedMonsterAttributes;
|
||||
@@ -40,10 +40,13 @@ public class EntityDecoy extends EntitySummonedCreature {
|
||||
public void onDespawn(){
|
||||
super.onDespawn();
|
||||
for(int i = 0; i < 20; i++){
|
||||
Wizardry.proxy.spawnParticle(WizardryParticleType.DUST, world,
|
||||
this.posX + (this.rand.nextDouble() - 0.5) * this.width,
|
||||
this.getEntityBoundingBox().minY + this.rand.nextDouble() * this.height,
|
||||
this.posZ + (this.rand.nextDouble() - 0.5) * this.width, 0, 0, 0, 40, 0.2f, 1.0f, 0.8f);
|
||||
ParticleBuilder.create(Type.DUST)
|
||||
.pos(this.posX + (this.rand.nextDouble() - 0.5) * this.width, this.getEntityBoundingBox().minY
|
||||
+ this.rand.nextDouble() * this.height, this.posZ + (this.rand.nextDouble() - 0.5) * this.width)
|
||||
.lifetime(40)
|
||||
.colour(0.2f, 1.0f, 0.8f)
|
||||
.shaded(true)
|
||||
.spawn(world);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -16,8 +16,9 @@ import electroblob.wizardry.registry.WizardryItems;
|
||||
import electroblob.wizardry.registry.WizardryPotions;
|
||||
import electroblob.wizardry.registry.WizardrySounds;
|
||||
import electroblob.wizardry.spell.Spell;
|
||||
import electroblob.wizardry.util.ParticleBuilder;
|
||||
import electroblob.wizardry.util.SpellModifiers;
|
||||
import electroblob.wizardry.util.WizardryParticleType;
|
||||
import electroblob.wizardry.util.ParticleBuilder.Type;
|
||||
import electroblob.wizardry.util.WizardryUtilities;
|
||||
import io.netty.buffer.ByteBuf;
|
||||
import net.minecraft.entity.Entity;
|
||||
@@ -200,20 +201,19 @@ public class EntityEvilWizard extends EntityMob implements ISpellCaster, IEntity
|
||||
// deathTime == 0 checks the wizard isn't currently dying
|
||||
}else if(healCooldown == -1 && this.deathTime == 0){
|
||||
|
||||
// Heal particles
|
||||
// Heal particles TODO: Change this so it uses the heal spell directly
|
||||
if(world.isRemote){
|
||||
for(int i = 0; i < 10; i++){
|
||||
double d0 = (double)((float)this.posX + rand.nextFloat() * 2 - 1.0F);
|
||||
for(int i=0; i<10; i++){
|
||||
double x = (double)((float)this.posX + rand.nextFloat() * 2 - 1.0F);
|
||||
// Apparently the client side spawns the particles 1 block higher than it should... hence the -
|
||||
// 0.5F.
|
||||
double d1 = (double)((float)this.posY - 0.5F + rand.nextFloat());
|
||||
double d2 = (double)((float)this.posZ + rand.nextFloat() * 2 - 1.0F);
|
||||
Wizardry.proxy.spawnParticle(WizardryParticleType.SPARKLE, world, d0, d1, d2, 0, 0.1F, 0,
|
||||
48 + rand.nextInt(12), 1.0f, 1.0f, 0.3f);
|
||||
double y = (double)((float)this.posY - 0.5F + rand.nextFloat());
|
||||
double z = (double)((float)this.posZ + rand.nextFloat() * 2 - 1.0F);
|
||||
ParticleBuilder.create(Type.SPARKLE).pos(x, y, z).vel(0, 0.1F, 0).colour(1, 1, 0.3f).spawn(world);
|
||||
}
|
||||
}else{
|
||||
if(this.getHealth() < 10){
|
||||
// Wizard heals himself more often if he has low health
|
||||
// Wizards heal themseselves more often if they have low health
|
||||
this.setHealCooldown(150);
|
||||
}else{
|
||||
this.setHealCooldown(400);
|
||||
|
||||
@@ -6,7 +6,8 @@ import java.util.UUID;
|
||||
import electroblob.wizardry.Wizardry;
|
||||
import electroblob.wizardry.registry.WizardryPotions;
|
||||
import electroblob.wizardry.registry.WizardrySounds;
|
||||
import electroblob.wizardry.util.WizardryParticleType;
|
||||
import electroblob.wizardry.util.ParticleBuilder;
|
||||
import electroblob.wizardry.util.ParticleBuilder.Type;
|
||||
import net.minecraft.entity.EntityFlying;
|
||||
import net.minecraft.entity.EntityLivingBase;
|
||||
import net.minecraft.entity.ai.EntityAIAttackMelee;
|
||||
@@ -144,10 +145,12 @@ public class EntityIceGiant extends EntityIronGolem implements ISummonedCreature
|
||||
if(this.world.isRemote){
|
||||
for(int i = 0; i < 30; i++){
|
||||
float brightness = 0.5f + (rand.nextFloat() / 2);
|
||||
Wizardry.proxy.spawnParticle(WizardryParticleType.SPARKLE, this.world,
|
||||
this.posX - 1 + rand.nextDouble() * 2, this.posY + rand.nextDouble() * 3,
|
||||
this.posZ - 1 + rand.nextDouble() * 2, 0, -0.02, 0, 12 + rand.nextInt(8), brightness,
|
||||
brightness + 0.1f, 1.0f);
|
||||
ParticleBuilder.create(Type.SPARKLE)
|
||||
.pos(this.posX - 1 + rand.nextDouble() * 2, this.posY + rand.nextDouble() * 3, this.posZ - 1 + rand.nextDouble() * 2)
|
||||
.vel(0, -0.02, 0)
|
||||
.lifetime(12 + rand.nextInt(8))
|
||||
.colour(brightness, brightness + 0.1f, 1.0f)
|
||||
.spawn(world);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -158,9 +161,9 @@ public class EntityIceGiant extends EntityIronGolem implements ISummonedCreature
|
||||
super.onLivingUpdate();
|
||||
|
||||
if(this.world.isRemote){
|
||||
Wizardry.proxy.spawnParticle(WizardryParticleType.SNOW, this.world, this.posX - 1 + rand.nextDouble() * 2,
|
||||
this.posY + rand.nextDouble() * 3, this.posZ - 1 + rand.nextDouble() * 2, 0, -0.02, 0,
|
||||
40 + rand.nextInt(10));
|
||||
ParticleBuilder.create(Type.SNOW)
|
||||
.pos(this.posX - 1 + rand.nextDouble() * 2, this.posY + rand.nextDouble() * 3, this.posZ - 1 + rand.nextDouble() * 2)
|
||||
.spawn(world);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -1,10 +1,10 @@
|
||||
package electroblob.wizardry.entity.living;
|
||||
|
||||
import electroblob.wizardry.Wizardry;
|
||||
import electroblob.wizardry.registry.Spells;
|
||||
import electroblob.wizardry.registry.WizardrySounds;
|
||||
import electroblob.wizardry.util.ParticleBuilder;
|
||||
import electroblob.wizardry.util.SpellModifiers;
|
||||
import electroblob.wizardry.util.WizardryParticleType;
|
||||
import electroblob.wizardry.util.ParticleBuilder.Type;
|
||||
import net.minecraft.entity.EntityLivingBase;
|
||||
import net.minecraft.entity.ai.EntityAIBase;
|
||||
import net.minecraft.entity.ai.EntityAILookIdle;
|
||||
@@ -50,9 +50,13 @@ public class EntityIceWraith extends EntityBlazeMinion {
|
||||
if(this.world.isRemote){
|
||||
for(int i = 0; i < 15; i++){
|
||||
float brightness = 0.5f + (rand.nextFloat() / 2);
|
||||
Wizardry.proxy.spawnParticle(WizardryParticleType.SPARKLE, world, this.posX - 0.5d + rand.nextDouble(),
|
||||
this.posY + this.height / 2 - 0.5d + rand.nextDouble(), this.posZ - 0.5d + rand.nextDouble(), 0,
|
||||
0.05f, 0, 20 + rand.nextInt(10), brightness, brightness + 0.1f, 1.0f);
|
||||
ParticleBuilder.create(Type.SPARKLE)
|
||||
.pos(this.posX - 0.5d + rand.nextDouble(), this.posY + this.height / 2 - 0.5d + rand.nextDouble(),
|
||||
this.posZ - 0.5d + rand.nextDouble())
|
||||
.vel(0, 0.05f, 0)
|
||||
.lifetime(20 + rand.nextInt(10))
|
||||
.colour(brightness, brightness + 0.1f, 1.0f)
|
||||
.spawn(world);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,9 +1,9 @@
|
||||
package electroblob.wizardry.entity.living;
|
||||
|
||||
import electroblob.wizardry.Wizardry;
|
||||
import electroblob.wizardry.registry.Spells;
|
||||
import electroblob.wizardry.util.ParticleBuilder;
|
||||
import electroblob.wizardry.util.SpellModifiers;
|
||||
import electroblob.wizardry.util.WizardryParticleType;
|
||||
import electroblob.wizardry.util.ParticleBuilder.Type;
|
||||
import net.minecraft.entity.EntityLivingBase;
|
||||
import net.minecraft.entity.ai.EntityAIBase;
|
||||
import net.minecraft.entity.ai.EntityAILookIdle;
|
||||
@@ -44,9 +44,12 @@ public class EntityLightningWraith extends EntityBlazeMinion {
|
||||
if(this.world.isRemote){
|
||||
for(int i = 0; i < 15; i++){
|
||||
float brightness = 0.3f + (rand.nextFloat() / 2);
|
||||
Wizardry.proxy.spawnParticle(WizardryParticleType.SPARKLE, world, this.posX - 0.5d + rand.nextDouble(),
|
||||
this.posY + this.height / 2 - 0.5d + rand.nextDouble(), this.posZ - 0.5d + rand.nextDouble(), 0,
|
||||
0.05f, 0, 20 + rand.nextInt(10), brightness, brightness + 0.2f, 1.0f);
|
||||
ParticleBuilder.create(Type.SPARKLE)
|
||||
.pos(this.posX - 0.5d + rand.nextDouble(), this.posY + this.height / 2 - 0.5d + rand.nextDouble(), this.posZ - 0.5d + rand.nextDouble())
|
||||
.vel(0, 0.05, 0)
|
||||
.lifetime(20 + rand.nextInt(10))
|
||||
.colour(brightness, brightness + 0.2f, 1.0f)
|
||||
.spawn(world);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -56,10 +59,7 @@ public class EntityLightningWraith extends EntityBlazeMinion {
|
||||
// Fortunately, lightning wraiths don't replace any of blazes' particle effects or the fire sound, they only
|
||||
// add the sparks, so it's fine to call super here.
|
||||
if(world.isRemote){
|
||||
Wizardry.proxy.spawnParticle(WizardryParticleType.SPARK, 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, 3);
|
||||
ParticleBuilder.create(Type.SPARK, this).spawn(world);
|
||||
}
|
||||
super.onLivingUpdate();
|
||||
}
|
||||
|
||||
@@ -3,11 +3,11 @@ package electroblob.wizardry.entity.living;
|
||||
import java.util.Collections;
|
||||
import java.util.List;
|
||||
|
||||
import electroblob.wizardry.Wizardry;
|
||||
import electroblob.wizardry.registry.Spells;
|
||||
import electroblob.wizardry.spell.Spell;
|
||||
import electroblob.wizardry.util.ParticleBuilder;
|
||||
import electroblob.wizardry.util.SpellModifiers;
|
||||
import electroblob.wizardry.util.WizardryParticleType;
|
||||
import electroblob.wizardry.util.ParticleBuilder.Type;
|
||||
import net.minecraft.entity.EntityLivingBase;
|
||||
import net.minecraft.entity.SharedMonsterAttributes;
|
||||
import net.minecraft.entity.ai.EntityAIAttackMelee;
|
||||
@@ -128,9 +128,13 @@ public class EntityShadowWraith extends EntitySummonedCreature implements ISpell
|
||||
if(this.world.isRemote){
|
||||
for(int i = 0; i < 15; i++){
|
||||
float brightness = rand.nextFloat() * 0.4f;
|
||||
Wizardry.proxy.spawnParticle(WizardryParticleType.SPARKLE, world, this.posX - 0.5d + rand.nextDouble(),
|
||||
this.posY + this.height / 2 - 0.5d + rand.nextDouble(), this.posZ - 0.5d + rand.nextDouble(), 0,
|
||||
0.05f, 0, 20 + rand.nextInt(10), brightness, 0.0f, brightness);
|
||||
ParticleBuilder.create(Type.SPARKLE)
|
||||
.pos(this.posX - 0.5d + rand.nextDouble(), this.posY + this.height / 2 - 0.5d + rand.nextDouble(),
|
||||
this.posZ - 0.5d + rand.nextDouble())
|
||||
.vel(0, 0.05, 0)
|
||||
.lifetime(20 + rand.nextInt(10))
|
||||
.colour(brightness, 0.0f, brightness)
|
||||
.spawn(world);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -149,26 +153,25 @@ public class EntityShadowWraith extends EntitySummonedCreature implements ISpell
|
||||
}
|
||||
|
||||
if(world.isRemote){
|
||||
for(int i = 0; i < 2; i++){
|
||||
|
||||
for(int i=0; i<2; i++){
|
||||
|
||||
world.spawnParticle(EnumParticleTypes.PORTAL,
|
||||
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);
|
||||
|
||||
world.spawnParticle(EnumParticleTypes.SMOKE_LARGE,
|
||||
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);
|
||||
|
||||
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.05f, 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).vel(0, 0.05, 0).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);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -4,7 +4,8 @@ import java.lang.ref.WeakReference;
|
||||
import java.util.UUID;
|
||||
|
||||
import electroblob.wizardry.Wizardry;
|
||||
import electroblob.wizardry.util.WizardryParticleType;
|
||||
import electroblob.wizardry.util.ParticleBuilder;
|
||||
import electroblob.wizardry.util.ParticleBuilder.Type;
|
||||
import net.minecraft.entity.EntityFlying;
|
||||
import net.minecraft.entity.EntityLivingBase;
|
||||
import net.minecraft.entity.ai.EntityAIAttackMelee;
|
||||
@@ -119,9 +120,10 @@ public class EntitySilverfishMinion extends EntitySilverfish implements ISummone
|
||||
private void spawnParticleEffect(){
|
||||
if(this.world.isRemote){
|
||||
for(int i = 0; i < 15; i++){
|
||||
Wizardry.proxy.spawnParticle(WizardryParticleType.DARK_MAGIC, world, this.posX + this.rand.nextFloat(),
|
||||
this.posY + this.rand.nextFloat(), this.posZ + this.rand.nextFloat(), 0.0d, 0.0d, 0.0d, 0, 0.3f,
|
||||
0.3f, 0.3f);
|
||||
ParticleBuilder.create(Type.DARK_MAGIC)
|
||||
.pos(this.posX + this.rand.nextFloat(), this.posY + this.rand.nextFloat(), this.posZ + this.rand.nextFloat())
|
||||
.colour(0.3f, 0.3f, 0.3f)
|
||||
.spawn(world);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -4,7 +4,8 @@ import java.lang.ref.WeakReference;
|
||||
import java.util.UUID;
|
||||
|
||||
import electroblob.wizardry.Wizardry;
|
||||
import electroblob.wizardry.util.WizardryParticleType;
|
||||
import electroblob.wizardry.util.ParticleBuilder;
|
||||
import electroblob.wizardry.util.ParticleBuilder.Type;
|
||||
import net.minecraft.entity.EntityFlying;
|
||||
import net.minecraft.entity.EntityLivingBase;
|
||||
import net.minecraft.entity.IEntityLivingData;
|
||||
@@ -147,9 +148,10 @@ public class EntitySpiderMinion extends EntityCaveSpider implements ISummonedCre
|
||||
private void spawnParticleEffect(){
|
||||
if(this.world.isRemote){
|
||||
for(int i = 0; i < 15; i++){
|
||||
Wizardry.proxy.spawnParticle(WizardryParticleType.DARK_MAGIC, world, this.posX + this.rand.nextFloat(),
|
||||
this.posY + this.rand.nextFloat(), this.posZ + this.rand.nextFloat(), 0.0d, 0.0d, 0.0d, 0, 0.1f,
|
||||
0.2f, 0.0f);
|
||||
ParticleBuilder.create(Type.DARK_MAGIC)
|
||||
.pos(this.posX + this.rand.nextFloat(), this.posY + this.rand.nextFloat(), this.posZ + this.rand.nextFloat())
|
||||
.colour(0.1f, 0.2f, 0.0f)
|
||||
.spawn(world);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -4,7 +4,8 @@ import electroblob.wizardry.WizardData;
|
||||
import electroblob.wizardry.Wizardry;
|
||||
import electroblob.wizardry.item.ItemWand;
|
||||
import electroblob.wizardry.registry.WizardrySounds;
|
||||
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;
|
||||
@@ -85,17 +86,15 @@ public class EntitySpiritHorse extends EntityHorse {
|
||||
if(itemstack.getItem() instanceof ItemWand && this.getOwner() == player && player.isSneaking()){
|
||||
// Prevents accidental double clicking.
|
||||
if(this.ticksExisted > 20){
|
||||
for(int i = 0; i < 15; i++){
|
||||
Wizardry.proxy.spawnParticle(WizardryParticleType.SPARKLE, world,
|
||||
this.posX - this.width / 2 + this.rand.nextFloat() * width,
|
||||
this.posY + this.height * this.rand.nextFloat() + 0.2f,
|
||||
this.posZ - this.width / 2 + this.rand.nextFloat() * width, 0, 0, 0,
|
||||
48 + this.rand.nextInt(12), 0.8f, 0.8f, 1.0f);
|
||||
}
|
||||
|
||||
this.spawnAppearParticles();
|
||||
|
||||
this.setDead();
|
||||
|
||||
if(WizardData.get(player) != null){
|
||||
WizardData.get(player).hasSpiritHorse = false;
|
||||
}
|
||||
|
||||
this.playSound(WizardrySounds.SPELL_HEAL, 0.7F, rand.nextFloat() * 0.4F + 1.0F);
|
||||
// This is necessary to prevent the wand's spell being cast when performing this action.
|
||||
return true;
|
||||
@@ -105,6 +104,15 @@ public class EntitySpiritHorse extends EntityHorse {
|
||||
|
||||
return super.processInteract(player, hand);
|
||||
}
|
||||
|
||||
private void spawnAppearParticles(){
|
||||
for(int i=0; i<15; i++){
|
||||
double x = this.posX - this.width / 2 + this.rand.nextFloat() * width;
|
||||
double y = this.posY + this.height * this.rand.nextFloat() + 0.2f;
|
||||
double z = this.posZ - this.width / 2 + this.rand.nextFloat() * width;
|
||||
ParticleBuilder.create(Type.SPARKLE).pos(x, y, z).colour(0.8f, 0.8f, 1.0f).spawn(world);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onDeath(DamageSource par1DamageSource){
|
||||
@@ -137,10 +145,10 @@ public class EntitySpiritHorse extends EntityHorse {
|
||||
|
||||
// Adds a dust particle effect
|
||||
if(this.world.isRemote){
|
||||
Wizardry.proxy.spawnParticle(WizardryParticleType.DUST, world,
|
||||
this.posX - this.width / 2 + this.rand.nextFloat() * width,
|
||||
this.posY + this.height * this.rand.nextFloat() + 0.2f,
|
||||
this.posZ - this.width / 2 + this.rand.nextFloat() * width, 0, 0, 0, 0, 0.8f, 0.8f, 1.0f);
|
||||
double x = this.posX - this.width / 2 + this.rand.nextFloat() * width;
|
||||
double y = this.posY + this.height * this.rand.nextFloat() + 0.2f;
|
||||
double z = this.posZ - this.width / 2 + this.rand.nextFloat() * width;
|
||||
ParticleBuilder.create(Type.DUST).pos(x, y, z).colour(0.8f, 0.8f, 1.0f).shaded(true).spawn(world);
|
||||
}
|
||||
|
||||
// Spirit horse disappears a short time after being dismounted.
|
||||
@@ -151,20 +159,17 @@ public class EntitySpiritHorse extends EntityHorse {
|
||||
}
|
||||
|
||||
if(this.idleTimer > 200){
|
||||
|
||||
if(this.world.isRemote){
|
||||
for(int i = 0; i < 15; i++){
|
||||
Wizardry.proxy.spawnParticle(WizardryParticleType.SPARKLE, world,
|
||||
this.posX - this.width / 2 + this.rand.nextFloat() * width,
|
||||
this.posY + this.height * this.rand.nextFloat() + 0.2f,
|
||||
this.posZ - this.width / 2 + this.rand.nextFloat() * width, 0, 0, 0,
|
||||
48 + this.rand.nextInt(12), 0.8f, 0.8f, 1.0f);
|
||||
}
|
||||
this.spawnAppearParticles();
|
||||
}
|
||||
|
||||
this.playSound(WizardrySounds.SPELL_HEAL, 0.7F, rand.nextFloat() * 0.4F + 1.0F);
|
||||
// Allows player to summon another spirit horse once this one has disappeared.
|
||||
if(this.getOwner() instanceof EntityPlayer && WizardData.get((EntityPlayer)this.getOwner()) != null){
|
||||
WizardData.get((EntityPlayer)this.getOwner()).hasSpiritHorse = false;
|
||||
}
|
||||
|
||||
this.setDead();
|
||||
}
|
||||
}
|
||||
@@ -179,13 +184,7 @@ public class EntitySpiritHorse extends EntityHorse {
|
||||
|
||||
// Adds Particles on spawn. Due to client/server differences this cannot be done in the item.
|
||||
if(this.world.isRemote){
|
||||
for(int i = 0; i < 15; i++){
|
||||
Wizardry.proxy.spawnParticle(WizardryParticleType.SPARKLE, world,
|
||||
this.posX - this.width / 2 + this.rand.nextFloat() * width,
|
||||
this.posY + this.height * this.rand.nextFloat() + 0.2f,
|
||||
this.posZ - this.width / 2 + this.rand.nextFloat() * width, 0, 0, 0, 48 + this.rand.nextInt(12),
|
||||
0.8f, 0.8f, 1.0f);
|
||||
}
|
||||
this.spawnAppearParticles();
|
||||
}
|
||||
|
||||
return super.onInitialSpawn(difficulty, data);
|
||||
|
||||
@@ -4,7 +4,8 @@ import electroblob.wizardry.WizardData;
|
||||
import electroblob.wizardry.Wizardry;
|
||||
import electroblob.wizardry.item.ItemWand;
|
||||
import electroblob.wizardry.registry.WizardrySounds;
|
||||
import electroblob.wizardry.util.WizardryParticleType;
|
||||
import electroblob.wizardry.util.ParticleBuilder;
|
||||
import electroblob.wizardry.util.ParticleBuilder.Type;
|
||||
import net.minecraft.entity.EntityAgeable;
|
||||
import net.minecraft.entity.IEntityLivingData;
|
||||
import net.minecraft.entity.ai.EntityAIAttackMelee;
|
||||
@@ -81,18 +82,21 @@ public class EntitySpiritWolf extends EntityWolf {
|
||||
// Adds Particles on spawn. Due to client/server differences this cannot be done
|
||||
// in the item.
|
||||
if(this.world.isRemote){
|
||||
for(int i = 0; i < 15; i++){
|
||||
Wizardry.proxy.spawnParticle(WizardryParticleType.SPARK, world,
|
||||
this.posX - this.width / 2 + this.rand.nextFloat() * width,
|
||||
this.posY + this.height * this.rand.nextFloat() + 0.2f,
|
||||
this.posZ - this.width / 2 + this.rand.nextFloat() * width, 0, 0, 0, 48 + this.rand.nextInt(12),
|
||||
0.8f, 0.8f, 1.0f);
|
||||
}
|
||||
this.spawnAppearParticles();
|
||||
}
|
||||
|
||||
return livingdata;
|
||||
}
|
||||
|
||||
private void spawnAppearParticles(){
|
||||
for(int i=0; i<15; i++){
|
||||
double x = this.posX - this.width / 2 + this.rand.nextFloat() * width;
|
||||
double y = this.posY + this.height * this.rand.nextFloat() + 0.2f;
|
||||
double z = this.posZ - this.width / 2 + this.rand.nextFloat() * width;
|
||||
ParticleBuilder.create(Type.SPARKLE).pos(x, y, z).colour(0.8f, 0.8f, 1.0f).spawn(world);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onUpdate(){
|
||||
|
||||
@@ -100,10 +104,10 @@ public class EntitySpiritWolf extends EntityWolf {
|
||||
|
||||
// Adds a dust particle effect
|
||||
if(this.world.isRemote){
|
||||
Wizardry.proxy.spawnParticle(WizardryParticleType.DUST, world,
|
||||
this.posX - this.width / 2 + this.rand.nextFloat() * width,
|
||||
this.posY + this.height * this.rand.nextFloat() + 0.2f,
|
||||
this.posZ - this.width / 2 + this.rand.nextFloat() * width, 0, 0, 0, 0, 0.8f, 0.8f, 1.0f);
|
||||
double x = this.posX - this.width / 2 + this.rand.nextFloat() * width;
|
||||
double y = this.posY + this.height * this.rand.nextFloat() + 0.2f;
|
||||
double z = this.posZ - this.width / 2 + this.rand.nextFloat() * width;
|
||||
ParticleBuilder.create(Type.DUST).pos(x, y, z).colour(0.8f, 0.8f, 1.0f).shaded(true).spawn(world);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -119,17 +123,17 @@ public class EntitySpiritWolf extends EntityWolf {
|
||||
if(stack.getItem() instanceof ItemWand && this.getOwner() == player && player.isSneaking()){
|
||||
// Prevents accidental double clicking.
|
||||
if(this.ticksExisted > 20){
|
||||
for(int i = 0; i < 10; i++){
|
||||
Wizardry.proxy.spawnParticle(WizardryParticleType.SPARKLE, world,
|
||||
this.posX - this.width / 2 + this.rand.nextFloat() * width,
|
||||
this.posY + this.height * this.rand.nextFloat() + 0.2f,
|
||||
this.posZ - this.width / 2 + this.rand.nextFloat() * width, 0, 0, 0,
|
||||
48 + this.rand.nextInt(12), 0.8f, 0.8f, 1.0f);
|
||||
|
||||
if(this.world.isRemote){
|
||||
this.spawnAppearParticles();
|
||||
}
|
||||
|
||||
this.setDead();
|
||||
|
||||
if(WizardData.get(player) != null){
|
||||
WizardData.get(player).hasSpiritWolf = false;
|
||||
}
|
||||
|
||||
this.playSound(WizardrySounds.SPELL_HEAL, 0.7F, rand.nextFloat() * 0.4F + 1.0F);
|
||||
// This is necessary to prevent the wand's spell being cast when performing this
|
||||
// action.
|
||||
|
||||
@@ -3,12 +3,12 @@ package electroblob.wizardry.entity.living;
|
||||
import java.util.Collections;
|
||||
import java.util.List;
|
||||
|
||||
import electroblob.wizardry.Wizardry;
|
||||
import electroblob.wizardry.registry.Spells;
|
||||
import electroblob.wizardry.registry.WizardrySounds;
|
||||
import electroblob.wizardry.spell.Spell;
|
||||
import electroblob.wizardry.util.ParticleBuilder;
|
||||
import electroblob.wizardry.util.SpellModifiers;
|
||||
import electroblob.wizardry.util.WizardryParticleType;
|
||||
import electroblob.wizardry.util.ParticleBuilder.Type;
|
||||
import net.minecraft.entity.EntityLivingBase;
|
||||
import net.minecraft.entity.SharedMonsterAttributes;
|
||||
import net.minecraft.entity.ai.EntityAIAttackMelee;
|
||||
@@ -135,22 +135,23 @@ public class EntityStormElemental extends EntitySummonedCreature implements ISpe
|
||||
|
||||
if(world.isRemote){
|
||||
|
||||
for(int i = 0; i < 2; ++i){
|
||||
for(int i=0; i<2; ++i){
|
||||
|
||||
world.spawnParticle(EnumParticleTypes.SMOKE_LARGE,
|
||||
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);
|
||||
Wizardry.proxy.spawnParticle(WizardryParticleType.SPARK, 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, 0, 0);
|
||||
|
||||
ParticleBuilder.create(Type.SPARK, this).spawn(world);
|
||||
}
|
||||
|
||||
for(int i = 0; i < 10; i++){
|
||||
for(int i=0; i<10; i++){
|
||||
|
||||
float brightness = rand.nextFloat() * 0.2f;
|
||||
double dy = this.rand.nextDouble() * (double)this.height;
|
||||
Wizardry.proxy.spawnParticle(WizardryParticleType.SPARKLE_ROTATING, world, this.posX, this.posY + dy,
|
||||
this.posZ, 0, 0, 0, 20 + rand.nextInt(10), 0, brightness, brightness, false, 0.2f + 0.5f * dy);
|
||||
|
||||
ParticleBuilder.create(Type.SPARKLE_ROTATING).pos(this.posX, this.posY + dy, this.posZ)
|
||||
.lifetime(20 + rand.nextInt(10)).colour(0, brightness, brightness).radius(0.2f + 0.5f * dy).spawn(world);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -21,10 +21,11 @@ import electroblob.wizardry.registry.WizardryItems;
|
||||
import electroblob.wizardry.registry.WizardryPotions;
|
||||
import electroblob.wizardry.registry.WizardrySounds;
|
||||
import electroblob.wizardry.spell.Spell;
|
||||
import electroblob.wizardry.util.ParticleBuilder;
|
||||
import electroblob.wizardry.util.SpellModifiers;
|
||||
import electroblob.wizardry.util.WandHelper;
|
||||
import electroblob.wizardry.util.WildcardTradeList;
|
||||
import electroblob.wizardry.util.WizardryParticleType;
|
||||
import electroblob.wizardry.util.ParticleBuilder.Type;
|
||||
import electroblob.wizardry.util.WizardryUtilities;
|
||||
import io.netty.buffer.ByteBuf;
|
||||
import net.minecraft.entity.Entity;
|
||||
@@ -245,20 +246,19 @@ public class EntityWizard extends EntityVillager implements ISpellCaster, IEntit
|
||||
// deathTime == 0 checks the wizard isn't currently dying
|
||||
}else if(healCooldown == -1 && this.deathTime == 0){
|
||||
|
||||
// Heal particles
|
||||
// Heal particles TODO: Change this so it uses the heal spell directly
|
||||
if(world.isRemote){
|
||||
for(int i = 0; i < 10; i++){
|
||||
double d0 = (double)((float)this.posX + rand.nextFloat() * 2 - 1.0F);
|
||||
for(int i=0; i<10; i++){
|
||||
double x = (double)((float)this.posX + rand.nextFloat() * 2 - 1.0F);
|
||||
// Apparently the client side spawns the particles 1 block higher than it should... hence the -
|
||||
// 0.5F.
|
||||
double d1 = (double)((float)this.posY - 0.5F + rand.nextFloat());
|
||||
double d2 = (double)((float)this.posZ + rand.nextFloat() * 2 - 1.0F);
|
||||
Wizardry.proxy.spawnParticle(WizardryParticleType.SPARKLE, world, d0, d1, d2, 0, 0.1F, 0,
|
||||
48 + rand.nextInt(12), 1.0f, 1.0f, 0.3f);
|
||||
double y = (double)((float)this.posY - 0.5F + rand.nextFloat());
|
||||
double z = (double)((float)this.posZ + rand.nextFloat() * 2 - 1.0F);
|
||||
ParticleBuilder.create(Type.SPARKLE).pos(x, y, z).vel(0, 0.1F, 0).colour(1, 1, 0.3f).spawn(world);
|
||||
}
|
||||
}else{
|
||||
if(this.getHealth() < 10){
|
||||
// Wizard heals himself more often if he has low health
|
||||
// Wizards heal themseselves more often if they have low health
|
||||
this.setHealCooldown(150);
|
||||
}else{
|
||||
this.setHealCooldown(400);
|
||||
|
||||
@@ -16,7 +16,8 @@ import electroblob.wizardry.util.IElementalDamage;
|
||||
import electroblob.wizardry.util.IndirectMinionDamage;
|
||||
import electroblob.wizardry.util.MagicDamage.DamageType;
|
||||
import electroblob.wizardry.util.MinionDamage;
|
||||
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;
|
||||
@@ -288,9 +289,10 @@ public interface ISummonedCreature extends IEntityAdditionalSpawnData {
|
||||
}
|
||||
|
||||
if(this.hasParticleEffect() && thisEntity.world.isRemote && thisEntity.world.rand.nextInt(8) == 0)
|
||||
Wizardry.proxy.spawnParticle(WizardryParticleType.DARK_MAGIC, thisEntity.world, thisEntity.posX,
|
||||
thisEntity.posY + thisEntity.world.rand.nextDouble() * 1.5, thisEntity.posZ, 0.0d, 0.0d, 0.0d, 0,
|
||||
0.1f, 0.0f, 0.0f);
|
||||
ParticleBuilder.create(Type.DARK_MAGIC)
|
||||
.pos(thisEntity.posX, thisEntity.posY + thisEntity.world.rand.nextDouble() * 1.5, thisEntity.posZ)
|
||||
.colour(0.1f, 0.0f, 0.0f)
|
||||
.spawn(thisEntity.world);
|
||||
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user