mirror of
https://github.com/Sollace/Unicopia.git
synced 2024-11-23 21:38:00 +01:00
Gems will produce particles of the same colour as their magic
This commit is contained in:
parent
a1da66272b
commit
898e93d8b1
9 changed files with 39 additions and 22 deletions
|
@ -1,5 +1,7 @@
|
|||
package com.minelittlepony.unicopia.particle.client;
|
||||
|
||||
import com.minelittlepony.util.render.Color;
|
||||
|
||||
import net.minecraft.client.particle.Particle;
|
||||
|
||||
import net.minecraft.client.renderer.BufferBuilder;
|
||||
|
@ -13,10 +15,10 @@ public class ParticleUnicornMagic extends Particle {
|
|||
private double portalPosZ;
|
||||
|
||||
public ParticleUnicornMagic(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);
|
||||
this(w, x, y, z, vX, vY, vZ, args.length > 0 ? args[0] : -1);
|
||||
}
|
||||
|
||||
public ParticleUnicornMagic(World w, double x, double y, double z, double vX, double vY, double vZ) {
|
||||
public ParticleUnicornMagic(World w, double x, double y, double z, double vX, double vY, double vZ, int tint) {
|
||||
super(w, x, y, z, vX, vY, vZ);
|
||||
motionX = vX;
|
||||
motionY = vY;
|
||||
|
@ -29,17 +31,32 @@ public class ParticleUnicornMagic extends Particle {
|
|||
|
||||
setParticleTextureIndex((int)(Math.random() * 8));
|
||||
|
||||
particleRed = particleGreen = particleBlue = 1;
|
||||
particleGreen *= 0.3F;
|
||||
if (tint >= 0) {
|
||||
particleRed = Color.r(tint);
|
||||
particleGreen = Color.g(tint);
|
||||
particleBlue = Color.b(tint);
|
||||
} else {
|
||||
particleRed = 1;
|
||||
particleGreen = 1;
|
||||
particleBlue = 1;
|
||||
|
||||
if (rand.nextBoolean()) particleBlue *= 0.4F;
|
||||
if (rand.nextBoolean()) particleRed *= 0.9F;
|
||||
if (rand.nextBoolean()) particleGreen += 0.5F;
|
||||
particleGreen *= 0.3F;
|
||||
|
||||
if (rand.nextBoolean()) {
|
||||
particleGreen *= 2F;
|
||||
} else if (rand.nextBoolean()) {
|
||||
particleRed *= 3.9F;
|
||||
if (rand.nextBoolean()) {
|
||||
particleBlue *= 0.4F;
|
||||
}
|
||||
if (rand.nextBoolean()) {
|
||||
particleRed *= 0.9F;
|
||||
}
|
||||
if (rand.nextBoolean()) {
|
||||
particleGreen += 0.5F;
|
||||
}
|
||||
|
||||
if (rand.nextBoolean()) {
|
||||
particleGreen *= 2F;
|
||||
} else if (rand.nextBoolean()) {
|
||||
particleRed *= 3.9F;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -42,7 +42,7 @@ public interface IPower<T extends IData> extends IKeyBind {
|
|||
return player.posY + player.getEyeHeight() - 1;
|
||||
}
|
||||
|
||||
static void spawnParticles(int particleId, Entity entity, int count) {
|
||||
static void spawnParticles(int particleId, Entity entity, int count, int...args) {
|
||||
double halfDist = entity.getEyeHeight() / 1.5;
|
||||
double middle = entity.getEntityBoundingBox().minY + halfDist;
|
||||
|
||||
|
@ -55,7 +55,7 @@ public interface IPower<T extends IData> extends IKeyBind {
|
|||
entity.posX + point.x,
|
||||
middle + point.y,
|
||||
entity.posZ + point.z,
|
||||
0, 0, 0);
|
||||
0, 0, 0, args);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -39,7 +39,7 @@ public class GenericSpell extends AbstractSpell {
|
|||
|
||||
@Override
|
||||
public void render(ICaster<?> source) {
|
||||
source.spawnParticles(UParticles.UNICORN_MAGIC, 1);
|
||||
source.spawnParticles(UParticles.UNICORN_MAGIC, 1, getTint());
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
@ -70,8 +70,8 @@ public interface ICaster<E extends EntityLivingBase> extends IOwned<E>, ILevelle
|
|||
return getEntity().getPositionVector();
|
||||
}
|
||||
|
||||
default void spawnParticles(int particleId, int count) {
|
||||
IPower.spawnParticles(particleId, getEntity(), count);
|
||||
default void spawnParticles(int particleId, int count, int...args) {
|
||||
IPower.spawnParticles(particleId, getEntity(), count, args);
|
||||
}
|
||||
|
||||
default void spawnParticles(IShape area, int count, Consumer<Vec3d> particleSpawner) {
|
||||
|
|
|
@ -49,7 +49,7 @@ public class SpellCharge extends AbstractAttachableSpell {
|
|||
IShape line = new Line(start, target.getPositionVector());
|
||||
|
||||
source.spawnParticles(line, (int)line.getVolumeOfSpawnableSpace(), pos -> {
|
||||
Particles.instance().spawnParticle(UParticles.UNICORN_MAGIC, false, pos.add(start), 0, 0, 0);
|
||||
Particles.instance().spawnParticle(UParticles.UNICORN_MAGIC, false, pos.add(start), 0, 0, 0, getTint());
|
||||
});
|
||||
}
|
||||
|
||||
|
|
|
@ -151,7 +151,7 @@ public class SpellPortal extends AbstractSpell.RangedAreaSpell implements IUseAc
|
|||
@Override
|
||||
public void render(ICaster<?> source) {
|
||||
source.spawnParticles(getPortalZone(), 10, pos -> {
|
||||
Particles.instance().spawnParticle(UParticles.UNICORN_MAGIC, false, pos, 0, 0, 0);
|
||||
Particles.instance().spawnParticle(UParticles.UNICORN_MAGIC, false, pos, 0, 0, 0, getTint());
|
||||
});
|
||||
}
|
||||
|
||||
|
|
|
@ -44,10 +44,10 @@ public class SpellReveal extends AbstractSpell {
|
|||
IShape area = new Sphere(false, 15);
|
||||
|
||||
source.spawnParticles(area, 5, pos -> {
|
||||
Particles.instance().spawnParticle(UParticles.UNICORN_MAGIC, false, pos, 0, 0, 0);
|
||||
Particles.instance().spawnParticle(UParticles.UNICORN_MAGIC, false, pos, 0, 0, 0, getTint());
|
||||
});
|
||||
|
||||
source.spawnParticles(UParticles.UNICORN_MAGIC, 5);
|
||||
source.spawnParticles(UParticles.UNICORN_MAGIC, 5, getTint());
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
@ -40,7 +40,7 @@ public class SpellShield extends AbstractSpell.RangedAreaSpell implements IAttac
|
|||
float radius = 4 + (source.getCurrentLevel() * 2);
|
||||
|
||||
source.spawnParticles(new Sphere(true, radius), (int)(radius * 6), pos -> {
|
||||
Particles.instance().spawnParticle(UParticles.UNICORN_MAGIC, false, pos, 0, 0, 0);
|
||||
Particles.instance().spawnParticle(UParticles.UNICORN_MAGIC, false, pos, 0, 0, 0, getTint());
|
||||
});
|
||||
|
||||
particlEffect
|
||||
|
|
|
@ -33,7 +33,7 @@ public class SpellVortex extends SpellShield {
|
|||
Vec3d pos = source.getOriginVector();
|
||||
|
||||
source.spawnParticles(new Sphere(false, range), range * 9, p -> {
|
||||
Particles.instance().spawnParticle(UParticles.UNICORN_MAGIC, false, p, p.subtract(pos));
|
||||
Particles.instance().spawnParticle(UParticles.UNICORN_MAGIC, false, p, p.subtract(pos), getTint());
|
||||
});
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue