修复弹射物打到自己的bug
This commit is contained in:
parent
e8a0fc2840
commit
a166421d5c
12 changed files with 26 additions and 7 deletions
|
@ -145,6 +145,8 @@ public class Agm65Entity extends FastThrowableProjectile implements GeoEntity, E
|
|||
@Override
|
||||
protected void onHitEntity(EntityHitResult result) {
|
||||
Entity entity = result.getEntity();
|
||||
if (this.getOwner() != null && this.getOwner().getVehicle() != null && entity == this.getOwner().getVehicle())
|
||||
return;
|
||||
if (this.level() instanceof ServerLevel && tickCount > 8) {
|
||||
if (entity == this.getOwner() || (this.getOwner() != null && entity == this.getOwner().getVehicle()))
|
||||
return;
|
||||
|
|
|
@ -146,6 +146,8 @@ public class CannonShellEntity extends FastThrowableProjectile implements GeoEnt
|
|||
public void onHitEntity(@NotNull EntityHitResult entityHitResult) {
|
||||
if (this.level() instanceof ServerLevel) {
|
||||
Entity entity = entityHitResult.getEntity();
|
||||
if (this.getOwner() != null && this.getOwner().getVehicle() != null && entity == this.getOwner().getVehicle())
|
||||
return;
|
||||
entity.hurt(ModDamageTypes.causeCannonFireDamage(this.level().registryAccess(), this, this.getOwner()), this.damage);
|
||||
|
||||
if (entity instanceof LivingEntity) {
|
||||
|
|
|
@ -114,6 +114,8 @@ public class GunGrenadeEntity extends FastThrowableProjectile implements GeoEnti
|
|||
protected void onHitEntity(EntityHitResult result) {
|
||||
float damageMultiplier = 1 + this.monsterMultiplier;
|
||||
Entity entity = result.getEntity();
|
||||
if (this.getOwner() != null && this.getOwner().getVehicle() != null && entity == this.getOwner().getVehicle())
|
||||
return;
|
||||
|
||||
if (this.getOwner() instanceof LivingEntity living) {
|
||||
if (!living.level().isClientSide() && living instanceof ServerPlayer player) {
|
||||
|
|
|
@ -93,7 +93,8 @@ public class HeliRocketEntity extends FastThrowableProjectile implements GeoEnti
|
|||
@Override
|
||||
protected void onHitEntity(EntityHitResult result) {
|
||||
Entity entity = result.getEntity();
|
||||
if (entity == this.getOwner() || entity == this.getVehicle()) return;
|
||||
if (this.getOwner() != null && this.getOwner().getVehicle() != null && entity == this.getOwner().getVehicle())
|
||||
return;
|
||||
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);
|
||||
|
|
|
@ -173,7 +173,8 @@ public class JavelinMissileEntity extends FastThrowableProjectile implements Geo
|
|||
protected void onHitEntity(EntityHitResult result) {
|
||||
float damageMultiplier = 1 + this.monsterMultiplier;
|
||||
Entity entity = result.getEntity();
|
||||
if (entity == this.getOwner() || entity == this.getVehicle()) return;
|
||||
if (this.getOwner() != null && this.getOwner().getVehicle() != null && entity == this.getOwner().getVehicle())
|
||||
return;
|
||||
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);
|
||||
|
|
|
@ -100,6 +100,8 @@ public class RgoGrenadeEntity extends FastThrowableProjectile implements GeoEnti
|
|||
case ENTITY:
|
||||
EntityHitResult entityResult = (EntityHitResult) result;
|
||||
Entity entity = entityResult.getEntity();
|
||||
if (this.getOwner() != null && this.getOwner().getVehicle() != null && entity == this.getOwner().getVehicle())
|
||||
return;
|
||||
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);
|
||||
|
|
|
@ -128,7 +128,8 @@ public class RpgRocketEntity extends FastThrowableProjectile implements GeoEntit
|
|||
protected void onHitEntity(EntityHitResult result) {
|
||||
float damageMultiplier = 1 + this.monsterMultiplier;
|
||||
Entity entity = result.getEntity();
|
||||
if (entity == this.getOwner() || entity == this.getVehicle()) return;
|
||||
if (this.getOwner() != null && this.getOwner().getVehicle() != null && entity == this.getOwner().getVehicle())
|
||||
return;
|
||||
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);
|
||||
|
|
|
@ -96,6 +96,9 @@ public class SmallCannonShellEntity extends FastThrowableProjectile implements G
|
|||
@Override
|
||||
protected void onHitEntity(@NotNull EntityHitResult result) {
|
||||
Entity entity = result.getEntity();
|
||||
|
||||
if (this.getOwner() != null && this.getOwner().getVehicle() != null && entity == this.getOwner().getVehicle())
|
||||
return;
|
||||
if (this.level() instanceof ServerLevel) {
|
||||
if (this.getOwner() instanceof LivingEntity living) {
|
||||
if (!living.level().isClientSide() && living instanceof ServerPlayer player) {
|
||||
|
|
|
@ -179,9 +179,12 @@ public class SwarmDroneEntity extends FastThrowableProjectile implements GeoEnti
|
|||
|
||||
@Override
|
||||
protected void onHitEntity(@NotNull EntityHitResult result) {
|
||||
if (result.getEntity() instanceof SwarmDroneEntity) {
|
||||
Entity entity = result.getEntity();
|
||||
if (entity instanceof SwarmDroneEntity) {
|
||||
return;
|
||||
}
|
||||
if (this.getOwner() != null && this.getOwner().getVehicle() != null && entity == this.getOwner().getVehicle())
|
||||
return;
|
||||
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);
|
||||
|
|
|
@ -103,7 +103,8 @@ public class TaserBulletEntity extends AbstractArrow implements GeoEntity {
|
|||
@Override
|
||||
protected void onHitEntity(EntityHitResult result) {
|
||||
Entity entity = result.getEntity();
|
||||
if (entity == this.getVehicle()) return;
|
||||
if (this.getOwner() != null && this.getOwner().getVehicle() != null && entity == this.getOwner().getVehicle())
|
||||
return;
|
||||
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);
|
||||
|
|
|
@ -136,7 +136,8 @@ public class WgMissileEntity extends FastThrowableProjectile implements GeoEntit
|
|||
protected void onHitEntity(EntityHitResult result) {
|
||||
Entity entity = result.getEntity();
|
||||
if (this.tickCount < 1) return;
|
||||
if (entity == this.getOwner() || entity == this.getVehicle()) return;
|
||||
if (this.getOwner() != null && this.getOwner().getVehicle() != null && entity == this.getOwner().getVehicle())
|
||||
return;
|
||||
|
||||
if (this.getOwner() instanceof LivingEntity living) {
|
||||
if (!living.level().isClientSide() && living instanceof ServerPlayer player) {
|
||||
|
|
|
@ -59,7 +59,7 @@ public class SpeedboatEntity extends ContainerMobileVehicleEntity implements Geo
|
|||
public SpeedboatEntity(EntityType<SpeedboatEntity> type, Level world) {
|
||||
super(type, world);
|
||||
this.obb = new OBB(this.position().toVector3f(), new Vector3f(1.5625f, 0.75f, 3.1875f), new Quaternionf(), false);
|
||||
this.obb2 = new OBB(this.position().toVector3f(), new Vector3f(1.0625f, 0.5f, 1.90625f), new Quaternionf(), true);
|
||||
this.obb2 = new OBB(this.position().toVector3f(), new Vector3f(1.0625f, 0.5f, 1.90625f), new Quaternionf(), false);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
Loading…
Add table
Reference in a new issue