优化载具烟雾弹效果

This commit is contained in:
Atsuishio 2025-05-26 12:22:24 +08:00 committed by Light_Quanta
parent d65ba026f4
commit e3600dc185
No known key found for this signature in database
GPG key ID: 11A39A1B8C890959
17 changed files with 52 additions and 30 deletions

View file

@ -41,11 +41,6 @@ public class CustomCloudParticle extends TextureSheetParticle {
this.setSpriteFromAge(spriteSet);
}
@Override
public int getLightColor(float partialTick) {
return 15728880;
}
@Override
public @NotNull ParticleRenderType getRenderType() {
return ParticleRenderType.PARTICLE_SHEET_TRANSLUCENT;

View file

@ -41,11 +41,6 @@ public class CustomSmokeParticle extends TextureSheetParticle {
this.setSpriteFromAge(spriteSet);
}
@Override
public int getLightColor(float partialTick) {
return 15728880;
}
@Override
public @NotNull ParticleRenderType getRenderType() {
return ParticleRenderType.PARTICLE_SHEET_TRANSLUCENT;

View file

@ -4,6 +4,7 @@ import com.atsuishio.superbwarfare.init.ModEntities;
import com.atsuishio.superbwarfare.init.ModParticleTypes;
import com.atsuishio.superbwarfare.init.ModSounds;
import com.atsuishio.superbwarfare.tools.ParticleTool;
import net.minecraft.core.particles.ParticleTypes;
import net.minecraft.nbt.CompoundTag;
import net.minecraft.network.syncher.SynchedEntityData;
import net.minecraft.server.level.ServerLevel;
@ -55,7 +56,9 @@ public class SmokeDecoyEntity extends Entity implements DecoyEntity {
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, 0, 0, 0, 0.07, true);
ParticleTool.sendParticle(serverLevel, ParticleTypes.LARGE_SMOKE, this.xo, this.yo, this.zo, 10, 1, 1, 1, 0.1, true);
ParticleTool.sendParticle(serverLevel, ModParticleTypes.FIRE_STAR.get(), this.xo, this.yo, this.zo, 30, 0, 0, 0, 0.2, true);
}
this.level().playSound(null, this, ModSounds.SMOKE_FIRE.get(), this.getSoundSource(), 1, random.nextFloat() * 0.05f + 1);
this.setDeltaMovement(Vec3.ZERO);

View file

@ -218,7 +218,7 @@ public class Bmp2Entity extends ContainerMobileVehicleEntity implements GeoEntit
this.terrainCompact(4f, 5f);
inertiaRotate(1);
releaseSmokeDecoy();
releaseSmokeDecoy(getTurretVector(1));
lowHealthWarning();
this.refreshDimensions();
@ -557,6 +557,13 @@ public class Bmp2Entity extends ContainerMobileVehicleEntity implements GeoEntit
return transformT;
}
public Vec3 getTurretVector(float pPartialTicks) {
Matrix4f transform = getTurretTransform(pPartialTicks);
Vector4f rootPosition = transformPosition(transform, 0, 0, 0);
Vector4f targetPosition = transformPosition(transform, 0, 0, 1);
return new Vec3(rootPosition.x, rootPosition.y, rootPosition.z).vectorTo(new Vec3(targetPosition.x, targetPosition.y, targetPosition.z));
}
public Matrix4f getTurretTransform(float ticks) {
Matrix4f transformV = getVehicleTransform(ticks);

View file

@ -171,7 +171,7 @@ public class Lav150Entity extends ContainerMobileVehicleEntity implements GeoEnt
this.terrainCompact(2.7f, 3.61f);
inertiaRotate(1.25f);
releaseSmokeDecoy();
releaseSmokeDecoy(getTurretVector(1));
this.refreshDimensions();
}
@ -429,6 +429,13 @@ public class Lav150Entity extends ContainerMobileVehicleEntity implements GeoEnt
return transformT;
}
public Vec3 getTurretVector(float pPartialTicks) {
Matrix4f transform = getTurretTransform(pPartialTicks);
Vector4f rootPosition = transformPosition(transform, 0, 0, 0);
Vector4f targetPosition = transformPosition(transform, 0, 0, 1);
return new Vec3(rootPosition.x, rootPosition.y, rootPosition.z).vectorTo(new Vec3(targetPosition.x, targetPosition.y, targetPosition.z));
}
public Matrix4f getTurretTransform(float ticks) {
Matrix4f transformV = getVehicleTransform(ticks);

View file

@ -195,7 +195,7 @@ public class PrismTankEntity extends ContainerMobileVehicleEntity implements Geo
this.terrainCompact(4.6375f, 5.171875f);
inertiaRotate(1);
releaseSmokeDecoy();
releaseSmokeDecoy(getTurretVector(1));
if (this.getFirstPassenger() instanceof Player player && fireInputDown && getWeaponIndex(0) == 1 && getEnergy() > VehicleConfig.PRISM_TANK_SHOOT_COST_MODE_2.get() && !cannotFire) {
vehicleShoot(player, 0);
@ -609,6 +609,13 @@ public class PrismTankEntity extends ContainerMobileVehicleEntity implements Geo
return transformT;
}
public Vec3 getTurretVector(float pPartialTicks) {
Matrix4f transform = getTurretTransform(pPartialTicks);
Vector4f rootPosition = transformPosition(transform, 0, 0, 0);
Vector4f targetPosition = transformPosition(transform, 0, 0, 1);
return new Vec3(rootPosition.x, rootPosition.y, rootPosition.z).vectorTo(new Vec3(targetPosition.x, targetPosition.y, targetPosition.z));
}
public Matrix4f getTurretTransform(float ticks) {
Matrix4f transformV = getVehicleTransform(ticks);

View file

@ -320,7 +320,7 @@ public class Yx100Entity extends ContainerMobileVehicleEntity implements GeoEnti
inertiaRotate(1.2f);
releaseSmokeDecoy();
releaseSmokeDecoy(getTurretVector(1));
this.refreshDimensions();
}
@ -795,6 +795,13 @@ public class Yx100Entity extends ContainerMobileVehicleEntity implements GeoEnti
return new Vec3(rootPosition.x, rootPosition.y, rootPosition.z).vectorTo(new Vec3(targetPosition.x, targetPosition.y, targetPosition.z));
}
public Vec3 getTurretVector(float pPartialTicks) {
Matrix4f transform = getTurretTransform(pPartialTicks);
Vector4f rootPosition = transformPosition(transform, 0, 0, 0);
Vector4f targetPosition = transformPosition(transform, 0, 0, 1);
return new Vec3(rootPosition.x, rootPosition.y, rootPosition.z).vectorTo(new Vec3(targetPosition.x, targetPosition.y, targetPosition.z));
}
public Vec3 getGunnerVector(float pPartialTicks) {
Matrix4f transform = getGunnerBarrelTransform(pPartialTicks);
Vector4f rootPosition = transformPosition(transform, 0, 0, 0);

View file

@ -288,17 +288,18 @@ public abstract class MobileVehicleEntity extends EnergyVehicleEntity implements
}
//烟雾诱饵
public void releaseSmokeDecoy() {
public void releaseSmokeDecoy(Vec3 vec3) {
if (decoyInputDown) {
if (this.entityData.get(DECOY_COUNT) > 0 && this.level() instanceof ServerLevel) {
for (int i = 0; i < 16; i++) {
SmokeDecoyEntity smokeDecoyEntity = new SmokeDecoyEntity(this.level());
smokeDecoyEntity.setPos(this.getX(), this.getY() + 2, this.getZ());
smokeDecoyEntity.decoyShoot(this, this.getViewVector(1).yRot((11.25F + 22.5F * i) * Mth.DEG_TO_RAD), 3.2f, 8);
Entity passenger = getFirstPassenger();
for (int i = 0; i < 8; i++) {
SmokeDecoyEntity smokeDecoyEntity = new SmokeDecoyEntity((LivingEntity) passenger, this.level());
smokeDecoyEntity.setPos(this.getX(), this.getY() + getBbHeight(), this.getZ());
smokeDecoyEntity.decoyShoot(this, vec3.yRot((-78.75f + 22.5F * i) * Mth.DEG_TO_RAD), 4f, 8);
this.level().addFreshEntity(smokeDecoyEntity);
}
this.level().playSound(null, this, ModSounds.DECOY_FIRE.get(), this.getSoundSource(), 1, 1);
decoyReloadCoolDown = 400;
decoyReloadCoolDown = 500;
this.getEntityData().set(DECOY_COUNT, this.getEntityData().get(DECOY_COUNT) - 1);
}
decoyInputDown = false;
@ -306,7 +307,7 @@ public abstract class MobileVehicleEntity extends EnergyVehicleEntity implements
if (this.entityData.get(DECOY_COUNT) < 1 && decoyReloadCoolDown == 0 && this.level() instanceof ServerLevel) {
this.entityData.set(DECOY_COUNT, this.entityData.get(DECOY_COUNT) + 1);
this.level().playSound(null, this, ModSounds.DECOY_RELOAD.get(), this.getSoundSource(), 1, 1);
decoyReloadCoolDown = 400;
decoyReloadCoolDown = 500;
}
}

View file

@ -1,12 +1,12 @@
{
"textures": [
"minecraft:generic_0",
"minecraft:generic_1",
"minecraft:generic_2",
"minecraft:generic_3",
"minecraft:generic_4",
"minecraft:generic_5",
"minecraft:generic_6",
"minecraft:generic_7"
"superbwarfare:generic_0",
"superbwarfare:generic_1",
"superbwarfare:generic_2",
"superbwarfare:generic_3",
"superbwarfare:generic_4",
"superbwarfare:generic_5",
"superbwarfare:generic_6",
"superbwarfare:generic_7"
]
}

Binary file not shown.

After

Width:  |  Height:  |  Size: 159 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 197 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 266 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 351 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 410 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 472 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 490 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 487 B