部分弹射物能够被击落,调整数值

This commit is contained in:
Atsuishio 2025-04-10 17:17:34 +08:00 committed by Light_Quanta
parent ca6378b6d2
commit dab59fce2a
No known key found for this signature in database
GPG key ID: 11A39A1B8C890959
13 changed files with 192 additions and 49 deletions

View file

@ -0,0 +1,4 @@
package com.atsuishio.superbwarfare.entity.projectile;
public interface DestroyableProjectileEntity {
}

View file

@ -10,6 +10,7 @@ import com.atsuishio.superbwarfare.network.message.receive.ClientIndicatorMessag
import com.atsuishio.superbwarfare.tools.*; import com.atsuishio.superbwarfare.tools.*;
import net.minecraft.core.BlockPos; import net.minecraft.core.BlockPos;
import net.minecraft.core.particles.ParticleTypes; import net.minecraft.core.particles.ParticleTypes;
import net.minecraft.nbt.CompoundTag;
import net.minecraft.network.syncher.EntityDataAccessor; import net.minecraft.network.syncher.EntityDataAccessor;
import net.minecraft.network.syncher.EntityDataSerializers; import net.minecraft.network.syncher.EntityDataSerializers;
import net.minecraft.network.syncher.SynchedEntityData; import net.minecraft.network.syncher.SynchedEntityData;
@ -18,12 +19,16 @@ import net.minecraft.server.level.ServerPlayer;
import net.minecraft.sounds.SoundEvents; import net.minecraft.sounds.SoundEvents;
import net.minecraft.sounds.SoundSource; import net.minecraft.sounds.SoundSource;
import net.minecraft.util.Mth; import net.minecraft.util.Mth;
import net.minecraft.world.damagesource.DamageSource;
import net.minecraft.world.damagesource.DamageTypes;
import net.minecraft.world.entity.AreaEffectCloud;
import net.minecraft.world.entity.Entity; import net.minecraft.world.entity.Entity;
import net.minecraft.world.entity.EntityType; import net.minecraft.world.entity.EntityType;
import net.minecraft.world.entity.LivingEntity; import net.minecraft.world.entity.LivingEntity;
import net.minecraft.world.entity.animal.Pig; import net.minecraft.world.entity.animal.Pig;
import net.minecraft.world.entity.boss.enderdragon.EnderDragon; import net.minecraft.world.entity.boss.enderdragon.EnderDragon;
import net.minecraft.world.entity.monster.Monster; import net.minecraft.world.entity.monster.Monster;
import net.minecraft.world.entity.projectile.ThrownPotion;
import net.minecraft.world.item.Item; import net.minecraft.world.item.Item;
import net.minecraft.world.level.Explosion; import net.minecraft.world.level.Explosion;
import net.minecraft.world.level.Level; import net.minecraft.world.level.Level;
@ -43,8 +48,8 @@ import software.bernie.geckolib.util.GeckoLibUtil;
import java.util.List; import java.util.List;
public class JavelinMissileEntity extends FastThrowableProjectile implements GeoEntity { public class JavelinMissileEntity extends FastThrowableProjectile implements GeoEntity, DestroyableProjectileEntity {
public static final EntityDataAccessor<Float> HEALTH = SynchedEntityData.defineId(JavelinMissileEntity.class, EntityDataSerializers.FLOAT);
public static final EntityDataAccessor<String> TARGET_UUID = SynchedEntityData.defineId(JavelinMissileEntity.class, EntityDataSerializers.STRING); public static final EntityDataAccessor<String> TARGET_UUID = SynchedEntityData.defineId(JavelinMissileEntity.class, EntityDataSerializers.STRING);
public static final EntityDataAccessor<Boolean> TOP = SynchedEntityData.defineId(JavelinMissileEntity.class, EntityDataSerializers.BOOLEAN); public static final EntityDataAccessor<Boolean> TOP = SynchedEntityData.defineId(JavelinMissileEntity.class, EntityDataSerializers.BOOLEAN);
public static final EntityDataAccessor<Float> TARGET_X = SynchedEntityData.defineId(JavelinMissileEntity.class, EntityDataSerializers.FLOAT); public static final EntityDataAccessor<Float> TARGET_X = SynchedEntityData.defineId(JavelinMissileEntity.class, EntityDataSerializers.FLOAT);
@ -91,16 +96,60 @@ public class JavelinMissileEntity extends FastThrowableProjectile implements Geo
this.entityData.set(TOP, mode); this.entityData.set(TOP, mode);
} }
@Override
public boolean hurt(DamageSource source, float amount) {
if (source.getDirectEntity() instanceof ThrownPotion || source.getDirectEntity() instanceof AreaEffectCloud)
return false;
if (source.is(DamageTypes.FALL))
return false;
if (source.is(DamageTypes.CACTUS))
return false;
if (source.is(DamageTypes.DROWN))
return false;
if (source.is(DamageTypes.DRAGON_BREATH))
return false;
if (source.is(DamageTypes.WITHER))
return false;
if (source.is(DamageTypes.WITHER_SKULL))
return false;
this.entityData.set(HEALTH, this.entityData.get(HEALTH) - amount);
return super.hurt(source, amount);
}
@Override @Override
protected void defineSynchedData(SynchedEntityData.@NotNull Builder builder) { protected void defineSynchedData(SynchedEntityData.@NotNull Builder builder) {
super.defineSynchedData(builder); super.defineSynchedData(builder);
builder.define(TARGET_UUID, "none") builder.define(HEALTH, 10f)
.define(TARGET_UUID, "none")
.define(TOP, false) .define(TOP, false)
.define(TARGET_X, 0f) .define(TARGET_X, 0f)
.define(TARGET_Y, 0f) .define(TARGET_Y, 0f)
.define(TARGET_Z, 0f); .define(TARGET_Z, 0f);
} }
@Override
public boolean isPickable() {
return !this.isRemoved();
}
@Override
public void readAdditionalSaveData(@NotNull CompoundTag compound) {
super.readAdditionalSaveData(compound);
super.readAdditionalSaveData(compound);
if (compound.contains("Health")) {
this.entityData.set(HEALTH, compound.getFloat("Health"));
}
}
@Override
public void addAdditionalSaveData(@NotNull CompoundTag compound) {
super.addAdditionalSaveData(compound);
compound.putFloat("Health", this.entityData.get(HEALTH));
}
@Override @Override
public boolean shouldRenderAtSqrDistance(double pDistance) { public boolean shouldRenderAtSqrDistance(double pDistance) {
return true; return true;
@ -260,7 +309,7 @@ public class JavelinMissileEntity extends FastThrowableProjectile implements Geo
} }
} }
if (this.tickCount > 200 || this.isInWater()) { if (this.tickCount > 200 || this.isInWater() || this.entityData.get(HEALTH) <= 0) {
if (this.level() instanceof ServerLevel) { if (this.level() instanceof ServerLevel) {
ProjectileTool.causeCustomExplode(this, ProjectileTool.causeCustomExplode(this,
ModDamageTypes.causeProjectileBoomDamage(this.level().registryAccess(), this, this.getOwner()), ModDamageTypes.causeProjectileBoomDamage(this.level().registryAccess(), this, this.getOwner()),

View file

@ -3,15 +3,24 @@ package com.atsuishio.superbwarfare.entity.projectile;
import com.atsuishio.superbwarfare.config.server.VehicleConfig; import com.atsuishio.superbwarfare.config.server.VehicleConfig;
import com.atsuishio.superbwarfare.init.ModEntities; import com.atsuishio.superbwarfare.init.ModEntities;
import com.atsuishio.superbwarfare.tools.ProjectileTool; import com.atsuishio.superbwarfare.tools.ProjectileTool;
import net.minecraft.nbt.CompoundTag;
import net.minecraft.network.syncher.EntityDataAccessor;
import net.minecraft.network.syncher.EntityDataSerializers;
import net.minecraft.network.syncher.SynchedEntityData;
import net.minecraft.world.damagesource.DamageSource;
import net.minecraft.world.damagesource.DamageTypes;
import net.minecraft.world.entity.AreaEffectCloud;
import net.minecraft.world.entity.EntityType; import net.minecraft.world.entity.EntityType;
import net.minecraft.world.entity.LivingEntity; import net.minecraft.world.entity.LivingEntity;
import net.minecraft.world.entity.projectile.ThrownPotion;
import net.minecraft.world.item.Item; import net.minecraft.world.item.Item;
import net.minecraft.world.item.Items; import net.minecraft.world.item.Items;
import net.minecraft.world.level.Level; import net.minecraft.world.level.Level;
import net.minecraft.world.phys.BlockHitResult; import net.minecraft.world.phys.BlockHitResult;
import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.NotNull;
public class MelonBombEntity extends FastThrowableProjectile { public class MelonBombEntity extends FastThrowableProjectile implements DestroyableProjectileEntity {
public static final EntityDataAccessor<Float> HEALTH = SynchedEntityData.defineId(MelonBombEntity.class, EntityDataSerializers.FLOAT);
public MelonBombEntity(EntityType<? extends MelonBombEntity> type, Level world) { public MelonBombEntity(EntityType<? extends MelonBombEntity> type, Level world) {
super(type, world); super(type, world);
@ -22,7 +31,6 @@ public class MelonBombEntity extends FastThrowableProjectile {
super(ModEntities.MELON_BOMB.get(), entity, level); super(ModEntities.MELON_BOMB.get(), entity, level);
} }
@Override
protected @NotNull Item getDefaultItem() { protected @NotNull Item getDefaultItem() {
return Items.MELON; return Items.MELON;
} }
@ -32,6 +40,52 @@ public class MelonBombEntity extends FastThrowableProjectile {
return true; return true;
} }
@Override
public boolean hurt(DamageSource source, float amount) {
if (source.getDirectEntity() instanceof ThrownPotion || source.getDirectEntity() instanceof AreaEffectCloud)
return false;
if (source.is(DamageTypes.FALL))
return false;
if (source.is(DamageTypes.CACTUS))
return false;
if (source.is(DamageTypes.DROWN))
return false;
if (source.is(DamageTypes.DRAGON_BREATH))
return false;
if (source.is(DamageTypes.WITHER))
return false;
if (source.is(DamageTypes.WITHER_SKULL))
return false;
this.entityData.set(HEALTH, this.entityData.get(HEALTH) - amount);
return super.hurt(source, amount);
}
@Override
public boolean isPickable() {
return !this.isRemoved();
}
@Override
protected void defineSynchedData(SynchedEntityData.@NotNull Builder builder) {
super.defineSynchedData(builder);
builder.define(HEALTH, 10F);
}
@Override
public void readAdditionalSaveData(@NotNull CompoundTag compound) {
super.readAdditionalSaveData(compound);
if (compound.contains("Health")) {
this.entityData.set(HEALTH, compound.getFloat("Health"));
}
}
@Override
public void addAdditionalSaveData(@NotNull CompoundTag compound) {
super.addAdditionalSaveData(compound);
compound.putFloat("Health", this.entityData.get(HEALTH));
}
@Override @Override
public void onHitBlock(@NotNull BlockHitResult blockHitResult) { public void onHitBlock(@NotNull BlockHitResult blockHitResult) {
super.onHitBlock(blockHitResult); super.onHitBlock(blockHitResult);
@ -42,7 +96,7 @@ public class MelonBombEntity extends FastThrowableProjectile {
@Override @Override
public void tick() { public void tick() {
super.tick(); super.tick();
if (tickCount > 600) { if (tickCount > 600 || this.entityData.get(HEALTH) <= 0) {
this.discard(); this.discard();
if (!this.level().isClientSide) { if (!this.level().isClientSide) {
ProjectileTool.causeCustomExplode(this, VehicleConfig.TOM_6_BOMB_EXPLOSION_DAMAGE.get(), VehicleConfig.TOM_6_BOMB_EXPLOSION_RADIUS.get().floatValue(), 1.5f); ProjectileTool.causeCustomExplode(this, VehicleConfig.TOM_6_BOMB_EXPLOSION_DAMAGE.get(), VehicleConfig.TOM_6_BOMB_EXPLOSION_RADIUS.get().floatValue(), 1.5f);

View file

@ -180,7 +180,7 @@ public class MortarShellEntity extends FastThrowableProjectile implements GeoEnt
public void onHitEntity(@NotNull EntityHitResult entityHitResult) { public void onHitEntity(@NotNull EntityHitResult entityHitResult) {
if (this.tickCount > 1) { if (this.tickCount > 1) {
Entity entity = entityHitResult.getEntity(); Entity entity = entityHitResult.getEntity();
entity.hurt(ModDamageTypes.causeCannonFireDamage(this.level().registryAccess(), this, this.getOwner()), this.damage); entity.hurt(ModDamageTypes.causeCannonFireDamage(this.level().registryAccess(), this, this.getOwner()), 50);
if (this.level() instanceof ServerLevel) { if (this.level() instanceof ServerLevel) {
causeExplode(entityHitResult.getLocation()); causeExplode(entityHitResult.getLocation());
this.createAreaCloud(this.level()); this.createAreaCloud(this.level());

View file

@ -41,7 +41,7 @@ import software.bernie.geckolib.util.GeckoLibUtil;
import javax.annotation.Nullable; import javax.annotation.Nullable;
public class SwarmDroneEntity extends FastThrowableProjectile implements GeoEntity { public class SwarmDroneEntity extends FastThrowableProjectile implements GeoEntity, DestroyableProjectileEntity {
public static final EntityDataAccessor<String> TARGET_UUID = SynchedEntityData.defineId(SwarmDroneEntity.class, EntityDataSerializers.STRING); public static final EntityDataAccessor<String> TARGET_UUID = SynchedEntityData.defineId(SwarmDroneEntity.class, EntityDataSerializers.STRING);
public static final EntityDataAccessor<Float> TARGET_X = SynchedEntityData.defineId(SwarmDroneEntity.class, EntityDataSerializers.FLOAT); public static final EntityDataAccessor<Float> TARGET_X = SynchedEntityData.defineId(SwarmDroneEntity.class, EntityDataSerializers.FLOAT);
@ -110,10 +110,6 @@ public class SwarmDroneEntity extends FastThrowableProjectile implements GeoEnti
if (source.getDirectEntity() instanceof SwarmDroneEntity) { if (source.getDirectEntity() instanceof SwarmDroneEntity) {
return false; return false;
} }
// if (source.getEntity() == getOwner()) {
// return false;
// }
this.entityData.set(HEALTH, this.entityData.get(HEALTH) - amount); this.entityData.set(HEALTH, this.entityData.get(HEALTH) - amount);
return super.hurt(source, amount); return super.hurt(source, amount);
@ -226,14 +222,7 @@ public class SwarmDroneEntity extends FastThrowableProjectile implements GeoEnti
} }
} }
if (this.tickCount > 300 || this.isInWater()) { if (this.tickCount > 300 || this.isInWater() || this.entityData.get(HEALTH) <= 0) {
if (this.level() instanceof ServerLevel) {
causeMissileExplode(ModDamageTypes.causeProjectileBoomDamage(this.level().registryAccess(), this, this.getOwner()), this.explosionDamage, this.explosionRadius);
}
this.discard();
}
if (this.entityData.get(HEALTH) <= 0) {
if (this.level() instanceof ServerLevel) { if (this.level() instanceof ServerLevel) {
causeMissileExplode(ModDamageTypes.causeProjectileBoomDamage(this.level().registryAccess(), this, this.getOwner()), this.explosionDamage, this.explosionRadius); causeMissileExplode(ModDamageTypes.causeProjectileBoomDamage(this.level().registryAccess(), this, this.getOwner()), this.explosionDamage, this.explosionRadius);
} }

View file

@ -11,14 +11,20 @@ import com.atsuishio.superbwarfare.tools.CustomExplosion;
import com.atsuishio.superbwarfare.tools.ParticleTool; import com.atsuishio.superbwarfare.tools.ParticleTool;
import com.atsuishio.superbwarfare.tools.TraceTool; import com.atsuishio.superbwarfare.tools.TraceTool;
import net.minecraft.core.particles.ParticleTypes; import net.minecraft.core.particles.ParticleTypes;
import net.minecraft.nbt.CompoundTag;
import net.minecraft.network.syncher.EntityDataAccessor;
import net.minecraft.network.syncher.EntityDataSerializers;
import net.minecraft.network.syncher.SynchedEntityData;
import net.minecraft.server.level.ServerLevel; import net.minecraft.server.level.ServerLevel;
import net.minecraft.server.level.ServerPlayer; import net.minecraft.server.level.ServerPlayer;
import net.minecraft.sounds.SoundSource; import net.minecraft.sounds.SoundSource;
import net.minecraft.world.damagesource.DamageSource; import net.minecraft.world.damagesource.DamageSource;
import net.minecraft.world.damagesource.DamageTypes;
import net.minecraft.world.entity.AreaEffectCloud;
import net.minecraft.world.entity.Entity; import net.minecraft.world.entity.Entity;
import net.minecraft.world.entity.EntityType; import net.minecraft.world.entity.EntityType;
import net.minecraft.world.entity.LivingEntity; import net.minecraft.world.entity.LivingEntity;
import net.minecraft.world.entity.projectile.ThrowableItemProjectile; import net.minecraft.world.entity.projectile.ThrownPotion;
import net.minecraft.world.item.Item; import net.minecraft.world.item.Item;
import net.minecraft.world.level.ClipContext; import net.minecraft.world.level.ClipContext;
import net.minecraft.world.level.Explosion; import net.minecraft.world.level.Explosion;
@ -36,8 +42,8 @@ import software.bernie.geckolib.util.GeckoLibUtil;
import javax.annotation.Nullable; import javax.annotation.Nullable;
public class WgMissileEntity extends FastThrowableProjectile implements GeoEntity { public class WgMissileEntity extends FastThrowableProjectile implements GeoEntity, DestroyableProjectileEntity {
public static final EntityDataAccessor<Float> HEALTH = SynchedEntityData.defineId(WgMissileEntity.class, EntityDataSerializers.FLOAT);
private final AnimatableInstanceCache cache = GeckoLibUtil.createInstanceCache(this); private final AnimatableInstanceCache cache = GeckoLibUtil.createInstanceCache(this);
private float damage = 250f; private float damage = 250f;
@ -56,6 +62,52 @@ public class WgMissileEntity extends FastThrowableProjectile implements GeoEntit
this.explosionRadius = explosionRadius; this.explosionRadius = explosionRadius;
} }
@Override
public boolean hurt(DamageSource source, float amount) {
if (source.getDirectEntity() instanceof ThrownPotion || source.getDirectEntity() instanceof AreaEffectCloud)
return false;
if (source.is(DamageTypes.FALL))
return false;
if (source.is(DamageTypes.CACTUS))
return false;
if (source.is(DamageTypes.DROWN))
return false;
if (source.is(DamageTypes.DRAGON_BREATH))
return false;
if (source.is(DamageTypes.WITHER))
return false;
if (source.is(DamageTypes.WITHER_SKULL))
return false;
this.entityData.set(HEALTH, this.entityData.get(HEALTH) - amount);
return super.hurt(source, amount);
}
@Override
public boolean isPickable() {
return !this.isRemoved();
}
@Override
protected void defineSynchedData(SynchedEntityData.@NotNull Builder builder) {
super.defineSynchedData(builder);
builder.define(HEALTH, 10F);
}
@Override
public void readAdditionalSaveData(@NotNull CompoundTag compound) {
super.readAdditionalSaveData(compound);
if (compound.contains("Health")) {
this.entityData.set(HEALTH, compound.getFloat("Health"));
}
}
@Override
public void addAdditionalSaveData(@NotNull CompoundTag compound) {
super.addAdditionalSaveData(compound);
compound.putFloat("Health", this.entityData.get(HEALTH));
}
@Override @Override
protected @NotNull Item getDefaultItem() { protected @NotNull Item getDefaultItem() {
return ModItems.WIRE_GUIDE_MISSILE.get(); return ModItems.WIRE_GUIDE_MISSILE.get();
@ -88,9 +140,7 @@ public class WgMissileEntity extends FastThrowableProjectile implements GeoEntit
if (this.tickCount > 2) { if (this.tickCount > 2) {
if (this.level() instanceof ServerLevel) { if (this.level() instanceof ServerLevel) {
causeMissileExplode(this, causeMissileExplode(ModDamageTypes.causeProjectileBoomDamage(this.level().registryAccess(), this, this.getOwner()), this.explosionDamage, this.explosionRadius);
ModDamageTypes.causeProjectileBoomDamage(this.level().registryAccess(), this, this.getOwner()),
entity, this.explosionDamage, this.explosionRadius);
} }
} }
} }
@ -99,9 +149,7 @@ public class WgMissileEntity extends FastThrowableProjectile implements GeoEntit
public void onHitBlock(@NotNull BlockHitResult blockHitResult) { public void onHitBlock(@NotNull BlockHitResult blockHitResult) {
super.onHitBlock(blockHitResult); super.onHitBlock(blockHitResult);
if (this.level() instanceof ServerLevel) { if (this.level() instanceof ServerLevel) {
causeMissileExplode(this, causeMissileExplode(ModDamageTypes.causeProjectileBoomDamage(this.level().registryAccess(), this, this.getOwner()), this.explosionDamage, this.explosionRadius);
ModDamageTypes.causeProjectileBoomDamage(this.level().registryAccess(), this, this.getOwner()),
this, this.explosionDamage, this.explosionRadius);
} }
} }
@ -145,24 +193,22 @@ public class WgMissileEntity extends FastThrowableProjectile implements GeoEntit
this.setDeltaMovement(this.getDeltaMovement().multiply(0.8, 0.8, 0.8)); this.setDeltaMovement(this.getDeltaMovement().multiply(0.8, 0.8, 0.8));
} }
if (this.tickCount > 300 || this.isInWater()) { if (this.tickCount > 300 || this.isInWater() || this.entityData.get(HEALTH) <= 0) {
if (this.level() instanceof ServerLevel) { if (this.level() instanceof ServerLevel) {
causeMissileExplode(this, causeMissileExplode(ModDamageTypes.causeProjectileBoomDamage(this.level().registryAccess(), this, this.getOwner()), this.explosionDamage, this.explosionRadius);
ModDamageTypes.causeProjectileBoomDamage(this.level().registryAccess(), this, this.getOwner()),
this, this.explosionDamage, this.explosionRadius);
} }
this.discard(); this.discard();
} }
} }
public static void causeMissileExplode(ThrowableItemProjectile projectile, @Nullable DamageSource source, Entity target, float damage, float radius) { public void causeMissileExplode(@Nullable DamageSource source, float damage, float radius) {
CustomExplosion explosion = new CustomExplosion(projectile.level(), projectile, source, damage, CustomExplosion explosion = new CustomExplosion(level(), this, source, damage,
target.getX(), target.getEyeY(), target.getZ(), radius, ExplosionConfig.EXPLOSION_DESTROY.get() ? Explosion.BlockInteraction.DESTROY : Explosion.BlockInteraction.KEEP).setDamageMultiplier(1.25f); this.getX(), this.getY(), this.getZ(), radius, ExplosionConfig.EXPLOSION_DESTROY.get() ? Explosion.BlockInteraction.DESTROY : Explosion.BlockInteraction.KEEP).setDamageMultiplier(1.25f);
explosion.explode(); explosion.explode();
EventHooks.onExplosionStart(projectile.level(), explosion); EventHooks.onExplosionStart(level(), explosion);
explosion.finalizeExplosion(false); explosion.finalizeExplosion(false);
ParticleTool.spawnMediumExplosionParticles(projectile.level(), projectile.position()); ParticleTool.spawnMediumExplosionParticles(level(), position());
projectile.discard(); discard();
} }
private PlayState movementPredicate(AnimationState<WgMissileEntity> event) { private PlayState movementPredicate(AnimationState<WgMissileEntity> event) {

View file

@ -173,7 +173,7 @@ public class Ah6Entity extends ContainerMobileVehicleEntity implements GeoEntity
return 5f * damage; return 5f * damage;
} }
if (source.getDirectEntity() instanceof MortarShellEntity) { if (source.getDirectEntity() instanceof MortarShellEntity) {
return 4f * damage; return 3f * damage;
} }
return damage; return damage;
}) })

View file

@ -158,7 +158,7 @@ public class Bmp2Entity extends ContainerMobileVehicleEntity implements GeoEntit
return 2f * damage; return 2f * damage;
} }
if (source.getDirectEntity() instanceof MortarShellEntity) { if (source.getDirectEntity() instanceof MortarShellEntity) {
return 3f * damage; return 1.1f * damage;
} }
if (source.getDirectEntity() instanceof GunGrenadeEntity) { if (source.getDirectEntity() instanceof GunGrenadeEntity) {
return 1.5f * damage; return 1.5f * damage;

View file

@ -140,7 +140,7 @@ public class Lav150Entity extends ContainerMobileVehicleEntity implements GeoEnt
return 3f * damage; return 3f * damage;
} }
if (source.getDirectEntity() instanceof MortarShellEntity) { if (source.getDirectEntity() instanceof MortarShellEntity) {
return 3f * damage; return 1.25f * damage;
} }
if (source.getDirectEntity() instanceof GunGrenadeEntity) { if (source.getDirectEntity() instanceof GunGrenadeEntity) {
return 1.5f * damage; return 1.5f * damage;

View file

@ -5,7 +5,6 @@ import com.atsuishio.superbwarfare.config.server.ExplosionConfig;
import com.atsuishio.superbwarfare.config.server.VehicleConfig; import com.atsuishio.superbwarfare.config.server.VehicleConfig;
import com.atsuishio.superbwarfare.entity.projectile.GunGrenadeEntity; import com.atsuishio.superbwarfare.entity.projectile.GunGrenadeEntity;
import com.atsuishio.superbwarfare.entity.projectile.MelonBombEntity; import com.atsuishio.superbwarfare.entity.projectile.MelonBombEntity;
import com.atsuishio.superbwarfare.entity.projectile.MortarShellEntity;
import com.atsuishio.superbwarfare.entity.vehicle.base.ContainerMobileVehicleEntity; import com.atsuishio.superbwarfare.entity.vehicle.base.ContainerMobileVehicleEntity;
import com.atsuishio.superbwarfare.entity.vehicle.base.LandArmorEntity; import com.atsuishio.superbwarfare.entity.vehicle.base.LandArmorEntity;
import com.atsuishio.superbwarfare.entity.vehicle.base.ThirdPersonCameraPosition; import com.atsuishio.superbwarfare.entity.vehicle.base.ThirdPersonCameraPosition;
@ -152,9 +151,6 @@ public class PrismTankEntity extends ContainerMobileVehicleEntity implements Geo
if (source.getDirectEntity() instanceof MelonBombEntity) { if (source.getDirectEntity() instanceof MelonBombEntity) {
return 2f * damage; return 2f * damage;
} }
if (source.getDirectEntity() instanceof MortarShellEntity) {
return 3f * damage;
}
if (source.getDirectEntity() instanceof GunGrenadeEntity) { if (source.getDirectEntity() instanceof GunGrenadeEntity) {
return 1.5f * damage; return 1.5f * damage;
} }

View file

@ -231,6 +231,9 @@ public class Yx100Entity extends ContainerMobileVehicleEntity implements GeoEnti
if (source.getDirectEntity() instanceof GunGrenadeEntity) { if (source.getDirectEntity() instanceof GunGrenadeEntity) {
return 2f * damage; return 2f * damage;
} }
if (source.getDirectEntity() instanceof MortarShellEntity) {
return 2f * damage;
}
return damage; return damage;
}) })
.reduce(9); .reduce(9);

View file

@ -3,6 +3,7 @@ package com.atsuishio.superbwarfare.tools;
import com.atsuishio.superbwarfare.config.server.VehicleConfig; import com.atsuishio.superbwarfare.config.server.VehicleConfig;
import com.atsuishio.superbwarfare.entity.ClaymoreEntity; import com.atsuishio.superbwarfare.entity.ClaymoreEntity;
import com.atsuishio.superbwarfare.entity.projectile.C4Entity; import com.atsuishio.superbwarfare.entity.projectile.C4Entity;
import com.atsuishio.superbwarfare.entity.projectile.DestroyableProjectileEntity;
import com.atsuishio.superbwarfare.entity.vehicle.base.MobileVehicleEntity; import com.atsuishio.superbwarfare.entity.vehicle.base.MobileVehicleEntity;
import com.atsuishio.superbwarfare.entity.vehicle.base.VehicleEntity; import com.atsuishio.superbwarfare.entity.vehicle.base.VehicleEntity;
import net.minecraft.core.BlockPos; import net.minecraft.core.BlockPos;
@ -161,7 +162,7 @@ public class SeekTool {
&& !(entity instanceof ItemEntity && !(entity instanceof ItemEntity
|| entity instanceof ExperienceOrb || entity instanceof ExperienceOrb
|| entity instanceof HangingEntity || entity instanceof HangingEntity
|| entity instanceof Projectile || (entity instanceof Projectile && !(entity instanceof DestroyableProjectileEntity))
|| entity instanceof ArmorStand || entity instanceof ArmorStand
|| entity instanceof ClaymoreEntity || entity instanceof ClaymoreEntity
|| entity instanceof C4Entity || entity instanceof C4Entity

View file

@ -1,5 +1,6 @@
package com.atsuishio.superbwarfare.tools; package com.atsuishio.superbwarfare.tools;
import com.atsuishio.superbwarfare.entity.projectile.DestroyableProjectileEntity;
import com.atsuishio.superbwarfare.entity.vehicle.base.VehicleEntity; import com.atsuishio.superbwarfare.entity.vehicle.base.VehicleEntity;
import net.minecraft.core.BlockPos; import net.minecraft.core.BlockPos;
import net.minecraft.core.Direction; import net.minecraft.core.Direction;
@ -104,7 +105,7 @@ public class TraceTool {
Vec3 viewVec = vehicle.getBarrelVector(1); Vec3 viewVec = vehicle.getBarrelVector(1);
Vec3 toVec = eye.add(viewVec.x * entityReach, viewVec.y * entityReach, viewVec.z * entityReach); Vec3 toVec = eye.add(viewVec.x * entityReach, viewVec.y * entityReach, viewVec.z * entityReach);
AABB aabb = vehicle.getBoundingBox().expandTowards(viewVec.scale(entityReach)).inflate(1.0D, 1.0D, 1.0D); AABB aabb = vehicle.getBoundingBox().expandTowards(viewVec.scale(entityReach)).inflate(1.0D, 1.0D, 1.0D);
EntityHitResult entityhitresult = ProjectileUtil.getEntityHitResult(vehicle, eye, toVec, aabb, p -> !p.isSpectator() && p.isAlive() && !(p instanceof Projectile), distance); EntityHitResult entityhitresult = ProjectileUtil.getEntityHitResult(vehicle, eye, toVec, aabb, p -> !p.isSpectator() && p.isAlive() && !(p instanceof Projectile && !(p instanceof DestroyableProjectileEntity)), distance);
if (entityhitresult != null) { if (entityhitresult != null) {
hitResult = entityhitresult; hitResult = entityhitresult;