Package net.minecraft.server

Examples of net.minecraft.server.Entity


   * Checks whether this Entity is spawned in the world
   *
   * @return True if the Entity is spawned, False if not
   */
  public boolean isSpawned() {
    final Entity handle = h();
    return handle != null && handle.world != null && handle.world.entityList.contains(handle);
  }
View Full Code Here


   * Sets the passenger of this Vehicle without raising any events
   *
   * @param newPassenger to set to
   */
  public void setPassengerSilent(org.bukkit.entity.Entity newPassenger) {
    final Entity handle = getHandle(Entity.class);
    if (hasPassenger()) {
      if (getPassenger() == newPassenger) {
        // Ignore setting to the same Entity
        return;
      }
View Full Code Here

  public void setVelocity(Vector arg0) {
    entity.setVelocity(arg0);
  }

  public void setVelocity(double motX, double motY, double motZ) {
    final Entity handle = getHandle(Entity.class);
    handle.motX = motX;
    handle.motY = motY;
    handle.motZ = motZ;
  }
View Full Code Here

   * @param bounds
   * @return referenced list of collision cubes
   */
  public static List<AxisAlignedBB> getCollisions(EntityController<?> controller, AxisAlignedBB bounds) {
    final CommonEntity<?> entity = controller.getEntity();
    final Entity handle = entity.getHandle(Entity.class);
    collisionBuffer.clear();
    final int xmin = MathUtil.floor(bounds.a);
    final int ymin = MathUtil.floor(bounds.b);
    final int zmin = MathUtil.floor(bounds.c);
    final int xmax = MathUtil.floor(bounds.d + 1.0);
View Full Code Here

   * @param dx offset to move
   * @param dy offset to move
   * @param dz offset to move
   */
  public void onMove(double dx, double dy, double dz) {
    final Entity handle = entity.getHandle(Entity.class);
    if (handle.X) {
      handle.boundingBox.d(dx, dy, dz);
      handle.locX = CommonNMS.getMiddleX(handle.boundingBox);
      handle.locY = (handle.boundingBox.b + (double) handle.height) - (double) handle.W;
      handle.locZ = CommonNMS.getMiddleZ(handle.boundingBox);
View Full Code Here

      onPostMove(moveDx, moveDy, moveDz);
    }
  }

  private void onPostMove(double moveDx, double moveDy, double moveDz) {
    Entity handle = this.entity.getHandle(Entity.class);
    // Update entity movement sounds
    if (EntityRef.hasMovementSound(handle) && handle.vehicle == null) {
      int bX = entity.loc.x.block();
      int bY = MathUtil.floor(handle.locY - 0.2 - (double) handle.height);
      int bZ = entity.loc.z.block();
      Block block = handle.world.getType(bX, bY, bZ);
      int j1 = handle.world.getType(bX, bY - 1, bZ).b();

      // Magic values! *gasp* Bad, BAD Minecraft! Go sit in a corner!
      if (j1 == 11 || j1 == 32 || j1 == 21) {
        block = handle.world.getType(bX, bY - 1, bZ);
      }
      if (block != Blocks.LADDER) {
        moveDy = 0.0;
      }

      handle.Q += MathUtil.length(moveDx, moveDz) * 0.6;
      handle.O += MathUtil.length(moveDx, moveDy, moveDz) * 0.6;
      if (handle.O > EntityRef.stepCounter.get(entity.getHandle()) && block != Blocks.AIR) {
        EntityRef.stepCounter.set(entity.getHandle(), (int) handle.O + 1);
        if (entity.isInWater(true)) {
          float f = (float) Math.sqrt(entity.vel.y.squared() + 0.2 * entity.vel.xz.lengthSquared()) * 0.35f;
          if (f > 1.0f) {
            f = 1.0f;
          }
          entity.makeRandomSound(EntityRef.getSwimSound.invoke(handle), f, 1.0f);
        }
        entity.makeStepSound(bX, bY, bZ, CommonNMS.getMaterial(block));
        block.b(handle.world, bX, bY, bZ, handle);
      }
    }

    EntityRef.updateBlockCollision(handle);

    // Fire tick calculation (check using block collision)
    final boolean isInWater = handle.L(); // In water or raining
    if (handle.world.e(handle.boundingBox.shrink(0.001, 0.001, 0.001))) {
      onBurnDamage(1);
      if (!isInWater) {
        handle.fireTicks++;
        if (handle.fireTicks <= 0) {
          EntityCombustEvent event = new EntityCombustEvent(entity.getEntity(), 8);
          if (!CommonUtil.callEvent(event).isCancelled()) {
            handle.setOnFire(event.getDuration());
          }
        } else {
          handle.setOnFire(8);
        }
      }
    } else if (handle.fireTicks <= 0) {
      handle.fireTicks = -handle.maxFireTicks;
    }
View Full Code Here

TOP

Related Classes of net.minecraft.server.Entity

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.