/** Get the position where the dispenser at the given Coordinates should dispense to. */
 public static IPosition getDispensePosition(IBlockSource coords) {
   EnumDirection var1 = getFacing(coords.getBlockMetadata());
   double var2 = coords.getX() + 0.7D * var1.getOffsetX();
   double var4 = coords.getY() + 0.7D * var1.getOffsetY();
   double var6 = coords.getZ() + 0.7D * var1.getOffsetZ();
   return new PositionImpl(var2, var4, var6);
 }
  public ItemStack dispenseStack(IBlockSource BlockSource, ItemStack stack) {
    EnumFacing enumfacing = BlockDispenser.getFacing(BlockSource.getBlockMetadata());
    double d0 = BlockSource.getX() + (double) enumfacing.getFrontOffsetX();
    double d1 = BlockSource.getY() + (double) enumfacing.getFrontOffsetY();
    double d2 = BlockSource.getZ() + (double) enumfacing.getFrontOffsetZ();
    Entity entity =
        ItemGaiaSpawnEgg.spawnCreature(BlockSource.getWorld(), stack.getItemDamage(), d0, d1, d2);

    if (entity instanceof EntityLivingBase && stack.hasDisplayName()) {
      ((EntityLiving) entity).setCustomNameTag(stack.getDisplayName());
    }

    stack.splitStack(1);
    return stack;
  }