Skip to content

Commit

Permalink
separate fire/fire emitter particle
Browse files Browse the repository at this point in the history
  • Loading branch information
iron431 committed Sep 3, 2024
1 parent 1a8eb14 commit 9dceade
Show file tree
Hide file tree
Showing 6 changed files with 24 additions and 12 deletions.
1 change: 1 addition & 0 deletions LATEST_CHANGES.MD
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@
- Teleport range now scales with a softcap
- Aoe Fields now fit to the ground better
- Overhauled Ancient Battlegrounds origin structure piece
- Separated Fire Particle from Fire Emitter Particle, and now use fire particle is various contexts

### Fixes
- Fixed Priest's Villager Bible trade
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,7 @@ public void spawnParticles() {
double angularness = .5;
Vec3 randomVec = new Vec3(Math.random() * 2 * angularness - angularness, Math.random() * 2 * angularness - angularness, Math.random() * 2 * angularness - angularness).normalize();
Vec3 result = (rotation.scale(3).add(randomVec)).normalize().scale(speed);
level.addParticle(ParticleHelper.FIRE, x + ox, y + oy, z + oz, result.x, result.y, result.z);
level.addParticle(ParticleHelper.FIRE_EMITTER, x + ox, y + oy, z + oz, result.x, result.y, result.z);
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ public void applyEffect(LivingEntity target) {

@Override
public float getParticleCount() {
return 0.7f * getRadius();
return 0.9f * getRadius();
}

@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -77,9 +77,10 @@ public void tick() {
subEntity.yOld = pos.y;
subEntity.zOld = pos.z;
if (level.isClientSide && i < subEntitiesLength - 1) {
for (int j = 0; j < 1; j++) {
int count = this.random.nextIntBetweenInclusive(1,2);
for (int j = 0; j < count; j++) {
Vec3 offset = partPositions.get(i + 1).subtract(pos).scale(Utils.random.nextFloat()).add(Utils.getRandomVec3(.1));
level.addParticle(ParticleHelper.FIRE, pos.x + offset.x, pos.y + Utils.random.nextFloat() * .25, pos.z + offset.z, 0, Math.random() * .3, 0);
level.addParticle(ParticleHelper.FIRE, pos.x + offset.x, pos.y + Utils.random.nextFloat() * .25 + .1, pos.z + offset.z, 0, Math.random() * .25 + 0.05, 0);
}
} else {
for (LivingEntity livingentity : this.level.getEntitiesOfClass(LivingEntity.class, subEntity.getBoundingBox().inflate(0.2D, 0.0D, 0.2D))) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,13 @@

import net.minecraft.client.multiplayer.ClientLevel;
import net.minecraft.client.particle.*;
import net.minecraft.core.particles.ParticleTypes;
import net.minecraft.core.particles.SimpleParticleType;
import net.neoforged.api.distmarker.Dist;
import net.neoforged.api.distmarker.OnlyIn;

public class DragonFireParticle extends TextureSheetParticle {
private final SpriteSet sprites;
private final boolean mirrored;

public DragonFireParticle(ClientLevel level, double xCoord, double yCoord, double zCoord, SpriteSet spriteSet, double xd, double yd, double zd) {

Expand All @@ -19,12 +19,11 @@ public DragonFireParticle(ClientLevel level, double xCoord, double yCoord, doubl
this.yd = yd;
this.zd = zd;
this.scale(this.random.nextFloat() * 1.75f + 1f);
this.lifetime = 5 + (int) (Math.random() * 20);
this.lifetime = 10 + (int) (Math.random() * 10);
sprites = spriteSet;
this.setSpriteFromAge(spriteSet);
this.gravity = -0.015F;


this.mirrored = this.random.nextBoolean();
}

@Override
Expand All @@ -34,9 +33,19 @@ public void tick() {
this.yd += this.random.nextFloat() / 100.0F;
this.zd += this.random.nextFloat() / 500.0F * (float) (this.random.nextBoolean() ? 1 : -1);
this.setSpriteFromAge(this.sprites);
if (age > lifetime * .5f && this.random.nextFloat() <= .35f) {
this.level.addParticle(ParticleTypes.SMOKE, this.x, this.y, this.z, this.xd, this.yd, this.zd);
}
// if (age > lifetime * .5f && this.random.nextFloat() <= .35f) {
// this.level.addParticle(ParticleTypes.SMOKE, this.x, this.y, this.z, this.xd, this.yd, this.zd);
// }
}

@Override
protected float getU0() {
return mirrored ? super.getU1() : super.getU0();
}

@Override
protected float getU1() {
return mirrored ? super.getU0() : super.getU1();
}

@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,8 @@

public class ParticleHelper {
//public static final ParticleOptions DRAGON_FIRE = ParticleRegistry.DRAGON_FIRE_PARTICLE.get();
public static final ParticleOptions FIRE = ParticleRegistry.FIRE_PARTICLE.get();
public static final ParticleOptions FIRE = ParticleRegistry.DRAGON_FIRE_PARTICLE.get();
public static final ParticleOptions FIRE_EMITTER = ParticleRegistry.FIRE_PARTICLE.get();
public static final ParticleOptions BLOOD = ParticleRegistry.BLOOD_PARTICLE.get();
public static final ParticleOptions WISP = ParticleRegistry.WISP_PARTICLE.get();
public static final ParticleOptions BLOOD_GROUND = ParticleRegistry.BLOOD_GROUND_PARTICLE.get();
Expand Down

0 comments on commit 9dceade

Please sign in to comment.