diff --git a/src/main/java/com/atsuishio/superbwarfare/entity/projectile/DestroyableProjectileEntity.java b/src/main/java/com/atsuishio/superbwarfare/entity/projectile/DestroyableProjectileEntity.java new file mode 100644 index 000000000..0149349e3 --- /dev/null +++ b/src/main/java/com/atsuishio/superbwarfare/entity/projectile/DestroyableProjectileEntity.java @@ -0,0 +1,4 @@ +package com.atsuishio.superbwarfare.entity.projectile; + +public interface DestroyableProjectileEntity { +} diff --git a/src/main/java/com/atsuishio/superbwarfare/entity/projectile/JavelinMissileEntity.java b/src/main/java/com/atsuishio/superbwarfare/entity/projectile/JavelinMissileEntity.java index 2657a45ff..3c7584c7a 100644 --- a/src/main/java/com/atsuishio/superbwarfare/entity/projectile/JavelinMissileEntity.java +++ b/src/main/java/com/atsuishio/superbwarfare/entity/projectile/JavelinMissileEntity.java @@ -10,6 +10,7 @@ import com.atsuishio.superbwarfare.network.message.receive.ClientIndicatorMessag import com.atsuishio.superbwarfare.tools.*; import net.minecraft.core.BlockPos; 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; @@ -18,12 +19,16 @@ import net.minecraft.server.level.ServerPlayer; import net.minecraft.sounds.SoundEvents; import net.minecraft.sounds.SoundSource; 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.EntityType; import net.minecraft.world.entity.LivingEntity; import net.minecraft.world.entity.animal.Pig; import net.minecraft.world.entity.boss.enderdragon.EnderDragon; import net.minecraft.world.entity.monster.Monster; +import net.minecraft.world.entity.projectile.ThrownPotion; import net.minecraft.world.item.Item; import net.minecraft.world.level.Explosion; import net.minecraft.world.level.Level; @@ -43,8 +48,8 @@ import software.bernie.geckolib.util.GeckoLibUtil; import java.util.List; -public class JavelinMissileEntity extends FastThrowableProjectile implements GeoEntity { - +public class JavelinMissileEntity extends FastThrowableProjectile implements GeoEntity, DestroyableProjectileEntity { + public static final EntityDataAccessor HEALTH = SynchedEntityData.defineId(JavelinMissileEntity.class, EntityDataSerializers.FLOAT); public static final EntityDataAccessor TARGET_UUID = SynchedEntityData.defineId(JavelinMissileEntity.class, EntityDataSerializers.STRING); public static final EntityDataAccessor TOP = SynchedEntityData.defineId(JavelinMissileEntity.class, EntityDataSerializers.BOOLEAN); public static final EntityDataAccessor TARGET_X = SynchedEntityData.defineId(JavelinMissileEntity.class, EntityDataSerializers.FLOAT); @@ -91,16 +96,60 @@ public class JavelinMissileEntity extends FastThrowableProjectile implements Geo 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 protected void defineSynchedData(SynchedEntityData.@NotNull Builder builder) { super.defineSynchedData(builder); - builder.define(TARGET_UUID, "none") + builder.define(HEALTH, 10f) + .define(TARGET_UUID, "none") .define(TOP, false) .define(TARGET_X, 0f) .define(TARGET_Y, 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 public boolean shouldRenderAtSqrDistance(double pDistance) { 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) { ProjectileTool.causeCustomExplode(this, ModDamageTypes.causeProjectileBoomDamage(this.level().registryAccess(), this, this.getOwner()), diff --git a/src/main/java/com/atsuishio/superbwarfare/entity/projectile/MelonBombEntity.java b/src/main/java/com/atsuishio/superbwarfare/entity/projectile/MelonBombEntity.java index d8eca60c6..42362e7ad 100644 --- a/src/main/java/com/atsuishio/superbwarfare/entity/projectile/MelonBombEntity.java +++ b/src/main/java/com/atsuishio/superbwarfare/entity/projectile/MelonBombEntity.java @@ -3,15 +3,24 @@ package com.atsuishio.superbwarfare.entity.projectile; import com.atsuishio.superbwarfare.config.server.VehicleConfig; import com.atsuishio.superbwarfare.init.ModEntities; 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.LivingEntity; +import net.minecraft.world.entity.projectile.ThrownPotion; import net.minecraft.world.item.Item; import net.minecraft.world.item.Items; import net.minecraft.world.level.Level; import net.minecraft.world.phys.BlockHitResult; import org.jetbrains.annotations.NotNull; -public class MelonBombEntity extends FastThrowableProjectile { +public class MelonBombEntity extends FastThrowableProjectile implements DestroyableProjectileEntity { + public static final EntityDataAccessor HEALTH = SynchedEntityData.defineId(MelonBombEntity.class, EntityDataSerializers.FLOAT); public MelonBombEntity(EntityType type, Level world) { super(type, world); @@ -22,7 +31,6 @@ public class MelonBombEntity extends FastThrowableProjectile { super(ModEntities.MELON_BOMB.get(), entity, level); } - @Override protected @NotNull Item getDefaultItem() { return Items.MELON; } @@ -32,6 +40,52 @@ public class MelonBombEntity extends FastThrowableProjectile { 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 public void onHitBlock(@NotNull BlockHitResult blockHitResult) { super.onHitBlock(blockHitResult); @@ -42,7 +96,7 @@ public class MelonBombEntity extends FastThrowableProjectile { @Override public void tick() { super.tick(); - if (tickCount > 600) { + if (tickCount > 600 || this.entityData.get(HEALTH) <= 0) { this.discard(); if (!this.level().isClientSide) { ProjectileTool.causeCustomExplode(this, VehicleConfig.TOM_6_BOMB_EXPLOSION_DAMAGE.get(), VehicleConfig.TOM_6_BOMB_EXPLOSION_RADIUS.get().floatValue(), 1.5f); diff --git a/src/main/java/com/atsuishio/superbwarfare/entity/projectile/MortarShellEntity.java b/src/main/java/com/atsuishio/superbwarfare/entity/projectile/MortarShellEntity.java index 520207671..663108fae 100644 --- a/src/main/java/com/atsuishio/superbwarfare/entity/projectile/MortarShellEntity.java +++ b/src/main/java/com/atsuishio/superbwarfare/entity/projectile/MortarShellEntity.java @@ -180,7 +180,7 @@ public class MortarShellEntity extends FastThrowableProjectile implements GeoEnt public void onHitEntity(@NotNull EntityHitResult entityHitResult) { if (this.tickCount > 1) { 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) { causeExplode(entityHitResult.getLocation()); this.createAreaCloud(this.level()); diff --git a/src/main/java/com/atsuishio/superbwarfare/entity/projectile/SwarmDroneEntity.java b/src/main/java/com/atsuishio/superbwarfare/entity/projectile/SwarmDroneEntity.java index 89700450b..08460d78e 100644 --- a/src/main/java/com/atsuishio/superbwarfare/entity/projectile/SwarmDroneEntity.java +++ b/src/main/java/com/atsuishio/superbwarfare/entity/projectile/SwarmDroneEntity.java @@ -41,7 +41,7 @@ import software.bernie.geckolib.util.GeckoLibUtil; import javax.annotation.Nullable; -public class SwarmDroneEntity extends FastThrowableProjectile implements GeoEntity { +public class SwarmDroneEntity extends FastThrowableProjectile implements GeoEntity, DestroyableProjectileEntity { public static final EntityDataAccessor TARGET_UUID = SynchedEntityData.defineId(SwarmDroneEntity.class, EntityDataSerializers.STRING); public static final EntityDataAccessor TARGET_X = SynchedEntityData.defineId(SwarmDroneEntity.class, EntityDataSerializers.FLOAT); @@ -110,10 +110,6 @@ public class SwarmDroneEntity extends FastThrowableProjectile implements GeoEnti if (source.getDirectEntity() instanceof SwarmDroneEntity) { return false; } -// if (source.getEntity() == getOwner()) { -// return false; -// } - this.entityData.set(HEALTH, this.entityData.get(HEALTH) - 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.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.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); } diff --git a/src/main/java/com/atsuishio/superbwarfare/entity/projectile/WgMissileEntity.java b/src/main/java/com/atsuishio/superbwarfare/entity/projectile/WgMissileEntity.java index da684869b..011e3df61 100644 --- a/src/main/java/com/atsuishio/superbwarfare/entity/projectile/WgMissileEntity.java +++ b/src/main/java/com/atsuishio/superbwarfare/entity/projectile/WgMissileEntity.java @@ -11,14 +11,20 @@ import com.atsuishio.superbwarfare.tools.CustomExplosion; import com.atsuishio.superbwarfare.tools.ParticleTool; import com.atsuishio.superbwarfare.tools.TraceTool; 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.ServerPlayer; import net.minecraft.sounds.SoundSource; 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.EntityType; 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.level.ClipContext; import net.minecraft.world.level.Explosion; @@ -36,8 +42,8 @@ import software.bernie.geckolib.util.GeckoLibUtil; import javax.annotation.Nullable; -public class WgMissileEntity extends FastThrowableProjectile implements GeoEntity { - +public class WgMissileEntity extends FastThrowableProjectile implements GeoEntity, DestroyableProjectileEntity { + public static final EntityDataAccessor HEALTH = SynchedEntityData.defineId(WgMissileEntity.class, EntityDataSerializers.FLOAT); private final AnimatableInstanceCache cache = GeckoLibUtil.createInstanceCache(this); private float damage = 250f; @@ -56,6 +62,52 @@ public class WgMissileEntity extends FastThrowableProjectile implements GeoEntit 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 protected @NotNull Item getDefaultItem() { return ModItems.WIRE_GUIDE_MISSILE.get(); @@ -88,9 +140,7 @@ public class WgMissileEntity extends FastThrowableProjectile implements GeoEntit if (this.tickCount > 2) { if (this.level() instanceof ServerLevel) { - causeMissileExplode(this, - ModDamageTypes.causeProjectileBoomDamage(this.level().registryAccess(), this, this.getOwner()), - entity, this.explosionDamage, this.explosionRadius); + causeMissileExplode(ModDamageTypes.causeProjectileBoomDamage(this.level().registryAccess(), this, this.getOwner()), this.explosionDamage, this.explosionRadius); } } } @@ -99,9 +149,7 @@ public class WgMissileEntity extends FastThrowableProjectile implements GeoEntit public void onHitBlock(@NotNull BlockHitResult blockHitResult) { super.onHitBlock(blockHitResult); if (this.level() instanceof ServerLevel) { - causeMissileExplode(this, - ModDamageTypes.causeProjectileBoomDamage(this.level().registryAccess(), this, this.getOwner()), - this, this.explosionDamage, this.explosionRadius); + causeMissileExplode(ModDamageTypes.causeProjectileBoomDamage(this.level().registryAccess(), this, this.getOwner()), 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)); } - if (this.tickCount > 300 || this.isInWater()) { + if (this.tickCount > 300 || this.isInWater() || this.entityData.get(HEALTH) <= 0) { if (this.level() instanceof ServerLevel) { - causeMissileExplode(this, - ModDamageTypes.causeProjectileBoomDamage(this.level().registryAccess(), this, this.getOwner()), - this, this.explosionDamage, this.explosionRadius); + causeMissileExplode(ModDamageTypes.causeProjectileBoomDamage(this.level().registryAccess(), this, this.getOwner()), this.explosionDamage, this.explosionRadius); } this.discard(); } } - public static void causeMissileExplode(ThrowableItemProjectile projectile, @Nullable DamageSource source, Entity target, float damage, float radius) { - CustomExplosion explosion = new CustomExplosion(projectile.level(), projectile, source, damage, - target.getX(), target.getEyeY(), target.getZ(), radius, ExplosionConfig.EXPLOSION_DESTROY.get() ? Explosion.BlockInteraction.DESTROY : Explosion.BlockInteraction.KEEP).setDamageMultiplier(1.25f); + public void causeMissileExplode(@Nullable DamageSource source, float damage, float radius) { + CustomExplosion explosion = new CustomExplosion(level(), this, source, damage, + this.getX(), this.getY(), this.getZ(), radius, ExplosionConfig.EXPLOSION_DESTROY.get() ? Explosion.BlockInteraction.DESTROY : Explosion.BlockInteraction.KEEP).setDamageMultiplier(1.25f); explosion.explode(); - EventHooks.onExplosionStart(projectile.level(), explosion); + EventHooks.onExplosionStart(level(), explosion); explosion.finalizeExplosion(false); - ParticleTool.spawnMediumExplosionParticles(projectile.level(), projectile.position()); - projectile.discard(); + ParticleTool.spawnMediumExplosionParticles(level(), position()); + discard(); } private PlayState movementPredicate(AnimationState event) { diff --git a/src/main/java/com/atsuishio/superbwarfare/entity/vehicle/Ah6Entity.java b/src/main/java/com/atsuishio/superbwarfare/entity/vehicle/Ah6Entity.java index 7d0343fb7..cad95e535 100644 --- a/src/main/java/com/atsuishio/superbwarfare/entity/vehicle/Ah6Entity.java +++ b/src/main/java/com/atsuishio/superbwarfare/entity/vehicle/Ah6Entity.java @@ -173,7 +173,7 @@ public class Ah6Entity extends ContainerMobileVehicleEntity implements GeoEntity return 5f * damage; } if (source.getDirectEntity() instanceof MortarShellEntity) { - return 4f * damage; + return 3f * damage; } return damage; }) diff --git a/src/main/java/com/atsuishio/superbwarfare/entity/vehicle/Bmp2Entity.java b/src/main/java/com/atsuishio/superbwarfare/entity/vehicle/Bmp2Entity.java index 0219f005e..3329f0841 100644 --- a/src/main/java/com/atsuishio/superbwarfare/entity/vehicle/Bmp2Entity.java +++ b/src/main/java/com/atsuishio/superbwarfare/entity/vehicle/Bmp2Entity.java @@ -158,7 +158,7 @@ public class Bmp2Entity extends ContainerMobileVehicleEntity implements GeoEntit return 2f * damage; } if (source.getDirectEntity() instanceof MortarShellEntity) { - return 3f * damage; + return 1.1f * damage; } if (source.getDirectEntity() instanceof GunGrenadeEntity) { return 1.5f * damage; diff --git a/src/main/java/com/atsuishio/superbwarfare/entity/vehicle/Lav150Entity.java b/src/main/java/com/atsuishio/superbwarfare/entity/vehicle/Lav150Entity.java index 0f81d5b59..9c90d82d4 100644 --- a/src/main/java/com/atsuishio/superbwarfare/entity/vehicle/Lav150Entity.java +++ b/src/main/java/com/atsuishio/superbwarfare/entity/vehicle/Lav150Entity.java @@ -140,7 +140,7 @@ public class Lav150Entity extends ContainerMobileVehicleEntity implements GeoEnt return 3f * damage; } if (source.getDirectEntity() instanceof MortarShellEntity) { - return 3f * damage; + return 1.25f * damage; } if (source.getDirectEntity() instanceof GunGrenadeEntity) { return 1.5f * damage; diff --git a/src/main/java/com/atsuishio/superbwarfare/entity/vehicle/PrismTankEntity.java b/src/main/java/com/atsuishio/superbwarfare/entity/vehicle/PrismTankEntity.java index 70487d758..631226251 100644 --- a/src/main/java/com/atsuishio/superbwarfare/entity/vehicle/PrismTankEntity.java +++ b/src/main/java/com/atsuishio/superbwarfare/entity/vehicle/PrismTankEntity.java @@ -5,7 +5,6 @@ import com.atsuishio.superbwarfare.config.server.ExplosionConfig; import com.atsuishio.superbwarfare.config.server.VehicleConfig; import com.atsuishio.superbwarfare.entity.projectile.GunGrenadeEntity; 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.LandArmorEntity; import com.atsuishio.superbwarfare.entity.vehicle.base.ThirdPersonCameraPosition; @@ -152,9 +151,6 @@ public class PrismTankEntity extends ContainerMobileVehicleEntity implements Geo if (source.getDirectEntity() instanceof MelonBombEntity) { return 2f * damage; } - if (source.getDirectEntity() instanceof MortarShellEntity) { - return 3f * damage; - } if (source.getDirectEntity() instanceof GunGrenadeEntity) { return 1.5f * damage; } diff --git a/src/main/java/com/atsuishio/superbwarfare/entity/vehicle/Yx100Entity.java b/src/main/java/com/atsuishio/superbwarfare/entity/vehicle/Yx100Entity.java index bb9e9ab51..d660ca2f8 100644 --- a/src/main/java/com/atsuishio/superbwarfare/entity/vehicle/Yx100Entity.java +++ b/src/main/java/com/atsuishio/superbwarfare/entity/vehicle/Yx100Entity.java @@ -231,6 +231,9 @@ public class Yx100Entity extends ContainerMobileVehicleEntity implements GeoEnti if (source.getDirectEntity() instanceof GunGrenadeEntity) { return 2f * damage; } + if (source.getDirectEntity() instanceof MortarShellEntity) { + return 2f * damage; + } return damage; }) .reduce(9); diff --git a/src/main/java/com/atsuishio/superbwarfare/tools/SeekTool.java b/src/main/java/com/atsuishio/superbwarfare/tools/SeekTool.java index eb990750e..d854699c6 100644 --- a/src/main/java/com/atsuishio/superbwarfare/tools/SeekTool.java +++ b/src/main/java/com/atsuishio/superbwarfare/tools/SeekTool.java @@ -3,6 +3,7 @@ package com.atsuishio.superbwarfare.tools; import com.atsuishio.superbwarfare.config.server.VehicleConfig; import com.atsuishio.superbwarfare.entity.ClaymoreEntity; 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.VehicleEntity; import net.minecraft.core.BlockPos; @@ -161,7 +162,7 @@ public class SeekTool { && !(entity instanceof ItemEntity || entity instanceof ExperienceOrb || entity instanceof HangingEntity - || entity instanceof Projectile + || (entity instanceof Projectile && !(entity instanceof DestroyableProjectileEntity)) || entity instanceof ArmorStand || entity instanceof ClaymoreEntity || entity instanceof C4Entity diff --git a/src/main/java/com/atsuishio/superbwarfare/tools/TraceTool.java b/src/main/java/com/atsuishio/superbwarfare/tools/TraceTool.java index 40c5a2c51..4056c53ac 100644 --- a/src/main/java/com/atsuishio/superbwarfare/tools/TraceTool.java +++ b/src/main/java/com/atsuishio/superbwarfare/tools/TraceTool.java @@ -1,5 +1,6 @@ package com.atsuishio.superbwarfare.tools; +import com.atsuishio.superbwarfare.entity.projectile.DestroyableProjectileEntity; import com.atsuishio.superbwarfare.entity.vehicle.base.VehicleEntity; import net.minecraft.core.BlockPos; import net.minecraft.core.Direction; @@ -104,7 +105,7 @@ public class TraceTool { Vec3 viewVec = vehicle.getBarrelVector(1); 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); - 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) { hitResult = entityhitresult;