修复坦克三号位使用自身武器情况下显示载具武器的bug,修复锁定自己的蜂群无人机bug
This commit is contained in:
parent
fc59522ac6
commit
7736e8264f
4 changed files with 20 additions and 19 deletions
|
@ -357,12 +357,14 @@ public class VehicleHudOverlay implements LayeredDraw.Layer {
|
||||||
}
|
}
|
||||||
|
|
||||||
private static void renderWeaponInfo(GuiGraphics guiGraphics, VehicleEntity vehicle, int w, int h) {
|
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;
|
var temp = wasRenderingWeapons;
|
||||||
wasRenderingWeapons = false;
|
wasRenderingWeapons = false;
|
||||||
|
|
||||||
Player player = Minecraft.getInstance().player;
|
|
||||||
assert player != null;
|
assert player != null;
|
||||||
|
|
||||||
int index = vehicle.getSeatIndex(player);
|
int index = vehicle.getSeatIndex(player);
|
||||||
|
|
|
@ -166,6 +166,13 @@ public class SwarmDroneEntity extends FastThrowableProjectile implements GeoEnti
|
||||||
if (result.getEntity() instanceof SwarmDroneEntity) {
|
if (result.getEntity() instanceof SwarmDroneEntity) {
|
||||||
return;
|
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) {
|
if (this.level() instanceof ServerLevel) {
|
||||||
causeMissileExplode(ModDamageTypes.causeProjectileBoomDamage(this.level().registryAccess(), this, this.getOwner()), this.explosionDamage, this.explosionRadius);
|
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) {
|
if (guide_type == 0 && entity != null) {
|
||||||
targetPos = entity.getEyePosition();
|
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 {
|
} else {
|
||||||
targetPos = new Vec3(this.entityData.get(TARGET_X), this.entityData.get(TARGET_Y), this.entityData.get(TARGET_Z));
|
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) {
|
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,
|
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);
|
this.getX(), this.getY(), this.getZ(), radius, ExplosionConfig.EXPLOSION_DESTROY.get() ? Explosion.BlockInteraction.DESTROY : Explosion.BlockInteraction.KEEP).setDamageMultiplier(1.25f);
|
||||||
explosion.explode();
|
explosion.explode();
|
||||||
|
|
|
@ -649,7 +649,7 @@ public class Yx100Entity extends ContainerMobileVehicleEntity implements GeoEnti
|
||||||
swarmDroneEntity.setPos(worldPosition.x, worldPosition.y, worldPosition.z);
|
swarmDroneEntity.setPos(worldPosition.x, worldPosition.y, worldPosition.z);
|
||||||
swarmDroneEntity.shoot(direct.x, direct.y, direct.z, 1.2f, 10);
|
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.setGuideType(0);
|
||||||
swarmDroneEntity.setTargetUuid(lookingEntity.getStringUUID());
|
swarmDroneEntity.setTargetUuid(lookingEntity.getStringUUID());
|
||||||
swarmDroneEntity.setTargetVec(lookingEntity.getEyePosition());
|
swarmDroneEntity.setTargetVec(lookingEntity.getEyePosition());
|
||||||
|
|
|
@ -4,6 +4,7 @@ import com.atsuishio.superbwarfare.config.server.VehicleConfig;
|
||||||
import com.atsuishio.superbwarfare.entity.ClaymoreEntity;
|
import com.atsuishio.superbwarfare.entity.ClaymoreEntity;
|
||||||
import com.atsuishio.superbwarfare.entity.projectile.C4Entity;
|
import com.atsuishio.superbwarfare.entity.projectile.C4Entity;
|
||||||
import com.atsuishio.superbwarfare.entity.projectile.DestroyableProjectileEntity;
|
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.MobileVehicleEntity;
|
||||||
import com.atsuishio.superbwarfare.entity.vehicle.base.VehicleEntity;
|
import com.atsuishio.superbwarfare.entity.vehicle.base.VehicleEntity;
|
||||||
import net.minecraft.core.BlockPos;
|
import net.minecraft.core.BlockPos;
|
||||||
|
@ -69,14 +70,10 @@ public class SeekTool {
|
||||||
&& e != entity
|
&& e != entity
|
||||||
&& baseFilter(e)
|
&& baseFilter(e)
|
||||||
&& e.getVehicle() == null
|
&& e.getVehicle() == null
|
||||||
&& (!e.isAlliedTo(entity) || e.getTeam() == null || e.getTeam().getName().equals("TDM"))
|
&& !(e instanceof SwarmDroneEntity swarmDrone && swarmDrone.getOwner() != entity)
|
||||||
) {
|
&& (!e.isAlliedTo(entity) || e.getTeam() == null || e.getTeam().getName().equals("TDM"))) {
|
||||||
return level.clip(new ClipContext(
|
return level.clip(new ClipContext(entity.getEyePosition(), e.getEyePosition(),
|
||||||
entity.getEyePosition(),
|
ClipContext.Block.COLLIDER, ClipContext.Fluid.NONE, entity)).getType() != HitResult.Type.BLOCK;
|
||||||
e.getEyePosition(),
|
|
||||||
ClipContext.Block.COLLIDER,
|
|
||||||
ClipContext.Fluid.NONE, entity)
|
|
||||||
).getType() != HitResult.Type.BLOCK;
|
|
||||||
}
|
}
|
||||||
return false;
|
return false;
|
||||||
})
|
})
|
||||||
|
|
Loading…
Add table
Reference in a new issue