调整实体搜寻逻辑
This commit is contained in:
parent
6447d92f81
commit
406486817f
3 changed files with 3 additions and 8 deletions
|
@ -1,4 +0,0 @@
|
||||||
package com.atsuishio.superbwarfare.entity.projectile;
|
|
||||||
|
|
||||||
public interface DestroyableProjectileEntity {
|
|
||||||
}
|
|
|
@ -2,11 +2,11 @@ package com.atsuishio.superbwarfare.tools;
|
||||||
|
|
||||||
import com.atsuishio.superbwarfare.config.server.SeekConfig;
|
import com.atsuishio.superbwarfare.config.server.SeekConfig;
|
||||||
import com.atsuishio.superbwarfare.entity.projectile.DecoyEntity;
|
import com.atsuishio.superbwarfare.entity.projectile.DecoyEntity;
|
||||||
import com.atsuishio.superbwarfare.entity.projectile.DestroyableProjectileEntity;
|
|
||||||
import com.atsuishio.superbwarfare.entity.projectile.SmokeDecoyEntity;
|
import com.atsuishio.superbwarfare.entity.projectile.SmokeDecoyEntity;
|
||||||
import com.atsuishio.superbwarfare.entity.projectile.SwarmDroneEntity;
|
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 com.atsuishio.superbwarfare.init.ModTags;
|
||||||
import net.minecraft.core.BlockPos;
|
import net.minecraft.core.BlockPos;
|
||||||
import net.minecraft.core.registries.BuiltInRegistries;
|
import net.minecraft.core.registries.BuiltInRegistries;
|
||||||
import net.minecraft.world.entity.Entity;
|
import net.minecraft.world.entity.Entity;
|
||||||
|
@ -197,7 +197,7 @@ public class SeekTool {
|
||||||
|
|
||||||
public static boolean baseFilter(Entity entity) {
|
public static boolean baseFilter(Entity entity) {
|
||||||
return entity.isAlive()
|
return entity.isAlive()
|
||||||
&& !(entity instanceof HangingEntity || (entity instanceof Projectile && !(entity instanceof DestroyableProjectileEntity)))
|
&& !(entity instanceof HangingEntity || (entity instanceof Projectile && !entity.getType().is(ModTags.EntityTypes.DESTROYABLE_PROJECTILE)))
|
||||||
&& !(entity instanceof Player player && player.isSpectator())
|
&& !(entity instanceof Player player && player.isSpectator())
|
||||||
&& !isInBlackList(entity);
|
&& !isInBlackList(entity);
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,7 +1,6 @@
|
||||||
package com.atsuishio.superbwarfare.tools;
|
package com.atsuishio.superbwarfare.tools;
|
||||||
|
|
||||||
import com.atsuishio.superbwarfare.entity.projectile.DecoyEntity;
|
import com.atsuishio.superbwarfare.entity.projectile.DecoyEntity;
|
||||||
import com.atsuishio.superbwarfare.entity.projectile.DestroyableProjectileEntity;
|
|
||||||
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;
|
||||||
import net.minecraft.core.Direction;
|
import net.minecraft.core.Direction;
|
||||||
|
@ -109,7 +108,7 @@ public class TraceTool {
|
||||||
Vec3 viewVec = vehicle.getBarrelVector(1);
|
Vec3 viewVec = vehicle.getBarrelVector(1);
|
||||||
Vec3 toVec = eye.add(viewVec.x * entityReach, viewVec.y * entityReach, viewVec.z * entityReach);
|
Vec3 toVec = eye.add(viewVec.x * entityReach, viewVec.y * entityReach, viewVec.z * entityReach);
|
||||||
AABB aabb = vehicle.getBoundingBox().expandTowards(viewVec.scale(entityReach)).inflate(1.0D, 1.0D, 1.0D);
|
AABB aabb = vehicle.getBoundingBox().expandTowards(viewVec.scale(entityReach)).inflate(1.0D, 1.0D, 1.0D);
|
||||||
EntityHitResult entityhitresult = ProjectileUtil.getEntityHitResult(vehicle, eye, toVec, aabb, p -> !p.isSpectator() && p.isAlive() && !(p instanceof Projectile && !(p instanceof DestroyableProjectileEntity)) && SeekTool.baseFilter(p) && !(p instanceof DecoyEntity) && smokeFilter(p), distance);
|
EntityHitResult entityhitresult = ProjectileUtil.getEntityHitResult(vehicle, eye, toVec, aabb, p -> !p.isSpectator() && p.isAlive() && SeekTool.baseFilter(p) && !(p instanceof DecoyEntity) && smokeFilter(p), distance);
|
||||||
if (entityhitresult != null) {
|
if (entityhitresult != null) {
|
||||||
hitResult = entityhitresult;
|
hitResult = entityhitresult;
|
||||||
|
|
||||||
|
|
Loading…
Add table
Reference in a new issue