优化近防炮拦截,调整部分载具减伤
This commit is contained in:
parent
1742e1b706
commit
15b20eb86f
5 changed files with 14 additions and 34 deletions
|
@ -60,6 +60,9 @@ public class SmallCannonShellEntity extends FastThrowableProjectile implements G
|
||||||
this.explosionDamage = explosionDamage;
|
this.explosionDamage = explosionDamage;
|
||||||
this.explosionRadius = explosionRadius;
|
this.explosionRadius = explosionRadius;
|
||||||
this.aa = aa;
|
this.aa = aa;
|
||||||
|
if (aa) {
|
||||||
|
crushProjectile(getDeltaMovement());
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public SmallCannonShellEntity setBlockInteraction(Explosion.BlockInteraction blockInteraction) {
|
public SmallCannonShellEntity setBlockInteraction(Explosion.BlockInteraction blockInteraction) {
|
||||||
|
|
|
@ -33,7 +33,6 @@ import net.minecraft.world.entity.projectile.Projectile;
|
||||||
import net.minecraft.world.item.ItemStack;
|
import net.minecraft.world.item.ItemStack;
|
||||||
import net.minecraft.world.level.Explosion;
|
import net.minecraft.world.level.Explosion;
|
||||||
import net.minecraft.world.level.Level;
|
import net.minecraft.world.level.Level;
|
||||||
import net.minecraft.world.phys.AABB;
|
|
||||||
import net.minecraft.world.phys.Vec2;
|
import net.minecraft.world.phys.Vec2;
|
||||||
import net.minecraft.world.phys.Vec3;
|
import net.minecraft.world.phys.Vec3;
|
||||||
import net.neoforged.api.distmarker.Dist;
|
import net.neoforged.api.distmarker.Dist;
|
||||||
|
@ -49,7 +48,6 @@ import software.bernie.geckolib.animatable.instance.AnimatableInstanceCache;
|
||||||
import software.bernie.geckolib.animation.AnimatableManager;
|
import software.bernie.geckolib.animation.AnimatableManager;
|
||||||
import software.bernie.geckolib.util.GeckoLibUtil;
|
import software.bernie.geckolib.util.GeckoLibUtil;
|
||||||
|
|
||||||
import java.util.Comparator;
|
|
||||||
import java.util.Optional;
|
import java.util.Optional;
|
||||||
import java.util.UUID;
|
import java.util.UUID;
|
||||||
import java.util.function.Consumer;
|
import java.util.function.Consumer;
|
||||||
|
@ -301,7 +299,7 @@ public class Hpj11Entity extends ContainerMobileVehicleEntity implements GeoEnti
|
||||||
Vec3 targetPos = target.getBoundingBox().getCenter();
|
Vec3 targetPos = target.getBoundingBox().getCenter();
|
||||||
Vec3 targetVel = target.getDeltaMovement();
|
Vec3 targetVel = target.getDeltaMovement();
|
||||||
|
|
||||||
Vec3 targetVec = RangeTool.calculateFiringSolution(barrelRootPos, targetPos, targetVel, 30, 0.03);
|
Vec3 targetVec = RangeTool.calculateFiringSolution(barrelRootPos, targetPos, targetVel, 20, 0.03);
|
||||||
|
|
||||||
double d0 = targetVec.x;
|
double d0 = targetVec.x;
|
||||||
double d1 = targetVec.y;
|
double d1 = targetVec.y;
|
||||||
|
@ -319,7 +317,6 @@ public class Hpj11Entity extends ContainerMobileVehicleEntity implements GeoEnti
|
||||||
if (target.distanceTo(this) <= 144 && VectorTool.calculateAngle(getViewVector(1), targetVec) < 10) {
|
if (target.distanceTo(this) <= 144 && VectorTool.calculateAngle(getViewVector(1), targetVec) < 10) {
|
||||||
if (checkNoClip(this, target, barrelRootPos) && entityData.get(AMMO) > 0) {
|
if (checkNoClip(this, target, barrelRootPos) && entityData.get(AMMO) > 0) {
|
||||||
vehicleShoot(player, 0);
|
vehicleShoot(player, 0);
|
||||||
findEntityOnPath(barrelRootPos, targetVec, 0.3);
|
|
||||||
} else {
|
} else {
|
||||||
changeTargetTimer++;
|
changeTargetTimer++;
|
||||||
}
|
}
|
||||||
|
@ -356,34 +353,6 @@ public class Hpj11Entity extends ContainerMobileVehicleEntity implements GeoEnti
|
||||||
return !projectile.getOwner().isAlliedTo(this.getOwner()) || (projectile.getOwner().getTeam() != null && projectile.getOwner().getTeam().getName().equals("TDM"));
|
return !projectile.getOwner().isAlliedTo(this.getOwner()) || (projectile.getOwner().getTeam() != null && projectile.getOwner().getTeam().getName().equals("TDM"));
|
||||||
}
|
}
|
||||||
|
|
||||||
public void findEntityOnPath(Vec3 pos, Vec3 toVec, double size) {
|
|
||||||
for (Entity target : level().getEntitiesOfClass(Entity.class, new AABB(pos, pos).inflate(0.125).expandTowards(toVec.scale(30)), e -> true).stream().sorted(Comparator.comparingDouble(e -> e.distanceToSqr(pos))).toList()) {
|
|
||||||
var condition = target instanceof Projectile && isThreateningEntity(this, target, size, pos) && smokeFilter(target);
|
|
||||||
if (condition) {
|
|
||||||
causeAirExplode(target.position());
|
|
||||||
target.discard();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
private void causeAirExplode(Vec3 vec3) {
|
|
||||||
CustomExplosion explosion = new CustomExplosion(this.level(), this,
|
|
||||||
ModDamageTypes.causeProjectileBoomDamage(this.level().registryAccess(),
|
|
||||||
this,
|
|
||||||
this.getOwner()),
|
|
||||||
VehicleConfig.HPJ11_EXPLOSION_DAMAGE.get().floatValue(),
|
|
||||||
vec3.x,
|
|
||||||
vec3.y,
|
|
||||||
vec3.z,
|
|
||||||
VehicleConfig.HPJ11_EXPLOSION_RADIUS.get().floatValue(),
|
|
||||||
ExplosionConfig.EXPLOSION_DESTROY.get() ? Explosion.BlockInteraction.DESTROY : Explosion.BlockInteraction.KEEP).
|
|
||||||
setDamageMultiplier(1.25f);
|
|
||||||
explosion.explode();
|
|
||||||
EventHooks.onExplosionStart(this.level(), explosion);
|
|
||||||
explosion.finalizeExplosion(false);
|
|
||||||
ParticleTool.spawnMediumExplosionParticles(this.level(), vec3);
|
|
||||||
}
|
|
||||||
|
|
||||||
public float getGunRot() {
|
public float getGunRot() {
|
||||||
return this.gunRot;
|
return this.gunRot;
|
||||||
}
|
}
|
||||||
|
@ -479,7 +448,7 @@ public class Hpj11Entity extends ContainerMobileVehicleEntity implements GeoEnti
|
||||||
Vector4f worldPosition = transformPosition(transform, 0f, 0.4f, 0);
|
Vector4f worldPosition = transformPosition(transform, 0f, 0.4f, 0);
|
||||||
|
|
||||||
entityToSpawn.setPos(worldPosition.x, worldPosition.y, worldPosition.z);
|
entityToSpawn.setPos(worldPosition.x, worldPosition.y, worldPosition.z);
|
||||||
entityToSpawn.shoot(getLookAngle().x, getLookAngle().y, getLookAngle().z, 30, 0.75f);
|
entityToSpawn.shoot(getLookAngle().x, getLookAngle().y, getLookAngle().z, 20, 0.25f);
|
||||||
level().addFreshEntity(entityToSpawn);
|
level().addFreshEntity(entityToSpawn);
|
||||||
|
|
||||||
this.entityData.set(GUN_ROTATE, entityData.get(GUN_ROTATE) + 0.5f);
|
this.entityData.set(GUN_ROTATE, entityData.get(GUN_ROTATE) + 0.5f);
|
||||||
|
|
|
@ -91,6 +91,10 @@
|
||||||
"Value": 1.5,
|
"Value": 1.5,
|
||||||
"Source": "@superbwarfare:gun_grenade"
|
"Source": "@superbwarfare:gun_grenade"
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
"Type": "Multiply",
|
||||||
|
"Value": 0.75
|
||||||
|
},
|
||||||
{
|
{
|
||||||
"Type": "Reduce",
|
"Type": "Reduce",
|
||||||
"Value": 7
|
"Value": 7
|
||||||
|
|
|
@ -96,6 +96,10 @@
|
||||||
"Value": 3,
|
"Value": 3,
|
||||||
"Source": "@superbwarfare:mortar_shell"
|
"Source": "@superbwarfare:mortar_shell"
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
"Type": "Multiply",
|
||||||
|
"Value": 0.8
|
||||||
|
},
|
||||||
{
|
{
|
||||||
"Type": "Reduce",
|
"Type": "Reduce",
|
||||||
"Value": 2
|
"Value": 2
|
||||||
|
|
|
@ -7,7 +7,7 @@
|
||||||
"DamageModifiers": [
|
"DamageModifiers": [
|
||||||
{
|
{
|
||||||
"Type": "Multiply",
|
"Type": "Multiply",
|
||||||
"Value": 0.2
|
"Value": 0.17
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"Type": "Multiply",
|
"Type": "Multiply",
|
||||||
|
|
Loading…
Add table
Reference in a new issue