diff --git a/src/main/java/com/atsuishio/superbwarfare/client/overlay/AircraftOverlay.java b/src/main/java/com/atsuishio/superbwarfare/client/overlay/AircraftOverlay.java index d010d4dcc..75d9b6442 100644 --- a/src/main/java/com/atsuishio/superbwarfare/client/overlay/AircraftOverlay.java +++ b/src/main/java/com/atsuishio/superbwarfare/client/overlay/AircraftOverlay.java @@ -285,7 +285,7 @@ public class AircraftOverlay implements LayeredDraw.Layer { if (lockOn) { RenderHelper.preciseBlit(guiGraphics, FRAME_LOCK, x - 12, y - 12, 24, 24, 0, 0, 24, 24, 24, 24); } else if (nearest) { - lerpLock = Mth.lerp(partialTick, lerpLock, a10Entity.lockTime); + lerpLock = Mth.lerp(partialTick, lerpLock, 2 * a10Entity.lockTime); float lockTime = Mth.clamp(20 - lerpLock, 0, 20); RenderHelper.preciseBlit(guiGraphics, IND_1, x - 12, y - 12 - lockTime, 24, 24, 0, 0, 24, 24, 24, 24); RenderHelper.preciseBlit(guiGraphics, IND_2, x - 12, y - 12 + lockTime, 24, 24, 0, 0, 24, 24, 24, 24); diff --git a/src/main/java/com/atsuishio/superbwarfare/entity/projectile/Agm65Entity.java b/src/main/java/com/atsuishio/superbwarfare/entity/projectile/Agm65Entity.java index 0dd6402dd..2314da2ae 100644 --- a/src/main/java/com/atsuishio/superbwarfare/entity/projectile/Agm65Entity.java +++ b/src/main/java/com/atsuishio/superbwarfare/entity/projectile/Agm65Entity.java @@ -33,8 +33,7 @@ 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; -import net.minecraft.world.level.block.BellBlock; -import net.minecraft.world.level.block.state.BlockState; +import net.minecraft.world.level.block.Block; import net.minecraft.world.phys.BlockHitResult; import net.minecraft.world.phys.EntityHitResult; import net.minecraft.world.phys.HitResult; @@ -58,6 +57,8 @@ public class Agm65Entity extends FastThrowableProjectile implements GeoEntity, D private float explosionDamage = ExplosionConfig.AGM_65_EXPLOSION_DAMAGE.get(); private float explosionRadius = ExplosionConfig.AGM_65_EXPLOSION_RADIUS.get().floatValue(); private boolean distracted = false; + private int durability = 40; + private boolean firstHit = true; public Agm65Entity(EntityType type, Level world) { super(type, world); @@ -173,21 +174,43 @@ public class Agm65Entity extends FastThrowableProjectile implements GeoEntity, D @Override public void onHitBlock(@NotNull BlockHitResult blockHitResult) { - super.onHitBlock(blockHitResult); - BlockPos resultPos = blockHitResult.getBlockPos(); - BlockState state = this.level().getBlockState(resultPos); + if (this.level() instanceof ServerLevel) { + double x = blockHitResult.getLocation().x; + double y = blockHitResult.getLocation().y; + double z = blockHitResult.getLocation().z; - if (state.getBlock() instanceof BellBlock bell) { - bell.attemptToRing(this.level(), resultPos, blockHitResult.getDirection()); - } - - if (this.tickCount > 8) { - if (this.level() instanceof ServerLevel) { - causeExplode(blockHitResult); + if (ExplosionConfig.EXPLOSION_DESTROY.get()) { + float hardness = this.level().getBlockState(BlockPos.containing(x, y, z)).getBlock().defaultDestroyTime(); + if (hardness <= 50) { + BlockPos blockPos = BlockPos.containing(x, y, z); + Block.dropResources(this.level().getBlockState(blockPos), this.level(), BlockPos.containing(x, y, z), null); + this.level().destroyBlock(blockPos, true); + } } - } - this.discard(); + for (int i = 0; i < 5; i++) { + apExplode(blockHitResult, i); + } + + causeExplode(blockHitResult); + } + } + + private void apExplode(HitResult result, int index) { + CustomExplosion explosion = new CustomExplosion(this.level(), this, + ModDamageTypes.causeProjectileBoomDamage(this.level().registryAccess(), + this, + this.getOwner()), + explosionDamage, + result.getLocation().x + index * getDeltaMovement().normalize().x, + result.getLocation().y + index * getDeltaMovement().normalize().y, + result.getLocation().z + index * getDeltaMovement().normalize().z, + 0.5f * explosionRadius, + ExplosionConfig.EXPLOSION_DESTROY.get() ? Explosion.BlockInteraction.DESTROY : Explosion.BlockInteraction.KEEP, true). + setDamageMultiplier(1); + explosion.explode(); + EventHooks.onExplosionStart(this.level(), explosion); + explosion.finalizeExplosion(false); } @Override diff --git a/src/main/java/com/atsuishio/superbwarfare/entity/vehicle/A10Entity.java b/src/main/java/com/atsuishio/superbwarfare/entity/vehicle/A10Entity.java index cbc5d3a76..4007ebd15 100644 --- a/src/main/java/com/atsuishio/superbwarfare/entity/vehicle/A10Entity.java +++ b/src/main/java/com/atsuishio/superbwarfare/entity/vehicle/A10Entity.java @@ -438,7 +438,7 @@ public class A10Entity extends ContainerMobileVehicleEntity implements GeoEntity resetSeek(player); } - Entity entity = SeekTool.seekCustomSizeEntity(this, this.level(), 384, 20, 0.9, true); + Entity entity = SeekTool.seekCustomSizeEntity(this, this.level(), 384, 18, 0.9, true); if (entity != null) { if (lockTime == 0) { setTargetUuid(String.valueOf(entity.getUUID())); @@ -457,7 +457,7 @@ public class A10Entity extends ContainerMobileVehicleEntity implements GeoEntity } } - if (lockTime > 20) { + if (lockTime > 10) { if (player instanceof ServerPlayer serverPlayer) { SoundTool.playLocalSound(serverPlayer, ModSounds.JET_LOCKON.get(), 2, 1); } @@ -967,7 +967,7 @@ public class A10Entity extends ContainerMobileVehicleEntity implements GeoEntity Agm65Entity.setTargetUuid(getTargetUuid()); } Agm65Entity.setPos(worldPosition.x, worldPosition.y, worldPosition.z); - Agm65Entity.shoot(getDeltaMovement().x, getDeltaMovement().y, getDeltaMovement().z, (float) getDeltaMovement().length() + 1, 1); + Agm65Entity.shoot(getLookAngle().x, getLookAngle().y, getLookAngle().z, (float) getDeltaMovement().length() + 1, 1); player.level().addFreshEntity(Agm65Entity); BlockPos pos = BlockPos.containing(new Vec3(worldPosition.x, worldPosition.y, worldPosition.z)); diff --git a/src/main/resources/assets/superbwarfare/sounds/a10/jet_lock.ogg b/src/main/resources/assets/superbwarfare/sounds/a10/jet_lock.ogg index 079b9b5cb..5ff1e53c6 100644 Binary files a/src/main/resources/assets/superbwarfare/sounds/a10/jet_lock.ogg and b/src/main/resources/assets/superbwarfare/sounds/a10/jet_lock.ogg differ