调整火炮粒子效果和数据

This commit is contained in:
Atsuihsio 2024-09-12 11:07:17 +08:00
parent 5439d3e0ab
commit 4ae291db84
4 changed files with 86 additions and 96 deletions

View file

@ -12,6 +12,7 @@ import net.minecraft.network.chat.Component;
import net.minecraft.resources.ResourceLocation; import net.minecraft.resources.ResourceLocation;
import net.minecraft.util.Mth; import net.minecraft.util.Mth;
import net.minecraft.world.entity.Entity; import net.minecraft.world.entity.Entity;
import net.minecraft.world.entity.LivingEntity;
import net.minecraft.world.entity.player.Player; import net.minecraft.world.entity.player.Player;
import net.minecraft.world.level.ClipContext; import net.minecraft.world.level.ClipContext;
import net.minecraft.world.phys.Vec3; import net.minecraft.world.phys.Vec3;
@ -68,9 +69,9 @@ public class CannonHudOverlay {
double entity_range = 0; double entity_range = 0;
if (lookingEntity != null) { if (lookingEntity instanceof LivingEntity living) {
lookAtEntity = true; lookAtEntity = true;
entity_range = player.distanceTo(lookingEntity); entity_range = player.distanceTo(living);
} }
if (lookAtEntity) { if (lookAtEntity) {
event.getGuiGraphics().drawString(Minecraft.getInstance().font, Component.translatable("des.superbwarfare.drone.range") event.getGuiGraphics().drawString(Minecraft.getInstance().font, Component.translatable("des.superbwarfare.drone.range")

View file

@ -122,7 +122,7 @@ public class Mk42Entity extends PathfinderMob implements GeoEntity, ICannonEntit
if (amount < 32) { if (amount < 32) {
return false; return false;
} }
return super.hurt(source, amount - 32); return super.hurt(source, 0.3f * amount);
} }
@Override @Override
@ -216,7 +216,7 @@ public class Mk42Entity extends PathfinderMob implements GeoEntity, ICannonEntit
int durability = 0; int durability = 0;
if (stack.is(ModItems.HE_5_INCHES.get())) { if (stack.is(ModItems.HE_5_INCHES.get())) {
hitDamage = 100; hitDamage = 600;
explosionRadius = 10; explosionRadius = 10;
explosionDamage = 200; explosionDamage = 200;
fireProbability = 0.18F; fireProbability = 0.18F;
@ -224,7 +224,7 @@ public class Mk42Entity extends PathfinderMob implements GeoEntity, ICannonEntit
} }
if (stack.is(ModItems.AP_5_INCHES.get())) { if (stack.is(ModItems.AP_5_INCHES.get())) {
hitDamage = 450; hitDamage = 850;
explosionRadius = 3; explosionRadius = 3;
explosionDamage = 250; explosionDamage = 250;
fireProbability = 0; fireProbability = 0;
@ -257,7 +257,7 @@ public class Mk42Entity extends PathfinderMob implements GeoEntity, ICannonEntit
this.getX() + 5 * this.getLookAngle().x, this.getX() + 5 * this.getLookAngle().x,
this.getY(), this.getY(),
this.getZ() + 5 * this.getLookAngle().z, this.getZ() + 5 * this.getLookAngle().z,
200, 5, 0.02, 5, 0.005); 100, 7, 0.02, 7, 0.005);
double x = this.getX() + 9 * this.getLookAngle().x; double x = this.getX() + 9 * this.getLookAngle().x;
double y = this.getEyeY() + 9 * this.getLookAngle().y; double y = this.getEyeY() + 9 * this.getLookAngle().y;
@ -267,42 +267,15 @@ public class Mk42Entity extends PathfinderMob implements GeoEntity, ICannonEntit
server.sendParticles(ParticleTypes.CLOUD, x, y, z, 10, 0.4, 0.4, 0.4, 0.0075); server.sendParticles(ParticleTypes.CLOUD, x, y, z, 10, 0.4, 0.4, 0.4, 0.0075);
int count = 6;
for (float i = 9.5f; i < 16; i += .5f) {
server.sendParticles(ParticleTypes.CAMPFIRE_COSY_SMOKE, server.sendParticles(ParticleTypes.CAMPFIRE_COSY_SMOKE,
this.getX() + 9.5 * this.getLookAngle().x, this.getX() + i * this.getLookAngle().x,
this.getEyeY() + 9.5 * this.getLookAngle().y, this.getEyeY() + i * this.getLookAngle().y,
this.getZ() + 9.5 * this.getLookAngle().z, this.getZ() + i * this.getLookAngle().z,
5, 0.15, 0.15, 0.15, 0.0075); Mth.clamp(count--,1,5), 0.15, 0.15, 0.15, 0.0025);
}
server.sendParticles(ParticleTypes.CAMPFIRE_COSY_SMOKE,
this.getX() + 10 * this.getLookAngle().x,
this.getEyeY() + 10 * this.getLookAngle().y,
this.getZ() + 10 * this.getLookAngle().z,
4, 0.15, 0.15, 0.15, 0.0075);
server.sendParticles(ParticleTypes.CAMPFIRE_COSY_SMOKE,
this.getX() + 11.5 * this.getLookAngle().x,
this.getEyeY() + 11.5 * this.getLookAngle().y,
this.getZ() + 11.5 * this.getLookAngle().z,
3, 0.15, 0.15, 0.15, 0.0075);
server.sendParticles(ParticleTypes.CAMPFIRE_COSY_SMOKE,
this.getX() + 12 * this.getLookAngle().x,
this.getEyeY() + 12 * this.getLookAngle().y,
this.getZ() + 12 * this.getLookAngle().z,
2, 0.15, 0.15, 0.15, 0.0075);
server.sendParticles(ParticleTypes.CAMPFIRE_COSY_SMOKE,
this.getX() + 12.5 * this.getLookAngle().x,
this.getEyeY() + 12.5 * this.getLookAngle().y,
this.getZ() + 12.5 * this.getLookAngle().z,
2, 0.15, 0.15, 0.15, 0.0075);
server.sendParticles(ParticleTypes.CAMPFIRE_COSY_SMOKE,
this.getX() + 13 * this.getLookAngle().x,
this.getEyeY() + 13 * this.getLookAngle().y,
this.getZ() + 13 * this.getLookAngle().z,
1, 0.15, 0.15, 0.15, 0.0075);
} }
} }

View file

@ -124,7 +124,7 @@ public class Mle1934Entity extends PathfinderMob implements GeoEntity, ICannonEn
if (amount < 34) { if (amount < 34) {
return false; return false;
} }
return super.hurt(source, amount - 34); return super.hurt(source, 0.3f * amount);
} }
@Override @Override
@ -213,7 +213,7 @@ public class Mle1934Entity extends PathfinderMob implements GeoEntity, ICannonEn
boolean salvoShoot = false; boolean salvoShoot = false;
if (stack.is(ModItems.HE_5_INCHES.get())) { if (stack.is(ModItems.HE_5_INCHES.get())) {
hitDamage = 130; hitDamage = 700;
explosionRadius = 13; explosionRadius = 13;
explosionDamage = 250; explosionDamage = 250;
fireProbability = 0.24F; fireProbability = 0.24F;
@ -222,7 +222,7 @@ public class Mle1934Entity extends PathfinderMob implements GeoEntity, ICannonEn
} }
if (stack.is(ModItems.AP_5_INCHES.get())) { if (stack.is(ModItems.AP_5_INCHES.get())) {
hitDamage = 550; hitDamage = 1000;
explosionRadius = 3.8f; explosionRadius = 3.8f;
explosionDamage = 300; explosionDamage = 300;
fireProbability = 0; fireProbability = 0;
@ -241,7 +241,7 @@ public class Mle1934Entity extends PathfinderMob implements GeoEntity, ICannonEn
} }
yRot = yRot + 90 % 360; yRot = yRot + 90 % 360;
var leftPos = new Vector3d(7.2, 0, -0.45); var leftPos = new Vector3d(0, 0, -0.45);
leftPos.rotateZ(-this.getXRot() * Mth.DEG_TO_RAD); leftPos.rotateZ(-this.getXRot() * Mth.DEG_TO_RAD);
leftPos.rotateY(-yRot * Mth.DEG_TO_RAD); leftPos.rotateY(-yRot * Mth.DEG_TO_RAD);
@ -255,9 +255,40 @@ public class Mle1934Entity extends PathfinderMob implements GeoEntity, ICannonEn
entityToSpawnLeft.shoot(this.getLookAngle().x, this.getLookAngle().y, this.getLookAngle().z, 15, 0.05f); entityToSpawnLeft.shoot(this.getLookAngle().x, this.getLookAngle().y, this.getLookAngle().z, 15, 0.05f);
level.addFreshEntity(entityToSpawnLeft); level.addFreshEntity(entityToSpawnLeft);
var leftPosP1 = new Vector3d(7, 0, -0.45);
leftPosP1.rotateZ(-this.getXRot() * Mth.DEG_TO_RAD);
leftPosP1.rotateY(-yRot * Mth.DEG_TO_RAD);
server.sendParticles(ParticleTypes.CAMPFIRE_COSY_SMOKE,
this.getX() + leftPosP1.x,
this.getEyeY() - 0.2 + leftPosP1.y,
this.getZ() + leftPosP1.z,
10, 0.4, 0.4, 0.4, 0.0075);
server.sendParticles(ParticleTypes.CLOUD,
this.getX() + leftPosP1.x,
this.getEyeY() - 0.2 + leftPosP1.y,
this.getZ() + leftPosP1.z,
10, 0.4, 0.4, 0.4, 0.0075);
int count = 5;
for (float i = 9.5f; i < 14; i += .5f) {
var leftPosP = new Vector3d(i, 0, -0.45);
leftPosP.rotateZ(-this.getXRot() * Mth.DEG_TO_RAD);
leftPosP.rotateY(-yRot * Mth.DEG_TO_RAD);
server.sendParticles(ParticleTypes.CAMPFIRE_COSY_SMOKE,
this.getX() + leftPosP.x,
this.getEyeY() - 0.2 + leftPosP.y,
this.getZ() + leftPosP.z,
Mth.clamp(count--,1,5), 0.1, 0.1, 0.1, 0.002);
}
//右炮管 //右炮管
if (salvoShoot) { if (salvoShoot) {
var rightPos = new Vector3d(7.2, 0, 0.45); var rightPos = new Vector3d(0, 0, 0.45);
rightPos.rotateZ(-this.getXRot() * Mth.DEG_TO_RAD); rightPos.rotateZ(-this.getXRot() * Mth.DEG_TO_RAD);
rightPos.rotateY(-yRot * Mth.DEG_TO_RAD); rightPos.rotateY(-yRot * Mth.DEG_TO_RAD);
@ -270,6 +301,37 @@ public class Mle1934Entity extends PathfinderMob implements GeoEntity, ICannonEn
entityToSpawnRight.shoot(this.getLookAngle().x, this.getLookAngle().y, this.getLookAngle().z, 15, 0.05f); entityToSpawnRight.shoot(this.getLookAngle().x, this.getLookAngle().y, this.getLookAngle().z, 15, 0.05f);
level.addFreshEntity(entityToSpawnRight); level.addFreshEntity(entityToSpawnRight);
var rightPosP1 = new Vector3d(7, 0, 0.45);
rightPosP1.rotateZ(-this.getXRot() * Mth.DEG_TO_RAD);
rightPosP1.rotateY(-yRot * Mth.DEG_TO_RAD);
server.sendParticles(ParticleTypes.CAMPFIRE_COSY_SMOKE,
this.getX() + rightPosP1.x,
this.getEyeY() - 0.2 + rightPosP1.y,
this.getZ() + rightPosP1.z,
10, 0.4, 0.4, 0.4, 0.0075);
server.sendParticles(ParticleTypes.CLOUD,
this.getX() + rightPosP1.x,
this.getEyeY() - 0.2 + rightPosP1.y,
this.getZ() + rightPosP1.z,
10, 0.4, 0.4, 0.4, 0.0075);
int countR = 5;
for (float i = 9.5f; i < 14; i += .5f) {
var rightPosP = new Vector3d(i, 0, 0.45);
rightPosP.rotateZ(-this.getXRot() * Mth.DEG_TO_RAD);
rightPosP.rotateY(-yRot * Mth.DEG_TO_RAD);
server.sendParticles(ParticleTypes.CAMPFIRE_COSY_SMOKE,
this.getX() + rightPosP.x,
this.getEyeY() - 0.2 + rightPosP.y,
this.getZ() + rightPosP.z,
Mth.clamp(countR--,1,5), 0.1, 0.1, 0.1, 0.002);
}
player.getCapability(ModVariables.PLAYER_VARIABLES_CAPABILITY, null).ifPresent(capability -> capability.recoilHorizon = 1); player.getCapability(ModVariables.PLAYER_VARIABLES_CAPABILITY, null).ifPresent(capability -> capability.recoilHorizon = 1);
} else { } else {
player.getCapability(ModVariables.PLAYER_VARIABLES_CAPABILITY, null).ifPresent(capability -> capability.recoilHorizon = -1); player.getCapability(ModVariables.PLAYER_VARIABLES_CAPABILITY, null).ifPresent(capability -> capability.recoilHorizon = -1);
@ -289,51 +351,8 @@ public class Mle1934Entity extends PathfinderMob implements GeoEntity, ICannonEn
this.getX() + 5 * this.getLookAngle().x, this.getX() + 5 * this.getLookAngle().x,
this.getY(), this.getY(),
this.getZ() + 5 * this.getLookAngle().z, this.getZ() + 5 * this.getLookAngle().z,
200, 5, 0.02, 5, 0.005); 100, 7, 0.02, 7, 0.005);
double x = this.getX() + 9 * this.getLookAngle().x;
double y = this.getEyeY() + 9 * this.getLookAngle().y;
double z = this.getZ() + 9 * this.getLookAngle().z;
server.sendParticles(ParticleTypes.CAMPFIRE_COSY_SMOKE, x, y, z, 10, 0.4, 0.4, 0.4, 0.0075);
server.sendParticles(ParticleTypes.CLOUD, x, y, z, 10, 0.4, 0.4, 0.4, 0.0075);
server.sendParticles(ParticleTypes.CAMPFIRE_COSY_SMOKE,
this.getX() + 9.5 * this.getLookAngle().x,
this.getEyeY() + 9.5 * this.getLookAngle().y,
this.getZ() + 9.5 * this.getLookAngle().z,
5, 0.15, 0.15, 0.15, 0.0075);
server.sendParticles(ParticleTypes.CAMPFIRE_COSY_SMOKE,
this.getX() + 10 * this.getLookAngle().x,
this.getEyeY() + 10 * this.getLookAngle().y,
this.getZ() + 10 * this.getLookAngle().z,
4, 0.15, 0.15, 0.15, 0.0075);
server.sendParticles(ParticleTypes.CAMPFIRE_COSY_SMOKE,
this.getX() + 11.5 * this.getLookAngle().x,
this.getEyeY() + 11.5 * this.getLookAngle().y,
this.getZ() + 11.5 * this.getLookAngle().z,
3, 0.15, 0.15, 0.15, 0.0075);
server.sendParticles(ParticleTypes.CAMPFIRE_COSY_SMOKE,
this.getX() + 12 * this.getLookAngle().x,
this.getEyeY() + 12 * this.getLookAngle().y,
this.getZ() + 12 * this.getLookAngle().z,
2, 0.15, 0.15, 0.15, 0.0075);
server.sendParticles(ParticleTypes.CAMPFIRE_COSY_SMOKE,
this.getX() + 12.5 * this.getLookAngle().x,
this.getEyeY() + 12.5 * this.getLookAngle().y,
this.getZ() + 12.5 * this.getLookAngle().z,
2, 0.15, 0.15, 0.15, 0.0075);
server.sendParticles(ParticleTypes.CAMPFIRE_COSY_SMOKE,
this.getX() + 13 * this.getLookAngle().x,
this.getEyeY() + 13 * this.getLookAngle().y,
this.getZ() + 13 * this.getLookAngle().z,
1, 0.15, 0.15, 0.15, 0.0075);
} }
} }

View file

@ -119,14 +119,14 @@ public class JavelinMissileEntity extends ThrowableItemProjectile implements Geo
} }
if (entity instanceof Monster monster) { if (entity instanceof Monster monster) {
monster.hurt(ModDamageTypes.causeCannonFireDamage(this.level().registryAccess(), this, this.getOwner()), this.damage * damageMultiplier); monster.hurt(ModDamageTypes.causeCannonFireDamage(this.level().registryAccess(), this, this.getOwner()), 2 * this.damage * damageMultiplier);
} else { } else {
entity.hurt(ModDamageTypes.causeCannonFireDamage(this.level().registryAccess(), this, this.getOwner()), this.damage); entity.hurt(ModDamageTypes.causeCannonFireDamage(this.level().registryAccess(), this, this.getOwner()), 2 * this.damage);
} }
if (this.tickCount > 1) { if (this.tickCount > 1) {
if (this.level() instanceof ServerLevel) { if (this.level() instanceof ServerLevel) {
ProjectileTool.causeCustomExplode(this, entity, this.damage, 8.0f, this.monsterMultiplier); ProjectileTool.causeCustomExplode(this, entity, 1.25f *this.damage, 8.0f, this.monsterMultiplier);
} }
} }
@ -187,9 +187,6 @@ public class JavelinMissileEntity extends ThrowableItemProjectile implements Geo
} else { } else {
this.look(EntityAnchorArgument.Anchor.EYES, new Vec3(entity.getX(), entity.getEyeY() + (entity instanceof EnderDragon ? -3 : 1), entity.getZ())); this.look(EntityAnchorArgument.Anchor.EYES, new Vec3(entity.getX(), entity.getEyeY() + (entity instanceof EnderDragon ? -3 : 1), entity.getZ()));
} }
if (this.position().distanceTo(entity.position()) < 4) {
ProjectileTool.causeCustomExplode(this, entity, this.damage, 8.0f, this.monsterMultiplier);
}
} }
} }