From ca2dc468f91231499dd33f59c1514d6db1f52852 Mon Sep 17 00:00:00 2001 From: Sebastian Hartte Date: Tue, 1 Nov 2016 08:05:16 +0800 Subject: [PATCH] Fixes #2546: When touching an annihilation plane horizontally, use the middle of the entities bounding box on the y-axis to determine whether it is touching the annihilation plane side or not. Otherwise entities did not get picked up when they were *exactly* on the same y-level as the annihilation plane. (cherry picked from commit dfe7a29c92dbe9c247fb5e8b2331e6912430af54) --- .../appeng/parts/automation/PartAnnihilationPlane.java | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/src/main/java/appeng/parts/automation/PartAnnihilationPlane.java b/src/main/java/appeng/parts/automation/PartAnnihilationPlane.java index 1011c9ef..96a66b80 100644 --- a/src/main/java/appeng/parts/automation/PartAnnihilationPlane.java +++ b/src/main/java/appeng/parts/automation/PartAnnihilationPlane.java @@ -148,6 +148,7 @@ public class PartAnnihilationPlane extends PartBasicState implements IGridTickab } bch.addBox( 5, 5, 14, 11, 11, 15 ); + // The smaller collision hitbox here is needed to allow for the entity collision event bch.addBox( minX, minY, 15, maxX, maxY, bch.isBBCollision() ? 15 : 16 ); } @@ -240,6 +241,9 @@ public class PartAnnihilationPlane extends PartBasicState implements IGridTickab { boolean capture = false; + // This is the middle point of the entities BB, which is better suited for comparisons that don't rely on it "touching" the plane + double posYMiddle = (entity.getBoundingBox().minY + entity.getBoundingBox().maxY) / 2.0D; + switch( this.getSide() ) { case DOWN: @@ -259,7 +263,7 @@ public class PartAnnihilationPlane extends PartBasicState implements IGridTickab case NORTH: if( entity.posX > this.getTile().xCoord && entity.posX < this.getTile().xCoord + 1 ) { - if( entity.posY > this.getTile().yCoord && entity.posY < this.getTile().yCoord + 1 ) + if( posYMiddle > this.getTile().yCoord && posYMiddle < this.getTile().yCoord + 1 ) { if( ( entity.posZ > this.getTile().zCoord + 0.9 && this.getSide() == ForgeDirection.SOUTH ) || ( entity.posZ < this.getTile().zCoord + 0.1 && this.getSide() == ForgeDirection.NORTH ) ) { @@ -272,7 +276,7 @@ public class PartAnnihilationPlane extends PartBasicState implements IGridTickab case WEST: if( entity.posZ > this.getTile().zCoord && entity.posZ < this.getTile().zCoord + 1 ) { - if( entity.posY > this.getTile().yCoord && entity.posY < this.getTile().yCoord + 1 ) + if( posYMiddle > this.getTile().yCoord && posYMiddle < this.getTile().yCoord + 1 ) { if( ( entity.posX > this.getTile().xCoord + 0.9 && this.getSide() == ForgeDirection.EAST ) || ( entity.posX < this.getTile().xCoord + 0.1 && this.getSide() == ForgeDirection.WEST ) ) {