Java Code Examples for cn.nukkit.math.AxisAlignedBB#intersectsWith()
The following examples show how to use
cn.nukkit.math.AxisAlignedBB#intersectsWith() .
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: Entity.java From Jupiter with GNU General Public License v3.0 | 5 votes |
public boolean isInsideOfSolid() { double y = this.y + this.getEyeHeight(); Block block = this.level.getBlock( this.temporalVector.setComponents( NukkitMath.floorDouble(this.x), NukkitMath.floorDouble(y), NukkitMath.floorDouble(this.z)) ); AxisAlignedBB bb = block.getBoundingBox(); return bb != null && block.isSolid() && !block.isTransparent() && bb.intersectsWith(this.getBoundingBox()); }
Example 2
Source File: BlockStairs.java From Jupiter with GNU General Public License v3.0 | 4 votes |
@Override public boolean collidesWithBB(AxisAlignedBB bb) { int damage = this.getDamage(); int side = damage & 0x03; double f = 0; double f1 = 0.5; double f2 = 0.5; double f3 = 1; if ((damage & 0x04) > 0) { f = 0.5; f1 = 1; f2 = 0; f3 = 0.5; } if (bb.intersectsWith(new AxisAlignedBB( this.x, this.y + f, this.z, this.x + 1, this.y + f1, this.z + 1 ))) { return true; } if (side == 0) { if (bb.intersectsWith(new AxisAlignedBB( this.x + 0.5, this.y + f2, this.z, this.x + 1, this.y + f3, this.z + 1 ))) { return true; } } else if (side == 1) { if (bb.intersectsWith(new AxisAlignedBB( this.x, this.y + f2, this.z, this.x + 0.5, this.y + f3, this.z + 1 ))) { return true; } } else if (side == 2) { if (bb.intersectsWith(new AxisAlignedBB( this.x, this.y + f2, this.z + 0.5, this.x + 1, this.y + f3, this.z + 1 ))) { return true; } } else if (side == 3) { if (bb.intersectsWith(new AxisAlignedBB( this.x, this.y + f2, this.z, this.x + 1, this.y + f3, this.z + 0.5 ))) { return true; } } return false; }
Example 3
Source File: Block.java From Jupiter with GNU General Public License v3.0 | 4 votes |
public boolean collidesWithBB(AxisAlignedBB bb, boolean collisionBB) { AxisAlignedBB bb1 = collisionBB ? this.getCollisionBoundingBox() : this.getBoundingBox(); return bb1 != null && bb.intersectsWith(bb1); }
Example 4
Source File: BlockStairs.java From Nukkit with GNU General Public License v3.0 | 4 votes |
@Override public boolean collidesWithBB(AxisAlignedBB bb) { int damage = this.getDamage(); int side = damage & 0x03; double f = 0; double f1 = 0.5; double f2 = 0.5; double f3 = 1; if ((damage & 0x04) > 0) { f = 0.5; f1 = 1; f2 = 0; f3 = 0.5; } if (bb.intersectsWith(new SimpleAxisAlignedBB( this.x, this.y + f, this.z, this.x + 1, this.y + f1, this.z + 1 ))) { return true; } if (side == 0) { if (bb.intersectsWith(new SimpleAxisAlignedBB( this.x + 0.5, this.y + f2, this.z, this.x + 1, this.y + f3, this.z + 1 ))) { return true; } } else if (side == 1) { if (bb.intersectsWith(new SimpleAxisAlignedBB( this.x, this.y + f2, this.z, this.x + 0.5, this.y + f3, this.z + 1 ))) { return true; } } else if (side == 2) { if (bb.intersectsWith(new SimpleAxisAlignedBB( this.x, this.y + f2, this.z + 0.5, this.x + 1, this.y + f3, this.z + 1 ))) { return true; } } else if (side == 3) { if (bb.intersectsWith(new SimpleAxisAlignedBB( this.x, this.y + f2, this.z, this.x + 1, this.y + f3, this.z + 0.5 ))) { return true; } } return false; }
Example 5
Source File: Block.java From Nukkit with GNU General Public License v3.0 | 4 votes |
public boolean collidesWithBB(AxisAlignedBB bb, boolean collisionBB) { AxisAlignedBB bb1 = collisionBB ? this.getCollisionBoundingBox() : this.getBoundingBox(); return bb1 != null && bb.intersectsWith(bb1); }
Example 6
Source File: BlockStairs.java From Nukkit with GNU General Public License v3.0 | 4 votes |
@Override public boolean collidesWithBB(AxisAlignedBB bb) { int damage = this.getDamage(); int side = damage & 0x03; double f = 0; double f1 = 0.5; double f2 = 0.5; double f3 = 1; if ((damage & 0x04) > 0) { f = 0.5; f1 = 1; f2 = 0; f3 = 0.5; } if (bb.intersectsWith(new SimpleAxisAlignedBB( this.x, this.y + f, this.z, this.x + 1, this.y + f1, this.z + 1 ))) { return true; } if (side == 0) { if (bb.intersectsWith(new SimpleAxisAlignedBB( this.x + 0.5, this.y + f2, this.z, this.x + 1, this.y + f3, this.z + 1 ))) { return true; } } else if (side == 1) { if (bb.intersectsWith(new SimpleAxisAlignedBB( this.x, this.y + f2, this.z, this.x + 0.5, this.y + f3, this.z + 1 ))) { return true; } } else if (side == 2) { if (bb.intersectsWith(new SimpleAxisAlignedBB( this.x, this.y + f2, this.z + 0.5, this.x + 1, this.y + f3, this.z + 1 ))) { return true; } } else if (side == 3) { if (bb.intersectsWith(new SimpleAxisAlignedBB( this.x, this.y + f2, this.z, this.x + 1, this.y + f3, this.z + 0.5 ))) { return true; } } return false; }
Example 7
Source File: Block.java From Nukkit with GNU General Public License v3.0 | 4 votes |
public boolean collidesWithBB(AxisAlignedBB bb, boolean collisionBB) { AxisAlignedBB bb1 = collisionBB ? this.getCollisionBoundingBox() : this.getBoundingBox(); return bb1 != null && bb.intersectsWith(bb1); }