修复坦克三号位使用自身武器情况下显示载具武器的bug,修复锁定自己的蜂群无人机bug

This commit is contained in:
Atsuishio 2025-04-11 17:05:35 +08:00 committed by Light_Quanta
parent fc59522ac6
commit 7736e8264f
No known key found for this signature in database
GPG key ID: 11A39A1B8C890959
4 changed files with 20 additions and 19 deletions

View file

@ -357,12 +357,14 @@ public class VehicleHudOverlay implements LayeredDraw.Layer {
}
private static void renderWeaponInfo(GuiGraphics guiGraphics, VehicleEntity vehicle, int w, int h) {
if (!(vehicle instanceof WeaponVehicleEntity weaponVehicle)) return;
Player player = Minecraft.getInstance().player;
if (!(vehicle instanceof WeaponVehicleEntity weaponVehicle && weaponVehicle.banHand(player))) return;
var temp = wasRenderingWeapons;
wasRenderingWeapons = false;
Player player = Minecraft.getInstance().player;
assert player != null;
int index = vehicle.getSeatIndex(player);

View file

@ -166,6 +166,13 @@ public class SwarmDroneEntity extends FastThrowableProjectile implements GeoEnti
if (result.getEntity() instanceof SwarmDroneEntity) {
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);
PacketDistributor.sendToPlayer(player, new ClientIndicatorMessage(0, 5));
}
}
if (this.level() instanceof ServerLevel) {
causeMissileExplode(ModDamageTypes.causeProjectileBoomDamage(this.level().registryAccess(), this, this.getOwner()), this.explosionDamage, this.explosionRadius);
}
@ -198,6 +205,9 @@ public class SwarmDroneEntity extends FastThrowableProjectile implements GeoEnti
if (guide_type == 0 && entity != null) {
targetPos = entity.getEyePosition();
this.entityData.set(TARGET_X, (float) targetPos.x);
this.entityData.set(TARGET_Y, (float) targetPos.y);
this.entityData.set(TARGET_Z, (float) targetPos.z);
} else {
targetPos = new Vec3(this.entityData.get(TARGET_X), this.entityData.get(TARGET_Y), this.entityData.get(TARGET_Z));
}
@ -235,14 +245,6 @@ public class SwarmDroneEntity extends FastThrowableProjectile implements GeoEnti
}
public void causeMissileExplode(@Nullable DamageSource source, float damage, float radius) {
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));
}
}
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();

View file

@ -649,7 +649,7 @@ public class Yx100Entity extends ContainerMobileVehicleEntity implements GeoEnti
swarmDroneEntity.setPos(worldPosition.x, worldPosition.y, worldPosition.z);
swarmDroneEntity.shoot(direct.x, direct.y, direct.z, 1.2f, 10);
if (lookingEntity != null) {
if (lookingEntity != null && !(lookingEntity instanceof SwarmDroneEntity swarmDrone && swarmDrone.getOwner() == player)) {
swarmDroneEntity.setGuideType(0);
swarmDroneEntity.setTargetUuid(lookingEntity.getStringUUID());
swarmDroneEntity.setTargetVec(lookingEntity.getEyePosition());

View file

@ -4,6 +4,7 @@ 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.projectile.SwarmDroneEntity;
import com.atsuishio.superbwarfare.entity.vehicle.base.MobileVehicleEntity;
import com.atsuishio.superbwarfare.entity.vehicle.base.VehicleEntity;
import net.minecraft.core.BlockPos;
@ -69,14 +70,10 @@ public class SeekTool {
&& e != entity
&& baseFilter(e)
&& e.getVehicle() == null
&& (!e.isAlliedTo(entity) || e.getTeam() == null || e.getTeam().getName().equals("TDM"))
) {
return level.clip(new ClipContext(
entity.getEyePosition(),
e.getEyePosition(),
ClipContext.Block.COLLIDER,
ClipContext.Fluid.NONE, entity)
).getType() != HitResult.Type.BLOCK;
&& !(e instanceof SwarmDroneEntity swarmDrone && swarmDrone.getOwner() != entity)
&& (!e.isAlliedTo(entity) || e.getTeam() == null || e.getTeam().getName().equals("TDM"))) {
return level.clip(new ClipContext(entity.getEyePosition(), e.getEyePosition(),
ClipContext.Block.COLLIDER, ClipContext.Fluid.NONE, entity)).getType() != HitResult.Type.BLOCK;
}
return false;
})