mirror of
https://github.com/Sollace/Unicopia.git
synced 2024-11-27 23:27:59 +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;
|
package com.minelittlepony.unicopia.particle.client;
|
||||||
|
|
||||||
|
import com.minelittlepony.util.render.Color;
|
||||||
|
|
||||||
import net.minecraft.client.particle.Particle;
|
import net.minecraft.client.particle.Particle;
|
||||||
|
|
||||||
import net.minecraft.client.renderer.BufferBuilder;
|
import net.minecraft.client.renderer.BufferBuilder;
|
||||||
|
@ -13,10 +15,10 @@ public class ParticleUnicornMagic extends Particle {
|
||||||
private double portalPosZ;
|
private double portalPosZ;
|
||||||
|
|
||||||
public ParticleUnicornMagic(int id, World w, double x, double y, double z, double vX, double vY, double vZ, int... args) {
|
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);
|
super(w, x, y, z, vX, vY, vZ);
|
||||||
motionX = vX;
|
motionX = vX;
|
||||||
motionY = vY;
|
motionY = vY;
|
||||||
|
@ -29,12 +31,26 @@ public class ParticleUnicornMagic extends Particle {
|
||||||
|
|
||||||
setParticleTextureIndex((int)(Math.random() * 8));
|
setParticleTextureIndex((int)(Math.random() * 8));
|
||||||
|
|
||||||
particleRed = particleGreen = particleBlue = 1;
|
if (tint >= 0) {
|
||||||
|
particleRed = Color.r(tint);
|
||||||
|
particleGreen = Color.g(tint);
|
||||||
|
particleBlue = Color.b(tint);
|
||||||
|
} else {
|
||||||
|
particleRed = 1;
|
||||||
|
particleGreen = 1;
|
||||||
|
particleBlue = 1;
|
||||||
|
|
||||||
particleGreen *= 0.3F;
|
particleGreen *= 0.3F;
|
||||||
|
|
||||||
if (rand.nextBoolean()) particleBlue *= 0.4F;
|
if (rand.nextBoolean()) {
|
||||||
if (rand.nextBoolean()) particleRed *= 0.9F;
|
particleBlue *= 0.4F;
|
||||||
if (rand.nextBoolean()) particleGreen += 0.5F;
|
}
|
||||||
|
if (rand.nextBoolean()) {
|
||||||
|
particleRed *= 0.9F;
|
||||||
|
}
|
||||||
|
if (rand.nextBoolean()) {
|
||||||
|
particleGreen += 0.5F;
|
||||||
|
}
|
||||||
|
|
||||||
if (rand.nextBoolean()) {
|
if (rand.nextBoolean()) {
|
||||||
particleGreen *= 2F;
|
particleGreen *= 2F;
|
||||||
|
@ -42,6 +58,7 @@ public class ParticleUnicornMagic extends Particle {
|
||||||
particleRed *= 3.9F;
|
particleRed *= 3.9F;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
public void renderParticle(BufferBuilder renderer, Entity e, float p_70539_2_, float p_70539_3_, float p_70539_4_, float p_70539_5_, float p_70539_6_, float p_70539_7_) {
|
public void renderParticle(BufferBuilder renderer, Entity e, float p_70539_2_, float p_70539_3_, float p_70539_4_, float p_70539_5_, float p_70539_6_, float p_70539_7_) {
|
||||||
float f6 = 1 - ((particleAge + p_70539_2_) / particleMaxAge);
|
float f6 = 1 - ((particleAge + p_70539_2_) / particleMaxAge);
|
||||||
|
|
|
@ -42,7 +42,7 @@ public interface IPower<T extends IData> extends IKeyBind {
|
||||||
return player.posY + player.getEyeHeight() - 1;
|
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 halfDist = entity.getEyeHeight() / 1.5;
|
||||||
double middle = entity.getEntityBoundingBox().minY + halfDist;
|
double middle = entity.getEntityBoundingBox().minY + halfDist;
|
||||||
|
|
||||||
|
@ -55,7 +55,7 @@ public interface IPower<T extends IData> extends IKeyBind {
|
||||||
entity.posX + point.x,
|
entity.posX + point.x,
|
||||||
middle + point.y,
|
middle + point.y,
|
||||||
entity.posZ + point.z,
|
entity.posZ + point.z,
|
||||||
0, 0, 0);
|
0, 0, 0, args);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -39,7 +39,7 @@ public class GenericSpell extends AbstractSpell {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void render(ICaster<?> source) {
|
public void render(ICaster<?> source) {
|
||||||
source.spawnParticles(UParticles.UNICORN_MAGIC, 1);
|
source.spawnParticles(UParticles.UNICORN_MAGIC, 1, getTint());
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|
|
@ -70,8 +70,8 @@ public interface ICaster<E extends EntityLivingBase> extends IOwned<E>, ILevelle
|
||||||
return getEntity().getPositionVector();
|
return getEntity().getPositionVector();
|
||||||
}
|
}
|
||||||
|
|
||||||
default void spawnParticles(int particleId, int count) {
|
default void spawnParticles(int particleId, int count, int...args) {
|
||||||
IPower.spawnParticles(particleId, getEntity(), count);
|
IPower.spawnParticles(particleId, getEntity(), count, args);
|
||||||
}
|
}
|
||||||
|
|
||||||
default void spawnParticles(IShape area, int count, Consumer<Vec3d> particleSpawner) {
|
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());
|
IShape line = new Line(start, target.getPositionVector());
|
||||||
|
|
||||||
source.spawnParticles(line, (int)line.getVolumeOfSpawnableSpace(), pos -> {
|
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
|
@Override
|
||||||
public void render(ICaster<?> source) {
|
public void render(ICaster<?> source) {
|
||||||
source.spawnParticles(getPortalZone(), 10, pos -> {
|
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);
|
IShape area = new Sphere(false, 15);
|
||||||
|
|
||||||
source.spawnParticles(area, 5, pos -> {
|
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
|
@Override
|
||||||
|
|
|
@ -40,7 +40,7 @@ public class SpellShield extends AbstractSpell.RangedAreaSpell implements IAttac
|
||||||
float radius = 4 + (source.getCurrentLevel() * 2);
|
float radius = 4 + (source.getCurrentLevel() * 2);
|
||||||
|
|
||||||
source.spawnParticles(new Sphere(true, radius), (int)(radius * 6), pos -> {
|
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
|
particlEffect
|
||||||
|
|
|
@ -33,7 +33,7 @@ public class SpellVortex extends SpellShield {
|
||||||
Vec3d pos = source.getOriginVector();
|
Vec3d pos = source.getOriginVector();
|
||||||
|
|
||||||
source.spawnParticles(new Sphere(false, range), range * 9, p -> {
|
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