Exemplo n.º 1
1
  /** Adds an entity to the chunk. Args: entity */
  public void addEntity(Entity par1Entity) {
    this.hasEntities = true;
    int var2 = MathHelper.floor_double(par1Entity.posX / 16.0D);
    int var3 = MathHelper.floor_double(par1Entity.posZ / 16.0D);

    if (var2 != this.xPosition || var3 != this.zPosition) {
      this.worldObj.func_98180_V().func_98232_c("Wrong location! " + par1Entity);
      Thread.dumpStack();
    }

    int var4 = MathHelper.floor_double(par1Entity.posY / 16.0D);

    if (var4 < 0) {
      var4 = 0;
    }

    if (var4 >= this.entityLists.length) {
      var4 = this.entityLists.length - 1;
    }

    par1Entity.addedToChunk = true;
    par1Entity.chunkCoordX = this.xPosition;
    par1Entity.chunkCoordY = var4;
    par1Entity.chunkCoordZ = this.zPosition;
    this.entityLists[var4].add(par1Entity);
  }
Exemplo n.º 2
0
 public void addEntity(Entity entity) {
   hasEntities = true;
   int i = MathHelper.floor_double(entity.posX / 16D);
   int j = MathHelper.floor_double(entity.posZ / 16D);
   if (i != xPosition || j != zPosition) {
     System.out.println(
         (new StringBuilder()).append("Wrong location! ").append(entity).toString());
     Thread.dumpStack();
   }
   int k = MathHelper.floor_double(entity.posY / 16D);
   if (k < 0) {
     k = 0;
   }
   if (k >= entities.length) {
     k = entities.length - 1;
   }
   entity.addedToChunk = true;
   entity.chunkCoordX = xPosition;
   entity.chunkCoordY = k;
   entity.chunkCoordZ = zPosition;
   entities[k].add(entity);
 }