调整无人机判定

This commit is contained in:
17146 2025-01-23 17:26:53 +08:00
parent c35f5aa2b1
commit d07f085d57
14 changed files with 28 additions and 20 deletions

View file

@ -1,7 +1,7 @@
package com.atsuishio.superbwarfare.client.model.entity;
import com.atsuishio.superbwarfare.ModUtils;
import com.atsuishio.superbwarfare.entity.DroneEntity;
import com.atsuishio.superbwarfare.entity.vehicle.DroneEntity;
import com.atsuishio.superbwarfare.init.ModItems;
import com.atsuishio.superbwarfare.tools.EntityFindUtil;
import net.minecraft.resources.ResourceLocation;
@ -13,7 +13,7 @@ import software.bernie.geckolib.model.GeoModel;
import java.util.UUID;
import static com.atsuishio.superbwarfare.entity.DroneEntity.*;
import static com.atsuishio.superbwarfare.entity.vehicle.DroneEntity.*;
public class DroneModel extends GeoModel<DroneEntity> {
@Override

View file

@ -2,7 +2,7 @@ package com.atsuishio.superbwarfare.client.overlay;
import com.atsuishio.superbwarfare.ModUtils;
import com.atsuishio.superbwarfare.client.RenderHelper;
import com.atsuishio.superbwarfare.entity.DroneEntity;
import com.atsuishio.superbwarfare.entity.vehicle.DroneEntity;
import com.atsuishio.superbwarfare.event.ClientEventHandler;
import com.atsuishio.superbwarfare.init.ModItems;
import com.atsuishio.superbwarfare.tools.EntityFindUtil;
@ -32,8 +32,8 @@ import java.text.DecimalFormat;
import java.util.List;
import static com.atsuishio.superbwarfare.client.RenderHelper.preciseBlit;
import static com.atsuishio.superbwarfare.entity.DroneEntity.AMMO;
import static com.atsuishio.superbwarfare.entity.DroneEntity.KAMIKAZE_MODE;
import static com.atsuishio.superbwarfare.entity.vehicle.DroneEntity.AMMO;
import static com.atsuishio.superbwarfare.entity.vehicle.DroneEntity.KAMIKAZE_MODE;
@Mod.EventBusSubscriber(value = Dist.CLIENT)
public class DroneUIOverlay {

View file

@ -2,7 +2,7 @@
package com.atsuishio.superbwarfare.client.renderer.entity;
import com.atsuishio.superbwarfare.client.model.entity.DroneModel;
import com.atsuishio.superbwarfare.entity.DroneEntity;
import com.atsuishio.superbwarfare.entity.vehicle.DroneEntity;
import com.mojang.blaze3d.vertex.PoseStack;
import com.mojang.blaze3d.vertex.VertexConsumer;
import com.mojang.math.Axis;

View file

@ -3,6 +3,7 @@ package com.atsuishio.superbwarfare.entity.projectile;
import com.atsuishio.superbwarfare.ModUtils;
import com.atsuishio.superbwarfare.block.BarbedWireBlock;
import com.atsuishio.superbwarfare.entity.*;
import com.atsuishio.superbwarfare.entity.vehicle.DroneEntity;
import com.atsuishio.superbwarfare.entity.vehicle.IArmedVehicleEntity;
import com.atsuishio.superbwarfare.init.*;
import com.atsuishio.superbwarfare.item.Transcript;

View file

@ -3,7 +3,7 @@ package com.atsuishio.superbwarfare.entity.projectile;
import com.atsuishio.superbwarfare.ModUtils;
import com.atsuishio.superbwarfare.config.server.ExplosionConfig;
import com.atsuishio.superbwarfare.config.server.ExplosionDestroyConfig;
import com.atsuishio.superbwarfare.entity.DroneEntity;
import com.atsuishio.superbwarfare.entity.vehicle.DroneEntity;
import com.atsuishio.superbwarfare.init.ModDamageTypes;
import com.atsuishio.superbwarfare.init.ModEntities;
import com.atsuishio.superbwarfare.init.ModItems;

View file

@ -1,12 +1,12 @@
package com.atsuishio.superbwarfare.entity;
package com.atsuishio.superbwarfare.entity.vehicle;
import com.atsuishio.superbwarfare.config.server.ExplosionConfig;
import com.atsuishio.superbwarfare.config.server.ExplosionDestroyConfig;
import com.atsuishio.superbwarfare.entity.C4Entity;
import com.atsuishio.superbwarfare.entity.projectile.FlareDecoyEntity;
import com.atsuishio.superbwarfare.entity.projectile.LaserEntity;
import com.atsuishio.superbwarfare.entity.projectile.ProjectileEntity;
import com.atsuishio.superbwarfare.entity.projectile.RgoGrenadeEntity;
import com.atsuishio.superbwarfare.entity.vehicle.MobileVehicleEntity;
import com.atsuishio.superbwarfare.init.ModDamageTypes;
import com.atsuishio.superbwarfare.init.ModEntities;
import com.atsuishio.superbwarfare.init.ModItems;
@ -609,4 +609,9 @@ public class DroneEntity extends MobileVehicleEntity implements GeoEntity {
}
super.onRemovedFromWorld();
}
@Override
public boolean canCrushEntities() {
return false;
}
}

View file

@ -1,7 +1,6 @@
package com.atsuishio.superbwarfare.entity.vehicle;
import com.atsuishio.superbwarfare.entity.C4Entity;
import com.atsuishio.superbwarfare.entity.DroneEntity;
import com.atsuishio.superbwarfare.entity.TargetEntity;
import com.atsuishio.superbwarfare.entity.projectile.FlareDecoyEntity;
import com.atsuishio.superbwarfare.entity.projectile.LaserEntity;
@ -153,10 +152,11 @@ public class MobileVehicleEntity extends EnergyVehicleEntity {
/**
* 撞击实体并造成伤害
*
* @param velocity 动量
*/
public void crushEntities(Vec3 velocity) {
if (this instanceof DroneEntity) return;
if (!this.canCrushEntities()) return;
if (velocity.horizontalDistance() < 0.25) return;
if (isRemoved()) return;
var frontBox = getBoundingBox().move(velocity.scale(0.5));
@ -166,7 +166,8 @@ public class MobileVehicleEntity extends EnergyVehicleEntity {
entity -> entity != this && entity != getFirstPassenger() && entity.getVehicle() == null)
.stream().filter(entity -> entity.isAlive()
&& !(entity instanceof ItemEntity || entity instanceof Projectile || entity instanceof ProjectileEntity || entity instanceof LaserEntity || entity instanceof FlareDecoyEntity || entity instanceof AreaEffectCloud || entity instanceof C4Entity)
&& !(entity instanceof Player player && (player.isSpectator() || player.isCreative())))
&& !(entity instanceof Player player && (player.isSpectator() || player.isCreative()))
&& !entity.getType().getDescriptionId().equals("entity.create.super_glue"))
.toList();
for (var entity : entities) {
@ -230,4 +231,8 @@ public class MobileVehicleEntity extends EnergyVehicleEntity {
super.addAdditionalSaveData(compound);
compound.putFloat("Power", this.entityData.get(POWER));
}
public boolean canCrushEntities() {
return true;
}
}

View file

@ -1,6 +1,5 @@
package com.atsuishio.superbwarfare.entity.vehicle;
import com.atsuishio.superbwarfare.entity.DroneEntity;
import com.atsuishio.superbwarfare.init.ModDamageTypes;
import com.atsuishio.superbwarfare.init.ModItems;
import com.atsuishio.superbwarfare.init.ModParticleTypes;

View file

@ -3,7 +3,6 @@ package com.atsuishio.superbwarfare.event;
import com.atsuishio.superbwarfare.ModUtils;
import com.atsuishio.superbwarfare.client.ClickHandler;
import com.atsuishio.superbwarfare.config.client.DisplayConfig;
import com.atsuishio.superbwarfare.entity.DroneEntity;
import com.atsuishio.superbwarfare.entity.vehicle.*;
import com.atsuishio.superbwarfare.init.*;
import com.atsuishio.superbwarfare.item.gun.GunItem;

View file

@ -1,7 +1,7 @@
package com.atsuishio.superbwarfare.item;
import com.atsuishio.superbwarfare.ModUtils;
import com.atsuishio.superbwarfare.entity.DroneEntity;
import com.atsuishio.superbwarfare.entity.vehicle.DroneEntity;
import com.atsuishio.superbwarfare.event.ClientEventHandler;
import com.atsuishio.superbwarfare.network.message.ResetCameraTypeMessage;
import com.atsuishio.superbwarfare.tools.EntityFindUtil;

View file

@ -1,6 +1,5 @@
package com.atsuishio.superbwarfare.mixins;
import com.atsuishio.superbwarfare.entity.DroneEntity;
import com.atsuishio.superbwarfare.entity.vehicle.*;
import com.atsuishio.superbwarfare.event.ClientEventHandler;
import com.atsuishio.superbwarfare.init.ModItems;

View file

@ -1,6 +1,6 @@
package com.atsuishio.superbwarfare.network.message;
import com.atsuishio.superbwarfare.entity.DroneEntity;
import com.atsuishio.superbwarfare.entity.vehicle.DroneEntity;
import com.atsuishio.superbwarfare.init.ModItems;
import com.atsuishio.superbwarfare.tools.EntityFindUtil;
import com.atsuishio.superbwarfare.tools.SeekTool;

View file

@ -1,6 +1,6 @@
package com.atsuishio.superbwarfare.network.message;
import com.atsuishio.superbwarfare.entity.DroneEntity;
import com.atsuishio.superbwarfare.entity.vehicle.DroneEntity;
import com.atsuishio.superbwarfare.init.ModItems;
import com.atsuishio.superbwarfare.init.ModTags;
import com.atsuishio.superbwarfare.tools.EntityFindUtil;

View file

@ -1,6 +1,6 @@
package com.atsuishio.superbwarfare.tools;
import com.atsuishio.superbwarfare.entity.DroneEntity;
import com.atsuishio.superbwarfare.entity.vehicle.DroneEntity;
import net.minecraft.client.multiplayer.ClientLevel;
import net.minecraft.server.level.ServerLevel;
import net.minecraft.world.entity.Entity;