排除obb entity自身影响
This commit is contained in:
parent
07f7710103
commit
3c3c0d0bda
1 changed files with 5 additions and 0 deletions
|
@ -3,6 +3,7 @@ package com.atsuishio.superbwarfare.mixins;
|
||||||
import com.atsuishio.superbwarfare.entity.OBBEntity;
|
import com.atsuishio.superbwarfare.entity.OBBEntity;
|
||||||
import com.atsuishio.superbwarfare.tools.OBB;
|
import com.atsuishio.superbwarfare.tools.OBB;
|
||||||
import net.minecraft.world.entity.Entity;
|
import net.minecraft.world.entity.Entity;
|
||||||
|
import net.minecraft.world.entity.projectile.Projectile;
|
||||||
import net.minecraft.world.entity.projectile.ProjectileUtil;
|
import net.minecraft.world.entity.projectile.ProjectileUtil;
|
||||||
import net.minecraft.world.level.Level;
|
import net.minecraft.world.level.Level;
|
||||||
import net.minecraft.world.phys.AABB;
|
import net.minecraft.world.phys.AABB;
|
||||||
|
@ -27,6 +28,10 @@ public class ProjectileUtilMixin {
|
||||||
|
|
||||||
for (var entity : pLevel.getEntities(pProjectile, pBoundingBox, pFilter)) {
|
for (var entity : pLevel.getEntities(pProjectile, pBoundingBox, pFilter)) {
|
||||||
if (entity instanceof OBBEntity obbEntity) {
|
if (entity instanceof OBBEntity obbEntity) {
|
||||||
|
if (pProjectile instanceof Projectile projectile &&
|
||||||
|
(projectile.getOwner() == entity || entity.getPassengers().contains(projectile.getOwner()))) {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
OBB obb = obbEntity.getOBB().inflate(pInflationAmount * 2);
|
OBB obb = obbEntity.getOBB().inflate(pInflationAmount * 2);
|
||||||
|
|
||||||
Optional<Vector3f> optional = obb.clip(pStartVec.toVector3f(), pEndVec.toVector3f());
|
Optional<Vector3f> optional = obb.clip(pStartVec.toVector3f(), pEndVec.toVector3f());
|
||||||
|
|
Loading…
Add table
Reference in a new issue