diff --git a/src/main/java/com/atsuishio/superbwarfare/entity/projectile/SmokeDecoyEntity.java b/src/main/java/com/atsuishio/superbwarfare/entity/projectile/SmokeDecoyEntity.java index b4dc534ae..afb87d2a8 100644 --- a/src/main/java/com/atsuishio/superbwarfare/entity/projectile/SmokeDecoyEntity.java +++ b/src/main/java/com/atsuishio/superbwarfare/entity/projectile/SmokeDecoyEntity.java @@ -25,12 +25,23 @@ public class SmokeDecoyEntity extends Entity implements DecoyEntity { super(ModEntities.SMOKE_DECOY.get(), level); } + public int life = 400; + public int igniteTime = 4; + @Override protected void readAdditionalSaveData(@NotNull CompoundTag compoundTag) { + if (compoundTag.contains("IgniteTime")) { + this.igniteTime = compoundTag.getInt("IgniteTime"); + } + if (compoundTag.contains("Life")) { + this.life = compoundTag.getInt("Life"); + } } @Override protected void addAdditionalSaveData(@NotNull CompoundTag compoundTag) { + compoundTag.putInt("IgniteTime", igniteTime); + compoundTag.putInt("Life", life); } @Override @@ -41,7 +52,7 @@ public class SmokeDecoyEntity extends Entity implements DecoyEntity { public void tick() { super.tick(); this.move(MoverType.SELF, this.getDeltaMovement()); - if (tickCount == 4) { + if (tickCount == this.igniteTime) { if (this.level() instanceof ServerLevel serverLevel) { ParticleTool.sendParticle(serverLevel, ModParticleTypes.CUSTOM_SMOKE.get(), this.xo, this.yo, this.zo, 100, 0, 0, 0, 0.07, true); @@ -50,13 +61,13 @@ public class SmokeDecoyEntity extends Entity implements DecoyEntity { this.setDeltaMovement(Vec3.ZERO); } - if (this.tickCount > 400) { + if (this.tickCount > this.life) { this.discard(); } } public void decoyShoot(Entity entity, Vec3 shootVec, float pVelocity, float pInaccuracy) { - Vec3 vec3 = shootVec.normalize().add(this.random.triangle(0.0, 0.0172275 * (double) pInaccuracy), this.random.triangle(0.0, 0.0172275 * (double) pInaccuracy), this.random.triangle(0.0, 0.0172275 * (double) pInaccuracy)).scale((double) pVelocity); + Vec3 vec3 = shootVec.normalize().add(this.random.triangle(0.0, 0.0172275 * (double) pInaccuracy), this.random.triangle(0.0, 0.0172275 * (double) pInaccuracy), this.random.triangle(0.0, 0.0172275 * (double) pInaccuracy)).scale(pVelocity); this.setDeltaMovement(entity.getDeltaMovement().scale(0.75).add(vec3)); double d0 = vec3.horizontalDistance(); this.setYRot((float) (Mth.atan2(vec3.x, vec3.z) * 57.2957763671875));