public void ejectContents() {
    float f3 = 0.05F;
    EntityItem entityitem;
    Random rand = new Random();
    float f = rand.nextFloat() * 0.8F + 0.1F;
    float f1 = rand.nextFloat() * 0.8F + 0.4F;
    float f2 = rand.nextFloat() * 0.8F + 0.1F;

    for (int i = 0; i < getSizeInventory(); i++) {
      if (storage[i] != null) {
        entityitem =
            new EntityItem(
                worldObj, (float) xCoord + f, (float) yCoord + f1, (float) zCoord + f2, storage[i]);
        entityitem.motionX = (float) rand.nextGaussian() * f3;
        entityitem.motionY = (float) rand.nextGaussian() * f3 + 0.2F;
        entityitem.motionZ = (float) rand.nextGaussian() * f3;
        worldObj.spawnEntityInWorld(entityitem);
        storage[i] = null;
      }
    }
  }
  public void ejectItem(int index, int dir) {
    float f3 = 0.05F;
    EntityItem entityitem;
    Random rand = new Random();
    float f = rand.nextFloat() * 0.8F + 0.1F;
    float f1 = rand.nextFloat() * 0.2F + 0.1F;
    float f2 = rand.nextFloat() * 0.8F + 0.1F;

    if (storage[index] != null) {
      entityitem =
          new EntityItem(
              worldObj,
              (float) xCoord + f,
              (float) yCoord + f1,
              (float) zCoord + f2,
              storage[index]);
      entityitem.motionX = (float) rand.nextGaussian() * f3;
      entityitem.motionY = 0;
      entityitem.motionZ = (float) rand.nextGaussian() * f3;
      worldObj.spawnEntityInWorld(entityitem);
      storage[index] = null;
    }
  }