Пример #1
0
  public void removeAllEntities() {
    this.loadedEntityList.removeAll(this.unloadedEntityList);

    int var1;
    Entity var2;
    int var3;
    int var4;
    for (var1 = 0; var1 < this.unloadedEntityList.size(); ++var1) {
      var2 = (Entity) this.unloadedEntityList.get(var1);
      var3 = var2.chunkCoordX;
      var4 = var2.chunkCoordZ;
      if (var2.addedToChunk && this.chunkExists(var3, var4)) {
        this.getChunkFromChunkCoords(var3, var4).removeEntity(var2);
      }
    }

    for (var1 = 0; var1 < this.unloadedEntityList.size(); ++var1) {
      this.releaseEntitySkin((Entity) this.unloadedEntityList.get(var1));
    }

    this.unloadedEntityList.clear();

    for (var1 = 0; var1 < this.loadedEntityList.size(); ++var1) {
      var2 = (Entity) this.loadedEntityList.get(var1);
      if (var2.ridingEntity != null) {
        if (!var2.ridingEntity.isDead && var2.ridingEntity.riddenByEntity == var2) {
          continue;
        }

        var2.ridingEntity.riddenByEntity = null;
        var2.ridingEntity = null;
      }

      if (var2.isDead) {
        var3 = var2.chunkCoordX;
        var4 = var2.chunkCoordZ;
        if (var2.addedToChunk && this.chunkExists(var3, var4)) {
          this.getChunkFromChunkCoords(var3, var4).removeEntity(var2);
        }

        this.loadedEntityList.remove(var1--);
        this.releaseEntitySkin(var2);
      }
    }
  }
Пример #2
0
  /** Called when a player mounts an entity. e.g. mounts a pig, mounts a boat. */
  public void mountEntity(Entity par1Entity) {
    entityRiderPitchDelta = 0.0D;
    entityRiderYawDelta = 0.0D;

    if (par1Entity == null) {
      if (ridingEntity != null) {
        setLocationAndAngles(
            ridingEntity.posX,
            ridingEntity.boundingBox.minY + (double) ridingEntity.height,
            ridingEntity.posZ,
            rotationYaw,
            rotationPitch);
        ridingEntity.riddenByEntity = null;
      }

      ridingEntity = null;
      return;
    }

    if (ridingEntity == par1Entity) {
      ridingEntity.riddenByEntity = null;
      ridingEntity = null;
      setLocationAndAngles(
          par1Entity.posX,
          par1Entity.boundingBox.minY + (double) par1Entity.height,
          par1Entity.posZ,
          rotationYaw,
          rotationPitch);
      return;
    }

    if (ridingEntity != null) {
      ridingEntity.riddenByEntity = null;
    }

    if (par1Entity.riddenByEntity != null) {
      par1Entity.riddenByEntity.ridingEntity = null;
    }

    ridingEntity = par1Entity;
    par1Entity.riddenByEntity = this;
  }