more particle spawning rewrite

This commit is contained in:
Jenny 2025-01-27 23:29:42 +01:00
parent 339c466c88
commit 23942c9972
Signed by: Jenny
GPG Key ID: 2072A14E40940632
4 changed files with 10 additions and 10 deletions

View File

@ -38,7 +38,7 @@ mod_name=Enhanced Explosives
# The license of the mod. Review your options at https://choosealicense.com/. All Rights Reserved is the default.
mod_license=All Rights Reserved
# The mod version. See https://semver.org/
mod_version=0.9.0
mod_version=0.9.1
# The group ID for the mod. It is only important when publishing as an artifact to a Maven repository.
# This should match the base package used for the mod sources.
# See https://maven.apache.org/guides/mini/guide-naming-conventions.html

View File

@ -1,6 +1,5 @@
package com.jenny.enhancedexplosives.entities.tnt;
import com.jenny.enhancedexplosives.blocks.blocks;
import com.jenny.enhancedexplosives.entities.entities;
import net.minecraft.world.entity.EntityType;
import net.minecraft.world.entity.LivingEntity;

View File

@ -1,5 +1,6 @@
package com.jenny.enhancedexplosives.entities.tnt;
import com.jenny.enhancedexplosives.config.ConfigClient;
import net.minecraft.core.particles.ParticleTypes;
import net.minecraft.nbt.CompoundTag;
import net.minecraft.network.syncher.EntityDataAccessor;
@ -66,7 +67,9 @@ public abstract class basePrimedTNT extends Entity implements TraceableEntity {
public void tick() {
if (level().isClientSide) {
spawnParticles(0);
if (ConfigClient.tntParticles) {
spawnParticles();
}
}
if (!this.isNoGravity()) {
this.setDeltaMovement(this.getDeltaMovement().add(0.0D, -0.04D, 0.0D));
@ -87,9 +90,6 @@ public abstract class basePrimedTNT extends Entity implements TraceableEntity {
}
} else {
this.updateInWaterStateAndDoFluidPushing();
if (this.level().isClientSide) {
this.level().addParticle(ParticleTypes.SMOKE, this.getX(), this.getY() + 0.5D, this.getZ(), 0.0D, 0.0D, 0.0D);
}
}
}
@ -138,5 +138,7 @@ public abstract class basePrimedTNT extends Entity implements TraceableEntity {
return this.fuse;
}
public void spawnParticles(float partialTicks) {}
public void spawnParticles() {
level().addParticle(ParticleTypes.SMOKE, getX(), getY(), getZ(), 0, 0, 0);
}
}

View File

@ -96,10 +96,9 @@ public class homingPrimedTNT extends basePrimedTNT {
}
@Override
public void spawnParticles(float partialTicks) {
Vec3 pos = getPosition(partialTicks);
public void spawnParticles() {
for (int i = 1; i <= ConfigClient.calcPCount(1); i++) {
level().addParticle(ParticleTypes.FLAME, pos.x, pos.y, pos.z, 0, 0, 0);
level().addParticle(ParticleTypes.FLAME, getX(), getY(), getZ(), 0, 0, 0);
}
}