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 dfe7a29c92)
This commit is contained in:
Sebastian Hartte 2016-11-01 08:05:16 +08:00 committed by xsun2001
parent d050451bce
commit ca2dc468f9
1 changed files with 6 additions and 2 deletions

View File

@ -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 ) )
{