From f32bcae8d31889820e92ad91c67caf1557efd6e9 Mon Sep 17 00:00:00 2001 From: Electroblob77 <35599699+Electroblob77@users.noreply.github.com> Date: Sun, 27 Sep 2020 17:49:11 +0100 Subject: [PATCH] Better particle interaction for custom hitboxes (now they can't pass through thin stuff) --- .../wizardry/client/particle/ParticleWizardry.java | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/main/java/electroblob/wizardry/client/particle/ParticleWizardry.java b/src/main/java/electroblob/wizardry/client/particle/ParticleWizardry.java index b2946e3e..69f73843 100644 --- a/src/main/java/electroblob/wizardry/client/particle/ParticleWizardry.java +++ b/src/main/java/electroblob/wizardry/client/particle/ParticleWizardry.java @@ -476,9 +476,9 @@ public abstract class ParticleWizardry extends Particle { List nearbyEntities = EntityUtils.getEntitiesWithinRadius(searchRadius, this.posX, this.posY, this.posZ, world, Entity.class); - nearbyEntities.removeIf(e -> !(e instanceof ICustomHitbox && ((ICustomHitbox)e).contains(new Vec3d(this.posX, this.posY, this.posZ)))); - - if(nearbyEntities.size() > 0) this.setExpired(); + if(nearbyEntities.stream().anyMatch(e -> e instanceof ICustomHitbox + && ((ICustomHitbox)e).calculateIntercept(new Vec3d(posX, posY, posZ), + new Vec3d(prevPosX, prevPosY, prevPosZ), 0) != null)) this.setExpired(); }