Added a changeling magic particle effect

This commit is contained in:
Sollace 2019-02-03 19:59:11 +02:00
parent 161f61b138
commit 29af8f173d
4 changed files with 38 additions and 3 deletions

View file

@ -3,6 +3,7 @@ package com.minelittlepony.unicopia;
import com.minelittlepony.unicopia.particle.Particles; import com.minelittlepony.unicopia.particle.Particles;
import com.minelittlepony.unicopia.particle.client.EntityMagicFX; import com.minelittlepony.unicopia.particle.client.EntityMagicFX;
import com.minelittlepony.unicopia.particle.client.EntityRaindropFX; import com.minelittlepony.unicopia.particle.client.EntityRaindropFX;
import com.minelittlepony.unicopia.particle.client.ParticleChanglingMagic;
import net.minecraftforge.fml.relauncher.Side; import net.minecraftforge.fml.relauncher.Side;
import net.minecraftforge.fml.relauncher.SideOnly; import net.minecraftforge.fml.relauncher.SideOnly;
@ -11,10 +12,12 @@ public class UParticles {
public static int MAGIC_PARTICLE; public static int MAGIC_PARTICLE;
public static int RAIN_PARTICLE; public static int RAIN_PARTICLE;
public static int CHANGELING_MAGIC;
@SideOnly(Side.CLIENT) @SideOnly(Side.CLIENT)
static void init() { static void init() {
MAGIC_PARTICLE = Particles.instance().registerParticle(EntityMagicFX::new); MAGIC_PARTICLE = Particles.instance().registerParticle(EntityMagicFX::new);
RAIN_PARTICLE = Particles.instance().registerParticle(EntityRaindropFX::new); RAIN_PARTICLE = Particles.instance().registerParticle(EntityRaindropFX::new);
CHANGELING_MAGIC = Particles.instance().registerParticle(ParticleChanglingMagic::new);
} }
} }

View file

@ -0,0 +1,33 @@
package com.minelittlepony.unicopia.particle.client;
import net.minecraft.client.particle.ParticlePortal;
import net.minecraft.world.World;
public class ParticleChanglingMagic extends ParticlePortal {
private int baseTextureIndex = 128;
public ParticleChanglingMagic(int id, World w, double x, double y, double z, double vX, double vY, double vZ, int... args) {
this(w, x, y, z, vX, vY, vZ);
}
public ParticleChanglingMagic(World world, double x, double y, double z, double dx, double dy, double dz) {
super(world, x, y, z, dx, dy, dz);
float intensity = rand.nextFloat() * 0.6F + 0.4F;
particleRed = intensity * 0.5F;
particleGreen = intensity;
particleBlue = intensity * 0.4f;
setParticleTextureIndex((int)(Math.random() * 8.0D));
}
@Override
public void onUpdate() {
setParticleTextureIndex(baseTextureIndex + (7 - particleAge * 8 / particleMaxAge));
super.onUpdate();
}
}

View file

@ -54,12 +54,12 @@ public class PowerDisguise extends PowerFeed {
@Override @Override
public void preApply(IPlayer player) { public void preApply(IPlayer player) {
player.addEnergy(2); player.addEnergy(2);
IPower.spawnParticles(UParticles.MAGIC_PARTICLE, player, 5); IPower.spawnParticles(UParticles.CHANGELING_MAGIC, player, 5);
} }
@Override @Override
public void postApply(IPlayer player) { public void postApply(IPlayer player) {
player.setEnergy(0); player.setEnergy(0);
IPower.spawnParticles(UParticles.MAGIC_PARTICLE, player, 5); IPower.spawnParticles(UParticles.CHANGELING_MAGIC, player, 5);
} }
} }

View file

@ -11,7 +11,6 @@ import net.minecraft.entity.Entity;
import net.minecraft.entity.EntityList; import net.minecraft.entity.EntityList;
import net.minecraft.entity.EntityLiving; import net.minecraft.entity.EntityLiving;
import net.minecraft.entity.EntityLivingBase; import net.minecraft.entity.EntityLivingBase;
import net.minecraft.entity.passive.EntityChicken;
import net.minecraft.entity.player.EntityPlayer; import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.inventory.EntityEquipmentSlot; import net.minecraft.inventory.EntityEquipmentSlot;
import net.minecraft.nbt.NBTTagCompound; import net.minecraft.nbt.NBTTagCompound;