Package net.minecraft.server

Examples of net.minecraft.server.AxisAlignedBB


    }

    // Handle block collisions
    BlockFace hitFace;
    Iterator<AxisAlignedBB> iter = collisionBuffer.iterator();
    AxisAlignedBB blockBounds;
    double dx, dz;
    while (iter.hasNext()) {
      blockBounds = iter.next();
      // Convert to block and block coordinates
      org.bukkit.block.Block block = entity.getWorld().getBlockAt(MathUtil.floor(blockBounds.a), MathUtil.floor(blockBounds.b), MathUtil.floor(blockBounds.c));

      // Find out what direction the block is hit
      if (bounds.e > blockBounds.e) {
        hitFace = BlockFace.UP;
      } else if (bounds.b < blockBounds.b) {
        hitFace = BlockFace.DOWN;
      } else {
        dx = entity.loc.getX() - block.getX() - 0.5;
        dz = entity.loc.getZ() - block.getZ() - 0.5;
        hitFace = FaceUtil.getDirection(dx, dz, false);
      }
      // Block collision event
      if (!controller.onBlockCollision(block, hitFace)) {
        iter.remove();
      }
    }

    // Handle and add entities
    AxisAlignedBB entityBounds;
    for (Entity collider : CommonNMS.getEntitiesIn(handle.world, handle, bounds.grow(0.25, 0.25, 0.25))) {
      /*
       * This part is completely pointless as E() always returns null May
       * this ever change, make sure E() is handled correctly.
       *
       * entityBounds = entity.E(); if (entityBounds != null &&
       * entityBounds.a(bounds)) { collisionBuffer.add(entityBounds); }
       */

      entityBounds = collider.boundingBox;
      // Entity collision event after the null/inBounds check
      if (entityBounds != null && entityBounds.b(bounds) && controller.onEntityCollision(Conversion.toEntity.convert(collider))) {
        collisionBuffer.add(entityBounds);
      }
    }

    // Done
View Full Code Here


      // Perform movement updates
      final double oldDx = dx;
      final double oldDy = dy;
      final double oldDz = dz;
      AxisAlignedBB axisalignedbb = handle.boundingBox.clone();
      List<AxisAlignedBB> list = EntityControllerCollisionHelper.getCollisions(this, handle.boundingBox.a(dx, dy, dz));

      // Collision testing using Y
      for (AxisAlignedBB aabb : list) {
        dy = aabb.b(handle.boundingBox, dy);
      }
      handle.boundingBox.d(0.0, dy, 0.0);
      if (!handle.J && oldDy != dy) {
        dx = dy = dz = 0.0;
      }
      boolean isOnGround = handle.onGround || oldDy != dy && oldDy < 0.0;

      // Collision testing using X
      for (AxisAlignedBB aabb : list) {
        dx = aabb.a(handle.boundingBox, dx);
      }
      handle.boundingBox.d(dx, 0.0, 0.0);
      if (!handle.J && oldDx != dx) {
        dx = dy = dz = 0.0;
      }

      // Collision testing using Z
      for (AxisAlignedBB aabb : list) {
        dz = aabb.c(handle.boundingBox, dz);
      }
      handle.boundingBox.d(0.0, 0.0, dz);
      if (!handle.J && oldDz != dz) {
        dx = dy = dz = 0.0;
      }

      double moveDx;
      double moveDy;
      double moveDz;
      if (handle.Y > 0.0f && handle.Y < 0.05f && isOnGround && (oldDx != dx || oldDz != dz)) {
        moveDx = dx;
        moveDy = dy;
        moveDz = dz;
        dx = oldDx;
        dy = (double) handle.Y;
        dz = oldDz;

        AxisAlignedBB axisalignedbb1 = handle.boundingBox.clone();
        handle.boundingBox.d(axisalignedbb);

        list = EntityControllerCollisionHelper.getCollisions(this, handle.boundingBox.a(oldDx, dy, oldDz));

        // Collision testing using Y
View Full Code Here

TOP

Related Classes of net.minecraft.server.AxisAlignedBB

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.