diff --git a/src/main/java/com/atsuishio/superbwarfare/entity/projectile/SmallCannonShellEntity.java b/src/main/java/com/atsuishio/superbwarfare/entity/projectile/SmallCannonShellEntity.java index 477d27b3b..ec97eedc3 100644 --- a/src/main/java/com/atsuishio/superbwarfare/entity/projectile/SmallCannonShellEntity.java +++ b/src/main/java/com/atsuishio/superbwarfare/entity/projectile/SmallCannonShellEntity.java @@ -63,24 +63,26 @@ public class SmallCannonShellEntity extends FastThrowableProjectile implements G @Override protected void onHitEntity(EntityHitResult result) { - Entity entity = result.getEntity(); - if (this.getOwner() instanceof LivingEntity living) { - if (!living.level().isClientSide() && living instanceof ServerPlayer player) { - living.level().playSound(null, living.blockPosition(), ModSounds.INDICATION.get(), SoundSource.VOICE, 1, 1); - PacketDistributor.sendToPlayer(player, new ClientIndicatorMessage(0, 5)); + if (this.level() instanceof ServerLevel) { + Entity entity = result.getEntity(); + if (this.getOwner() instanceof LivingEntity living) { + if (!living.level().isClientSide() && living instanceof ServerPlayer player) { + living.level().playSound(null, living.blockPosition(), ModSounds.INDICATION.get(), SoundSource.VOICE, 1, 1); + PacketDistributor.sendToPlayer(player, new ClientIndicatorMessage(0, 5)); + } } - } - entity.hurt(ModDamageTypes.causeCannonFireDamage(this.level().registryAccess(), this, this.getOwner()), damage); + entity.hurt(ModDamageTypes.causeCannonFireDamage(this.level().registryAccess(), this, this.getOwner()), damage); - if (entity instanceof LivingEntity) { - entity.invulnerableTime = 0; - } + if (entity instanceof LivingEntity) { + entity.invulnerableTime = 0; + } - if (this.tickCount > 0 && this.level() instanceof ServerLevel) { - causeExplode(result.getLocation()); + if (this.tickCount > 0) { + causeExplode(result.getLocation()); + } + this.discard(); } - this.discard(); } @Override diff --git a/src/main/java/com/atsuishio/superbwarfare/entity/vehicle/Hpj11Entity.java b/src/main/java/com/atsuishio/superbwarfare/entity/vehicle/Hpj11Entity.java index 7a5c1967f..687e2c01b 100644 --- a/src/main/java/com/atsuishio/superbwarfare/entity/vehicle/Hpj11Entity.java +++ b/src/main/java/com/atsuishio/superbwarfare/entity/vehicle/Hpj11Entity.java @@ -267,7 +267,7 @@ public class Hpj11Entity extends ContainerMobileVehicleEntity implements GeoEnti return; } - Vec3 targetPos = new Vec3(target.getX(), target.getY() + target.getBbHeight() / 2, target.getZ()); + Vec3 targetPos = new Vec3(target.getX(), target.getY() + target.getBbHeight() / 2, target.getZ()).add(target.getDeltaMovement().scale(2.5)); Vec3 targetVec = barrelRootPos.vectorTo(targetPos).normalize(); double d0 = targetVec.x; @@ -280,11 +280,9 @@ public class Hpj11Entity extends ContainerMobileVehicleEntity implements GeoEnti float diffY = Math.clamp(-90f, 90f, Mth.wrapDegrees(targetY - this.getYRot())); turretTurnSound(0, diffY, 1.1f); + this.setYRot(this.getYRot() + Mth.clamp(0.9f * diffY, -20f, 20f)); - this.setYRot(this.getYRot() + Mth.clamp(0.5f * diffY, -60f, 60f)); - this.setRot(this.getYRot(), this.getXRot()); - - if (VectorTool.calculateAngle(getViewVector(1), targetVec) < 1) { + if (VectorTool.calculateAngle(getViewVector(1), targetVec) < 3) { if (checkNoClip(target) && entityData.get(AMMO) > 0) { vehicleShoot(player, 0); } else { @@ -421,7 +419,7 @@ public class Hpj11Entity extends ContainerMobileVehicleEntity implements GeoEnti Vector4f worldPosition = transformPosition(transform, 0f, 0.4f, 2.6875f); entityToSpawn.setPos(worldPosition.x, worldPosition.y, worldPosition.z); - entityToSpawn.shoot(getLookAngle().x, getLookAngle().y, getLookAngle().z, 40, 0.3f); + entityToSpawn.shoot(getLookAngle().x, getLookAngle().y, getLookAngle().z, 50, 0.5f); level().addFreshEntity(entityToSpawn); if (!player.level().isClientSide) {